--- a/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -1,3 +1,4 @@
+94680c6d60ecd9ed3ffd1847706efde7eb947afc jdk-9+174
6dd7fda42bab7ecf648cafb0a4e9b4ca11b3094f jdk-9+173
dad6746278facbbea57dd462cb56fb743dc0a5f0 jdk-9+172
643b5f18c2656fe91b69fea85b07b98d5fad394d jdk-9+171
@@ -428,3 +429,4 @@
aa5b01f5e5620438fd39efdb2e2f6365a2c7d898 jdk-10+9
b0f2b8ff25a2209b2c807785d75f20e5086bbfc2 jdk-10+10
036dbf8b381798e5d31065109714d04d97bf98a4 jdk-10+11
+e6d70017f5b9adbb2ec82d826973d0251800a3c3 jdk-10+12
--- a/.hgtags-top-repo Wed Jun 28 11:27:28 2017 -0700
+++ b/.hgtags-top-repo Thu Aug 24 16:24:44 2017 +0200
@@ -428,3 +428,7 @@
2c25fc24103251f9711a1c280c31e1e41016d90f jdk-9+172
6b750cdb823a029a25ff2e560302cc2d28a86cb6 jdk-10+11
88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173
+5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174
+8d4ed1e06fe184c9cb08c5b708e7d6f5c066644f jdk-10+12
+8f7227c6012b0051ea4e0bcee040c627bf699b88 jdk-9+175
+d67a3f1f057f7e31e12f33ebe3667cb73d252268 jdk-10+13
--- a/.jcheck/conf Wed Jun 28 11:27:28 2017 -0700
+++ b/.jcheck/conf Thu Aug 24 16:24:44 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/common/autoconf/generated-configure.sh Wed Jun 28 11:27:28 2017 -0700
+++ b/common/autoconf/generated-configure.sh Thu Aug 24 16:24:44 2017 +0200
@@ -688,6 +688,7 @@
LIBFFI_CFLAGS
ALSA_LIBS
ALSA_CFLAGS
+FREETYPE_LICENSE
FREETYPE_BUNDLE_LIB_PATH
FREETYPE_LIBS
FREETYPE_CFLAGS
@@ -1200,6 +1201,7 @@
with_freetype_lib
with_freetype_src
enable_freetype_bundling
+with_freetype_license
with_alsa
with_alsa_include
with_alsa_lib
@@ -2153,6 +2155,7 @@
--with-freetype-src specify directory with freetype sources to
automatically build the library (experimental,
Windows-only)
+ --with-freetype-license if bundling freetype, also bundle this license file
--with-alsa specify prefix directory for the alsa package
(expecting the libraries under PATH/lib and the
headers under PATH/include)
@@ -5186,7 +5189,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1494858828
+DATE_WHEN_GENERATED=1496926402
###############################################################################
#
@@ -57906,6 +57909,12 @@
fi
+# Check whether --with-freetype-license was given.
+if test "${with_freetype_license+set}" = set; then :
+ withval=$with_freetype_license;
+fi
+
+
# Need to specify explicitly since it needs to be overridden on some versions of macosx
FREETYPE_BASE_NAME=freetype
FREETYPE_CFLAGS=
@@ -63852,6 +63861,153 @@
fi # end freetype needed
+ FREETYPE_LICENSE=""
+ if test "x$with_freetype_license" = "xyes"; then
+ as_fn_error $? "--with-freetype-license must have a value" "$LINENO" 5
+ elif test "x$with_freetype_license" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype license" >&5
+$as_echo_n "checking for freetype license... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_freetype_license" >&5
+$as_echo "$with_freetype_license" >&6; }
+ FREETYPE_LICENSE="$with_freetype_license"
+
+ # Only process if variable expands to non-empty
+
+ if test "x$FREETYPE_LICENSE" != x; then
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$FREETYPE_LICENSE"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of FREETYPE_LICENSE" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-style (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ FREETYPE_LICENSE="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$FREETYPE_LICENSE"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ FREETYPE_LICENSE="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_LICENSE to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a unix platform. Hooray! :)
+ path="$FREETYPE_LICENSE"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_LICENSE, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of FREETYPE_LICENSE, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ if test -d "$path"; then
+ FREETYPE_LICENSE="`cd "$path"; $THEPWDCMD -L`"
+ else
+ dir="`$DIRNAME "$path"`"
+ base="`$BASENAME "$path"`"
+ FREETYPE_LICENSE="`cd "$dir"; $THEPWDCMD -L`/$base"
+ fi
+ fi
+ fi
+
+ if test ! -f "$FREETYPE_LICENSE"; then
+ as_fn_error $? "$FREETYPE_LICENSE cannot be found" "$LINENO" 5
+ fi
+ fi
+
+
--- a/common/autoconf/lib-freetype.m4 Wed Jun 28 11:27:28 2017 -0700
+++ b/common/autoconf/lib-freetype.m4 Thu Aug 24 16:24:44 2017 +0200
@@ -194,6 +194,8 @@
[specify directory with freetype sources to automatically build the library (experimental, Windows-only)])])
AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
[disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
+ AC_ARG_WITH(freetype-license, [AS_HELP_STRING([--with-freetype-license],
+ [if bundling freetype, also bundle this license file])])
# Need to specify explicitly since it needs to be overridden on some versions of macosx
FREETYPE_BASE_NAME=freetype
@@ -443,7 +445,21 @@
fi # end freetype needed
+ FREETYPE_LICENSE=""
+ if test "x$with_freetype_license" = "xyes"; then
+ AC_MSG_ERROR([--with-freetype-license must have a value])
+ elif test "x$with_freetype_license" != "x"; then
+ AC_MSG_CHECKING([for freetype license])
+ AC_MSG_RESULT([$with_freetype_license])
+ FREETYPE_LICENSE="$with_freetype_license"
+ BASIC_FIXUP_PATH(FREETYPE_LICENSE)
+ if test ! -f "$FREETYPE_LICENSE"; then
+ AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found])
+ fi
+ fi
+
AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
+ AC_SUBST(FREETYPE_LICENSE)
])
--- a/common/autoconf/spec.gmk.in Wed Jun 28 11:27:28 2017 -0700
+++ b/common/autoconf/spec.gmk.in Thu Aug 24 16:24:44 2017 +0200
@@ -312,6 +312,7 @@
FREETYPE_LIBS:=@FREETYPE_LIBS@
FREETYPE_CFLAGS:=@FREETYPE_CFLAGS@
FREETYPE_BUNDLE_LIB_PATH=@FREETYPE_BUNDLE_LIB_PATH@
+FREETYPE_LICENSE=@FREETYPE_LICENSE@
CUPS_CFLAGS:=@CUPS_CFLAGS@
ALSA_LIBS:=@ALSA_LIBS@
ALSA_CFLAGS:=@ALSA_CFLAGS@
--- a/common/conf/jib-profiles.js Wed Jun 28 11:27:28 2017 -0700
+++ b/common/conf/jib-profiles.js Thu Aug 24 16:24:44 2017 +0200
@@ -893,6 +893,16 @@
}
});
+ // The windows ri profile needs to add the freetype license file
+ profilesRiFreetype = {
+ "windows-x86-ri": {
+ configure_args: "--with-freetype-license="
+ + input.get("freetype", "install_path")
+ + "/freetype-2.7.1-v120-x86/freetype.md"
+ }
+ };
+ profiles = concatObjects(profiles, profilesRiFreetype);
+
// Generate the missing platform attributes
profiles = generatePlatformAttributes(profiles);
profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
--- a/common/doc/testing.html Wed Jun 28 11:27:28 2017 -0700
+++ b/common/doc/testing.html Thu Aug 24 16:24:44 2017 +0200
@@ -18,14 +18,16 @@
</header>
<nav id="TOC">
<ul>
-<li><a href="#using-the-run-test-framework">Using the run-test framework</a></li>
+<li><a href="#using-the-run-test-framework">Using the run-test framework</a><ul>
+<li><a href="#configuration">Configuration</a></li>
+</ul></li>
<li><a href="#test-selection">Test selection</a><ul>
-<li><a href="#jtreg">JTreg</a></li>
+<li><a href="#jtreg">JTReg</a></li>
<li><a href="#gtest">Gtest</a></li>
</ul></li>
<li><a href="#test-results-and-summary">Test results and summary</a></li>
<li><a href="#test-suite-control">Test suite control</a><ul>
-<li><a href="#jtreg-keywords">JTreg keywords</a></li>
+<li><a href="#jtreg-keywords">JTReg keywords</a></li>
<li><a href="#gtest-keywords">Gtest keywords</a></li>
</ul></li>
</ul>
@@ -41,14 +43,17 @@
$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
$ make exploded-run-test TEST=hotspot_tier1</code></pre>
+
+<h3 id="configuration">Configuration</h3>
+<p>To be able to run JTReg tests, <code>configure</code> needs to know where to find the JTReg test framework. If it is not picked up automatically by configure, use the <code>--with-jtreg=<path to jtreg home></code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc. (An alternative is to set the <code>JT_HOME</code> environment variable to point to the JTReg home before running <code>configure</code>.)</p>
<h2 id="test-selection">Test selection</h2>
<p>All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the <code>TEST</code> variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.</p>
-<p>For some common top-level tests, direct make targets have been generated. This includes all JTreg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST="x"</code> solution needs to be used.</p>
+<p>For some common top-level tests, direct make targets have been generated. This includes all JTReg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST="tier1"</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST="x"</code> solution needs to be used.</p>
<p>The test specifications given in <code>TEST</code> is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, <code>:tier1</code> will expand to <code>jtreg:jdk/test:tier1 jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1</code>. You can always submit a list of fully qualified test descriptors in the <code>TEST</code> variable if you want to shortcut the parser.</p>
-<h3 id="jtreg">JTreg</h3>
-<p>JTreg test groups can be specified either without a test root, e.g. <code>:tier1</code> (or <code>tier1</code>, the initial colon is optional), or with, e.g. <code>hotspot/test:tier1</code>, <code>jdk/test:jdk_util</code>.</p>
+<h3 id="jtreg">JTReg</h3>
+<p>JTReg test groups can be specified either without a test root, e.g. <code>:tier1</code> (or <code>tier1</code>, the initial colon is optional), or with, e.g. <code>hotspot/test:tier1</code>, <code>jdk/test:jdk_util</code>.</p>
<p>When specified without a test root, all matching groups from all tests roots will be added. Otherwise, only the group from the specified test root will be added.</p>
-<p>Individual JTreg tests or directories containing JTreg tests can also be specified, like <code>hotspot/test/native_sanity/JniVersion.java</code> or <code>hotspot/test/native_sanity</code>. You can also specify an absolute path, to point to a JTreg test outside the source tree.</p>
+<p>Individual JTReg tests or directories containing JTReg tests can also be specified, like <code>hotspot/test/native_sanity/JniVersion.java</code> or <code>hotspot/test/native_sanity</code>. You can also specify an absolute path, to point to a JTReg test outside the source tree.</p>
<p>As long as the test groups or test paths can be uniquely resolved, you do not need to enter the <code>jtreg:</code> prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add <code>jtreg:</code>, e.g. <code>jtreg:hotspot/test/native_sanity</code>.</p>
<h3 id="gtest">Gtest</h3>
<p>Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just <code>gtest</code>, or as a fully qualified test descriptor <code>gtest:all</code>.</p>
@@ -67,15 +72,15 @@
<p>Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the <code>>> ... <<</code> marker for easy identification.</p>
<p>The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.</p>
<p>In case of test failures, <code>make run-test</code> will exit with a non-zero exit value.</p>
-<p>All tests have their result stored in <code>build/$BUILD/test-result/$TEST_ID</code>, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for <code>jtreg:jdk/test:tier1</code> the TEST_ID is <code>jtreg_jdk_test_tier1</code>. This path is also printed in the log at the end of the test run.</p>
+<p>All tests have their result stored in <code>build/$BUILD/test-results/$TEST_ID</code>, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for <code>jtreg:jdk/test:tier1</code> the TEST_ID is <code>jtreg_jdk_test_tier1</code>. This path is also printed in the log at the end of the test run.</p>
<p>Additional work data is stored in <code>build/$BUILD/test-support/$TEST_ID</code>. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.</p>
<h2 id="test-suite-control">Test suite control</h2>
<p>It is possible to control various aspects of the test suites using make control variables.</p>
-<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG="JOBS=1;TIMEOUT=8"</code> will set the JTreg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG="TMIEOUT=8"</code> would give an error, while <code>JTREG_TMIEOUT=8</code> would just pass unnoticed.</p>
+<p>These variables use a keyword=value approach to allow multiple values to be set. So, for instance, <code>JTREG="JOBS=1;TIMEOUT=8"</code> will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting <code>JTREG_JOBS=1 JTREG_TIMEOUT=8</code>, but using the keyword format means that the <code>JTREG</code> variable is parsed and verified for correctness, so <code>JTREG="TMIEOUT=8"</code> would give an error, while <code>JTREG_TMIEOUT=8</code> would just pass unnoticed.</p>
<p>To separate multiple keyword=value pairs, use <code>;</code> (semicolon). Since the shell normally eats <code>;</code>, the recommended usage is to write the assignment inside qoutes, e.g. <code>JTREG="...;..."</code>. This will also make sure spaces are preserved, as in <code>JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"</code>.</p>
<p>(Other ways are possible, e.g. using backslash: <code>JTREG=JOBS=1\;TIMEOUT=8</code>. Also, as a special technique, the string <code>%20</code> will be replaced with space for certain options, e.g. <code>JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug</code>. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)</p>
<p>As far as possible, the names of the keywords have been standardized between test suites.</p>
-<h3 id="jtreg-keywords">JTreg keywords</h3>
+<h3 id="jtreg-keywords">JTReg keywords</h3>
<h4 id="jobs">JOBS</h4>
<p>The test concurrency (<code>-concurrency</code>).</p>
<p>Defaults to TEST_JOBS (if set by <code>--with-test-jobs=</code>), otherwise it defaults to JOBS, except for Hotspot, where the default is <em>number of CPU cores/2</em>, but never more than 12.</p>
@@ -96,15 +101,15 @@
<p>Defaults to <code>fail,error</code>.</p>
<h4 id="max_mem">MAX_MEM</h4>
<p>Limit memory consumption (<code>-Xmx</code> and <code>-vmoption:-Xmx</code>, or none).</p>
-<p>Limit memory consumption for JTreg test framework and VM under test. Set to 0 to disable the limits.</p>
+<p>Limit memory consumption for JTReg test framework and VM under test. Set to 0 to disable the limits.</p>
<p>Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).</p>
<h4 id="options">OPTIONS</h4>
-<p>Additional options to the JTreg test framework.</p>
-<p>Use <code>JTREG="OPTIONS=--help all"</code> to see all available JTreg options.</p>
+<p>Additional options to the JTReg test framework.</p>
+<p>Use <code>JTREG="OPTIONS=--help all"</code> to see all available JTReg options.</p>
<h4 id="java_options">JAVA_OPTIONS</h4>
-<p>Additional Java options to JTreg (<code>-javaoption</code>).</p>
+<p>Additional Java options to JTReg (<code>-javaoption</code>).</p>
<h4 id="vm_options">VM_OPTIONS</h4>
-<p>Additional VM options to JTreg (<code>-vmoption</code>).</p>
+<p>Additional VM options to JTReg (<code>-vmoption</code>).</p>
<h3 id="gtest-keywords">Gtest keywords</h3>
<h4 id="repeat">REPEAT</h4>
<p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
--- a/common/doc/testing.md Wed Jun 28 11:27:28 2017 -0700
+++ b/common/doc/testing.md Thu Aug 24 16:24:44 2017 +0200
@@ -22,6 +22,15 @@
$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
$ make exploded-run-test TEST=hotspot_tier1
+### Configuration
+
+To be able to run JTReg tests, `configure` needs to know where to find the
+JTReg test framework. If it is not picked up automatically by configure, use
+the `--with-jtreg=<path to jtreg home>` option to point to the JTReg framework.
+Note that this option should point to the JTReg home, i.e. the top directory,
+containing `lib/jtreg.jar` etc. (An alternative is to set the `JT_HOME`
+environment variable to point to the JTReg home before running `configure`.)
+
## Test selection
All functionality is available using the run-test make target. In this use
@@ -30,7 +39,7 @@
be used instead, which do not depend on the source and test image build.
For some common top-level tests, direct make targets have been generated. This
-includes all JTreg test groups, the hotspot gtest, and custom tests (if
+includes all JTReg test groups, the hotspot gtest, and custom tests (if
present). This means that `make run-test-tier1` is equivalent to `make run-test
TEST="tier1"`, but the latter is more tab-completion friendly. For more complex
test runs, the `run-test TEST="x"` solution needs to be used.
@@ -42,9 +51,9 @@
can always submit a list of fully qualified test descriptors in the `TEST`
variable if you want to shortcut the parser.
-### JTreg
+### JTReg
-JTreg test groups can be specified either without a test root, e.g. `:tier1`
+JTReg test groups can be specified either without a test root, e.g. `:tier1`
(or `tier1`, the initial colon is optional), or with, e.g.
`hotspot/test:tier1`, `jdk/test:jdk_util`.
@@ -52,10 +61,10 @@
will be added. Otherwise, only the group from the specified test root will be
added.
-Individual JTreg tests or directories containing JTreg tests can also be
+Individual JTReg tests or directories containing JTReg tests can also be
specified, like `hotspot/test/native_sanity/JniVersion.java` or
`hotspot/test/native_sanity`. You can also specify an absolute path, to point
-to a JTreg test outside the source tree.
+to a JTReg test outside the source tree.
As long as the test groups or test paths can be uniquely resolved, you do not
need to enter the `jtreg:` prefix. If this is not possible, or if you want to
@@ -99,7 +108,7 @@
In case of test failures, `make run-test` will exit with a non-zero exit value.
-All tests have their result stored in `build/$BUILD/test-result/$TEST_ID`,
+All tests have their result stored in `build/$BUILD/test-results/$TEST_ID`,
where TEST_ID is a path-safe conversion from the fully qualified test
descriptor, e.g. for `jtreg:jdk/test:tier1` the TEST_ID is
`jtreg_jdk_test_tier1`. This path is also printed in the log at the end of the
@@ -115,7 +124,7 @@
variables.
These variables use a keyword=value approach to allow multiple values to be
-set. So, for instance, `JTREG="JOBS=1;TIMEOUT=8"` will set the JTreg
+set. So, for instance, `JTREG="JOBS=1;TIMEOUT=8"` will set the JTReg
concurrency level to 1 and the timeout factor to 8. This is equivalent to
setting `JTREG_JOBS=1 JTREG_TIMEOUT=8`, but using the keyword format means that
the `JTREG` variable is parsed and verified for correctness, so
@@ -136,7 +145,7 @@
As far as possible, the names of the keywords have been standardized between
test suites.
-### JTreg keywords
+### JTReg keywords
#### JOBS
The test concurrency (`-concurrency`).
@@ -174,21 +183,21 @@
#### MAX_MEM
Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none).
-Limit memory consumption for JTreg test framework and VM under test. Set to 0
+Limit memory consumption for JTReg test framework and VM under test. Set to 0
to disable the limits.
Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).
#### OPTIONS
-Additional options to the JTreg test framework.
+Additional options to the JTReg test framework.
-Use `JTREG="OPTIONS=--help all"` to see all available JTreg options.
+Use `JTREG="OPTIONS=--help all"` to see all available JTReg options.
#### JAVA_OPTIONS
-Additional Java options to JTreg (`-javaoption`).
+Additional Java options to JTReg (`-javaoption`).
#### VM_OPTIONS
-Additional VM options to JTreg (`-vmoption`).
+Additional VM options to JTReg (`-vmoption`).
### Gtest keywords
--- a/corba/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -428,3 +428,7 @@
95ed14547ca9246baed34f90ef3ca13217538a8c jdk-9+172
8ef8a0f1c4dfea17e10125e1f885920538e63085 jdk-10+11
534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173
+3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174
+00ae6307d78bac49883ddc85d687aa88c49f3971 jdk-10+12
+dc78a3dd6b3a4f11cdae8a3e3d160e6a78bc7838 jdk-9+175
+564fced058bd2c8375e9104aa8f9494642cd7bdd jdk-10+13
--- a/corba/.jcheck/conf Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/.jcheck/conf Thu Aug 24 16:24:44 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/corba/src/java.corba/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/src/java.corba/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,18 +26,21 @@
/**
* Defines the Java binding of the OMG CORBA APIs, and the RMI-IIOP API.
*
+ * <p> This module is upgradeble.
+ *
* @moduleGraph
* @since 9
*/
@Deprecated(since="9", forRemoval=true)
module java.corba {
- requires transitive java.desktop;
- requires transitive java.rmi;
requires java.logging;
requires java.naming;
requires java.transaction;
requires jdk.unsupported;
+ requires transitive java.desktop;
+ requires transitive java.rmi;
+
exports javax.activity;
exports javax.rmi;
exports javax.rmi.CORBA;
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,7 +29,7 @@
/**
* This Helper class is used to facilitate the marshalling of {@code Bounds}.
* For more information on Helper files, see
- * <a href="doc-files/generatedfiles.html#helper">
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,7 +30,7 @@
* This Helper class is used to facilitate the marshalling of
* {@code ORBPackage/InvalidName}.
* For more information on Helper files, see
- * <a href="doc-files/generatedfiles.html#helper">
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,7 +30,7 @@
* This Helper class is used to facilitate the marshalling of
* {@code TypeCodePackage/BadKind}.
* For more information on Helper files, see
- * <a href="doc-files/generatedfiles.html#helper">
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,7 +30,7 @@
* This Helper class is used to facilitate the marshalling of
* {@code TypeCodePackage/Bounds}.
* For more information on Helper files, see
- * <a href="doc-files/generatedfiles.html#helper">
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.
*/
--- a/hotspot/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -588,3 +588,7 @@
1ae9e84f68b359420d2d153ecfe5ee2903e33a2e jdk-9+172
7f14e550f1e8abea41c223e5fdad2261e99ba929 jdk-10+11
e64b1cb48d6e7703928a9d1da106fc27f8cb65fd jdk-9+173
+944791f8160185bffa13fbb821fc09b6198f1f25 jdk-9+174
+070aa7a2eb14c4645f7eb31384cba0a2ba72a4b5 jdk-10+12
+8f04d457168b9f1f4a1b2c37f49e0513ca9d33a7 jdk-9+175
+a9da03357f190807591177fe9846d6e68ad64fc0 jdk-10+13
--- a/hotspot/.jcheck/conf Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/.jcheck/conf Thu Aug 24 16:24:44 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/hotspot/make/symbols/symbols-unix Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/make/symbols/symbols-unix Thu Aug 24 16:24:44 2017 +0200
@@ -188,7 +188,6 @@
JVM_AddModuleExports
JVM_AddModuleExportsToAll
JVM_AddModuleExportsToAllUnnamed
-JVM_AddModulePackage
JVM_AddReadsModule
JVM_DefineModule
JVM_SetBootLoaderUnnamedModule
--- a/hotspot/make/test/JtregNative.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/make/test/JtregNative.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -56,6 +56,7 @@
$(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \
$(HOTSPOT_TOPDIR)/test/compiler/calls \
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/GetNamedModule \
+ $(HOTSPOT_TOPDIR)/test/serviceability/jvmti/IsModifiableModule \
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleReads \
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleExportsAndOpens \
$(HOTSPOT_TOPDIR)/test/serviceability/jvmti/AddModuleUsesAndProvides \
@@ -85,6 +86,7 @@
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_liboverflow := -lc
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libSimpleClassFileLoadHook := -lc
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetNamedModuleTest := -lc
+ BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libIsModifiableModuleTest := -lc
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleReadsTest := -lc
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleExportsAndOpensTest := -lc
BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libAddModuleUsesAndProvidesTest := -lc
--- a/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -109,9 +109,15 @@
// for the callee's params we only need to account for the extra
// locals.
int size = overhead +
- (callee_locals - callee_params)*Interpreter::stackElementWords +
+ (callee_locals - callee_params) +
monitors * frame::interpreter_frame_monitor_size() +
- temps* Interpreter::stackElementWords + extra_args;
+ // On the top frame, at all times SP <= ESP, and SP is
+ // 16-aligned. We ensure this by adjusting SP on method
+ // entry and re-entry to allow room for the maximum size of
+ // the expression stack. When we call another method we bump
+ // SP so that no stack space is wasted. So, only on the top
+ // frame do we need to allow max_stack words.
+ (is_top_frame ? max_stack : temps + extra_args);
// On AArch64 we always keep the stack pointer 16-aligned, so we
// must round up here.
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -598,12 +598,12 @@
} else {
assert (x->op() == Bytecodes::_imul, "expect imul");
if (right.is_constant()) {
- int c = right.get_jint_constant();
- if (! is_power_of_2(c) && ! is_power_of_2(c + 1) && ! is_power_of_2(c - 1)) {
+ jint c = right.get_jint_constant();
+ if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
+ right_arg->dont_load_item();
+ } else {
// Cannot use constant op.
- right.load_item();
- } else {
- right.dont_load_item();
+ right_arg->load_item();
}
} else {
right.load_item();
--- a/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -51,6 +51,11 @@
VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
const int aarch64_code_length = VtableStub::pd_code_size_limit(true);
VtableStub* s = new(aarch64_code_length) VtableStub(true, vtable_index);
+ // Can be NULL if there is no free space in the code cache.
+ if (s == NULL) {
+ return NULL;
+ }
+
ResourceMark rm;
CodeBuffer cb(s->entry_point(), aarch64_code_length);
MacroAssembler* masm = new MacroAssembler(&cb);
--- a/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -923,8 +923,8 @@
} else {
left_arg->load_item();
if (x->op() == Bytecodes::_imul && right_arg->is_constant()) {
- int c = right_arg->get_jint_constant();
- if (c > 0 && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
+ jint c = right_arg->get_jint_constant();
+ if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) {
right_arg->dont_load_item();
} else {
right_arg->load_item();
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -234,8 +234,8 @@
}
-bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) {
- if (tmp->is_valid()) {
+bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
+ if (tmp->is_valid() && c > 0 && c < max_jint) {
if (is_power_of_2(c + 1)) {
__ move(left, tmp);
__ shift_left(left, log2_intptr(c + 1), left);
@@ -603,8 +603,8 @@
bool use_constant = false;
bool use_tmp = false;
if (right_arg->is_constant()) {
- int iconst = right_arg->get_jint_constant();
- if (iconst > 0) {
+ jint iconst = right_arg->get_jint_constant();
+ if (iconst > 0 && iconst < max_jint) {
if (is_power_of_2(iconst)) {
use_constant = true;
} else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
--- a/hotspot/src/jdk.aot/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.aot/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -23,8 +23,15 @@
* questions.
*/
+/**
+ * Defines the Ahead-of-Time (AOT) compiler, <em>{@index jaotc jaotc tool}</em>,
+ * for compiling Java classes into AOT library.
+ *
+ * @moduleGraph
+ * @since 9
+ */
module jdk.aot {
- requires jdk.management;
requires jdk.internal.vm.ci;
requires jdk.internal.vm.compiler;
+ requires jdk.management;
}
--- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,15 @@
/**
* Defines the implementation of the HotSpot Serviceability Agent.
*
+ * <p> This module includes the <em>{@index jhsdb jhsdb tool}</em> tool to
+ * attach to a running Java Virtual Machine (JVM) or launch a postmortem
+ * debugger to analyze the content of a core-dump from a crashed JVM.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:</dt>
+ * <dd> {@extLink jhsdb_tool_reference jhsdb}</dd>
+ * </dl>
+ *
* @moduleGraph
* @since 9
*/
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Thu Aug 24 16:24:44 2017 +0200
@@ -644,4 +644,9 @@
* {@link Long}
*/
native Object getFlagValue(String name);
+
+ /**
+ * Gets the host class for {@code type}.
+ */
+ native HotSpotResolvedObjectTypeImpl getHostClass(HotSpotResolvedObjectTypeImpl type);
}
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -412,6 +412,14 @@
}
@Override
+ public ResolvedJavaType getHostClass() {
+ if (isArray()) {
+ return null;
+ }
+ return compilerToVM().getHostClass(this);
+ }
+
+ @Override
public boolean isJavaLangObject() {
return javaClass.equals(Object.class);
}
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java Thu Aug 24 16:24:44 2017 +0200
@@ -154,6 +154,11 @@
}
@Override
+ public ResolvedJavaType getHostClass() {
+ return null;
+ }
+
+ @Override
public JavaKind getJavaKind() {
return kind;
}
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java Thu Aug 24 16:24:44 2017 +0200
@@ -105,6 +105,13 @@
boolean isAssignableFrom(ResolvedJavaType other);
/**
+ * Returns the {@link ResolvedJavaType} object representing the host class of this VM anonymous
+ * class (as opposed to the unrelated concept specified by {@link Class#isAnonymousClass()}) or
+ * {@code null} if this object does not represent a VM anonymous class.
+ */
+ ResolvedJavaType getHostClass();
+
+ /**
* Returns true if this type is exactly the type {@link java.lang.Object}.
*/
default boolean isJavaLangObject() {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,11 +26,9 @@
module jdk.internal.vm.compiler {
requires java.instrument;
requires java.management;
+ requires jdk.internal.vm.ci;
requires jdk.management;
- requires jdk.internal.vm.ci;
-
- // sun.misc.Unsafe is used
- requires jdk.unsupported;
+ requires jdk.unsupported; // sun.misc.Unsafe is used
uses org.graalvm.compiler.code.DisassemblerProvider;
uses org.graalvm.compiler.core.match.MatchStatementSet;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java Thu Aug 24 16:24:44 2017 +0200
@@ -251,7 +251,13 @@
for (JavaKind kind : new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object}) {
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
- r.register5("compareAndSwap" + kind.name(), Receiver.class, Object.class, long.class, javaClass, javaClass, new InvocationPlugin() {
+ String casName;
+ if (Java8OrEarlier) {
+ casName = "compareAndSwap";
+ } else {
+ casName = "compareAndSet";
+ }
+ r.register5(casName + kind.name(), Receiver.class, Object.class, long.class, javaClass, javaClass, new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode expected, ValueNode x) {
// Emits a null-check for the otherwise unused receiver
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -545,11 +545,11 @@
case Bytecodes::_imul:
{
- bool did_strength_reduce = false;
+ bool did_strength_reduce = false;
if (right->is_constant()) {
- int c = right->as_jint();
- if (is_power_of_2(c)) {
+ jint c = right->as_jint();
+ if (c > 0 && is_power_of_2(c)) {
// do not need tmp here
__ shift_left(left_op, exact_log2(c), result_op);
did_strength_reduce = true;
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Thu Aug 24 16:24:44 2017 +0200
@@ -313,7 +313,7 @@
// is_strictfp is only needed for mul and div (and only generates different code on i486)
void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL);
// machine dependent. returns true if it emitted code for the multiply
- bool strength_reduce_multiply(LIR_Opr left, int constant, LIR_Opr result, LIR_Opr tmp);
+ bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp);
void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
--- a/hotspot/src/share/vm/classfile/modules.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/classfile/modules.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -722,74 +722,6 @@
return NULL;
}
-void Modules::add_module_package(jobject module, const char* package_name, TRAPS) {
- ResourceMark rm(THREAD);
-
- if (module == NULL) {
- THROW_MSG(vmSymbols::java_lang_NullPointerException(),
- "module is null");
- }
- if (package_name == NULL) {
- THROW_MSG(vmSymbols::java_lang_NullPointerException(),
- "package is null");
- }
- ModuleEntry* module_entry = get_module_entry(module, CHECK);
- if (module_entry == NULL) {
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "module is invalid");
- }
- if (!module_entry->is_named()) {
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "module cannot be an unnamed module");
- }
- if (!verify_package_name(package_name)) {
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- err_msg("Invalid package name: %s", package_name));
- }
-
- ClassLoaderData *loader_data = module_entry->loader_data();
-
- // Only modules defined to either the boot or platform class loader, can define a "java/" package.
- if (!loader_data->is_the_null_class_loader_data() &&
- !loader_data->is_platform_class_loader_data() &&
- (strncmp(package_name, JAVAPKG, JAVAPKG_LEN) == 0 &&
- (package_name[JAVAPKG_LEN] == '/' || package_name[JAVAPKG_LEN] == '\0'))) {
- const char* class_loader_name = SystemDictionary::loader_name(loader_data);
- size_t pkg_len = strlen(package_name);
- char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len);
- strncpy(pkg_name, package_name, pkg_len);
- StringUtils::replace_no_expand(pkg_name, "/", ".");
- const char* msg_text1 = "Class loader (instance of): ";
- const char* msg_text2 = " tried to define prohibited package name: ";
- size_t len = strlen(msg_text1) + strlen(class_loader_name) + strlen(msg_text2) + pkg_len + 1;
- char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len);
- jio_snprintf(message, len, "%s%s%s%s", msg_text1, class_loader_name, msg_text2, pkg_name);
- THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message);
- }
-
- log_debug(module)("add_module_package(): Adding package %s to module %s",
- package_name, module_entry->name()->as_C_string());
-
- TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK);
- PackageEntryTable* package_table = loader_data->packages();
- assert(package_table != NULL, "Missing package_table");
-
- PackageEntry* existing_pkg = NULL;
- {
- MutexLocker ml(Module_lock, THREAD);
-
- // Check that the package does not exist in the class loader's package table.
- existing_pkg = package_table->lookup_only(pkg_symbol);
- if (existing_pkg == NULL) {
- PackageEntry* pkg = package_table->locked_create_entry_or_null(pkg_symbol, module_entry);
- assert(pkg != NULL, "Unable to create a module's package entry");
- }
- }
- if (existing_pkg != NULL) {
- throw_dup_pkg_exception(module_entry->name()->as_C_string(), existing_pkg, CHECK);
- }
-}
-
// Export package in module to all unnamed modules.
void Modules::add_module_exports_to_all_unnamed(jobject module, const char* package_name, TRAPS) {
if (module == NULL) {
--- a/hotspot/src/share/vm/classfile/modules.hpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/classfile/modules.hpp Thu Aug 24 16:24:44 2017 +0200
@@ -113,14 +113,6 @@
// Returns NULL if package is invalid or not defined by loader.
static jobject get_module(Symbol* package_name, Handle h_loader, TRAPS);
- // This adds package to module.
- // It throws IllegalArgumentException if:
- // * Module is bad
- // * Module is unnamed
- // * Package is not syntactically correct
- // * Package is already defined for module's class loader.
- static void add_module_package(jobject module, const char* package, TRAPS);
-
// Marks the specified package as exported to all unnamed modules.
// If either module or package is null then NullPointerException is thrown.
// If module or package is bad, or module is unnamed, or package is not in
--- a/hotspot/src/share/vm/code/codeCache.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -130,6 +130,7 @@
// Iterate over all CodeHeaps
#define FOR_ALL_HEAPS(heap) for (GrowableArrayIterator<CodeHeap*> heap = _heaps->begin(); heap != _heaps->end(); ++heap)
#define FOR_ALL_NMETHOD_HEAPS(heap) for (GrowableArrayIterator<CodeHeap*> heap = _nmethod_heaps->begin(); heap != _nmethod_heaps->end(); ++heap)
+#define FOR_ALL_ALLOCABLE_HEAPS(heap) for (GrowableArrayIterator<CodeHeap*> heap = _allocable_heaps->begin(); heap != _allocable_heaps->end(); ++heap)
// Iterate over all CodeBlobs (cb) on the given CodeHeap
#define FOR_ALL_BLOBS(cb, heap) for (CodeBlob* cb = first_blob(heap); cb != NULL; cb = next_blob(heap, cb))
@@ -140,10 +141,11 @@
bool CodeCache::_needs_cache_clean = false;
nmethod* CodeCache::_scavenge_root_nmethods = NULL;
-// Initialize array of CodeHeaps
+// Initialize arrays of CodeHeap subsets
GrowableArray<CodeHeap*>* CodeCache::_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
GrowableArray<CodeHeap*>* CodeCache::_compiled_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
GrowableArray<CodeHeap*>* CodeCache::_nmethod_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
+GrowableArray<CodeHeap*>* CodeCache::_allocable_heaps = new(ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, true);
void CodeCache::check_heap_sizes(size_t non_nmethod_size, size_t profiled_size, size_t non_profiled_size, size_t cache_size, bool all_set) {
size_t total_size = non_nmethod_size + profiled_size + non_profiled_size;
@@ -338,6 +340,7 @@
return rs;
}
+// Heaps available for allocation
bool CodeCache::heap_available(int code_blob_type) {
if (!SegmentedCodeCache) {
// No segmentation: use a single code heap
@@ -391,6 +394,9 @@
if (code_blob_type_accepts_nmethod(type)) {
_nmethod_heaps->insert_sorted<code_heap_compare>(heap);
}
+ if (code_blob_type_accepts_allocable(type)) {
+ _allocable_heaps->insert_sorted<code_heap_compare>(heap);
+ }
}
void CodeCache::add_heap(ReservedSpace rs, const char* name, int code_blob_type) {
@@ -620,7 +626,7 @@
void CodeCache::blobs_do(void f(CodeBlob* nm)) {
assert_locked_or_safepoint(CodeCache_lock);
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_HEAPS(heap) {
FOR_ALL_BLOBS(cb, *heap) {
f(cb);
}
@@ -663,7 +669,7 @@
void CodeCache::blobs_do(CodeBlobClosure* f) {
assert_locked_or_safepoint(CodeCache_lock);
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
FOR_ALL_BLOBS(cb, *heap) {
if (cb->is_alive()) {
f->do_code_blob(cb);
@@ -960,7 +966,7 @@
size_t CodeCache::capacity() {
size_t cap = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
cap += (*heap)->capacity();
}
return cap;
@@ -973,7 +979,7 @@
size_t CodeCache::unallocated_capacity() {
size_t unallocated_cap = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
unallocated_cap += (*heap)->unallocated_capacity();
}
return unallocated_cap;
@@ -981,7 +987,7 @@
size_t CodeCache::max_capacity() {
size_t max_cap = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
max_cap += (*heap)->max_capacity();
}
return max_cap;
@@ -1007,7 +1013,7 @@
size_t CodeCache::bytes_allocated_in_freelists() {
size_t allocated_bytes = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
allocated_bytes += (*heap)->allocated_in_freelist();
}
return allocated_bytes;
@@ -1015,7 +1021,7 @@
int CodeCache::allocated_segments() {
int number_of_segments = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
number_of_segments += (*heap)->allocated_segments();
}
return number_of_segments;
@@ -1023,7 +1029,7 @@
size_t CodeCache::freelists_length() {
size_t length = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
length += (*heap)->freelist_length();
}
return length;
@@ -1354,7 +1360,7 @@
void CodeCache::print_memory_overhead() {
size_t wasted_bytes = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
CodeHeap* curr_heap = *heap;
for (CodeBlob* cb = (CodeBlob*)curr_heap->first(); cb != NULL; cb = (CodeBlob*)curr_heap->next(cb)) {
HeapBlock* heap_block = ((HeapBlock*)cb) - 1;
@@ -1400,7 +1406,7 @@
ResourceMark rm;
int i = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
if ((_nmethod_heaps->length() >= 1) && Verbose) {
tty->print_cr("-- %s --", (*heap)->name());
}
@@ -1497,7 +1503,7 @@
CodeBlob_sizes live;
CodeBlob_sizes dead;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
FOR_ALL_BLOBS(cb, *heap) {
if (!cb->is_alive()) {
dead.add(cb);
@@ -1523,7 +1529,7 @@
int number_of_blobs = 0;
int number_of_oop_maps = 0;
int map_size = 0;
- FOR_ALL_NMETHOD_HEAPS(heap) {
+ FOR_ALL_ALLOCABLE_HEAPS(heap) {
FOR_ALL_BLOBS(cb, *heap) {
if (cb->is_alive()) {
number_of_blobs++;
--- a/hotspot/src/share/vm/code/codeCache.hpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/code/codeCache.hpp Thu Aug 24 16:24:44 2017 +0200
@@ -85,6 +85,7 @@
static GrowableArray<CodeHeap*>* _heaps;
static GrowableArray<CodeHeap*>* _compiled_heaps;
static GrowableArray<CodeHeap*>* _nmethod_heaps;
+ static GrowableArray<CodeHeap*>* _allocable_heaps;
static address _low_bound; // Lower bound of CodeHeap addresses
static address _high_bound; // Upper bound of CodeHeap addresses
@@ -237,6 +238,11 @@
return type == CodeBlobType::All || type <= CodeBlobType::MethodProfiled;
}
+ static bool code_blob_type_accepts_allocable(int type) {
+ return type <= CodeBlobType::All;
+ }
+
+
// Returns the CodeBlobType for the given compilation level
static int get_code_blob_type(int comp_level) {
if (comp_level == CompLevel_none ||
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -1557,7 +1557,7 @@
// First thread to get here will initialize the compiler interface
- if (!ciObjectFactory::is_initialized()) {
+ {
ASSERT_IN_VM;
MutexLocker only_one (CompileThread_lock, thread);
if (!ciObjectFactory::is_initialized()) {
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -1687,6 +1687,13 @@
}
C2V_END
+C2V_VMENTRY(jobject, getHostClass, (JNIEnv*, jobject, jobject jvmci_type))
+ InstanceKlass* k = InstanceKlass::cast(CompilerToVM::asKlass(jvmci_type));
+ InstanceKlass* host = k->host_klass();
+ oop result = CompilerToVM::get_jvmci_type(host, CHECK_NULL);
+ return JNIHandles::make_local(THREAD, result);
+C2V_END
+
C2V_VMENTRY(int, interpreterFrameSize, (JNIEnv*, jobject, jobject bytecode_frame_handle))
if (bytecode_frame_handle == NULL) {
THROW_0(vmSymbols::java_lang_NullPointerException());
@@ -1817,6 +1824,7 @@
{CC "flushDebugOutput", CC "()V", FN_PTR(flushDebugOutput)},
{CC "methodDataProfileDataSize", CC "(JI)I", FN_PTR(methodDataProfileDataSize)},
{CC "getFingerprint", CC "(J)J", FN_PTR(getFingerprint)},
+ {CC "getHostClass", CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_KLASS, FN_PTR(getHostClass)},
{CC "interpreterFrameSize", CC "(" BYTECODE_FRAME ")I", FN_PTR(interpreterFrameSize)},
{CC "compileToBytecode", CC "(" OBJECT ")V", FN_PTR(compileToBytecode)},
{CC "getFlagValue", CC "(" STRING ")" OBJECT, FN_PTR(getFlagValue)},
--- a/hotspot/src/share/vm/prims/jvm.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -1039,11 +1039,6 @@
Modules::add_reads_module(from_module, source_module, CHECK);
JVM_END
-JVM_ENTRY (void, JVM_AddModulePackage(JNIEnv *env, jobject module, const char* package))
- JVMWrapper("JVM_AddModulePackage");
- Modules::add_module_package(module, package, CHECK);
-JVM_END
-
// Reflection support //////////////////////////////////////////////////////////////////////////////
JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls))
--- a/hotspot/src/share/vm/prims/jvm.h Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/prims/jvm.h Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -467,14 +467,6 @@
JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);
/*
- * Add a package to a module.
- * module: module that will contain the package
- * package: package to add to the module
- */
-JNIEXPORT void JNICALL
-JVM_AddModulePackage(JNIEnv* env, jobject module, const char* package);
-
-/*
* Reflection support functions
*/
--- a/hotspot/src/share/vm/prims/whitebox.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -1457,15 +1457,6 @@
Modules::add_reads_module(from_module, source_module, CHECK);
WB_END
-WB_ENTRY(void, WB_AddModulePackage(JNIEnv* env, jobject o, jclass module, jstring package))
- ResourceMark rm(THREAD);
- char* package_name = NULL;
- if (package != NULL) {
- package_name = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(package));
- }
- Modules::add_module_package(module, package_name, CHECK);
-WB_END
-
WB_ENTRY(jobject, WB_GetModuleByPackageName(JNIEnv* env, jobject o, jobject loader, jstring package))
ResourceMark rm(THREAD);
char* package_name = NULL;
@@ -1910,8 +1901,6 @@
(void*)&WB_AddModuleExports },
{CC"AddReadsModule", CC"(Ljava/lang/Object;Ljava/lang/Object;)V",
(void*)&WB_AddReadsModule },
- {CC"AddModulePackage", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
- (void*)&WB_AddModulePackage },
{CC"GetModuleByPackageName", CC"(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;",
(void*)&WB_GetModuleByPackageName },
{CC"AddModuleExportsToAllUnnamed", CC"(Ljava/lang/Object;Ljava/lang/String;)V",
--- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -2861,8 +2861,8 @@
if (res != JNI_OK) {
return res;
}
- } else if (match_option(option, "--permit-illegal-access")) {
- if (!create_property("jdk.module.permitIllegalAccess", "true", ExternalProperty)) {
+ } else if (match_option(option, "--illegal-access=", &tail)) {
+ if (!create_property("jdk.module.illegalAccess", tail, ExternalProperty)) {
return JNI_ENOMEM;
}
// -agentlib and -agentpath
--- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -296,19 +296,41 @@
Klass* k = Management::sun_management_Sensor_klass(CHECK);
instanceKlassHandle sensorKlass (THREAD, k);
Handle sensor_h(THREAD, _sensor_obj);
- Handle usage_h = MemoryService::create_MemoryUsage_obj(_usage, CHECK);
+
+ Symbol* trigger_method_signature;
JavaValue result(T_VOID);
JavaCallArguments args(sensor_h);
args.push_int((int) count);
- args.push_oop(usage_h);
+
+ Handle usage_h = MemoryService::create_MemoryUsage_obj(_usage, THREAD);
+ // Call Sensor::trigger(int, MemoryUsage) to send notification to listeners.
+ // When OOME occurs and fails to allocate MemoryUsage object, call
+ // Sensor::trigger(int) instead. The pending request will be processed
+ // but no notification will be sent.
+ if (HAS_PENDING_EXCEPTION) {
+ assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOME here");
+ CLEAR_PENDING_EXCEPTION;
+ trigger_method_signature = vmSymbols::int_void_signature();
+ } else {
+ trigger_method_signature = vmSymbols::trigger_method_signature();
+ args.push_oop(usage_h);
+ }
JavaCalls::call_virtual(&result,
- sensorKlass,
- vmSymbols::trigger_name(),
- vmSymbols::trigger_method_signature(),
- &args,
- CHECK);
+ sensorKlass,
+ vmSymbols::trigger_name(),
+ trigger_method_signature,
+ &args,
+ THREAD);
+
+ if (HAS_PENDING_EXCEPTION) {
+ // We just clear the OOM pending exception that we might have encountered
+ // in Java's tiggerAction(), and continue with updating the counters since
+ // the Java counters have been updated too.
+ assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOME here");
+ CLEAR_PENDING_EXCEPTION;
+ }
}
{
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1095,8 +1095,11 @@
#undef min
#endif
-#define max(a,b) Do_not_use_max_use_MAX2_instead
-#define min(a,b) Do_not_use_min_use_MIN2_instead
+// The following defines serve the purpose of preventing use of accidentally
+// included min max macros from compiling, while continuing to allow innocent
+// min and max identifiers in the code to compile as intended.
+#define max max
+#define min min
// It is necessary to use templates here. Having normal overloaded
// functions does not work because it is necessary to provide both 32-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c1/MultiplyByMaxInt.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8181872
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
+ * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ * -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
+ * compiler.c1.MultiplyByMaxInt
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation
+ * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=3
+ * -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
+ * compiler.c1.MultiplyByMaxInt
+ */
+package compiler.c1;
+
+public class MultiplyByMaxInt {
+ static int test(int x) {
+ int loops = (x >>> 4) & 7;
+ while (loops-- > 0) {
+ x = (x * 2147483647) % 16807;
+ }
+ return x;
+ }
+
+ public static void main(String[] args) {
+ for (int i = 0; i < 20000; i++) {
+ test(i);
+ }
+ }
+}
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java Thu Aug 24 16:24:44 2017 +0200
@@ -773,221 +773,221 @@
static void test_ci(int[] a) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -1, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i), -1, -123);
}
}
static void test_vi(int[] a, int b, int old) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), old, b);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, b);
}
}
static void test_cp(int[] a, int[] b) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]);
+ unsafe.compareAndSetInt(a, byte_offset(i), -123, b[i]);
}
}
static void test_2ci(int[] a, int[] b) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123);
- unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103);
+ unsafe.compareAndSetInt(a, byte_offset(i), 123, -123);
+ unsafe.compareAndSetInt(b, byte_offset(i), 123, -103);
}
}
static void test_2vi(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -123, c);
- unsafe.compareAndSwapInt(b, byte_offset(i), -103, d);
+ unsafe.compareAndSetInt(a, byte_offset(i), -123, c);
+ unsafe.compareAndSetInt(b, byte_offset(i), -103, d);
}
}
static void test_ci_neg(int[] a, int old) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), old, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, -123);
}
}
static void test_vi_neg(int[] a, int b, int old) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), old, b);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, b);
}
}
static void test_cp_neg(int[] a, int[] b) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]);
+ unsafe.compareAndSetInt(a, byte_offset(i), -123, b[i]);
}
}
static void test_2ci_neg(int[] a, int[] b) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123);
- unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103);
+ unsafe.compareAndSetInt(a, byte_offset(i), 123, -123);
+ unsafe.compareAndSetInt(b, byte_offset(i), 123, -103);
}
}
static void test_2vi_neg(int[] a, int[] b, int c, int d) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -123, c);
- unsafe.compareAndSwapInt(b, byte_offset(i), -103, d);
+ unsafe.compareAndSetInt(a, byte_offset(i), -123, c);
+ unsafe.compareAndSetInt(b, byte_offset(i), -103, d);
}
}
static void test_ci_oppos(int[] a, int old) {
int limit = ARRLEN-1;
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, -123);
+ unsafe.compareAndSetInt(a, byte_offset(limit-i), old, -123);
}
}
static void test_vi_oppos(int[] a, int b, int old) {
int limit = ARRLEN-1;
for (int i = limit; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, b);
+ unsafe.compareAndSetInt(a, byte_offset(limit-i), old, b);
}
}
static void test_cp_oppos(int[] a, int[] b) {
int limit = ARRLEN-1;
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[limit-i]);
+ unsafe.compareAndSetInt(a, byte_offset(i), -123, b[limit-i]);
}
}
static void test_2ci_oppos(int[] a, int[] b) {
int limit = ARRLEN-1;
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(limit-i), 123, -123);
- unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103);
+ unsafe.compareAndSetInt(a, byte_offset(limit-i), 123, -123);
+ unsafe.compareAndSetInt(b, byte_offset(i), 123, -103);
}
}
static void test_2vi_oppos(int[] a, int[] b, int c, int d) {
int limit = ARRLEN-1;
for (int i = limit; i >= 0; i-=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i), -123, c);
- unsafe.compareAndSwapInt(b, byte_offset(limit-i), -103, d);
+ unsafe.compareAndSetInt(a, byte_offset(i), -123, c);
+ unsafe.compareAndSetInt(b, byte_offset(limit-i), -103, d);
}
}
static void test_ci_off(int[] a, int old) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), old, -123);
}
}
static void test_vi_off(int[] a, int b, int old) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, b);
+ unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), old, b);
}
}
static void test_cp_off(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]);
+ unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]);
}
}
static void test_2ci_off(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), 123, -123);
- unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), 123, -103);
+ unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), 123, -123);
+ unsafe.compareAndSetInt(b, byte_offset(i+OFFSET), 123, -103);
}
}
static void test_2vi_off(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, c);
- unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), -103, d);
+ unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), -123, c);
+ unsafe.compareAndSetInt(b, byte_offset(i+OFFSET), -103, d);
}
}
static void test_ci_inv(int[] a, int k, int old) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+k), old, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i+k), old, -123);
}
}
static void test_vi_inv(int[] a, int b, int k, int old) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+k), old, b);
+ unsafe.compareAndSetInt(a, byte_offset(i+k), old, b);
}
}
static void test_cp_inv(int[] a, int[] b, int k) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, b[i+k]);
+ unsafe.compareAndSetInt(a, byte_offset(i+k), -123, b[i+k]);
}
}
static void test_2ci_inv(int[] a, int[] b, int k) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+k), 123, -123);
- unsafe.compareAndSwapInt(b, byte_offset(i+k), 123, -103);
+ unsafe.compareAndSetInt(a, byte_offset(i+k), 123, -123);
+ unsafe.compareAndSetInt(b, byte_offset(i+k), 123, -103);
}
}
static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, c);
- unsafe.compareAndSwapInt(b, byte_offset(i+k), -103, d);
+ unsafe.compareAndSetInt(a, byte_offset(i+k), -123, c);
+ unsafe.compareAndSetInt(b, byte_offset(i+k), -103, d);
}
}
static void test_ci_scl(int[] a, int old) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i*SCALE), old, -123);
}
}
static void test_vi_scl(int[] a, int b, int old) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, b);
+ unsafe.compareAndSetInt(a, byte_offset(i*SCALE), old, b);
}
}
static void test_cp_scl(int[] a, int[] b) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]);
+ unsafe.compareAndSetInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]);
}
}
static void test_2ci_scl(int[] a, int[] b) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), 123, -123);
- unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), 123, -103);
+ unsafe.compareAndSetInt(a, byte_offset(i*SCALE), 123, -123);
+ unsafe.compareAndSetInt(b, byte_offset(i*SCALE), 123, -103);
}
}
static void test_2vi_scl(int[] a, int[] b, int c, int d) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, c);
- unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), -103, d);
+ unsafe.compareAndSetInt(a, byte_offset(i*SCALE), -123, c);
+ unsafe.compareAndSetInt(b, byte_offset(i*SCALE), -103, d);
}
}
static void test_cp_alndst(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]);
+ unsafe.compareAndSetInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]);
}
}
static void test_cp_alnsrc(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
int old = unsafe.getIntVolatile(a, byte_offset(i));
- unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+ALIGN_OFF]);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, b[i+ALIGN_OFF]);
}
}
static void test_2ci_aln(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i+ALIGN_OFF), -1, -123);
int old = unsafe.getIntVolatile(b, byte_offset(i));
- unsafe.compareAndSwapInt(b, byte_offset(i), old, -103);
+ unsafe.compareAndSetInt(b, byte_offset(i), old, -103);
}
}
static void test_2vi_aln(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
int old = unsafe.getIntVolatile(a, byte_offset(i));
- unsafe.compareAndSwapInt(a, byte_offset(i), old, c);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, c);
old = unsafe.getIntVolatile(b, byte_offset(i+ALIGN_OFF));
- unsafe.compareAndSwapInt(b, byte_offset(i+ALIGN_OFF), old, d);
+ unsafe.compareAndSetInt(b, byte_offset(i+ALIGN_OFF), old, d);
}
}
static void test_cp_unalndst(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]);
+ unsafe.compareAndSetInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]);
}
}
static void test_cp_unalnsrc(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
int old = unsafe.getIntVolatile(a, byte_offset(i));
- unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]);
}
}
static void test_2ci_unaln(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
- unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, -123);
+ unsafe.compareAndSetInt(a, byte_offset(i+UNALIGN_OFF), -1, -123);
int old = unsafe.getIntVolatile(b, byte_offset(i));
- unsafe.compareAndSwapInt(b, byte_offset(i), old, -103);
+ unsafe.compareAndSetInt(b, byte_offset(i), old, -103);
}
}
static void test_2vi_unaln(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
int old = unsafe.getIntVolatile(a, byte_offset(i));
- unsafe.compareAndSwapInt(a, byte_offset(i), old, c);
+ unsafe.compareAndSetInt(a, byte_offset(i), old, c);
old = unsafe.getIntVolatile(b, byte_offset(i+UNALIGN_OFF));
- unsafe.compareAndSwapInt(b, byte_offset(i+UNALIGN_OFF), old, d);
+ unsafe.compareAndSetInt(b, byte_offset(i+UNALIGN_OFF), old, d);
}
}
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Thu Aug 24 16:24:44 2017 +0200
@@ -54,6 +54,7 @@
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collections;
+import java.util.function.Supplier;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -143,6 +144,27 @@
}
@Test
+ public void getHostClassTest() {
+ for (Class<?> c : classes) {
+ ResolvedJavaType type = metaAccess.lookupJavaType(c);
+ ResolvedJavaType host = type.getHostClass();
+ assertNull(host);
+ }
+
+ class LocalClass {}
+ Cloneable clone = new Cloneable() {};
+ assertNull(metaAccess.lookupJavaType(LocalClass.class).getHostClass());
+ assertNull(metaAccess.lookupJavaType(clone.getClass()).getHostClass());
+
+ Supplier<Runnable> lambda = () -> () -> System.out.println("run");
+ ResolvedJavaType lambdaType = metaAccess.lookupJavaType(lambda.getClass());
+ ResolvedJavaType nestedLambdaType = metaAccess.lookupJavaType(lambda.get().getClass());
+ assertNotNull(lambdaType.getHostClass());
+ assertNotNull(nestedLambdaType.getHostClass());
+ assertEquals(lambdaType.getHostClass(), nestedLambdaType.getHostClass());
+ }
+
+ @Test
public void getModifiersTest() {
for (Class<?> c : classes) {
ResolvedJavaType type = metaAccess.lookupJavaType(c);
--- a/hotspot/test/compiler/profiling/UnsafeAccess.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/compiler/profiling/UnsafeAccess.java Thu Aug 24 16:24:44 2017 +0200
@@ -64,7 +64,7 @@
static Object helperUnsafeLoadStore(Object o, boolean isObjArray) {
if (isObjArray) {
Object o1 = U.getObject(o, off);
- U.compareAndSwapObject(o, off, o1, new Object());
+ U.compareAndSetObject(o, off, o1, new Object());
}
return o;
}
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @modules java.base/jdk.internal.misc
- * @library /test/lib ..
- * @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/ModuleHelper.java
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModulePackage
- */
-
-import static jdk.test.lib.Asserts.*;
-import java.sql.Time;
-
-public class JVMAddModulePackage {
-
- public static void main(String args[]) throws Throwable {
- MyClassLoader cl1 = new MyClassLoader();
- MyClassLoader cl3 = new MyClassLoader();
- Object module_one, module_two, module_three;
- boolean result;
-
- 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[] { "apackage/num3" });
- assertNotNull(module_three, "Module should not be null");
- ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "apackage/num3" });
-
- // Simple call
- ModuleHelper.AddModulePackage(module_one, "new_package");
-
- // Add a package and export it
- ModuleHelper.AddModulePackage(module_one, "apackage/num3");
- ModuleHelper.AddModuleExportsToAll(module_one, "apackage/num3");
-
- // Null module argument, expect an NPE
- try {
- ModuleHelper.AddModulePackage(null, "new_package");
- throw new RuntimeException("Failed to get the expected NPE");
- } catch(NullPointerException e) {
- // Expected
- }
-
- // Bad module argument, expect an IAE
- try {
- ModuleHelper.AddModulePackage(cl1, "new_package");
- throw new RuntimeException("Failed to get the expected IAE");
- } catch(IllegalArgumentException e) {
- // Expected
- }
-
- // Null package argument, expect an NPE
- try {
- ModuleHelper.AddModulePackage(module_one, null);
- throw new RuntimeException("Failed to get the expected NPE");
- } catch(NullPointerException e) {
- // Expected
- }
-
- // Existing package, expect an ISE
- try {
- ModuleHelper.AddModulePackage(module_one, "yourpackage");
- throw new RuntimeException("Failed to get the expected ISE");
- } catch(IllegalStateException e) {
- // Expected
- }
-
- // Invalid package name, expect an IAE
- try {
- ModuleHelper.AddModulePackage(module_one, "your.apackage");
- throw new RuntimeException("Failed to get the expected IAE");
- } catch(IllegalArgumentException e) {
- // Expected
- }
-
- // Invalid package name, expect an IAE
- try {
- ModuleHelper.AddModulePackage(module_one, ";your/apackage");
- throw new RuntimeException("Failed to get the expected IAE");
- } catch(IllegalArgumentException e) {
- // Expected
- }
-
- // Invalid package name, expect an IAE
- try {
- ModuleHelper.AddModulePackage(module_one, "7[743");
- throw new RuntimeException("Failed to get the expected IAE");
- } catch(IllegalArgumentException e) {
- // Expected
- }
-
- // Empty package name, expect an IAE
- try {
- ModuleHelper.AddModulePackage(module_one, "");
- throw new RuntimeException("Failed to get the expected IAE");
- } catch(IllegalArgumentException e) {
- // Expected
- }
-
- // Add package named "java" to an module defined to a class loader other than the boot or platform loader.
- try {
- // 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")) {
- throw new RuntimeException("Failed to get expected IAE message for prohibited package name: " + e.getMessage());
- }
- }
-
- // Package "javabar" should be ok
- ModuleHelper.AddModulePackage(module_one, "javabar");
-
- // Package named "java" defined to the boot class loader, should be ok
- 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
- // The module java.sql is defined to the platform class loader.
- java.sql.Time jst = new java.sql.Time(45000); // milliseconds
- Object module_javasql = jst.getClass().getModule();
- ModuleHelper.AddModulePackage(module_javasql, "java/foo");
- }
-
- static class MyClassLoader extends ClassLoader { }
-}
-
--- a/hotspot/test/runtime/modules/ModuleHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/runtime/modules/ModuleHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -49,12 +49,6 @@
java.lang.ModuleHelper.addReadsNoSync((Module)from, (Module)to);
}
- public static void AddModulePackage(Object m, String pkg) throws Throwable {
- WhiteBox wb = WhiteBox.getWhiteBox();
- wb.AddModulePackage(m, pkg);
- java.lang.ModuleHelper.addPackageNoSync((Module)m, pkg);
- }
-
public static Module GetModuleByPackageName(Object ldr, String pkg) throws Throwable {
WhiteBox wb = WhiteBox.getWhiteBox();
return (Module)wb.GetModuleByPackageName(ldr, pkg);
--- a/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -63,11 +63,4 @@
}
}
- /**
- * Adds a package to a module without notifying the VM.
- */
- public static void addPackageNoSync(Module m, String pkg) {
- m.implAddPackageNoSync(pkg);
- }
-
}
--- a/hotspot/test/serviceability/jvmti/GetNamedModule/MyPackage/GetNamedModuleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/serviceability/jvmti/GetNamedModule/MyPackage/GetNamedModuleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -26,6 +26,7 @@
/**
* @test
* @summary Verifies the JVMTI GetNamedModule API
+ * @modules jdk.jdi
* @compile GetNamedModuleTest.java
* @run main/othervm/native -agentlib:GetNamedModuleTest MyPackage.GetNamedModuleTest
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/IsModifiableModule/MyPackage/IsModifiableModuleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package MyPackage;
+
+/**
+ * @test
+ * @summary Verifies the JVMTI IsModifiableModule API
+ * @modules jdk.jdi
+ * @compile IsModifiableModuleTest.java
+ * @run main/othervm/native -agentlib:IsModifiableModuleTest MyPackage.IsModifiableModuleTest
+ */
+
+import java.io.PrintStream;
+
+public class IsModifiableModuleTest {
+
+ static {
+ try {
+ System.loadLibrary("IsModifiableModuleTest");
+ } catch (UnsatisfiedLinkError ule) {
+ System.err.println("Could not load IsModifiableModuleTest library");
+ System.err.println("java.library.path: "
+ + System.getProperty("java.library.path"));
+ throw ule;
+ }
+ }
+
+ native static int check();
+
+ public static void main(String args[]) {
+ int status = check();
+ if (status != 0) {
+ throw new RuntimeException("Non-zero status returned from the agent: " + status);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/IsModifiableModule/libIsModifiableModuleTest.c Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,215 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "jvmti.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef JNI_ENV_ARG
+
+#ifdef __cplusplus
+#define JNI_ENV_ARG(x, y) y
+#define JNI_ENV_PTR(x) x
+#else
+#define JNI_ENV_ARG(x,y) x, y
+#define JNI_ENV_PTR(x) (*x)
+#endif
+
+#endif
+
+#define TranslateError(err) "JVMTI error"
+
+#define PASSED 0
+#define FAILED 2
+
+static const char *EXC_CNAME = "java/lang/AssertionError";
+
+static jvmtiEnv *jvmti = NULL;
+static jint result = PASSED;
+static jboolean printdump = JNI_FALSE;
+
+static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved);
+
+JNIEXPORT
+jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+ return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) {
+ return Agent_Initialize(jvm, options, reserved);
+}
+
+JNIEXPORT
+jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
+ return JNI_VERSION_1_8;
+}
+
+static
+jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
+ jint res;
+
+ if (options != NULL && strcmp(options, "printdump") == 0) {
+ printdump = JNI_TRUE;
+ }
+
+ res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
+ JVMTI_VERSION_9);
+ if (res != JNI_OK || jvmti == NULL) {
+ printf(" Error: wrong result of a valid call to GetEnv!\n");
+ return JNI_ERR;
+ }
+
+ return JNI_OK;
+}
+
+static
+jclass find_class(JNIEnv *env, const char* cname) {
+ jclass cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, cname));
+
+ if (cls == NULL) {
+ printf("find_class: Error: FindClass(env, \"%s\") returned NULL\n", cname);
+ }
+ return cls;
+}
+
+static
+jint throw_exc(JNIEnv *env, char *msg) {
+ jclass exc_class = find_class(env, EXC_CNAME);
+
+ if (exc_class == NULL) {
+ printf("throw_exc: Error in find_class(env, \"%s\")\n", EXC_CNAME);
+ return -1;
+ }
+ return JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, exc_class), msg);
+}
+
+static jobject get_module_by_class_name(JNIEnv *env, const char* cname) {
+ jobject module = NULL;
+ jclass cls = find_class(env, cname);
+
+ printf(">>> getting module by class name: \"%s\"\n", cname);
+ if (cls == NULL) {
+ printf("get_module_by_class_name: Error in find_class(env, \"%s\")\n", cname);
+ return NULL;
+ }
+ module = JNI_ENV_PTR(env)->GetModule(JNI_ENV_ARG(env, cls));
+ if (module == NULL) {
+ printf("get_module_by_class_name: Error in GetModule for class \"%s\"\n", cname);
+ }
+ return module;
+}
+
+static
+jint check_is_modifiable_error_codes(jobject module, jobject not_a_module) {
+ jvmtiError err = JVMTI_ERROR_NONE;
+ jboolean is_modifiable = JNI_FALSE;
+
+ printf(">>> passing a bad module argument to JVMTI IsModifiableModule\n");
+ err = (*jvmti)->IsModifiableModule(jvmti, not_a_module, &is_modifiable);
+ if (err != JVMTI_ERROR_INVALID_MODULE) {
+ printf(" Error #EC0: Did not get expected INVALID_MODULE error code from"
+ " IsModifiableModule: %s (%d)\n", TranslateError(err), err);
+ return FAILED;
+ }
+ printf(">>> passing NULL module argument to JVMTI IsModifiableModule\n");
+ err = (*jvmti)->IsModifiableModule(jvmti, NULL, &is_modifiable);
+ if (err != JVMTI_ERROR_NULL_POINTER) {
+ printf(" Error #EC1: Did not get expected NULL_POINTER error code from"
+ " IsModifiableModule: %s (%d)\n", TranslateError(err), err);
+ return FAILED;
+ }
+ printf(">>> passing NULL status pointer to JVMTI IsModifiableModule\n");
+ err = (*jvmti)->IsModifiableModule(jvmti, module, NULL);
+ if (err != JVMTI_ERROR_NULL_POINTER) {
+ printf(" Error #EC2: Did not get expected NULL_POINTER error code from"
+ " IsModifiableModule: %s (%d)\n", TranslateError(err), err);
+ return FAILED;
+ }
+ return PASSED;
+}
+
+static
+jint check_is_modifiable(jobject module) {
+ jvmtiError err = JVMTI_ERROR_NONE;
+ jboolean is_modifiable = JNI_FALSE;
+
+ printf(">>> checking module %p is modifiable\n", module);
+ err = (*jvmti)->IsModifiableModule(jvmti, module, &is_modifiable);
+ if (err != JVMTI_ERROR_NONE) {
+ printf(" Error in IsModifiableModule for module %p: %s (%d)\n",
+ module, TranslateError(err), err);
+ return FAILED;
+ }
+ if (is_modifiable == JNI_FALSE) {
+ printf(" unexpected non-modifiable status for module: %p\n", module);
+ return FAILED;
+ }
+ return PASSED;
+}
+
+JNIEXPORT jint JNICALL
+Java_MyPackage_IsModifiableModuleTest_check(JNIEnv *env, jclass cls) {
+ jobject module = NULL;
+
+ if (jvmti == NULL) {
+ throw_exc(env, "JVMTI client was not properly loaded!\n");
+ return FAILED;
+ }
+
+ printf("\n*** Testing IsModifiableModule ***\n\n");
+
+ if (check_is_modifiable_error_codes(module, cls) == FAILED) {
+ throw_exc(env, "check #MM0: failed to return expected error code from "
+ "a bad call to JVMTI IsModifiableModule");
+ return FAILED;
+ }
+
+ module = get_module_by_class_name(env, "java/lang/Class");
+ if (check_is_modifiable(module) == FAILED) {
+ throw_exc(env, "check #MM1: failed to return modifiable module status");
+ return FAILED;
+ }
+
+ module = get_module_by_class_name(env, "com/sun/jdi/VirtualMachine");
+ if (check_is_modifiable(module) == FAILED) {
+ throw_exc(env, "check #MM2: failed to return modifiable module status");
+ return FAILED;
+ }
+
+ module = get_module_by_class_name(env, "MyPackage/IsModifiableModuleTest");
+ if (check_is_modifiable(module) == FAILED) {
+ throw_exc(env, "check #MM3: failed to return modifiable module status");
+ return FAILED;
+ }
+
+ return PASSED;
+}
+
+#ifdef __cplusplus
+}
+#endif
--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java Wed Jun 28 11:27:28 2017 -0700
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java Thu Aug 24 16:24:44 2017 +0200
@@ -51,8 +51,7 @@
VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
MODE("isInt", "isMixed", "isComp"),
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
- "shouldSAAttach", "canPtraceAttachLinux", "canAttachOSX",
- "isTieredSupported");
+ "shouldSAAttach", "isTieredSupported");
public final List<String> methodNames;
--- a/jaxp/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/jaxp/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -428,3 +428,7 @@
eedb6e54c8bd6197ecba5fc0d8568bac8ae852dd jdk-9+172
95bab8bf9201ae8bfdf28e164bf33b78e49477e7 jdk-10+11
9788347e0629d0cb3a0e55a903494ff741d4fa15 jdk-9+173
+b9c0b105002272d7414c8b34af9aded151f9cad6 jdk-9+174
+ff293e39e83366c40a5687dacd1ccb2305ed2c1e jdk-10+12
+736412a8dccee9d439044e6b1af2e7470d0a3563 jdk-9+175
+5d374af9e78d02976e0e7f8dc2706f91a020f025 jdk-10+13
--- a/jaxp/.jcheck/conf Wed Jun 28 11:27:28 2017 -0700
+++ b/jaxp/.jcheck/conf Thu Aug 24 16:24:44 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLCatalogResolver.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xerces.internal.util;
-
-import java.io.IOException;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.EntityResolver2;
-
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSResourceResolver;
-
-import javax.xml.parsers.SAXParserFactory;
-
-import com.sun.org.apache.xerces.internal.dom.DOMInputImpl;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-
-import com.sun.org.apache.xerces.internal.xni.XNIException;
-import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
-
-import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-
-/**
- * <p>The catalog resolver handles the resolution of external
- * identifiers and URI references through XML catalogs. This
- * component supports XML catalogs defined by the
- * <a href="http://www.oasis-open.org/committees/entity/spec.html">
- * OASIS XML Catalogs Specification</a>. It encapsulates the
- * <a href="http://xml.apache.org/commons/">XML Commons</a> resolver.
- * An instance of this class may be registered on the parser
- * as a SAX entity resolver, as a DOM LSResourceResolver or
- * as an XNI entity resolver by setting the property
- * (http://apache.org/xml/properties/internal/entity-resolver).</p>
- *
- * <p>It is intended that this class may be used standalone to perform
- * catalog resolution outside of a parsing context. It may be shared
- * between several parsers and the application.</p>
- *
- * @deprecated This class and the JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API should
- * migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Michael Glavassevich, IBM
- *
- */
-@Deprecated(since="9", forRemoval=true)
-public class XMLCatalogResolver
- implements XMLEntityResolver, EntityResolver2, LSResourceResolver {
-
- /** Internal catalog manager for Apache catalogs. **/
- private CatalogManager fResolverCatalogManager = null;
-
- /** Internal catalog structure. **/
- private Catalog fCatalog = null;
-
- /** An array of catalog URIs. **/
- private String [] fCatalogsList = null;
-
- /**
- * Indicates whether the list of catalogs has
- * changed since it was processed.
- */
- private boolean fCatalogsChanged = true;
-
- /** Application specified prefer public setting. **/
- private boolean fPreferPublic = true;
-
- /**
- * Indicates whether the application desires that
- * the parser or some other component performing catalog
- * resolution should use the literal system identifier
- * instead of the expanded system identifier.
- */
- private boolean fUseLiteralSystemId = true;
-
- /**
- * <p>Constructs a catalog resolver with a default configuration.</p>
- */
- public XMLCatalogResolver () {
- this(null, true);
- }
-
- /**
- * <p>Constructs a catalog resolver with the given
- * list of entry files.</p>
- *
- * @param catalogs an ordered array list of absolute URIs
- */
- public XMLCatalogResolver (String [] catalogs) {
- this(catalogs, true);
- }
-
- /**
- * <p>Constructs a catalog resolver with the given
- * list of entry files and the preference for whether
- * system or public matches are preferred.</p>
- *
- * @param catalogs an ordered array list of absolute URIs
- * @param preferPublic the prefer public setting
- */
- public XMLCatalogResolver (String [] catalogs, boolean preferPublic) {
- init(catalogs, preferPublic);
- }
-
- /**
- * <p>Returns the initial list of catalog entry files.</p>
- *
- * @return the initial list of catalog entry files
- */
- public final synchronized String [] getCatalogList () {
- return (fCatalogsList != null)
- ? (String[]) fCatalogsList.clone() : null;
- }
-
- /**
- * <p>Sets the initial list of catalog entry files.
- * If there were any catalog mappings cached from
- * the previous list they will be replaced by catalog
- * mappings from the new list the next time the catalog
- * is queried.</p>
- *
- * @param catalogs an ordered array list of absolute URIs
- */
- public final synchronized void setCatalogList (String [] catalogs) {
- fCatalogsChanged = true;
- fCatalogsList = (catalogs != null)
- ? (String[]) catalogs.clone() : null;
- }
-
- /**
- * <p>Forces the cache of catalog mappings to be cleared.</p>
- */
- public final synchronized void clear () {
- fCatalog = null;
- }
-
- /**
- * <p>Returns the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the <code>prefer</code> attribute
- * on the <code>catalog</code> entry of a catalog. If this
- * property has not yet been explicitly set its value is
- * <code>true</code>.</p>
- *
- * @return the prefer public setting
- */
- public final boolean getPreferPublic () {
- return fPreferPublic;
- }
-
- /**
- * <p>Sets the preference for whether system or public
- * matches are preferred. This is used in the absence
- * of any occurence of the <code>prefer</code> attribute
- * on the <code>catalog</code> entry of a catalog.</p>
- *
- * @param preferPublic the prefer public setting
- */
- public final void setPreferPublic (boolean preferPublic) {
- fPreferPublic = preferPublic;
- fResolverCatalogManager.setPreferPublic(preferPublic);
- }
-
- /**
- * <p>Returns the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available. If this property has not yet
- * been explicitly set its value is <code>true</code>.</p>
- *
- * @return the preference for using literal system identifers
- * for catalog resolution
- *
- * @see #setUseLiteralSystemId
- */
- public final boolean getUseLiteralSystemId () {
- return fUseLiteralSystemId;
- }
-
- /**
- * <p>Sets the preference for whether the literal system
- * identifier should be used when resolving system
- * identifiers when both it and the expanded system
- * identifier are available.</p>
- *
- * <p>The literal system identifier is the URI as it was
- * provided before absolutization. It may be embedded within
- * an entity. It may be provided externally or it may be the
- * result of redirection. For example, redirection may
- * have come from the protocol level through HTTP or from
- * an application's entity resolver.</p>
- *
- * <p>The expanded system identifier is an absolute URI
- * which is the result of resolving the literal system
- * identifier against a base URI.</p>
- *
- * @param useLiteralSystemId the preference for using
- * literal system identifers for catalog resolution
- */
- public final void setUseLiteralSystemId (boolean useLiteralSystemId) {
- fUseLiteralSystemId = useLiteralSystemId;
- }
-
- /**
- * <p>Resolves an external entity. If the entity cannot be
- * resolved, this method should return <code>null</code>. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.</p>
- *
- * @param publicId the public identifier, or <code>null</code> if none was supplied
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
-
- String resolvedId = null;
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- * <p>Resolves an external entity. If the entity cannot be
- * resolved, this method should return <code>null</code>. This
- * method returns an input source if an entry was found in the
- * catalog for the given external identifier. It should be
- * overrided if other behaviour is required.</p>
- *
- * @param name the identifier of the external entity
- * @param publicId the public identifier, or <code>null</code> if none was supplied
- * @param baseURI the URI with respect to which relative systemIDs are interpreted.
- * @param systemId the system identifier
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource resolveEntity(String name, String publicId,
- String baseURI, String systemId) throws SAXException, IOException {
-
- String resolvedId = null;
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
-
- if (resolvedId != null) {
- InputSource source = new InputSource(resolvedId);
- source.setPublicId(publicId);
- return source;
- }
- return null;
- }
-
- /**
- * <p>Locates an external subset for documents which do not explicitly
- * provide one. This method always returns <code>null</code>. It
- * should be overrided if other behaviour is required.</p>
- *
- * @param name the identifier of the document root element
- * @param baseURI the document's base URI
- *
- * @throws SAXException any SAX exception, possibly wrapping another exception
- * @throws IOException thrown if some i/o error occurs
- */
- public InputSource getExternalSubset(String name, String baseURI)
- throws SAXException, IOException {
- return null;
- }
-
- /**
- * <p>Resolves a resource using the catalog. This method interprets that
- * the namespace URI corresponds to uri entries in the catalog.
- * Where both a namespace and an external identifier exist, the namespace
- * takes precedence.</p>
- *
- * @param type the type of the resource being resolved
- * @param namespaceURI the namespace of the resource being resolved,
- * or <code>null</code> if none was supplied
- * @param publicId the public identifier of the resource being resolved,
- * or <code>null</code> if none was supplied
- * @param systemId the system identifier of the resource being resolved,
- * or <code>null</code> if none was supplied
- * @param baseURI the absolute base URI of the resource being parsed,
- * or <code>null</code> if there is no base URI
- */
- public LSInput resolveResource(String type, String namespaceURI,
- String publicId, String systemId, String baseURI) {
-
- String resolvedId = null;
-
- try {
- // The namespace is useful for resolving namespace aware
- // grammars such as XML schema. Let it take precedence over
- // the external identifier if one exists.
- if (namespaceURI != null) {
- resolvedId = resolveURI(namespaceURI);
- }
-
- if (!getUseLiteralSystemId() && baseURI != null) {
- // Attempt to resolve the system identifier against the base URI.
- try {
- URI uri = new URI(new URI(baseURI), systemId);
- systemId = uri.toString();
- }
- // Ignore the exception. Fallback to the literal system identifier.
- catch (URI.MalformedURIException ex) {}
- }
-
- // Resolve against an external identifier if one exists. This
- // is useful for resolving DTD external subsets and other
- // external entities. For XML schemas if there was no namespace
- // mapping we might be able to resolve a system identifier
- // specified as a location hint.
- if (resolvedId == null) {
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
- }
- }
- // Ignore IOException. It cannot be thrown from this method.
- catch (IOException ex) {}
-
- if (resolvedId != null) {
- return new DOMInputImpl(publicId, resolvedId, baseURI);
- }
- return null;
- }
-
-
- /**
- * <p>Resolves an external entity. If the entity cannot be
- * resolved, this method should return <code>null</code>. This
- * method only calls <code>resolveIdentifier</code> and returns
- * an input source if an entry was found in the catalog. It
- * should be overrided if other behaviour is required.</p>
- *
- * @param resourceIdentifier location of the XML resource to resolve
- *
- * @throws XNIException thrown on general error
- * @throws IOException thrown if some i/o error occurs
- */
- public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
- throws XNIException, IOException {
-
- String resolvedId = resolveIdentifier(resourceIdentifier);
- if (resolvedId != null) {
- return new XMLInputSource(resourceIdentifier.getPublicId(),
- resolvedId, resourceIdentifier.getBaseSystemId(), false);
- }
- return null;
- }
-
- /**
- * <p>Resolves an identifier using the catalog. This method interprets that
- * the namespace of the identifier corresponds to uri entries in the catalog.
- * Where both a namespace and an external identifier exist, the namespace
- * takes precedence.</p>
- *
- * @param resourceIdentifier the identifier to resolve
- *
- * @throws XNIException thrown on general error
- * @throws IOException thrown if some i/o error occurs
- */
- public String resolveIdentifier(XMLResourceIdentifier resourceIdentifier)
- throws IOException, XNIException {
-
- String resolvedId = null;
-
- // The namespace is useful for resolving namespace aware
- // grammars such as XML schema. Let it take precedence over
- // the external identifier if one exists.
- String namespace = resourceIdentifier.getNamespace();
- if (namespace != null) {
- resolvedId = resolveURI(namespace);
- }
-
- // Resolve against an external identifier if one exists. This
- // is useful for resolving DTD external subsets and other
- // external entities. For XML schemas if there was no namespace
- // mapping we might be able to resolve a system identifier
- // specified as a location hint.
- if (resolvedId == null) {
- String publicId = resourceIdentifier.getPublicId();
- String systemId = getUseLiteralSystemId()
- ? resourceIdentifier.getLiteralSystemId()
- : resourceIdentifier.getExpandedSystemId();
- if (publicId != null && systemId != null) {
- resolvedId = resolvePublic(publicId, systemId);
- }
- else if (systemId != null) {
- resolvedId = resolveSystem(systemId);
- }
- }
- return resolvedId;
- }
-
- /**
- * <p>Returns the URI mapping in the catalog for the given
- * external identifier or <code>null</code> if no mapping
- * exists. If the system identifier is an URN in the
- * <code>publicid</code> namespace it is converted into
- * a public identifier by URN "unwrapping" as specified
- * in the XML Catalogs specification.</p>
- *
- * @param systemId the system identifier to locate in the catalog
- *
- * @return the mapped URI or <code>null</code> if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveSystem (String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveSystem(systemId) : null;
- }
-
- /**
- * <p>Returns the URI mapping in the catalog for the given
- * external identifier or <code>null</code> if no mapping
- * exists. Public identifiers are normalized before
- * comparison.</p>
- *
- * @param publicId the public identifier to locate in the catalog
- * @param systemId the system identifier to locate in the catalog
- *
- * @return the mapped URI or <code>null</code> if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolvePublic (String publicId, String systemId)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolvePublic(publicId, systemId) : null;
- }
-
- /**
- * <p>Returns the URI mapping in the catalog for the given URI
- * reference or <code>null</code> if no mapping exists.
- * URI comparison is case sensitive. If the URI reference
- * is an URN in the <code>publicid</code> namespace
- * it is converted into a public identifier by URN "unwrapping"
- * as specified in the XML Catalogs specification and then
- * resolution is performed following the semantics of
- * external identifier resolution.</p>
- *
- * @param uri the URI to locate in the catalog
- *
- * @return the mapped URI or <code>null</code> if no mapping
- * was found in the catalog
- *
- * @throws IOException if an i/o error occurred while reading
- * the catalog
- */
- public final synchronized String resolveURI (String uri)
- throws IOException {
-
- if (fCatalogsChanged) {
- parseCatalogs();
- fCatalogsChanged = false;
- }
- return (fCatalog != null)
- ? fCatalog.resolveURI(uri) : null;
- }
-
- /**
- * Initialization. Create a CatalogManager and set all
- * the properties upfront. This prevents JVM wide system properties
- * or a property file somewhere in the environment from affecting
- * the behaviour of this catalog resolver.
- */
- private void init (String [] catalogs, boolean preferPublic) {
- fCatalogsList = (catalogs != null) ? (String[]) catalogs.clone() : null;
- fPreferPublic = preferPublic;
- fResolverCatalogManager = new CatalogManager();
- fResolverCatalogManager.setAllowOasisXMLCatalogPI(false);
- fResolverCatalogManager.setCatalogClassName("com.sun.org.apache.xml.internal.resolver.Catalog");
- fResolverCatalogManager.setCatalogFiles("");
- fResolverCatalogManager.setIgnoreMissingProperties(true);
- fResolverCatalogManager.setPreferPublic(fPreferPublic);
- fResolverCatalogManager.setRelativeCatalogs(false);
- fResolverCatalogManager.setUseStaticCatalog(false);
- fResolverCatalogManager.setVerbosity(0);
- }
-
- /**
- * Instruct the <code>Catalog</code> to parse each of the
- * catalogs in the list. Only the first catalog will actually be
- * parsed immediately. The others will be queued and read if
- * they are needed later.
- */
- private void parseCatalogs () throws IOException {
- if (fCatalogsList != null) {
- fCatalog = new Catalog(fResolverCatalogManager);
- attachReaderToCatalog(fCatalog);
- for (int i = 0; i < fCatalogsList.length; ++i) {
- String catalog = fCatalogsList[i];
- if (catalog != null && catalog.length() > 0) {
- fCatalog.parseCatalog(catalog);
- }
- }
- }
- else {
- fCatalog = null;
- }
- }
-
- /**
- * Attaches the reader to the catalog.
- */
- private void attachReaderToCatalog (Catalog catalog) {
-
- SAXParserFactory spf = new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
- catalog.addReader("application/xml", saxReader);
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Catalog.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2258 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
-import java.io.DataInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Vector;
-import javax.xml.parsers.SAXParserFactory;
-
-/**
- * Represents OASIS Open Catalog files.
- *
- * <p>This class implements the semantics of OASIS Open Catalog files
- * (defined by
- * <a href="http://www.oasis-open.org/html/a401.htm">OASIS Technical
- * Resolution 9401:1997 (Amendment 2 to TR 9401)</a>).</p>
- *
- * <p>The primary purpose of the Catalog is to associate resources in the
- * document with local system identifiers. Some entities
- * (document types, XML entities, and notations) have names and all of them
- * can have either public or system identifiers or both. (In XML, only a
- * notation can have a public identifier without a system identifier, but
- * the methods implemented in this class obey the Catalog semantics
- * from the SGML
- * days when system identifiers were optional.)</p>
- *
- * <p>The system identifiers returned by the resolution methods in this
- * class are valid, i.e. usable by, and in fact constructed by, the
- * <tt>java.net.URL</tt> class. Unfortunately, this class seems to behave in
- * somewhat non-standard ways and the system identifiers returned may
- * not be directly usable in a browser or filesystem context.
- *
- * <p>This class recognizes all of the Catalog entries defined in
- * TR9401:1997:</p>
- *
- * <ul>
- * <li><b>BASE</b>
- * changes the base URI for resolving relative system identifiers. The
- * initial base URI is the URI of the location of the catalog (which is,
- * in turn, relative to the location of the current working directory
- * at startup, as returned by the <tt>user.dir</tt> system property).</li>
- * <li><b>CATALOG</b>
- * processes other catalog files. An included catalog occurs logically
- * at the end of the including catalog.</li>
- * <li><b>DELEGATE_PUBLIC</b>
- * specifies alternate catalogs for some public identifiers. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.</li>
- * <li><b>DELEGATE_SYSTEM</b>
- * specifies alternate catalogs for some system identifiers. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.</li>
- * <li><b>DELEGATE_URI</b>
- * specifies alternate catalogs for some URIs. The delegated
- * catalogs are not loaded until they are needed, but they are cached
- * once loaded.</li>
- * <li><b>REWRITE_SYSTEM</b>
- * specifies alternate prefix for a system identifier.</li>
- * <li><b>REWRITE_URI</b>
- * specifies alternate prefix for a URI.</li>
- * <li><b>SYSTEM_SUFFIX</b>
- * maps any system identifier that ends with a particular suffix to another
- * system identifier.</li>
- * <li><b>URI_SUFFIX</b>
- * maps any URI that ends with a particular suffix to another URI.</li>
- * <li><b>DOCTYPE</b>
- * associates the names of root elements with URIs. (In other words, an XML
- * processor might infer the doctype of an XML document that does not include
- * a doctype declaration by looking for the DOCTYPE entry in the
- * catalog which matches the name of the root element of the document.)</li>
- * <li><b>DOCUMENT</b>
- * provides a default document.</li>
- * <li><b>DTDDECL</b>
- * recognized and silently ignored. Not relevant for XML.</li>
- * <li><b>ENTITY</b>
- * associates entity names with URIs.</li>
- * <li><b>LINKTYPE</b>
- * recognized and silently ignored. Not relevant for XML.</li>
- * <li><b>NOTATION</b>
- * associates notation names with URIs.</li>
- * <li><b>OVERRIDE</b>
- * changes the override behavior. Initial behavior is set by the
- * system property <tt>xml.catalog.override</tt>. The default initial
- * behavior is 'YES', that is, entries in the catalog override
- * system identifiers specified in the document.</li>
- * <li><b>PUBLIC</b>
- * maps a public identifier to a system identifier.</li>
- * <li><b>SGMLDECL</b>
- * recognized and silently ignored. Not relevant for XML.</li>
- * <li><b>SYSTEM</b>
- * maps a system identifier to another system identifier.</li>
- * <li><b>URI</b>
- * maps a URI to another URI.</li>
- * </ul>
- *
- * <p>Note that BASE entries are treated as described by RFC2396. In
- * particular, this has the counter-intuitive property that after a BASE
- * entry identifing "http://example.com/a/b/c" as the base URI,
- * the relative URI "foo" is resolved to the absolute URI
- * "http://example.com/a/b/foo". You must provide the trailing slash if
- * you do not want the final component of the path to be discarded as a
- * filename would in a URI for a resource: "http://example.com/a/b/c/".
- * </p>
- *
- * <p>Note that subordinate catalogs (all catalogs except the first,
- * including CATALOG and DELEGATE* catalogs) are only loaded if and when
- * they are required.</p>
- *
- * <p>This class relies on classes which implement the CatalogReader
- * interface to actually load catalog files. This allows the catalog
- * semantics to be implemented for TR9401 text-based catalogs, XML
- * catalogs, or any number of other storage formats.</p>
- *
- * <p>Additional catalogs may also be loaded with the
- * {@link #parseCatalog} method.</p>
- *
- * <p><b>Change Log:</b></p>
- * <dl>
- * <dt>2.0</dt>
- * <dd><p>Rewrite to use CatalogReaders.</p></dd>
- * <dt>1.1</dt>
- * <dd><p>Allow quoted components in <tt>xml.catalog.files</tt>
- * so that URLs containing colons can be used on Unix.
- * The string passed to <tt>xml.catalog.files</tt> can now have the form:</p>
- * <pre>
- * unquoted-path-with-no-sep-chars:"double-quoted path with or without sep chars":'single-quoted path with or without sep chars'
- * </pre>
- * <p>(Where ":" is the separater character in this example.)</p>
- * <p>If an unquoted path contains an embedded double or single quote
- * character, no special processig is performed on that character. No
- * path can contain separater characters, double, and single quotes
- * simultaneously.</p>
- * <p>Fix bug in calculation of BASE entries: if
- * a catalog contains multiple BASE entries, each is relative to the preceding
- * base, not the default base URI of the catalog.</p>
- * </dd>
- * <dt>1.0.1</dt>
- * <dd><p>Fixed a bug in the calculation of the list of subordinate catalogs.
- * This bug caused an infinite loop where parsing would alternately process
- * two catalogs indefinitely.</p>
- * </dd>
- * </dl>
- *
- * @see CatalogReader
- * @see CatalogEntry
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- *
- * <p>Derived from public domain code originally published by Arbortext,
- * Inc.</p>
- */
-@Deprecated(since="9", forRemoval=true)
-public class Catalog {
- /** The BASE Catalog Entry type. */
- public static final int BASE = CatalogEntry.addEntryType("BASE", 1);
-
- /** The CATALOG Catalog Entry type. */
- public static final int CATALOG = CatalogEntry.addEntryType("CATALOG", 1);
-
- /** The DOCUMENT Catalog Entry type. */
- public static final int DOCUMENT = CatalogEntry.addEntryType("DOCUMENT", 1);
-
- /** The OVERRIDE Catalog Entry type. */
- public static final int OVERRIDE = CatalogEntry.addEntryType("OVERRIDE", 1);
-
- /** The SGMLDECL Catalog Entry type. */
- public static final int SGMLDECL = CatalogEntry.addEntryType("SGMLDECL", 1);
-
- /** The DELEGATE_PUBLIC Catalog Entry type. */
- public static final int DELEGATE_PUBLIC = CatalogEntry.addEntryType("DELEGATE_PUBLIC", 2);
-
- /** The DELEGATE_SYSTEM Catalog Entry type. */
- public static final int DELEGATE_SYSTEM = CatalogEntry.addEntryType("DELEGATE_SYSTEM", 2);
-
- /** The DELEGATE_URI Catalog Entry type. */
- public static final int DELEGATE_URI = CatalogEntry.addEntryType("DELEGATE_URI", 2);
-
- /** The DOCTYPE Catalog Entry type. */
- public static final int DOCTYPE = CatalogEntry.addEntryType("DOCTYPE", 2);
-
- /** The DTDDECL Catalog Entry type. */
- public static final int DTDDECL = CatalogEntry.addEntryType("DTDDECL", 2);
-
- /** The ENTITY Catalog Entry type. */
- public static final int ENTITY = CatalogEntry.addEntryType("ENTITY", 2);
-
- /** The LINKTYPE Catalog Entry type. */
- public static final int LINKTYPE = CatalogEntry.addEntryType("LINKTYPE", 2);
-
- /** The NOTATION Catalog Entry type. */
- public static final int NOTATION = CatalogEntry.addEntryType("NOTATION", 2);
-
- /** The PUBLIC Catalog Entry type. */
- public static final int PUBLIC = CatalogEntry.addEntryType("PUBLIC", 2);
-
- /** The SYSTEM Catalog Entry type. */
- public static final int SYSTEM = CatalogEntry.addEntryType("SYSTEM", 2);
-
- /** The URI Catalog Entry type. */
- public static final int URI = CatalogEntry.addEntryType("URI", 2);
-
- /** The REWRITE_SYSTEM Catalog Entry type. */
- public static final int REWRITE_SYSTEM = CatalogEntry.addEntryType("REWRITE_SYSTEM", 2);
-
- /** The REWRITE_URI Catalog Entry type. */
- public static final int REWRITE_URI = CatalogEntry.addEntryType("REWRITE_URI", 2);
- /** The SYSTEM_SUFFIX Catalog Entry type. */
- public static final int SYSTEM_SUFFIX = CatalogEntry.addEntryType("SYSTEM_SUFFIX", 2);
- /** The URI_SUFFIX Catalog Entry type. */
- public static final int URI_SUFFIX = CatalogEntry.addEntryType("URI_SUFFIX", 2);
-
- /**
- * The base URI for relative system identifiers in the catalog.
- * This may be changed by BASE entries in the catalog.
- */
- protected URL base;
-
- /** The base URI of the Catalog file currently being parsed. */
- protected URL catalogCwd;
-
- /** The catalog entries currently known to the system. */
- protected Vector catalogEntries = new Vector();
-
- /** The default initial override setting. */
- protected boolean default_override = true;
-
- /** The catalog manager in use for this instance. */
- protected CatalogManager catalogManager = CatalogManager.getStaticManager();
-
- /**
- * A vector of catalog files to be loaded.
- *
- * <p>This list is initially established by
- * <code>loadSystemCatalogs</code> when
- * it parses the system catalog list, but CATALOG entries may
- * contribute to it during the course of parsing.</p>
- *
- * @see #loadSystemCatalogs
- * @see #localCatalogFiles
- */
- protected Vector catalogFiles = new Vector();
-
- /**
- * A vector of catalog files constructed during processing of
- * CATALOG entries in the current catalog.
- *
- * <p>This two-level system is actually necessary to correctly implement
- * the semantics of the CATALOG entry. If one catalog file includes
- * another with a CATALOG entry, the included catalog logically
- * occurs <i>at the end</i> of the including catalog, and after any
- * preceding CATALOG entries. In other words, the CATALOG entry
- * cannot insert anything into the middle of a catalog file.</p>
- *
- * <p>When processing reaches the end of each catalog files, any
- * elements on this vector are added to the front of the
- * <code>catalogFiles</code> vector.</p>
- *
- * @see #catalogFiles
- */
- protected Vector localCatalogFiles = new Vector();
-
- /**
- * A vector of Catalogs.
- *
- * <p>The semantics of Catalog resolution are such that each
- * catalog is effectively a list of Catalogs (in other words,
- * a recursive list of Catalog instances).</p>
- *
- * <p>Catalogs that are processed as the result of CATALOG or
- * DELEGATE* entries are subordinate to the catalog that contained
- * them, but they may in turn have subordinate catalogs.</p>
- *
- * <p>Catalogs are only loaded when they are needed, so this vector
- * initially contains a list of Catalog filenames (URLs). If, during
- * processing, one of these catalogs has to be loaded, the resulting
- * Catalog object is placed in the vector, effectively caching it
- * for the next query.</p>
- */
- protected Vector catalogs = new Vector();
-
- /**
- * A vector of DELEGATE* Catalog entries constructed during
- * processing of the Catalog.
- *
- * <p>This two-level system has two purposes; first, it allows
- * us to sort the DELEGATE* entries by the length of the partial
- * public identifier so that a linear search encounters them in
- * the correct order and second, it puts them all at the end of
- * the Catalog.</p>
- *
- * <p>When processing reaches the end of each catalog file, any
- * elements on this vector are added to the end of the
- * <code>catalogEntries</code> vector. This assures that matching
- * PUBLIC keywords are encountered before DELEGATE* entries.</p>
- */
- protected Vector localDelegate = new Vector();
-
- /**
- * A hash of CatalogReaders.
- *
- * <p>This hash maps MIME types to elements in the readerArr
- * vector. This allows the Catalog to quickly locate the reader
- * for a particular MIME type.</p>
- */
- protected Map<String, Integer> readerMap = new HashMap<>();
-
- /**
- * A vector of CatalogReaders.
- *
- * <p>This vector contains all of the readers in the order that they
- * were added. In the event that a catalog is read from a file, where
- * the MIME type is unknown, each reader is attempted in turn until
- * one succeeds.</p>
- */
- protected Vector readerArr = new Vector();
-
- /**
- * Constructs an empty Catalog.
- *
- * <p>The constructor interrogates the relevant system properties
- * using the default (static) CatalogManager
- * and initializes the catalog data structures.</p>
- */
- public Catalog() {
- // nop;
- }
-
- /**
- * Constructs an empty Catalog with a specific CatalogManager.
- *
- * <p>The constructor interrogates the relevant system properties
- * using the specified Catalog Manager
- * and initializes the catalog data structures.</p>
- */
- public Catalog(CatalogManager manager) {
- catalogManager = manager;
- }
-
- /**
- * Return the CatalogManager used by this catalog.
- *
- */
- public CatalogManager getCatalogManager() {
- return catalogManager;
- }
-
- /**
- * Establish the CatalogManager used by this catalog.
- *
- */
- public void setCatalogManager(CatalogManager manager) {
- catalogManager = manager;
- }
-
- /**
- * Setup readers.
- */
- public void setupReaders() {
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-
- saxReader.setCatalogParser(null, "XMLCatalog",
- "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
-
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
- "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
-
- addReader("application/xml", saxReader);
-
- TR9401CatalogReader textReader = new TR9401CatalogReader();
- addReader("text/plain", textReader);
- }
-
- /**
- * Add a new CatalogReader to the Catalog.
- *
- * <p>This method allows you to add a new CatalogReader to the
- * catalog. The reader will be associated with the specified mimeType.
- * You can only have one reader per mimeType.</p>
- *
- * <p>In the absence of a mimeType (e.g., when reading a catalog
- * directly from a file on the local system), the readers are attempted
- * in the order that you add them to the Catalog.</p>
- *
- * <p>Note that subordinate catalogs (created by CATALOG or
- * DELEGATE* entries) get a copy of the set of readers present in
- * the primary catalog when they are created. Readers added subsequently
- * will not be available. For this reason, it is best to add all
- * of the readers before the first call to parse a catalog.</p>
- *
- * @param mimeType The MIME type associated with this reader.
- * @param reader The CatalogReader to use.
- */
- public void addReader(String mimeType, CatalogReader reader) {
- if (readerMap.containsKey(mimeType)) {
- Integer pos = readerMap.get(mimeType);
- readerArr.set(pos, reader);
- } else {
- readerArr.add(reader);
- Integer pos = readerArr.size()-1;
- readerMap.put(mimeType, pos);
- }
- }
-
- /**
- * Copies the reader list from the current Catalog to a new Catalog.
- *
- * <p>This method is used internally when constructing a new catalog.
- * It copies the current reader associations over to the new catalog.
- * </p>
- *
- * @param newCatalog The new Catalog.
- */
- protected void copyReaders(Catalog newCatalog) {
- // Have to copy the readers in the right order...convert hash to arr
- Vector mapArr = new Vector(readerMap.size());
-
- // Pad the mapArr out to the right length
- for (int count = 0; count < readerMap.size(); count++) {
- mapArr.add(null);
- }
-
- for (Map.Entry<String, Integer> entry : readerMap.entrySet()) {
- mapArr.set(entry.getValue().intValue(), entry.getKey());
- }
-
- for (int count = 0; count < mapArr.size(); count++) {
- String mimeType = (String) mapArr.get(count);
- Integer pos = readerMap.get(mimeType);
- newCatalog.addReader(mimeType,
- (CatalogReader)
- readerArr.get(pos.intValue()));
- }
- }
-
- /**
- * Create a new Catalog object.
- *
- * <p>This method constructs a new instance of the running Catalog
- * class (which might be a subtype of com.sun.org.apache.xml.internal.resolver.Catalog).
- * All new catalogs are managed by the same CatalogManager.
- * </p>
- *
- * <p>N.B. All Catalog subtypes should call newCatalog() to construct
- * a new Catalog. Do not simply use "new Subclass()" since that will
- * confuse future subclasses.</p>
- */
- protected Catalog newCatalog() {
- String catalogClass = this.getClass().getName();
-
- try {
- Catalog c = (Catalog) (Class.forName(catalogClass).newInstance());
- c.setCatalogManager(catalogManager);
- copyReaders(c);
- return c;
- } catch (ClassNotFoundException cnfe) {
- catalogManager.debug.message(1, "Class Not Found Exception: " + catalogClass);
- } catch (IllegalAccessException iae) {
- catalogManager.debug.message(1, "Illegal Access Exception: " + catalogClass);
- } catch (InstantiationException ie) {
- catalogManager.debug.message(1, "Instantiation Exception: " + catalogClass);
- } catch (ClassCastException cce) {
- catalogManager.debug.message(1, "Class Cast Exception: " + catalogClass);
- } catch (Exception e) {
- catalogManager.debug.message(1, "Other Exception: " + catalogClass);
- }
-
- Catalog c = new Catalog();
- c.setCatalogManager(catalogManager);
- copyReaders(c);
- return c;
- }
-
- /**
- * Returns the current base URI.
- */
- public String getCurrentBase() {
- return base.toString();
- }
-
- /**
- * Returns the default override setting associated with this
- * catalog.
- *
- * <p>All catalog files loaded by this catalog will have the
- * initial override setting specified by this default.</p>
- */
- public String getDefaultOverride() {
- if (default_override) {
- return "yes";
- } else {
- return "no";
- }
- }
-
- /**
- * Load the system catalog files.
- *
- * <p>The method adds all of the
- * catalogs specified in the <tt>xml.catalog.files</tt> property
- * to the Catalog list.</p>
- *
- * @throws MalformedURLException One of the system catalogs is
- * identified with a filename that is not a valid URL.
- * @throws IOException One of the system catalogs cannot be read.
- */
- public void loadSystemCatalogs()
- throws MalformedURLException, IOException {
-
- Vector catalogs = catalogManager.getCatalogFiles();
- if (catalogs != null) {
- for (int count = 0; count < catalogs.size(); count++) {
- catalogFiles.addElement(catalogs.elementAt(count));
- }
- }
-
- if (catalogFiles.size() > 0) {
- // This is a little odd. The parseCatalog() method expects
- // a filename, but it adds that name to the end of the
- // catalogFiles vector, and then processes that vector.
- // This allows the system to handle CATALOG entries
- // correctly.
- //
- // In this init case, we take the last element off the
- // catalogFiles vector and pass it to parseCatalog. This
- // will "do the right thing" in the init case, and allow
- // parseCatalog() to do the right thing in the non-init
- // case. Honest.
- //
- String catfile = (String) catalogFiles.lastElement();
- catalogFiles.removeElement(catfile);
- parseCatalog(catfile);
- }
- }
-
- /**
- * Parse a catalog file, augmenting internal data structures.
- *
- * @param fileName The filename of the catalog file to process
- *
- * @throws MalformedURLException The fileName cannot be turned into
- * a valid URL.
- * @throws IOException Error reading catalog file.
- */
- public synchronized void parseCatalog(String fileName)
- throws MalformedURLException, IOException {
-
- default_override = catalogManager.getPreferPublic();
- catalogManager.debug.message(4, "Parse catalog: " + fileName);
-
- // Put the file into the list of catalogs to process...
- // In all cases except the case when initCatalog() is the
- // caller, this will be the only catalog initially in the list...
- catalogFiles.addElement(fileName);
-
- // Now process all the pending catalogs...
- parsePendingCatalogs();
- }
-
- /**
- * Parse a catalog file, augmenting internal data structures.
- *
- * <p>Catalogs retrieved over the net may have an associated MIME type.
- * The MIME type can be used to select an appropriate reader.</p>
- *
- * @param mimeType The MIME type of the catalog file.
- * @param is The InputStream from which the catalog should be read
- *
- * @throws CatalogException Failed to load catalog
- * mimeType.
- * @throws IOException Error reading catalog file.
- */
- public synchronized void parseCatalog(String mimeType, InputStream is)
- throws IOException, CatalogException {
-
- default_override = catalogManager.getPreferPublic();
- catalogManager.debug.message(4, "Parse " + mimeType + " catalog on input stream");
-
- CatalogReader reader = null;
-
- if (readerMap.containsKey(mimeType)) {
- int arrayPos = ((Integer) readerMap.get(mimeType)).intValue();
- reader = (CatalogReader) readerArr.get(arrayPos);
- }
-
- if (reader == null) {
- String msg = "No CatalogReader for MIME type: " + mimeType;
- catalogManager.debug.message(2, msg);
- throw new CatalogException(CatalogException.UNPARSEABLE, msg);
- }
-
- reader.readCatalog(this, is);
-
- // Now process all the pending catalogs...
- parsePendingCatalogs();
- }
-
- /**
- * Parse a catalog document, augmenting internal data structures.
- *
- * <p>This method supports catalog files stored in jar files: e.g.,
- * jar:file:///path/to/filename.jar!/path/to/catalog.xml". That URI
- * doesn't survive transmogrification through the URI processing that
- * the parseCatalog(String) performs and passing it as an input stream
- * doesn't set the base URI appropriately.</p>
- *
- * <p>Written by Stefan Wachter (2002-09-26)</p>
- *
- * @param aUrl The URL of the catalog document to process
- *
- * @throws IOException Error reading catalog file.
- */
- public synchronized void parseCatalog(URL aUrl) throws IOException {
- catalogCwd = aUrl;
- base = aUrl;
-
- default_override = catalogManager.getPreferPublic();
- catalogManager.debug.message(4, "Parse catalog: " + aUrl.toString());
-
- DataInputStream inStream = null;
- boolean parsed = false;
-
- for (int count = 0; !parsed && count < readerArr.size(); count++) {
- CatalogReader reader = (CatalogReader) readerArr.get(count);
-
- try {
- inStream = new DataInputStream(aUrl.openStream());
- } catch (FileNotFoundException fnfe) {
- // No catalog; give up!
- break;
- }
-
- try {
- reader.readCatalog(this, inStream);
- parsed=true;
- } catch (CatalogException ce) {
- if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
- // give up!
- break;
- } else {
- // try again!
- }
- }
-
- try {
- inStream.close();
- } catch (IOException e) {
- //nop
- }
- }
-
- if (parsed) parsePendingCatalogs();
- }
-
- /**
- * Parse all of the pending catalogs.
- *
- * <p>Catalogs may refer to other catalogs, this method parses
- * all of the currently pending catalog files.</p>
- */
- protected synchronized void parsePendingCatalogs()
- throws MalformedURLException, IOException {
-
- if (!localCatalogFiles.isEmpty()) {
- // Move all the localCatalogFiles into the front of
- // the catalogFiles queue
- Vector newQueue = new Vector();
- Enumeration q = localCatalogFiles.elements();
- while (q.hasMoreElements()) {
- newQueue.addElement(q.nextElement());
- }
-
- // Put the rest of the catalogs on the end of the new list
- for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
- String catfile = (String) catalogFiles.elementAt(curCat);
- newQueue.addElement(catfile);
- }
-
- catalogFiles = newQueue;
- localCatalogFiles.clear();
- }
-
- // Suppose there are no catalog files to process, but the
- // single catalog already parsed included some delegate
- // entries? Make sure they don't get lost.
- if (catalogFiles.isEmpty() && !localDelegate.isEmpty()) {
- Enumeration e = localDelegate.elements();
- while (e.hasMoreElements()) {
- catalogEntries.addElement(e.nextElement());
- }
- localDelegate.clear();
- }
-
- // Now process all the files on the catalogFiles vector. This
- // vector can grow during processing if CATALOG entries are
- // encountered in the catalog
- while (!catalogFiles.isEmpty()) {
- String catfile = (String) catalogFiles.elementAt(0);
- try {
- catalogFiles.remove(0);
- } catch (ArrayIndexOutOfBoundsException e) {
- // can't happen
- }
-
- if (catalogEntries.size() == 0 && catalogs.size() == 0) {
- // We haven't parsed any catalogs yet, let this
- // catalog be the first...
- try {
- parseCatalogFile(catfile);
- } catch (CatalogException ce) {
- System.out.println("FIXME: " + ce.toString());
- }
- } else {
- // This is a subordinate catalog. We save its name,
- // but don't bother to load it unless it's necessary.
- catalogs.addElement(catfile);
- }
-
- if (!localCatalogFiles.isEmpty()) {
- // Move all the localCatalogFiles into the front of
- // the catalogFiles queue
- Vector newQueue = new Vector();
- Enumeration q = localCatalogFiles.elements();
- while (q.hasMoreElements()) {
- newQueue.addElement(q.nextElement());
- }
-
- // Put the rest of the catalogs on the end of the new list
- for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
- catfile = (String) catalogFiles.elementAt(curCat);
- newQueue.addElement(catfile);
- }
-
- catalogFiles = newQueue;
- localCatalogFiles.clear();
- }
-
- if (!localDelegate.isEmpty()) {
- Enumeration e = localDelegate.elements();
- while (e.hasMoreElements()) {
- catalogEntries.addElement(e.nextElement());
- }
- localDelegate.clear();
- }
- }
-
- // We've parsed them all, reinit the vector...
- catalogFiles.clear();
- }
-
- /**
- * Parse a single catalog file, augmenting internal data structures.
- *
- * @param fileName The filename of the catalog file to process
- *
- * @throws MalformedURLException The fileName cannot be turned into
- * a valid URL.
- * @throws IOException Error reading catalog file.
- */
- protected synchronized void parseCatalogFile(String fileName)
- throws MalformedURLException, IOException, CatalogException {
-
- CatalogEntry entry;
-
- // The base-base is the cwd. If the catalog file is specified
- // with a relative path, this assures that it gets resolved
- // properly...
- try {
- // tack on a basename because URLs point to files not dirs
- catalogCwd = FileURL.makeURL("basename");
- } catch (MalformedURLException e) {
- catalogManager.debug.message(1, "Malformed URL on cwd", "user.dir");
- catalogCwd = null;
- }
-
- // The initial base URI is the location of the catalog file
- try {
- base = new URL(catalogCwd, fixSlashes(fileName));
- } catch (MalformedURLException e) {
- try {
- base = new URL("file:" + fixSlashes(fileName));
- } catch (MalformedURLException e2) {
- catalogManager.debug.message(1, "Malformed URL on catalog filename",
- fixSlashes(fileName));
- base = null;
- }
- }
-
- catalogManager.debug.message(2, "Loading catalog", fileName);
- catalogManager.debug.message(4, "Default BASE", base.toString());
-
- fileName = base.toString();
-
- DataInputStream inStream = null;
- boolean parsed = false;
- boolean notFound = false;
-
- for (int count = 0; !parsed && count < readerArr.size(); count++) {
- CatalogReader reader = (CatalogReader) readerArr.get(count);
-
- try {
- notFound = false;
- inStream = new DataInputStream(base.openStream());
- } catch (FileNotFoundException fnfe) {
- // No catalog; give up!
- notFound = true;
- break;
- }
-
- try {
- reader.readCatalog(this, inStream);
- parsed = true;
- } catch (CatalogException ce) {
- if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
- // give up!
- break;
- } else {
- // try again!
- }
- }
-
- try {
- inStream.close();
- } catch (IOException e) {
- //nop
- }
- }
-
- if (!parsed) {
- if (notFound) {
- catalogManager.debug.message(3, "Catalog does not exist", fileName);
- } else {
- catalogManager.debug.message(1, "Failed to parse catalog", fileName);
- }
- }
- }
-
- /**
- * Cleanup and process a Catalog entry.
- *
- * <p>This method processes each Catalog entry, changing mapped
- * relative system identifiers into absolute ones (based on the current
- * base URI), and maintaining other information about the current
- * catalog.</p>
- *
- * @param entry The CatalogEntry to process.
- */
- public void addEntry(CatalogEntry entry) {
- int type = entry.getEntryType();
-
- if (type == BASE) {
- String value = entry.getEntryArg(0);
- URL newbase = null;
-
- if (base == null) {
- catalogManager.debug.message(5, "BASE CUR", "null");
- } else {
- catalogManager.debug.message(5, "BASE CUR", base.toString());
- }
- catalogManager.debug.message(4, "BASE STR", value);
-
- try {
- value = fixSlashes(value);
- newbase = new URL(base, value);
- } catch (MalformedURLException e) {
- try {
- newbase = new URL("file:" + value);
- } catch (MalformedURLException e2) {
- catalogManager.debug.message(1, "Malformed URL on base", value);
- newbase = null;
- }
- }
-
- if (newbase != null) {
- base = newbase;
- }
-
- catalogManager.debug.message(5, "BASE NEW", base.toString());
- } else if (type == CATALOG) {
- String fsi = makeAbsolute(entry.getEntryArg(0));
-
- catalogManager.debug.message(4, "CATALOG", fsi);
-
- localCatalogFiles.addElement(fsi);
- } else if (type == PUBLIC) {
- String publicid = PublicId.normalize(entry.getEntryArg(0));
- String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, publicid);
- entry.setEntryArg(1, systemid);
-
- catalogManager.debug.message(4, "PUBLIC", publicid, systemid);
-
- catalogEntries.addElement(entry);
- } else if (type == SYSTEM) {
- String systemid = normalizeURI(entry.getEntryArg(0));
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "SYSTEM", systemid, fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == URI) {
- String uri = normalizeURI(entry.getEntryArg(0));
- String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(1, altURI);
-
- catalogManager.debug.message(4, "URI", uri, altURI);
-
- catalogEntries.addElement(entry);
- } else if (type == DOCUMENT) {
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
- entry.setEntryArg(0, fsi);
-
- catalogManager.debug.message(4, "DOCUMENT", fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == OVERRIDE) {
- catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0));
-
- catalogEntries.addElement(entry);
- } else if (type == SGMLDECL) {
- // meaningless in XML
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
- entry.setEntryArg(0, fsi);
-
- catalogManager.debug.message(4, "SGMLDECL", fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == DELEGATE_PUBLIC) {
- String ppi = PublicId.normalize(entry.getEntryArg(0));
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, ppi);
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi);
-
- addDelegate(entry);
- } else if (type == DELEGATE_SYSTEM) {
- String psi = normalizeURI(entry.getEntryArg(0));
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, psi);
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi);
-
- addDelegate(entry);
- } else if (type == DELEGATE_URI) {
- String pui = normalizeURI(entry.getEntryArg(0));
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, pui);
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi);
-
- addDelegate(entry);
- } else if (type == REWRITE_SYSTEM) {
- String psi = normalizeURI(entry.getEntryArg(0));
- String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, psi);
- entry.setEntryArg(1, rpx);
-
- catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx);
-
- catalogEntries.addElement(entry);
- } else if (type == REWRITE_URI) {
- String pui = normalizeURI(entry.getEntryArg(0));
- String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, pui);
- entry.setEntryArg(1, upx);
-
- catalogManager.debug.message(4, "REWRITE_URI", pui, upx);
-
- catalogEntries.addElement(entry);
- } else if (type == SYSTEM_SUFFIX) {
- String pui = normalizeURI(entry.getEntryArg(0));
- String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, pui);
- entry.setEntryArg(1, upx);
-
- catalogManager.debug.message(4, "SYSTEM_SUFFIX", pui, upx);
-
- catalogEntries.addElement(entry);
- } else if (type == URI_SUFFIX) {
- String pui = normalizeURI(entry.getEntryArg(0));
- String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(0, pui);
- entry.setEntryArg(1, upx);
-
- catalogManager.debug.message(4, "URI_SUFFIX", pui, upx);
-
- catalogEntries.addElement(entry);
- } else if (type == DOCTYPE) {
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == DTDDECL) {
- // meaningless in XML
- String fpi = PublicId.normalize(entry.getEntryArg(0));
- entry.setEntryArg(0, fpi);
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "DTDDECL", fpi, fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == ENTITY) {
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == LINKTYPE) {
- // meaningless in XML
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi);
-
- catalogEntries.addElement(entry);
- } else if (type == NOTATION) {
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi);
-
- catalogEntries.addElement(entry);
- } else {
- catalogEntries.addElement(entry);
- }
- }
-
- /**
- * Handle unknown CatalogEntry types.
- *
- * <p>This method exists to allow subclasses to deal with unknown
- * entry types.</p>
- */
- public void unknownEntry(Vector strings) {
- if (strings != null && strings.size() > 0) {
- String keyword = (String) strings.elementAt(0);
- catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword);
- }
- }
-
- /**
- * Parse all subordinate catalogs.
- *
- * <p>This method recursively parses all of the subordinate catalogs.
- * If this method does not throw an exception, you can be confident that
- * no subsequent call to any resolve*() method will either, with two
- * possible exceptions:</p>
- *
- * <ol>
- * <li><p>Delegated catalogs are re-parsed each time they are needed
- * (because a variable list of them may be needed in each case,
- * depending on the length of the matching partial public identifier).</p>
- * <p>But they are parsed by this method, so as long as they don't
- * change or disappear while the program is running, they shouldn't
- * generate errors later if they don't generate errors now.</p>
- * <li><p>If you add new catalogs with <code>parseCatalog</code>, they
- * won't be loaded until they are needed or until you call
- * <code>parseAllCatalogs</code> again.</p>
- * </ol>
- *
- * <p>On the other hand, if you don't call this method, you may
- * successfully parse documents without having to load all possible
- * catalogs.</p>
- *
- * @throws MalformedURLException The filename (URL) for a
- * subordinate or delegated catalog is not a valid URL.
- * @throws IOException Error reading some subordinate or delegated
- * catalog file.
- */
- public void parseAllCatalogs()
- throws MalformedURLException, IOException {
-
- // Parse all the subordinate catalogs
- for (int catPos = 0; catPos < catalogs.size(); catPos++) {
- Catalog c = null;
-
- try {
- c = (Catalog) catalogs.elementAt(catPos);
- } catch (ClassCastException e) {
- String catfile = (String) catalogs.elementAt(catPos);
- c = newCatalog();
-
- c.parseCatalog(catfile);
- catalogs.setElementAt(c, catPos);
- c.parseAllCatalogs();
- }
- }
-
- // Parse all the DELEGATE catalogs
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == DELEGATE_PUBLIC
- || e.getEntryType() == DELEGATE_SYSTEM
- || e.getEntryType() == DELEGATE_URI) {
- Catalog dcat = newCatalog();
- dcat.parseCatalog(e.getEntryArg(1));
- }
- }
- }
-
-
- /**
- * Return the applicable DOCTYPE system identifier.
- *
- * @param entityName The name of the entity (element) for which
- * a doctype is required.
- * @param publicId The nominal public identifier for the doctype
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the doctype
- * (as provided in the source document).
- *
- * @return The system identifier to use for the doctype.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveDoctype(String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
- String resolved = null;
-
- catalogManager.debug.message(3, "resolveDoctype("
- +entityName+","+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- if (systemId != null) {
- // If there's a SYSTEM entry in this catalog, use it
- resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- if (publicId != null) {
- // If there's a PUBLIC entry in this catalog, use it
- resolved = resolveLocalPublic(DOCTYPE,
- entityName,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a DOCTYPE entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == DOCTYPE
- && e.getEntryArg(0).equals(entityName)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(DOCTYPE,
- entityName,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable DOCUMENT entry.
- *
- * @return The system identifier to use for the doctype.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveDocument()
- throws MalformedURLException, IOException {
- // If there's a DOCUMENT entry, return it
-
- catalogManager.debug.message(3, "resolveDocument");
-
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == DOCUMENT) {
- return e.getEntryArg(0);
- }
- }
-
- return resolveSubordinateCatalogs(DOCUMENT,
- null, null, null);
- }
-
- /**
- * Return the applicable ENTITY system identifier.
- *
- * @param entityName The name of the entity for which
- * a system identifier is required.
- * @param publicId The nominal public identifier for the entity
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the entity
- * (as provided in the source document).
- *
- * @return The system identifier to use for the entity.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveEntity(String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
- String resolved = null;
-
- catalogManager.debug.message(3, "resolveEntity("
- +entityName+","+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- if (systemId != null) {
- // If there's a SYSTEM entry in this catalog, use it
- resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- if (publicId != null) {
- // If there's a PUBLIC entry in this catalog, use it
- resolved = resolveLocalPublic(ENTITY,
- entityName,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a ENTITY entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == ENTITY
- && e.getEntryArg(0).equals(entityName)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(ENTITY,
- entityName,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable NOTATION system identifier.
- *
- * @param notationName The name of the notation for which
- * a doctype is required.
- * @param publicId The nominal public identifier for the notation
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the notation
- * (as provided in the source document).
- *
- * @return The system identifier to use for the notation.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveNotation(String notationName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
- String resolved = null;
-
- catalogManager.debug.message(3, "resolveNotation("
- +notationName+","+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- if (systemId != null) {
- // If there's a SYSTEM entry in this catalog, use it
- resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- if (publicId != null) {
- // If there's a PUBLIC entry in this catalog, use it
- resolved = resolveLocalPublic(NOTATION,
- notationName,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a NOTATION entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == NOTATION
- && e.getEntryArg(0).equals(notationName)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(NOTATION,
- notationName,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable PUBLIC or SYSTEM identifier.
- *
- * <p>This method searches the Catalog and returns the system
- * identifier specified for the given system or
- * public identifiers. If
- * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * null is returned.</p>
- *
- * @param publicId The public identifier to locate in the catalog.
- * Public identifiers are normalized before comparison.
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- public String resolvePublic(String publicId, String systemId)
- throws MalformedURLException, IOException {
-
- catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (publicId != null && publicId.startsWith("urn:publicid:")) {
- publicId = PublicId.decodeURN(publicId);
- }
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- if (publicId != null && !publicId.equals(systemId)) {
- catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
- systemId = null;
- } else {
- publicId = systemId;
- systemId = null;
- }
- }
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a PUBLIC entry in this catalog, use it
- String resolved = resolveLocalPublic(PUBLIC,
- null,
- publicId,
- systemId);
- if (resolved != null) {
- return resolved;
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(PUBLIC,
- null,
- publicId,
- systemId);
- }
-
- /**
- * Return the applicable PUBLIC or SYSTEM identifier.
- *
- * <p>This method searches the Catalog and returns the system
- * identifier specified for the given system or public identifiers.
- * If no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * delegated Catalogs are interrogated.</p>
- *
- * <p>There are four possible cases:</p>
- *
- * <ul>
- * <li>If the system identifier provided matches a SYSTEM entry
- * in the current catalog, the SYSTEM entry is returned.
- * <li>If the system identifier is not null, the PUBLIC entries
- * that were encountered when OVERRIDE YES was in effect are
- * interrogated and the first matching entry is returned.</li>
- * <li>If the system identifier is null, then all of the PUBLIC
- * entries are interrogated and the first matching entry
- * is returned. This may not be the same as the preceding case, if
- * some PUBLIC entries are encountered when OVERRIDE NO is in effect. In
- * XML, the only place where a public identifier may occur without
- * a system identifier is in a notation declaration.</li>
- * <li>Finally, if the public identifier matches one of the partial
- * public identifiers specified in a DELEGATE* entry in
- * the Catalog, the delegated catalog is interrogated. The first
- * time that the delegated catalog is required, it will be
- * retrieved and parsed. It is subsequently cached.
- * </li>
- * </ul>
- *
- * @param entityType The CatalogEntry type for which this query is
- * being conducted. This is necessary in order to do the approprate
- * query on a delegated catalog.
- * @param entityName The name of the entity being searched for, if
- * appropriate.
- * @param publicId The public identifier of the entity in question.
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * delegated catalog cannot be turned into a valid URL.
- * @throws IOException Error reading delegated catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- protected synchronized String resolveLocalPublic(int entityType,
- String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
-
- // Always normalize the public identifier before attempting a match
- publicId = PublicId.normalize(publicId);
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // If there's a PUBLIC entry in this catalog, use it
- boolean over = default_override;
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == PUBLIC
- && e.getEntryArg(0).equals(publicId)) {
- if (over || systemId == null) {
- return e.getEntryArg(1);
- }
- }
- }
-
- // If there's a DELEGATE_PUBLIC entry in this catalog, use it
- over = default_override;
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == OVERRIDE) {
- over = e.getEntryArg(0).equalsIgnoreCase("YES");
- continue;
- }
-
- if (e.getEntryType() == DELEGATE_PUBLIC
- && (over || systemId == null)) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= publicId.length()
- && p.equals(publicId.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolvePublic(publicId, null);
- }
-
- // Nada!
- return null;
- }
-
- /**
- * Return the applicable SYSTEM system identifier.
- *
- * <p>If a SYSTEM entry exists in the Catalog
- * for the system ID specified, return the mapped value.</p>
- *
- * <p>On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive.</p>
- *
- * @param systemId The system ID to locate in the catalog.
- *
- * @return The resolved system identifier.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveSystem(String systemId)
- throws MalformedURLException, IOException {
-
- catalogManager.debug.message(3, "resolveSystem("+systemId+")");
-
- systemId = normalizeURI(systemId);
-
- if (systemId != null && systemId.startsWith("urn:publicid:")) {
- systemId = PublicId.decodeURN(systemId);
- return resolvePublic(systemId, null);
- }
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- String resolved = resolveLocalSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(SYSTEM,
- null,
- null,
- systemId);
- }
-
- /**
- * Return the applicable SYSTEM system identifier in this
- * catalog.
- *
- * <p>If a SYSTEM entry exists in the catalog file
- * for the system ID specified, return the mapped value.</p>
- *
- * @param systemId The system ID to locate in the catalog
- *
- * @return The mapped system identifier or null
- */
- protected String resolveLocalSystem(String systemId)
- throws MalformedURLException, IOException {
-
- String osname = SecuritySupport.getSystemProperty("os.name");
- boolean windows = (osname.indexOf("Windows") >= 0);
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == SYSTEM
- && (e.getEntryArg(0).equals(systemId)
- || (windows
- && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
- return e.getEntryArg(1);
- }
- }
-
- // If there's a REWRITE_SYSTEM entry in this catalog, use it
- en = catalogEntries.elements();
- String startString = null;
- String prefix = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == REWRITE_SYSTEM) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= systemId.length()
- && p.equals(systemId.substring(0, p.length()))) {
- // Is this the longest prefix?
- if (startString == null
- || p.length() > startString.length()) {
- startString = p;
- prefix = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (prefix != null) {
- // return the systemId with the new prefix
- return prefix + systemId.substring(startString.length());
- }
-
- // If there's a SYSTEM_SUFFIX entry in this catalog, use it
- en = catalogEntries.elements();
- String suffixString = null;
- String suffixURI = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == SYSTEM_SUFFIX) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= systemId.length()
- && systemId.endsWith(p)) {
- // Is this the longest prefix?
- if (suffixString == null
- || p.length() > suffixString.length()) {
- suffixString = p;
- suffixURI = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (suffixURI != null) {
- // return the systemId for the suffix
- return suffixURI;
- }
-
- // If there's a DELEGATE_SYSTEM entry in this catalog, use it
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == DELEGATE_SYSTEM) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= systemId.length()
- && p.equals(systemId.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolveSystem(systemId);
- }
-
- return null;
- }
-
- /**
- * Return the applicable URI.
- *
- * <p>If a URI entry exists in the Catalog
- * for the URI specified, return the mapped value.</p>
- *
- * <p>URI comparison is case sensitive.</p>
- *
- * @param uri The URI to locate in the catalog.
- *
- * @return The resolved URI.
- *
- * @throws MalformedURLException The system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveURI(String uri)
- throws MalformedURLException, IOException {
-
- catalogManager.debug.message(3, "resolveURI("+uri+")");
-
- uri = normalizeURI(uri);
-
- if (uri != null && uri.startsWith("urn:publicid:")) {
- uri = PublicId.decodeURN(uri);
- return resolvePublic(uri, null);
- }
-
- // If there's a URI entry in this catalog, use it
- if (uri != null) {
- String resolved = resolveLocalURI(uri);
- if (resolved != null) {
- return resolved;
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(URI,
- null,
- null,
- uri);
- }
-
- /**
- * Return the applicable URI in this catalog.
- *
- * <p>If a URI entry exists in the catalog file
- * for the URI specified, return the mapped value.</p>
- *
- * @param uri The URI to locate in the catalog
- *
- * @return The mapped URI or null
- */
- protected String resolveLocalURI(String uri)
- throws MalformedURLException, IOException {
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == URI
- && (e.getEntryArg(0).equals(uri))) {
- return e.getEntryArg(1);
- }
- }
-
- // If there's a REWRITE_URI entry in this catalog, use it
- en = catalogEntries.elements();
- String startString = null;
- String prefix = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == REWRITE_URI) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= uri.length()
- && p.equals(uri.substring(0, p.length()))) {
- // Is this the longest prefix?
- if (startString == null
- || p.length() > startString.length()) {
- startString = p;
- prefix = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (prefix != null) {
- // return the uri with the new prefix
- return prefix + uri.substring(startString.length());
- }
-
- // If there's a URI_SUFFIX entry in this catalog, use it
- en = catalogEntries.elements();
- String suffixString = null;
- String suffixURI = null;
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == URI_SUFFIX) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= uri.length()
- && uri.endsWith(p)) {
- // Is this the longest prefix?
- if (suffixString == null
- || p.length() > suffixString.length()) {
- suffixString = p;
- suffixURI = e.getEntryArg(1);
- }
- }
- }
- }
-
- if (suffixURI != null) {
- // return the uri for the suffix
- return suffixURI;
- }
-
- // If there's a DELEGATE_URI entry in this catalog, use it
- en = catalogEntries.elements();
- Vector delCats = new Vector();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
-
- if (e.getEntryType() == DELEGATE_URI) {
- String p = (String) e.getEntryArg(0);
- if (p.length() <= uri.length()
- && p.equals(uri.substring(0, p.length()))) {
- // delegate this match to the other catalog
-
- delCats.addElement(e.getEntryArg(1));
- }
- }
- }
-
- if (delCats.size() > 0) {
- Enumeration enCats = delCats.elements();
-
- if (catalogManager.debug.getDebug() > 1) {
- catalogManager.debug.message(2, "Switching to delegated catalog(s):");
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- catalogManager.debug.message(2, "\t" + delegatedCatalog);
- }
- }
-
- Catalog dcat = newCatalog();
-
- enCats = delCats.elements();
- while (enCats.hasMoreElements()) {
- String delegatedCatalog = (String) enCats.nextElement();
- dcat.parseCatalog(delegatedCatalog);
- }
-
- return dcat.resolveURI(uri);
- }
-
- return null;
- }
-
- /**
- * Search the subordinate catalogs, in order, looking for a match.
- *
- * <p>This method searches the Catalog and returns the system
- * identifier specified for the given entity type with the given
- * name, public, and system identifiers. In some contexts, these
- * may be null.</p>
- *
- * @param entityType The CatalogEntry type for which this query is
- * being conducted. This is necessary in order to do the approprate
- * query on a subordinate catalog.
- * @param entityName The name of the entity being searched for, if
- * appropriate.
- * @param publicId The public identifier of the entity in question
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document). This parameter is
- * overloaded for the URI entry type.
- *
- * @throws MalformedURLException The formal system identifier of a
- * delegated catalog cannot be turned into a valid URL.
- * @throws IOException Error reading delegated catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- protected synchronized String resolveSubordinateCatalogs(int entityType,
- String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
-
- for (int catPos = 0; catPos < catalogs.size(); catPos++) {
- Catalog c = null;
-
- try {
- c = (Catalog) catalogs.elementAt(catPos);
- } catch (ClassCastException e) {
- String catfile = (String) catalogs.elementAt(catPos);
- c = newCatalog();
-
- try {
- c.parseCatalog(catfile);
- } catch (MalformedURLException mue) {
- catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
- } catch (FileNotFoundException fnfe) {
- catalogManager.debug.message(1, "Failed to load catalog, file not found",
- catfile);
- } catch (IOException ioe) {
- catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
- }
-
- catalogs.setElementAt(c, catPos);
- }
-
- String resolved = null;
-
- // Ok, now what are we supposed to call here?
- if (entityType == DOCTYPE) {
- resolved = c.resolveDoctype(entityName,
- publicId,
- systemId);
- } else if (entityType == DOCUMENT) {
- resolved = c.resolveDocument();
- } else if (entityType == ENTITY) {
- resolved = c.resolveEntity(entityName,
- publicId,
- systemId);
- } else if (entityType == NOTATION) {
- resolved = c.resolveNotation(entityName,
- publicId,
- systemId);
- } else if (entityType == PUBLIC) {
- resolved = c.resolvePublic(publicId, systemId);
- } else if (entityType == SYSTEM) {
- resolved = c.resolveSystem(systemId);
- } else if (entityType == URI) {
- resolved = c.resolveURI(systemId);
- }
-
- if (resolved != null) {
- return resolved;
- }
- }
-
- return null;
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Replace backslashes with forward slashes. (URLs always use
- * forward slashes.)
- *
- * @param sysid The input system identifier.
- * @return The same system identifier with backslashes turned into
- * forward slashes.
- */
- protected String fixSlashes (String sysid) {
- return sysid.replace('\\', '/');
- }
-
- /**
- * Construct an absolute URI from a relative one, using the current
- * base URI.
- *
- * @param sysid The (possibly relative) system identifier
- * @return The system identifier made absolute with respect to the
- * current {@link #base}.
- */
- protected String makeAbsolute(String sysid) {
- URL local = null;
-
- sysid = fixSlashes(sysid);
-
- try {
- local = new URL(base, sysid);
- } catch (MalformedURLException e) {
- catalogManager.debug.message(1, "Malformed URL on system identifier", sysid);
- }
-
- if (local != null) {
- return local.toString();
- } else {
- return sysid;
- }
- }
-
-
- /**
- * Perform character normalization on a URI reference.
- *
- * @param uriref The URI reference
- * @return The normalized URI reference.
- */
- protected String normalizeURI(String uriref) {
- if (uriref == null) {
- return null;
- }
- final int length = uriref.length();
- for (int i = 0; i < length; ++i) {
- char c = uriref.charAt(i);
- if ((c <= 0x20) // ctrl
- || (c > 0x7F) // high ascii
- || (c == 0x22) // "
- || (c == 0x3C) // <
- || (c == 0x3E) // >
- || (c == 0x5C) // \
- || (c == 0x5E) // ^
- || (c == 0x60) // `
- || (c == 0x7B) // {
- || (c == 0x7C) // |
- || (c == 0x7D) // }
- || (c == 0x7F)) {
- return normalizeURI(uriref, i);
- }
- }
- return uriref;
- }
-
- /**
- * Perform character normalization on a URI reference.
- *
- * @param uriref The URI reference
- * @param index The index of the first character which requires escaping.
- * @return The normalized URI reference.
- */
- private String normalizeURI(String uriref, int index) {
- final StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < index; ++i) {
- buffer.append(uriref.charAt(i));
- }
- final byte[] bytes;
- try {
- bytes = uriref.substring(index).getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException uee) {
- // this can't happen
- catalogManager.debug.message(1, "UTF-8 is an unsupported encoding!?");
- return uriref;
- }
- for (int count = 0; count < bytes.length; ++count) {
- int ch = bytes[count] & 0xFF;
- if ((ch <= 0x20) // ctrl
- || (ch > 0x7F) // high ascii
- || (ch == 0x22) // "
- || (ch == 0x3C) // <
- || (ch == 0x3E) // >
- || (ch == 0x5C) // \
- || (ch == 0x5E) // ^
- || (ch == 0x60) // `
- || (ch == 0x7B) // {
- || (ch == 0x7C) // |
- || (ch == 0x7D) // }
- || (ch == 0x7F)) {
- writeEncodedByte(ch, buffer);
- }
- else {
- buffer.append((char) bytes[count]);
- }
- }
- return buffer.toString();
- }
-
- /**
- * Perform %-encoding on a single byte.
- *
- * @param b The 8-bit integer that represents the byte. (Bytes are signed
- * but encoding needs to look at the bytes unsigned.)
- * @return The %-encoded string for the byte in question.
- */
- protected String encodedByte(int b) {
- StringBuilder buffer = new StringBuilder(3);
- writeEncodedByte(b, buffer);
- return buffer.toString();
- }
-
- /**
- * Perform %-encoding on a single byte.
- *
- * @param b The 8-bit integer that represents the byte. (Bytes are signed
- * but encoding needs to look at the bytes unsigned.)
- * @param buffer The target for the %-encoded string for the byte in question.
- */
- private void writeEncodedByte(int b, StringBuilder buffer) {
- String hex = Integer.toHexString(b).toUpperCase(Locale.ENGLISH);
- if (hex.length() < 2) {
- buffer.append("%0");
- buffer.append(hex);
- }
- else {
- buffer.append('%');
- buffer.append(hex);
- }
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Add to the current list of delegated catalogs.
- *
- * <p>This method always constructs the {@link #localDelegate}
- * vector so that it is ordered by length of partial
- * public identifier.</p>
- *
- * @param entry The DELEGATE catalog entry
- */
- protected void addDelegate(CatalogEntry entry) {
- int pos = 0;
- String partial = entry.getEntryArg(0);
-
- Enumeration local = localDelegate.elements();
- while (local.hasMoreElements()) {
- CatalogEntry dpe = (CatalogEntry) local.nextElement();
- String dp = dpe.getEntryArg(0);
- if (dp.equals(partial)) {
- // we already have this prefix
- return;
- }
- if (dp.length() > partial.length()) {
- pos++;
- }
- if (dp.length() < partial.length()) {
- break;
- }
- }
-
- // now insert partial into the vector at [pos]
- if (localDelegate.size() == 0) {
- localDelegate.addElement(entry);
- } else {
- localDelegate.insertElementAt(entry, pos);
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogEntry.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import java.util.Map;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Represents a Catalog entry.
- *
- * <p>Instances of this class represent individual entries
- * in a Catalog.</p>
- *
- * <p>Each catalog entry has a unique name and is associated with
- * an arbitrary number of arguments (all strings). For example, the
- * TR9401 catalog entry "PUBLIC" has two arguments, a public identifier
- * and a system identifier. Each entry has a unique numeric type,
- * assigned automatically when the entry type is created.</p>
- *
- * <p>The number and type of catalog entries is maintained
- * <em>statically</em>. Catalog classes, or their subclasses, can add
- * new entry types, but all Catalog objects share the same global pool
- * of types.</p>
- *
- * <p>Initially there are no valid entries.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class CatalogEntry {
- /** The nextEntry is the ordinal number of the next entry type. */
- static AtomicInteger nextEntry = new AtomicInteger(0);
-
- /**
- * The entryTypes vector maps catalog entry names
- * (e.g., 'BASE' or 'SYSTEM') to their type (1, 2, etc.).
- * Names are case sensitive.
- */
- static final Map<String, Integer> entryTypes = new ConcurrentHashMap<>();
-
- /** The entryTypes vector maps catalog entry types to the
- number of arguments they're required to have. */
- static final Vector entryArgs = new Vector();
-
- /**
- * Adds a new catalog entry type.
- *
- * @param name The name of the catalog entry type. This must be
- * unique among all types and is case-sensitive. (Adding a duplicate
- * name effectively replaces the old type with the new type.)
- * @param numArgs The number of arguments that this entry type
- * is required to have. There is no provision for variable numbers
- * of arguments.
- * @return The type for the new entry.
- */
- static int addEntryType(String name, int numArgs) {
- final int index = nextEntry.getAndIncrement();
- entryTypes.put(name, index);
- entryArgs.add(index, numArgs);
-
- return index;
- }
-
- /**
- * Lookup an entry type
- *
- * @param name The name of the catalog entry type.
- * @return The type of the catalog entry with the specified name.
- * @throws InvalidCatalogEntryTypeException if no entry has the
- * specified name.
- */
- public static int getEntryType(String name)
- throws CatalogException {
- if (!entryTypes.containsKey(name)) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- Integer iType = entryTypes.get(name);
-
- if (iType == null) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- return iType;
- }
-
- /**
- * Find out how many arguments an entry is required to have.
- *
- * @param name The name of the catalog entry type.
- * @return The number of arguments that entry type is required to have.
- * @throws InvalidCatalogEntryTypeException if no entry has the
- * specified name.
- */
- public static int getEntryArgCount(String name)
- throws CatalogException {
- return getEntryArgCount(getEntryType(name));
- }
-
- /**
- * Find out how many arguments an entry is required to have.
- *
- * @param type A valid catalog entry type.
- * @return The number of arguments that entry type is required to have.
- * @throws InvalidCatalogEntryTypeException if the type is invalid.
- */
- public static int getEntryArgCount(int type)
- throws CatalogException {
- try {
- Integer iArgs = (Integer) entryArgs.get(type);
- return iArgs.intValue();
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
- }
-
- /** The entry type of this entry */
- protected int entryType = 0;
-
- /** The arguments associated with this entry */
- protected Vector args = null;
-
- /**
- * Null constructor; something for subclasses to call.
- */
- public CatalogEntry() {}
-
- /**
- * Construct a catalog entry of the specified type.
- *
- * @param name The name of the entry type
- * @param args A String Vector of arguments
- * @throws InvalidCatalogEntryTypeException if no such entry type
- * exists.
- * @throws InvalidCatalogEntryException if the wrong number of arguments
- * is passed.
- */
- public CatalogEntry(String name, Vector args)
- throws CatalogException {
- Integer iType = entryTypes.get(name);
-
- if (iType == null) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- int type = iType;
-
- try {
- Integer iArgs = (Integer) entryArgs.get(type);
- if (iArgs.intValue() != args.size()) {
- throw new CatalogException(CatalogException.INVALID_ENTRY);
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- entryType = type;
- this.args = args;
- }
-
- /**
- * Construct a catalog entry of the specified type.
- *
- * @param type The entry type
- * @param args A String Vector of arguments
- * @throws InvalidCatalogEntryTypeException if no such entry type
- * exists.
- * @throws InvalidCatalogEntryException if the wrong number of arguments
- * is passed.
- */
- public CatalogEntry(int type, Vector args)
- throws CatalogException {
- try {
- Integer iArgs = (Integer) entryArgs.get(type);
- if (iArgs.intValue() != args.size()) {
- throw new CatalogException(CatalogException.INVALID_ENTRY);
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new CatalogException(CatalogException.INVALID_ENTRY_TYPE);
- }
-
- entryType = type;
- this.args = args;
- }
-
- /**
- * Get the entry type.
- *
- * @return The entry type of the CatalogEntry
- */
- public int getEntryType() {
- return entryType;
- }
-
- /**
- * Get an entry argument.
- *
- * @param argNum The argument number (arguments are numbered from 0).
- * @return The specified argument or null if an invalid argNum is
- * provided.
- */
- public String getEntryArg(int argNum) {
- try {
- String arg = (String) args.get(argNum);
- return arg;
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
- /**
- * Set an entry argument.
- *
- * <p>Catalogs sometimes need to adjust the catlog entry parameters,
- * for example to make a relative URI absolute with respect to the
- * current base URI. But in general, this function should only be
- * called shortly after object creation to do some sort of cleanup.
- * Catalog entries should not mutate over time.</p>
- *
- * @param argNum The argument number (arguments are numbered from 0).
- * @throws ArrayIndexOutOfBoundsException if an invalid argument
- * number is provided.
- */
- public void setEntryArg(int argNum, String newspec)
- throws ArrayIndexOutOfBoundsException {
- args.set(argNum, newspec);
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogException.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-/**
- * Signal Catalog exception.
- *
- * <p>This exception is thrown if an error occurs loading a
- * catalog file.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class CatalogException extends Exception {
-
- private static final long serialVersionUID = 4007157171817798450L;
-
- /** A wrapper around another exception */
- public static final int WRAPPER = 1;
- /** An invalid entry */
- public static final int INVALID_ENTRY = 2;
- /** An invalid entry type */
- public static final int INVALID_ENTRY_TYPE = 3;
- /** Could not instantiate an XML parser */
- public static final int NO_XML_PARSER = 4;
- /** Unknown XML format */
- public static final int UNKNOWN_FORMAT = 5;
- /** Unparseable XML catalog (not XML)*/
- public static final int UNPARSEABLE = 6;
- /** XML but parse failed */
- public static final int PARSE_FAILED = 7;
- /** Text catalog ended in mid-comment */
- public static final int UNENDED_COMMENT = 8;
-
- /**
- * The embedded exception if tunnelling, or null.
- */
- private final Exception exception;
- private final int exceptionType;
-
- /**
- * Create a new CatalogException.
- *
- * @param type The exception type
- * @param message The error or warning message.
- */
- public CatalogException (int type, String message) {
- super(message);
- this.exceptionType = type;
- this.exception = null;
- }
-
- /**
- * Create a new CatalogException.
- *
- * @param type The exception type
- */
- public CatalogException (int type) {
- super("Catalog Exception " + type);
- this.exceptionType = type;
- this.exception = null;
- }
-
- /**
- * Create a new CatalogException wrapping an existing exception.
- *
- * <p>The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the CatalogException.</p>
- *
- * @param e The exception to be wrapped in a CatalogException.
- */
- public CatalogException (Exception e) {
- super();
- this.exceptionType = WRAPPER;
- this.exception = e;
- }
-
- /**
- * Create a new CatalogException from an existing exception.
- *
- * <p>The existing exception will be embedded in the new
- * one, but the new exception will have its own message.</p>
- *
- * @param message The detail message.
- * @param e The exception to be wrapped in a CatalogException.
- */
- public CatalogException (String message, Exception e) {
- super(message);
- this.exceptionType = WRAPPER;
- this.exception = e;
- }
-
- /**
- * Return a detail message for this exception.
- *
- * <p>If there is an embedded exception, and if the CatalogException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception.</p>
- *
- * @return The error or warning message.
- */
- public String getMessage ()
- {
- String message = super.getMessage();
-
- if (message == null && exception != null) {
- return exception.getMessage();
- } else {
- return message;
- }
- }
-
- /**
- * Return the embedded exception, if any.
- *
- * @return The embedded exception, or null if there is none.
- */
- public Exception getException ()
- {
- return exception;
- }
-
- /**
- * Return the exception type
- *
- * @return The exception type
- */
- public int getExceptionType ()
- {
- return exceptionType;
- }
-
- /**
- * Override toString to pick up any embedded exception.
- *
- * @return A string representation of this exception.
- */
- public String toString ()
- {
- if (exception != null) {
- return exception.toString();
- } else {
- return super.toString();
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/CatalogManager.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,870 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.resolver.helpers.BootstrapResolver;
-import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * CatalogManager provides an interface to the catalog properties.
- *
- * <p>Properties can come from two places: from system properties or
- * from a <i>CatalogManager.properties</i> file. This class provides a transparent
- * interface to both, with system properties preferred over property file values.</p>
- *
- * <p>The following table summarizes the properties:</p>
- *
- * <table border="1">
- * <thead>
- * <tr>
- * <td>System Property</td>
- * <td>CatalogManager.properties<br/>Property</td>
- * <td>Description</td>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
- * <td>xml.catalog.ignoreMissing</td>
- * <td> </td>
- * <td>If true, a missing <i>CatalogManager.properties</i> file or missing properties
- * within that file will not generate warning messages. See also the
- * <i>ignoreMissingProperties</i> method.</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.files</td>
- * <td>catalogs</td>
- * <td>The <emph>semicolon-delimited</emph> list of catalog files.</td>
- * </tr>
- *
- * <tr>
- * <td> </td>
- * <td>relative-catalogs</td>
- * <td>If false, relative catalog URIs are made absolute with respect to the base URI of
- * the <i>CatalogManager.properties</i> file. This setting only applies to catalog
- * URIs obtained from the <i>catalogs</i> property <emph>in the</emph>
- * <i>CatalogManager.properties</i> file</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.verbosity</td>
- * <td>verbosity</td>
- * <td>If non-zero, the Catalog classes will print informative and debugging messages.
- * The higher the number, the more messages.</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.prefer</td>
- * <td>prefer</td>
- * <td>Which identifier is preferred, "public" or "system"?</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.staticCatalog</td>
- * <td>static-catalog</td>
- * <td>Should a single catalog be constructed for all parsing, or should a different
- * catalog be created for each parser?</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.allowPI</td>
- * <td>allow-oasis-xml-catalog-pi</td>
- * <td>If the source document contains "oasis-xml-catalog" processing instructions,
- * should they be used?</td>
- * </tr>
- *
- * <tr>
- * <td>xml.catalog.className</td>
- * <td>catalog-class-name</td>
- * <td>If you're using the convenience classes
- * <tt>com.sun.org.apache.xml.internal.resolver.tools.*</tt>), this setting
- * allows you to specify an alternate class name to use for the underlying
- * catalog.</td>
- * </tr>
- * </tbody>
- * </table>
- *
- * @see Catalog
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogManager {
- private static final String pFiles = "xml.catalog.files";
- private static final String pVerbosity = "xml.catalog.verbosity";
- private static final String pPrefer = "xml.catalog.prefer";
- private static final String pStatic = "xml.catalog.staticCatalog";
- private static final String pAllowPI = "xml.catalog.allowPI";
- private static final String pClassname = "xml.catalog.className";
- private static final String pIgnoreMissing = "xml.catalog.ignoreMissing";
-
- /** A static CatalogManager instance for sharing */
- private static final CatalogManager staticManager = new CatalogManager();
-
- /** The bootstrap resolver to use when loading XML Catalogs. */
- private BootstrapResolver bResolver = new BootstrapResolver();
-
- /** Flag to ignore missing property files and/or properties */
- private boolean ignoreMissingProperties
- = (SecuritySupport.getSystemProperty(pIgnoreMissing) != null
- || SecuritySupport.getSystemProperty(pFiles) != null);
-
- /** Holds the resources after they are loaded from the file. */
- private ResourceBundle resources;
-
- /** The name of the CatalogManager properties file. */
- private String propertyFile = "CatalogManager.properties";
-
- /** The location of the propertyFile */
- private URL propertyFileURI = null;
-
- /** Default catalog files list. */
- private String defaultCatalogFiles = "./xcatalog";
-
- /** Current catalog files list. */
- private String catalogFiles = null;
-
- /** Did the catalogFiles come from the properties file? */
- private boolean fromPropertiesFile = false;
-
- /** Default verbosity level if there is no property setting for it. */
- private int defaultVerbosity = 1;
-
- /** Current verbosity level. */
- private Integer verbosity = null;
-
- /** Default preference setting. */
- private boolean defaultPreferPublic = true;
-
- /** Current preference setting. */
- private Boolean preferPublic = null;
-
- /** Default setting of the static catalog flag. */
- private boolean defaultUseStaticCatalog = true;
-
- /** Current setting of the static catalog flag. */
- private Boolean useStaticCatalog = null;
-
- /** The static catalog used by this manager. */
- private static volatile Catalog staticCatalog = null;
-
- /** Default setting of the oasisXMLCatalogPI flag. */
- private boolean defaultOasisXMLCatalogPI = true;
-
- /** Current setting of the oasisXMLCatalogPI flag. */
- private Boolean oasisXMLCatalogPI = null;
-
- /** Default setting of the relativeCatalogs flag. */
- private boolean defaultRelativeCatalogs = true;
-
- /** Current setting of the relativeCatalogs flag. */
- private Boolean relativeCatalogs = null;
-
- /** Current catalog class name. */
- private String catalogClassName = null;
- /**
- * Indicates whether implementation parts should use
- * service loader (or similar).
- * Note the default value (false) is the safe option..
- */
- private boolean useServicesMechanism;
-
- /** The manager's debug object. Used for printing debugging messages.
- *
- * <p>This field is public so that objects that have access to this
- * CatalogManager can use this debug object.</p>
- */
- public Debug debug = null;
-
- /** Constructor. */
- public CatalogManager() {
- init();
- }
-
- /** Constructor that specifies an explicit property file. */
- public CatalogManager(String propertyFile) {
- this.propertyFile = propertyFile;
- init();
- }
-
- private void init() {
- debug = new Debug();
- // Note that we don't setDebug() here; we do that lazily. Either the
- // user will set it explicitly, or we'll do it automagically if they
- // read from the propertyFile for some other reason. That way, there's
- // no attempt to read from the file before the caller has had a chance
- // to avoid it.
- if (System.getSecurityManager() == null) {
- useServicesMechanism = true;
- }
- // Make sure verbosity is set by xml.catalog.verbosity sysprop
- // setting, if defined.
- queryVerbosityFromSysProp();
- }
-
- /** Set the bootstrap resolver
- * @param resolver the bootstrap resolver
- */
- public void setBootstrapResolver(BootstrapResolver resolver) {
- bResolver = resolver;
- }
-
- /** Get the bootstrap resolver
- * @return the bootstrap resolver
- */
- public BootstrapResolver getBootstrapResolver() {
- return bResolver;
- }
-
- /** Query system property for verbosity level. */
- private void queryVerbosityFromSysProp() {
- String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
- if (verbStr != null) {
- try {
- int verb = Integer.parseInt(verbStr.trim());
- verbosity = new Integer(verb);
- debug.setDebug(verb);
- } catch (Exception e) {
- System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
- }
- }
- }
-
- /**
- * Load the properties from the propertyFile and build the
- * resources from it.
- */
- private synchronized void readProperties() {
- try {
- propertyFileURI = CatalogManager.class.getResource("/"+propertyFile);
- InputStream in =
- CatalogManager.class.getResourceAsStream("/"+propertyFile);
- if (in==null) {
- if (!ignoreMissingProperties) {
- System.err.println("Cannot find "+propertyFile);
- // there's no reason to give this warning more than once
- ignoreMissingProperties = true;
- }
- return;
- }
- resources = new PropertyResourceBundle(in);
- } catch (MissingResourceException mre) {
- if (!ignoreMissingProperties) {
- System.err.println("Cannot read "+propertyFile);
- }
- } catch (java.io.IOException e) {
- if (!ignoreMissingProperties) {
- System.err.println("Failure trying to read "+propertyFile);
- }
- }
-
- // This is a bit of a hack. After we've successfully read the properties,
- // use them to set the default debug level, if the user hasn't already set
- // the default debug level.
- if (verbosity == null) {
- try {
- String verbStr = resources.getString("verbosity");
- int verb = Integer.parseInt(verbStr.trim());
- debug.setDebug(verb);
- verbosity = new Integer(verb);
- } catch (Exception e) {
- // nop
- }
- }
- }
-
- /**
- * Allow access to the static CatalogManager
- */
- public static CatalogManager getStaticManager() {
- return staticManager;
- }
-
- /**
- * How are missing properties handled?
- *
- * <p>If true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * </p>
- */
- public boolean getIgnoreMissingProperties() {
- return ignoreMissingProperties;
- }
-
- /**
- * How should missing properties be handled?
- *
- * <p>If ignore is true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * </p>
- */
- public void setIgnoreMissingProperties(boolean ignore) {
- ignoreMissingProperties = ignore;
- }
-
- /**
- * How are missing properties handled?
- *
- * <p>If ignore is true, missing or unreadable property files will
- * not be reported. Otherwise, a message will be sent to System.err.
- * </p>
- *
- * @deprecated No longer static; use get/set methods.
- */
- public void ignoreMissingProperties(boolean ignore) {
- setIgnoreMissingProperties(ignore);
- }
-
- /**
- * Obtain the verbosity setting from the properties.
- *
- * @return The verbosity level from the propertyFile or the
- * defaultVerbosity.
- */
- private int queryVerbosity () {
- String defaultVerbStr = Integer.toString(defaultVerbosity);
-
- String verbStr = SecuritySupport.getSystemProperty(pVerbosity);
-
- if (verbStr == null) {
- if (resources==null) readProperties();
- if (resources != null) {
- try {
- verbStr = resources.getString("verbosity");
- } catch (MissingResourceException e) {
- verbStr = defaultVerbStr;
- }
- } else {
- verbStr = defaultVerbStr;
- }
- }
-
- int verb = defaultVerbosity;
-
- try {
- verb = Integer.parseInt(verbStr.trim());
- } catch (Exception e) {
- System.err.println("Cannot parse verbosity: \"" + verbStr + "\"");
- }
-
- // This is a bit of a hack. After we've successfully got the verbosity,
- // we have to use it to set the default debug level,
- // if the user hasn't already set the default debug level.
- if (verbosity == null) {
- debug.setDebug(verb);
- verbosity = new Integer(verb);
- }
-
- return verb;
- }
-
- /**
- * What is the current verbosity?
- */
- public int getVerbosity() {
- if (verbosity == null) {
- verbosity = new Integer(queryVerbosity());
- }
-
- return verbosity.intValue();
- }
-
- /**
- * Set the current verbosity.
- */
- public void setVerbosity (int verbosity) {
- this.verbosity = new Integer(verbosity);
- debug.setDebug(verbosity);
- }
-
- /**
- * What is the current verbosity?
- *
- * @deprecated No longer static; use get/set methods.
- */
- public int verbosity () {
- return getVerbosity();
- }
-
- /**
- * Obtain the relativeCatalogs setting from the properties.
- *
- * @return The relativeCatalogs setting from the propertyFile or the
- * defaultRelativeCatalogs.
- */
- private boolean queryRelativeCatalogs () {
- if (resources==null) readProperties();
-
- if (resources==null) return defaultRelativeCatalogs;
-
- try {
- String allow = resources.getString("relative-catalogs");
- return (allow.equalsIgnoreCase("true")
- || allow.equalsIgnoreCase("yes")
- || allow.equalsIgnoreCase("1"));
- } catch (MissingResourceException e) {
- return defaultRelativeCatalogs;
- }
- }
-
- /**
- * Get the relativeCatalogs setting.
- *
- * <p>This property is used when the catalogFiles property is
- * interrogated. If true, then relative catalog entry file names
- * are returned. If false, relative catalog entry file names are
- * made absolute with respect to the properties file before returning
- * them.</p>
- *
- * <p>This property <emph>only applies</emph> when the catalog files
- * come from a properties file. If they come from a system property or
- * the default list, they are never considered relative. (What would
- * they be relative to?)</p>
- *
- * <p>In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.</p>
- *
- * @return The relativeCatalogs setting from the propertyFile or the
- * defaultRelativeCatalogs.
- */
- public boolean getRelativeCatalogs () {
- if (relativeCatalogs == null) {
- relativeCatalogs = queryRelativeCatalogs() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- return relativeCatalogs.booleanValue();
- }
-
- /**
- * Set the relativeCatalogs setting.
- *
- * @see #getRelativeCatalogs()
- */
- public void setRelativeCatalogs (boolean relative) {
- relativeCatalogs = relative ? Boolean.TRUE : Boolean.FALSE;
- }
-
- /**
- * Get the relativeCatalogs setting.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean relativeCatalogs () {
- return getRelativeCatalogs();
- }
-
- /**
- * Obtain the list of catalog files from the properties.
- *
- * @return A semicolon delimited list of catlog file URIs
- */
- private String queryCatalogFiles () {
- String catalogList = SecuritySupport.getSystemProperty(pFiles);
- fromPropertiesFile = false;
-
- if (catalogList == null) {
- if (resources == null) readProperties();
- if (resources != null) {
- try {
- catalogList = resources.getString("catalogs");
- fromPropertiesFile = true;
- } catch (MissingResourceException e) {
- System.err.println(propertyFile + ": catalogs not found.");
- catalogList = null;
- }
- }
- }
-
- if (catalogList == null) {
- catalogList = defaultCatalogFiles;
- }
-
- return catalogList;
- }
-
- /**
- * Return the current list of catalog files.
- *
- * @return A vector of the catalog file names or null if no catalogs
- * are available in the properties.
- */
- public Vector getCatalogFiles() {
- if (catalogFiles == null) {
- catalogFiles = queryCatalogFiles();
- }
-
- StringTokenizer files = new StringTokenizer(catalogFiles, ";");
- Vector catalogs = new Vector();
- while (files.hasMoreTokens()) {
- String catalogFile = files.nextToken();
- URL absURI = null;
-
- if (fromPropertiesFile && !relativeCatalogs()) {
- try {
- absURI = new URL(propertyFileURI, catalogFile);
- catalogFile = absURI.toString();
- } catch (MalformedURLException mue) {
- absURI = null;
- }
- }
-
- catalogs.add(catalogFile);
- }
-
- return catalogs;
- }
-
- /**
- * Set the list of catalog files.
- */
- public void setCatalogFiles(String fileList) {
- catalogFiles = fileList;
- fromPropertiesFile = false;
- }
-
- /**
- * Return the current list of catalog files.
- *
- * @return A vector of the catalog file names or null if no catalogs
- * are available in the properties.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public Vector catalogFiles() {
- return getCatalogFiles();
- }
-
- /**
- * Obtain the preferPublic setting from the properties.
- *
- * <p>In the properties, a value of 'public' is true,
- * anything else is false.</p>
- *
- * @return True if prefer is public or the
- * defaultPreferSetting.
- */
- private boolean queryPreferPublic () {
- String prefer = SecuritySupport.getSystemProperty(pPrefer);
-
- if (prefer == null) {
- if (resources==null) readProperties();
- if (resources==null) return defaultPreferPublic;
- try {
- prefer = resources.getString("prefer");
- } catch (MissingResourceException e) {
- return defaultPreferPublic;
- }
- }
-
- if (prefer == null) {
- return defaultPreferPublic;
- }
-
- return (prefer.equalsIgnoreCase("public"));
- }
-
- /**
- * Return the current prefer public setting.
- *
- * @return True if public identifiers are preferred.
- */
- public boolean getPreferPublic () {
- if (preferPublic == null) {
- preferPublic = queryPreferPublic() ? Boolean.TRUE : Boolean.FALSE;
- }
- return preferPublic.booleanValue();
- }
-
- /**
- * Set the prefer public setting.
- */
- public void setPreferPublic (boolean preferPublic) {
- this.preferPublic = preferPublic ? Boolean.TRUE : Boolean.FALSE;
- }
-
- /**
- * Return the current prefer public setting.
- *
- * @return True if public identifiers are preferred.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean preferPublic () {
- return getPreferPublic();
- }
-
- /**
- * Obtain the static-catalog setting from the properties.
- *
- * <p>In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.</p>
- *
- * @return The static-catalog setting from the propertyFile or the
- * defaultUseStaticCatalog.
- */
- private boolean queryUseStaticCatalog () {
- String staticCatalog = SecuritySupport.getSystemProperty(pStatic);
-
- if (staticCatalog == null) {
- if (resources==null) readProperties();
- if (resources==null) return defaultUseStaticCatalog;
- try {
- staticCatalog = resources.getString("static-catalog");
- } catch (MissingResourceException e) {
- return defaultUseStaticCatalog;
- }
- }
-
- if (staticCatalog == null) {
- return defaultUseStaticCatalog;
- }
-
- return (staticCatalog.equalsIgnoreCase("true")
- || staticCatalog.equalsIgnoreCase("yes")
- || staticCatalog.equalsIgnoreCase("1"));
- }
-
- /**
- * Get the current use static catalog setting.
- */
- public boolean getUseStaticCatalog() {
- if (useStaticCatalog == null) {
- useStaticCatalog = queryUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- return useStaticCatalog.booleanValue();
- }
-
- /**
- * Set the use static catalog setting.
- */
- public void setUseStaticCatalog(boolean useStatic) {
- useStaticCatalog = useStatic ? Boolean.TRUE : Boolean.FALSE;
- }
-
- /**
- * Get the current use static catalog setting.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean staticCatalog() {
- return getUseStaticCatalog();
- }
-
- /**
- * Get a new catalog instance.
- *
- * This method always returns a new instance of the underlying catalog class.
- */
- public Catalog getPrivateCatalog() {
- Catalog catalog = staticCatalog;
-
- if (useStaticCatalog == null) {
- useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- if (catalog == null || !useStaticCatalog.booleanValue()) {
-
- try {
- String catalogClassName = getCatalogClassName();
-
- if (catalogClassName == null) {
- catalog = new Catalog();
- } else {
- try {
- catalog = (Catalog) ReflectUtil.forName(catalogClassName).newInstance();
- } catch (ClassNotFoundException cnfe) {
- debug.message(1,"Catalog class named '"
- + catalogClassName
- + "' could not be found. Using default.");
- catalog = new Catalog();
- } catch (ClassCastException cnfe) {
- debug.message(1,"Class named '"
- + catalogClassName
- + "' is not a Catalog. Using default.");
- catalog = new Catalog();
- }
- }
-
- catalog.setCatalogManager(this);
- catalog.setupReaders();
- catalog.loadSystemCatalogs();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- if (useStaticCatalog.booleanValue()) {
- staticCatalog = catalog;
- }
- }
-
- return catalog;
- }
-
- /**
- * Get a catalog instance.
- *
- * If this manager uses static catalogs, the same static catalog will
- * always be returned. Otherwise a new catalog will be returned.
- */
- public Catalog getCatalog() {
- Catalog catalog = staticCatalog;
-
- if (useStaticCatalog == null) {
- useStaticCatalog = getUseStaticCatalog() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- if (catalog == null || !useStaticCatalog.booleanValue()) {
- catalog = getPrivateCatalog();
- if (useStaticCatalog.booleanValue()) {
- staticCatalog = catalog;
- }
- }
-
- return catalog;
- }
-
- /**
- * <p>Obtain the oasisXMLCatalogPI setting from the properties.</p>
- *
- * <p>In the properties, a value of 'yes', 'true', or '1' is considered
- * true, anything else is false.</p>
- *
- * @return The oasisXMLCatalogPI setting from the propertyFile or the
- * defaultOasisXMLCatalogPI.
- */
- public boolean queryAllowOasisXMLCatalogPI () {
- String allow = SecuritySupport.getSystemProperty(pAllowPI);
-
- if (allow == null) {
- if (resources==null) readProperties();
- if (resources==null) return defaultOasisXMLCatalogPI;
- try {
- allow = resources.getString("allow-oasis-xml-catalog-pi");
- } catch (MissingResourceException e) {
- return defaultOasisXMLCatalogPI;
- }
- }
-
- if (allow == null) {
- return defaultOasisXMLCatalogPI;
- }
-
- return (allow.equalsIgnoreCase("true")
- || allow.equalsIgnoreCase("yes")
- || allow.equalsIgnoreCase("1"));
- }
-
- /**
- * Get the current XML Catalog PI setting.
- */
- public boolean getAllowOasisXMLCatalogPI () {
- if (oasisXMLCatalogPI == null) {
- oasisXMLCatalogPI = queryAllowOasisXMLCatalogPI() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- return oasisXMLCatalogPI.booleanValue();
- }
-
- public boolean useServicesMechanism() {
- return useServicesMechanism;
- }
- /**
- * Set the XML Catalog PI setting
- */
- public void setAllowOasisXMLCatalogPI(boolean allowPI) {
- oasisXMLCatalogPI = allowPI ? Boolean.TRUE : Boolean.FALSE;
- }
-
- /**
- * Get the current XML Catalog PI setting.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public boolean allowOasisXMLCatalogPI() {
- return getAllowOasisXMLCatalogPI();
- }
-
- /**
- * Obtain the Catalog class name setting from the properties.
- *
- */
- public String queryCatalogClassName () {
- String className = SecuritySupport.getSystemProperty(pClassname);
-
- if (className == null) {
- if (resources==null) readProperties();
- if (resources==null) return null;
- try {
- return resources.getString("catalog-class-name");
- } catch (MissingResourceException e) {
- return null;
- }
- }
-
- return className;
- }
-
- /**
- * Get the current Catalog class name.
- */
- public String getCatalogClassName() {
- if (catalogClassName == null) {
- catalogClassName = queryCatalogClassName();
- }
-
- return catalogClassName;
- }
-
- /**
- * Set the Catalog class name.
- */
- public void setCatalogClassName(String className) {
- catalogClassName = className;
- }
-
- /**
- * Get the current Catalog class name.
- *
- * @deprecated No longer static; use get/set methods.
- */
- public String catalogClassName() {
- return getCatalogClassName();
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/Resolver.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,697 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.FileNotFoundException;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.MalformedURLException;
-import javax.xml.parsers.SAXParserFactory;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
-import com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader;
-import com.sun.org.apache.xml.internal.resolver.readers.TR9401CatalogReader;
-
-/**
- * An extension to OASIS Open Catalog files, this class supports
- * suffix-based matching and an external RFC2483 resolver.
- *
- * @see Catalog
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class Resolver extends Catalog {
- /**
- * The URISUFFIX Catalog Entry type.
- *
- * <p>URI suffix entries match URIs that end in a specified suffix.</p>
- */
- public static final int URISUFFIX = CatalogEntry.addEntryType("URISUFFIX", 2);
-
- /**
- * The SYSTEMSUFFIX Catalog Entry type.
- *
- * <p>System suffix entries match system identifiers that end in a
- * specified suffix.</p>
- */
- public static final int SYSTEMSUFFIX = CatalogEntry.addEntryType("SYSTEMSUFFIX", 2);
-
- /**
- * The RESOLVER Catalog Entry type.
- *
- * <p>A hook for providing support for web-based backup resolvers.</p>
- */
- public static final int RESOLVER = CatalogEntry.addEntryType("RESOLVER", 1);
-
- /**
- * The SYSTEMREVERSE Catalog Entry type.
- *
- * <p>This is a bit of a hack. There's no actual SYSTEMREVERSE entry,
- * but this entry type is used to indicate that a reverse lookup is
- * being performed. (This allows the Resolver to implement
- * RFC2483 I2N and I2NS.)
- */
- public static final int SYSTEMREVERSE
- = CatalogEntry.addEntryType("SYSTEMREVERSE", 1);
-
- /**
- * Setup readers.
- */
- public void setupReaders() {
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- SAXCatalogReader saxReader = new SAXCatalogReader(spf);
-
- saxReader.setCatalogParser(null, "XCatalog",
- "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
-
- saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
- "catalog",
- "com.sun.org.apache.xml.internal.resolver.readers.ExtendedXMLCatalogReader");
-
- addReader("application/xml", saxReader);
-
- TR9401CatalogReader textReader = new TR9401CatalogReader();
- addReader("text/plain", textReader);
- }
-
- /**
- * Cleanup and process a Catalog entry.
- *
- * <p>This method processes each Catalog entry, changing mapped
- * relative system identifiers into absolute ones (based on the current
- * base URI), and maintaining other information about the current
- * catalog.</p>
- *
- * @param entry The CatalogEntry to process.
- */
- public void addEntry(CatalogEntry entry) {
- int type = entry.getEntryType();
-
- if (type == URISUFFIX) {
- String suffix = normalizeURI(entry.getEntryArg(0));
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "URISUFFIX", suffix, fsi);
- } else if (type == SYSTEMSUFFIX) {
- String suffix = normalizeURI(entry.getEntryArg(0));
- String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
-
- entry.setEntryArg(1, fsi);
-
- catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi);
- }
-
- super.addEntry(entry);
- }
-
- /**
- * Return the applicable URI.
- *
- * <p>If a URI entry exists in the Catalog
- * for the URI specified, return the mapped value.</p>
- *
- * <p>In the Resolver (as opposed to the Catalog) class, if the
- * URI isn't found by the usual algorithm, URISUFFIX entries are
- * considered.</p>
- *
- * <p>URI comparison is case sensitive.</p>
- *
- * @param uri The URI to locate in the catalog.
- *
- * @return The resolved URI.
- *
- * @throws MalformedURLException The system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveURI(String uri)
- throws MalformedURLException, IOException {
-
- String resolved = super.resolveURI(uri);
- if (resolved != null) {
- return resolved;
- }
-
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == RESOLVER) {
- resolved = resolveExternalSystem(uri, e.getEntryArg(0));
- if (resolved != null) {
- return resolved;
- }
- } else if (e.getEntryType() == URISUFFIX) {
- String suffix = e.getEntryArg(0);
- String result = e.getEntryArg(1);
-
- if (suffix.length() <= uri.length()
- && uri.substring(uri.length()-suffix.length()).equals(suffix)) {
- return result;
- }
- }
- }
-
- // Otherwise, look in the subordinate catalogs
- return resolveSubordinateCatalogs(Catalog.URI,
- null,
- null,
- uri);
- }
-
- /**
- * Return the applicable SYSTEM system identifier, resorting
- * to external RESOLVERs if necessary.
- *
- * <p>If a SYSTEM entry exists in the Catalog
- * for the system ID specified, return the mapped value.</p>
- *
- * <p>In the Resolver (as opposed to the Catalog) class, if the
- * URI isn't found by the usual algorithm, SYSTEMSUFFIX entries are
- * considered.</p>
- *
- * <p>On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive.</p>
- *
- * @param systemId The system ID to locate in the catalog.
- *
- * @return The system identifier to use for systemId.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public String resolveSystem(String systemId)
- throws MalformedURLException, IOException {
-
- String resolved = super.resolveSystem(systemId);
- if (resolved != null) {
- return resolved;
- }
-
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == RESOLVER) {
- resolved = resolveExternalSystem(systemId, e.getEntryArg(0));
- if (resolved != null) {
- return resolved;
- }
- } else if (e.getEntryType() == SYSTEMSUFFIX) {
- String suffix = e.getEntryArg(0);
- String result = e.getEntryArg(1);
-
- if (suffix.length() <= systemId.length()
- && systemId.substring(systemId.length()-suffix.length()).equals(suffix)) {
- return result;
- }
- }
- }
-
- return resolveSubordinateCatalogs(Catalog.SYSTEM,
- null,
- null,
- systemId);
- }
-
- /**
- * Return the applicable PUBLIC or SYSTEM identifier, resorting
- * to external resolvers if necessary.
- *
- * <p>This method searches the Catalog and returns the system
- * identifier specified for the given system or
- * public identifiers. If
- * no appropriate PUBLIC or SYSTEM entry is found in the Catalog,
- * null is returned.</p>
- *
- * <p>Note that a system or public identifier in the current catalog
- * (or subordinate catalogs) will be used in preference to an
- * external resolver. Further, if a systemId is present, the external
- * resolver(s) will be queried for that before the publicId.</p>
- *
- * @param publicId The public identifier to locate in the catalog.
- * Public identifiers are normalized before comparison.
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- public String resolvePublic(String publicId, String systemId)
- throws MalformedURLException, IOException {
-
- String resolved = super.resolvePublic(publicId, systemId);
- if (resolved != null) {
- return resolved;
- }
-
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == RESOLVER) {
- if (systemId != null) {
- resolved = resolveExternalSystem(systemId,
- e.getEntryArg(0));
- if (resolved != null) {
- return resolved;
- }
- }
- resolved = resolveExternalPublic(publicId, e.getEntryArg(0));
- if (resolved != null) {
- return resolved;
- }
- }
- }
-
- return resolveSubordinateCatalogs(Catalog.PUBLIC,
- null,
- publicId,
- systemId);
- }
-
- /**
- * Query an external RFC2483 resolver for a system identifier.
- *
- * @param systemId The system ID to locate.
- * @param resolver The name of the resolver to use.
- *
- * @return The system identifier to use for the systemId.
- */
- protected String resolveExternalSystem(String systemId, String resolver)
- throws MalformedURLException, IOException {
- Resolver r = queryResolver(resolver, "i2l", systemId, null);
- if (r != null) {
- return r.resolveSystem(systemId);
- } else {
- return null;
- }
- }
-
- /**
- * Query an external RFC2483 resolver for a public identifier.
- *
- * @param publicId The system ID to locate.
- * @param resolver The name of the resolver to use.
- *
- * @return The system identifier to use for the systemId.
- */
- protected String resolveExternalPublic(String publicId, String resolver)
- throws MalformedURLException, IOException {
- Resolver r = queryResolver(resolver, "fpi2l", publicId, null);
- if (r != null) {
- return r.resolvePublic(publicId, null);
- } else {
- return null;
- }
- }
-
- /**
- * Query an external RFC2483 resolver.
- *
- * @param resolver The URL of the RFC2483 resolver.
- * @param command The command to send the resolver.
- * @param arg1 The first argument to the resolver.
- * @param arg2 The second argument to the resolver, usually null.
- *
- * @return The Resolver constructed.
- */
- protected Resolver queryResolver(String resolver,
- String command,
- String arg1,
- String arg2) {
- InputStream iStream = null;
- String RFC2483 = resolver + "?command=" + command
- + "&format=tr9401&uri=" + arg1
- + "&uri2=" + arg2;
- String line = null;
-
- try {
- URL url = new URL(RFC2483);
-
- URLConnection urlCon = url.openConnection();
-
- urlCon.setUseCaches(false);
-
- Resolver r = (Resolver) newCatalog();
-
- String cType = urlCon.getContentType();
-
- // I don't care about the character set or subtype
- if (cType.indexOf(";") > 0) {
- cType = cType.substring(0, cType.indexOf(";"));
- }
-
- r.parseCatalog(cType, urlCon.getInputStream());
-
- return r;
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.UNPARSEABLE) {
- catalogManager.debug.message(1, "Unparseable catalog: " + RFC2483);
- } else if (cex.getExceptionType()
- == CatalogException.UNKNOWN_FORMAT) {
- catalogManager.debug.message(1, "Unknown catalog format: " + RFC2483);
- }
- return null;
- } catch (MalformedURLException mue) {
- catalogManager.debug.message(1, "Malformed resolver URL: " + RFC2483);
- return null;
- } catch (IOException ie) {
- catalogManager.debug.message(1, "I/O Exception opening resolver: " + RFC2483);
- return null;
- }
- }
-
- /**
- * Append two vectors, returning the result.
- *
- * @param vec The first vector
- * @param appvec The vector to be appended
- * @return The vector vec, with appvec's elements appended to it
- */
- private Vector appendVector(Vector vec, Vector appvec) {
- if (appvec != null) {
- for (int count = 0; count < appvec.size(); count++) {
- vec.addElement(appvec.elementAt(count));
- }
- }
- return vec;
- }
-
- /**
- * Find the URNs for a given system identifier in all catalogs.
- *
- * @param systemId The system ID to locate.
- *
- * @return A vector of URNs that map to the systemId.
- */
- public Vector resolveAllSystemReverse(String systemId)
- throws MalformedURLException, IOException {
- Vector resolved = new Vector();
-
- // If there's a SYSTEM entry in this catalog, use it
- if (systemId != null) {
- Vector localResolved = resolveLocalSystemReverse(systemId);
- resolved = appendVector(resolved, localResolved);
- }
-
- // Otherwise, look in the subordinate catalogs
- Vector subResolved = resolveAllSubordinateCatalogs(SYSTEMREVERSE,
- null,
- null,
- systemId);
-
- return appendVector(resolved, subResolved);
- }
-
- /**
- * Find the URN for a given system identifier.
- *
- * @param systemId The system ID to locate.
- *
- * @return A (single) URN that maps to the systemId.
- */
- public String resolveSystemReverse(String systemId)
- throws MalformedURLException, IOException {
- Vector resolved = resolveAllSystemReverse(systemId);
- if (resolved != null && resolved.size() > 0) {
- return (String) resolved.elementAt(0);
- } else {
- return null;
- }
- }
-
- /**
- * Return the applicable SYSTEM system identifiers.
- *
- * <p>If one or more SYSTEM entries exists in the Catalog
- * for the system ID specified, return the mapped values.</p>
- *
- * <p>The caller is responsible for doing any necessary
- * normalization of the system identifier before calling
- * this method. For example, a relative system identifier in
- * a document might be converted to an absolute system identifier
- * before attempting to resolve it.</p>
- *
- * <p>Note that this function will force all subordinate catalogs
- * to be loaded.</p>
- *
- * <p>On Windows-based operating systems, the comparison between
- * the system identifier provided and the SYSTEM entries in the
- * Catalog is case-insensitive.</p>
- *
- * @param systemId The system ID to locate in the catalog.
- *
- * @return The system identifier to use for the notation.
- *
- * @throws MalformedURLException The formal system identifier of a
- * subordinate catalog cannot be turned into a valid URL.
- * @throws IOException Error reading subordinate catalog file.
- */
- public Vector resolveAllSystem(String systemId)
- throws MalformedURLException, IOException {
- Vector resolutions = new Vector();
-
- // If there are SYSTEM entries in this catalog, start with them
- if (systemId != null) {
- Vector localResolutions = resolveAllLocalSystem(systemId);
- resolutions = appendVector(resolutions, localResolutions);
- }
-
- // Then look in the subordinate catalogs
- Vector subResolutions = resolveAllSubordinateCatalogs(SYSTEM,
- null,
- null,
- systemId);
- resolutions = appendVector(resolutions, subResolutions);
-
- if (resolutions.size() > 0) {
- return resolutions;
- } else {
- return null;
- }
- }
-
- /**
- * Return all applicable SYSTEM system identifiers in this
- * catalog.
- *
- * <p>If one or more SYSTEM entries exists in the catalog file
- * for the system ID specified, return the mapped values.</p>
- *
- * @param systemId The system ID to locate in the catalog
- *
- * @return A vector of the mapped system identifiers or null
- */
- private Vector resolveAllLocalSystem(String systemId) {
- Vector map = new Vector();
- String osname = SecuritySupport.getSystemProperty("os.name");
- boolean windows = (osname.indexOf("Windows") >= 0);
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == SYSTEM
- && (e.getEntryArg(0).equals(systemId)
- || (windows
- && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
- map.addElement(e.getEntryArg(1));
- }
- }
- if (map.size() == 0) {
- return null;
- } else {
- return map;
- }
- }
-
- /**
- * Find the URNs for a given system identifier in the current catalog.
- *
- * @param systemId The system ID to locate.
- *
- * @return A vector of URNs that map to the systemId.
- */
- private Vector resolveLocalSystemReverse(String systemId) {
- Vector map = new Vector();
- String osname = SecuritySupport.getSystemProperty("os.name");
- boolean windows = (osname.indexOf("Windows") >= 0);
- Enumeration en = catalogEntries.elements();
- while (en.hasMoreElements()) {
- CatalogEntry e = (CatalogEntry) en.nextElement();
- if (e.getEntryType() == SYSTEM
- && (e.getEntryArg(1).equals(systemId)
- || (windows
- && e.getEntryArg(1).equalsIgnoreCase(systemId)))) {
- map.addElement(e.getEntryArg(0));
- }
- }
- if (map.size() == 0) {
- return null;
- } else {
- return map;
- }
- }
-
- /**
- * Search the subordinate catalogs, in order, looking for all
- * match.
- *
- * <p>This method searches the Catalog and returns all of the system
- * identifiers specified for the given entity type with the given
- * name, public, and system identifiers. In some contexts, these
- * may be null.</p>
- *
- * @param entityType The CatalogEntry type for which this query is
- * being conducted. This is necessary in order to do the approprate
- * query on a subordinate catalog.
- * @param entityName The name of the entity being searched for, if
- * appropriate.
- * @param publicId The public identifier of the entity in question
- * (as provided in the source document).
- * @param systemId The nominal system identifier for the entity
- * in question (as provided in the source document).
- *
- * @throws MalformedURLException The formal system identifier of a
- * delegated catalog cannot be turned into a valid URL.
- * @throws IOException Error reading delegated catalog file.
- *
- * @return The system identifier to use.
- * Note that the nominal system identifier is not returned if a
- * match is not found in the catalog, instead null is returned
- * to indicate that no match was found.
- */
- private synchronized Vector resolveAllSubordinateCatalogs(int entityType,
- String entityName,
- String publicId,
- String systemId)
- throws MalformedURLException, IOException {
-
- Vector resolutions = new Vector();
-
- for (int catPos = 0; catPos < catalogs.size(); catPos++) {
- Resolver c = null;
-
- try {
- c = (Resolver) catalogs.elementAt(catPos);
- } catch (ClassCastException e) {
- String catfile = (String) catalogs.elementAt(catPos);
- c = (Resolver) newCatalog();
-
- try {
- c.parseCatalog(catfile);
- } catch (MalformedURLException mue) {
- catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
- } catch (FileNotFoundException fnfe) {
- catalogManager.debug.message(1, "Failed to load catalog, file not found",
- catfile);
- } catch (IOException ioe) {
- catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
- }
-
- catalogs.setElementAt(c, catPos);
- }
-
- String resolved = null;
-
- // Ok, now what are we supposed to call here?
- if (entityType == DOCTYPE) {
- resolved = c.resolveDoctype(entityName,
- publicId,
- systemId);
- if (resolved != null) {
- // Only find one DOCTYPE resolution
- resolutions.addElement(resolved);
- return resolutions;
- }
- } else if (entityType == DOCUMENT) {
- resolved = c.resolveDocument();
- if (resolved != null) {
- // Only find one DOCUMENT resolution
- resolutions.addElement(resolved);
- return resolutions;
- }
- } else if (entityType == ENTITY) {
- resolved = c.resolveEntity(entityName,
- publicId,
- systemId);
- if (resolved != null) {
- // Only find one ENTITY resolution
- resolutions.addElement(resolved);
- return resolutions;
- }
- } else if (entityType == NOTATION) {
- resolved = c.resolveNotation(entityName,
- publicId,
- systemId);
- if (resolved != null) {
- // Only find one NOTATION resolution
- resolutions.addElement(resolved);
- return resolutions;
- }
- } else if (entityType == PUBLIC) {
- resolved = c.resolvePublic(publicId, systemId);
- if (resolved != null) {
- // Only find one PUBLIC resolution
- resolutions.addElement(resolved);
- return resolutions;
- }
- } else if (entityType == SYSTEM) {
- Vector localResolutions = c.resolveAllSystem(systemId);
- resolutions = appendVector(resolutions, localResolutions);
- break;
- } else if (entityType == SYSTEMREVERSE) {
- Vector localResolutions = c.resolveAllSystemReverse(systemId);
- resolutions = appendVector(resolutions, localResolutions);
- }
- }
-
- if (resolutions != null) {
- return resolutions;
- } else {
- return null;
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/BootstrapResolver.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.sax.SAXSource;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-/**
- * A simple bootstrapping resolver.
- *
- * <p>This class is used as the entity resolver when reading XML Catalogs.
- * It searches for the OASIS XML Catalog DTD, Relax NG Grammar and W3C XML Schema
- * as resources (e.g., in the resolver jar file).</p>
- *
- * <p>If you have your own DTDs or schemas, you can extend this class and
- * set the BootstrapResolver in your CatalogManager.</p>
- *
- * @see com.sun.org.apache.xml.internal.resolver.CatalogManager
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class BootstrapResolver implements EntityResolver, URIResolver {
- /** URI of the W3C XML Schema for OASIS XML Catalog files. */
- public static final String xmlCatalogXSD = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.xsd";
-
- /** URI of the RELAX NG Grammar for OASIS XML Catalog files. */
- public static final String xmlCatalogRNG = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.rng";
-
- /** Public identifier for OASIS XML Catalog files. */
- public static final String xmlCatalogPubId = "-//OASIS//DTD XML Catalogs V1.0//EN";
-
- /** System identifier for OASIS XML Catalog files. */
- public static final String xmlCatalogSysId = "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";
-
- /** Public identifier for legacy Apache XCatalog files. There is no official system identifier for XCatalog files. */
- public static final String xCatalogPubId = "-//DTD XCatalog//EN";
-
- /** Private hash used for public identifiers. */
- private final Map<String, String> publicMap = new HashMap<>();
-
- /** Private hash used for system identifiers. */
- private final Map<String, String> systemMap = new HashMap<>();
-
- /** Private hash used for URIs. */
- private final Map<String, String> uriMap = new HashMap<>();
-
- /** Constructor. */
- public BootstrapResolver() {
- URL url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.dtd");
- if (url != null) {
- publicMap.put(xmlCatalogPubId, url.toString());
- systemMap.put(xmlCatalogSysId, url.toString());
- }
-
- url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.rng");
- if (url != null) {
- uriMap.put(xmlCatalogRNG, url.toString());
- }
-
- url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/catalog.xsd");
- if (url != null) {
- uriMap.put(xmlCatalogXSD, url.toString());
- }
-
- url = this.getClass().getResource("/com/sun/org/apache/xml/internal/resolver/etc/xcatalog.dtd");
- if (url != null) {
- publicMap.put(xCatalogPubId, url.toString());
- }
- }
-
- /** SAX resolveEntity API. */
- public InputSource resolveEntity (String publicId, String systemId) {
- String resolved = null;
-
- if (systemId != null && systemMap.containsKey(systemId)) {
- resolved = systemMap.get(systemId);
- } else if (publicId != null && publicMap.containsKey(publicId)) {
- resolved = publicMap.get(publicId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- // FIXME: silently fail?
- return null;
- }
- }
-
- return null;
- }
-
- /** Transformer resolve API. */
- public Source resolve(String href, String base)
- throws TransformerException {
-
- String uri = href;
- String fragment = null;
- int hashPos = href.indexOf("#");
- if (hashPos >= 0) {
- uri = href.substring(0, hashPos);
- fragment = href.substring(hashPos+1);
- }
-
- String result = null;
- if (href != null && uriMap.containsKey(href)) {
- result = uriMap.get(href);
- }
-
- if (result == null) {
- try {
- URL url = null;
-
- if (base==null) {
- url = new URL(uri);
- result = url.toString();
- } else {
- URL baseURL = new URL(base);
- url = (href.length()==0 ? baseURL : new URL(baseURL, uri));
- result = url.toString();
- }
- } catch (java.net.MalformedURLException mue) {
- // try to make an absolute URI from the current base
- String absBase = makeAbsolute(base);
- if (!absBase.equals(base)) {
- // don't bother if the absBase isn't different!
- return resolve(href, absBase);
- } else {
- throw new TransformerException("Malformed URL "
- + href + "(base " + base + ")",
- mue);
- }
- }
- }
-
- SAXSource source = new SAXSource();
- source.setInputSource(new InputSource(result));
- return source;
- }
-
- /** Attempt to construct an absolute URI */
- private String makeAbsolute(String uri) {
- if (uri == null) {
- uri = "";
- }
-
- try {
- URL url = new URL(uri);
- return url.toString();
- } catch (MalformedURLException mue) {
- try {
- URL fileURL = FileURL.makeURL(uri);
- return fileURL.toString();
- } catch (MalformedURLException mue2) {
- // bail
- return uri;
- }
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Debug.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-/**
- * Static debugging/messaging class for Catalogs.
- *
- * <p>This class defines a set of static methods that can be called
- * to produce debugging messages. Messages have an associated "debug
- * level" and messages below the current setting are not displayed.</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class Debug {
- /** The internal debug level. */
- protected int debug = 0;
-
- /** Constructor */
- public Debug() {
- // nop
- }
-
- /** Set the debug level for future messages. */
- public void setDebug(int newDebug) {
- debug = newDebug;
- }
-
- /** Get the current debug level. */
- public int getDebug() {
- return debug;
- }
-
- /**
- * Print debug message (if the debug level is high enough).
- *
- * <p>Prints "the message"</p>
- *
- * @param level The debug level of this message. This message
- * will only be
- * displayed if the current debug level is at least equal to this
- * value.
- * @param message The text of the message.
- */
- public void message(int level, String message) {
- if (debug >= level) {
- System.out.println(message);
- }
- }
-
- /**
- * Print debug message (if the debug level is high enough).
- *
- * <p>Prints "the message: spec"</p>
- *
- * @param level The debug level of this message. This message
- * will only be
- * displayed if the current debug level is at least equal to this
- * value.
- * @param message The text of the message.
- * @param spec An argument to the message.
- */
- public void message(int level, String message, String spec) {
- if (debug >= level) {
- System.out.println(message + ": " + spec);
- }
- }
-
- /**
- * Print debug message (if the debug level is high enough).
- *
- * <p>Prints "the message: spec1" and "spec2" indented on the next line.</p>
- *
- * @param level The debug level of this message. This message
- * will only be
- * displayed if the current debug level is at least equal to this
- * value.
- * @param message The text of the message.
- * @param spec1 An argument to the message.
- * @param spec2 Another argument to the message.
- */
- public void message(int level, String message,
- String spec1, String spec2) {
- if (debug >= level) {
- System.out.println(message + ": " + spec1);
- System.out.println("\t" + spec2);
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.io.File;
-
-/**
- * Static method for dealing with file: URLs.
- *
- * <p>This class defines a static method that can be used to construct
- * an appropriate file: URL from parts. It's defined here so that it
- * can be reused throught the resolver.</p>
- *
- * <p>(Yes, I'd rather have called this class FileUR<b>I</b>, but
- * given that a jave.net.URL is returned, it seemed...even more
- * confusing.)</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public abstract class FileURL {
- protected FileURL() { }
-
- /**
- * Construct a file: URL for a path name.
- *
- * <p>URLs in the file: scheme can be constructed for paths on
- * the local file system. Several possibilities need to be considered:
- * </p>
- *
- * <ul>
- * <li>If the path does not begin with a slash, then it is assumed
- * to reside in the users current working directory
- * (System.getProperty("user.dir")).</li>
- * <li>On Windows machines, the current working directory uses
- * backslashes (\\, instead of /).</li>
- * <li>If the current working directory is "/", don't add an extra
- * slash before the base name.</li>
- * </ul>
- *
- * <p>This method is declared static so that other classes
- * can use it directly.</p>
- *
- * @param pathname The path name component for which to construct a URL.
- *
- * @return The appropriate file: URL.
- *
- * @throws MalformedURLException if the pathname can't be turned into
- * a proper URL.
- */
- public static URL makeURL(String pathname) throws MalformedURLException {
- /*if (pathname.startsWith("/")) {
- return new URL("file://" + pathname);
- }
-
- String userdir = System.getProperty("user.dir");
- userdir.replace('\\', '/');
-
- if (userdir.endsWith("/")) {
- return new URL("file:///" + userdir + pathname);
- } else {
- return new URL("file:///" + userdir + "/" + pathname);
- }
- */
- File file = new File(pathname);
- return file.toURI().toURL();
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/Namespaces.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-import org.w3c.dom.*;
-
-/**
- * Static Namespace query methods.
- *
- * <p>This class defines a set of static methods that can be called
- * to analyze the namespace properties of DOM nodes.</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class Namespaces {
- /**
- * Returns the "prefix" part of a QName or the empty string (not
- * null) if the name has no prefix.
- *
- * @param element The QName of an element.
- * @return The prefix part of the element name.
- */
- public static String getPrefix(Element element) {
- String name = element.getTagName();
- String prefix = "";
-
- final int indexOfColon = name.indexOf(':');
- if (indexOfColon > 0) {
- prefix = name.substring(0, indexOfColon);
- }
-
- return prefix;
- }
-
- /**
- * Returns the "localname" part of a QName, which is the whole
- * name if it has no prefix.
- *
- * @param element The QName of an element.
- * @return The local part of a QName.
- */
- public static String getLocalName(Element element) {
- String name = element.getTagName();
-
- final int indexOfColon = name.indexOf(':');
- if (indexOfColon > 0) {
- name = name.substring(indexOfColon + 1);
- }
-
- return name;
- }
-
- /**
- * Returns the namespace URI for the specified prefix at the
- * specified context node.
- *
- * @param node The context node.
- * @param prefix The prefix.
- * @return The namespace URI associated with the prefix, or
- * null if no namespace declaration exists for the prefix.
- */
- public static String getNamespaceURI(Node node, String prefix) {
- if (node == null || node.getNodeType() != Node.ELEMENT_NODE) {
- return null;
- }
-
- if (prefix.length() == 0) {
- if (((Element) node).hasAttribute("xmlns")) {
- return ((Element) node).getAttribute("xmlns");
- }
- } else {
- String nsattr = "xmlns:" + prefix;
- if (((Element) node).hasAttribute(nsattr)) {
- return ((Element) node).getAttribute(nsattr);
- }
- }
-
- return getNamespaceURI(node.getParentNode(), prefix);
- }
-
- /**
- * Returns the namespace URI for the namespace to which the
- * element belongs.
- *
- * @param element The element.
- * @return The namespace URI associated with the namespace of the
- * element, or null if no namespace declaration exists for it.
- */
- public static String getNamespaceURI(Element element) {
- String prefix = getPrefix(element);
- return getNamespaceURI(element, prefix);
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/helpers/PublicId.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.helpers;
-
-/**
- * Static methods for dealing with public identifiers.
- *
- * <p>This class defines a set of static methods that can be called
- * to handle public identifiers.</p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public abstract class PublicId {
-
- protected PublicId() {}
-
- /**
- * Normalize a public identifier.
- *
- * <p>Public identifiers must be normalized according to the following
- * rules before comparisons between them can be made:</p>
- *
- * <ul>
- * <li>Whitespace characters are normalized to spaces (e.g., line feeds,
- * tabs, etc. become spaces).</li>
- * <li>Leading and trailing whitespace is removed.</li>
- * <li>Multiple internal whitespaces are normalized to a single
- * space.</li>
- * </ul>
- *
- * <p>This method is declared static so that other classes
- * can use it directly.</p>
- *
- * @param publicId The unnormalized public identifier.
- *
- * @return The normalized identifier.
- */
- public static String normalize(String publicId) {
- String normal = publicId.replace('\t', ' ');
- normal = normal.replace('\r', ' ');
- normal = normal.replace('\n', ' ');
- normal = normal.trim();
-
- int pos;
-
- while ((pos = normal.indexOf(" ")) >= 0) {
- normal = normal.substring(0, pos) + normal.substring(pos+1);
- }
- return normal;
- }
-
- /**
- * Encode a public identifier as a "publicid" URN.
- *
- * <p>This method is declared static so that other classes
- * can use it directly.</p>
- *
- * @param publicId The unnormalized public identifier.
- *
- * @return The normalized identifier.
- */
- public static String encodeURN(String publicId) {
- String urn = PublicId.normalize(publicId);
-
- urn = PublicId.stringReplace(urn, "%", "%25");
- urn = PublicId.stringReplace(urn, ";", "%3B");
- urn = PublicId.stringReplace(urn, "'", "%27");
- urn = PublicId.stringReplace(urn, "?", "%3F");
- urn = PublicId.stringReplace(urn, "#", "%23");
- urn = PublicId.stringReplace(urn, "+", "%2B");
- urn = PublicId.stringReplace(urn, " ", "+");
- urn = PublicId.stringReplace(urn, "::", ";");
- urn = PublicId.stringReplace(urn, ":", "%3A");
- urn = PublicId.stringReplace(urn, "//", ":");
- urn = PublicId.stringReplace(urn, "/", "%2F");
-
- StringBuilder buffer = new StringBuilder(13 + urn.length());
- buffer.append("urn:publicid:");
- buffer.append(urn);
- return buffer.toString();
- }
-
- /**
- * Decode a "publicid" URN into a public identifier.
- *
- * <p>This method is declared static so that other classes
- * can use it directly.</p>
- *
- * @param urn The urn:publicid: URN
- *
- * @return The normalized identifier.
- */
- public static String decodeURN(String urn) {
- String publicId;
- if (urn.startsWith("urn:publicid:")) {
- publicId = urn.substring(13);
- }
- else {
- return urn;
- }
-
- final boolean hasEscape = (publicId.indexOf('%') >= 0);
- if (hasEscape) {
- publicId = PublicId.stringReplace(publicId, "%2F", "/");
- }
- publicId = PublicId.stringReplace(publicId, ":", "//");
- if (hasEscape) {
- publicId = PublicId.stringReplace(publicId, "%3A", ":");
- }
- publicId = PublicId.stringReplace(publicId, ";", "::");
- publicId = PublicId.stringReplace(publicId, "+", " ");
- if (hasEscape) {
- publicId = PublicId.stringReplace(publicId, "%2B", "+");
- publicId = PublicId.stringReplace(publicId, "%23", "#");
- publicId = PublicId.stringReplace(publicId, "%3F", "?");
- publicId = PublicId.stringReplace(publicId, "%27", "'");
- publicId = PublicId.stringReplace(publicId, "%3B", ";");
- publicId = PublicId.stringReplace(publicId, "%25", "%");
- }
-
- return publicId;
- }
-
- /**
- * Replace one string with another.
- */
- private static String stringReplace(String str,
- String oldStr,
- String newStr) {
- int pos = str.indexOf(oldStr);
- if (pos >= 0) {
- final StringBuilder buffer = new StringBuilder();
- final int oldStrLength = oldStr.length();
- int start = 0;
- do {
- for (int i = start; i < pos; ++i) {
- buffer.append(str.charAt(i));
- }
- buffer.append(newStr);
- start = pos + oldStrLength;
- pos = str.indexOf(oldStr, start);
- }
- while (pos >= 0);
- final int strLength = str.length();
- for (int i = start; i < strLength; ++i) {
- buffer.append(str.charAt(i));
- }
- return buffer.toString();
- }
- return str;
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/CatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-
-import java.io.InputStream;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-
-/**
- * The CatalogReader interface.
- *
- * <p>The Catalog class requires that classes implement this interface
- * in order to be used to read catalogs. Examples of CatalogReaders
- * include the TextCatalogReader, the SAXCatalogReader, and the
- * DOMCatalogReader.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public interface CatalogReader {
- /**
- * Read a catalog from a file.
- *
- * <p>This class reads a catalog from a URL.</p>
- *
- * @param catalog The catalog for which this reader is called.
- * @param fileUrl The URL of a document to be read.
- * @throws MalformedURLException if the specified URL cannot be
- * turned into a URL object.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed.)
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException, CatalogException;
-
- /**
- * Read a catalog from an input stream.
- *
- * <p>This class reads a catalog from an input stream.</p>
- *
- * @param catalog The catalog for which this reader is called.
- * @param is The input stream that is to be read.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed.)
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws IOException, CatalogException;
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogParser.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import org.w3c.dom.Node;
-
-/**
- * The DOMCatalogParser interface.
- *
- * <p>This interface must be implemented in order for a class to
- * participate as a parser for the DOMCatalogReader.
- *
- * @see Catalog
- * @see DOMCatalogReader
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public interface DOMCatalogParser {
- /**
- * Parse a DOM node as a catalog entry.
- *
- * <p>This method is expected to analyze the specified node and
- * construct appropriate catalog entry(ies) from it.</p>
- *
- * @param catalog The catalog for which this node is being considered.
- * @param node The DOM Node from the catalog.
- */
- public void parseCatalogEntry(Catalog catalog, Node node);
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/DOMCatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.helpers.Namespaces;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.w3c.dom.*;
-import org.xml.sax.SAXException;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * A DOM-based CatalogReader.
- *
- * <p>This class is used to read XML Catalogs using the DOM. This reader
- * has an advantage over the SAX-based reader that it can analyze the
- * DOM tree rather than simply a series of SAX events. It has the disadvantage
- * that it requires all of the code necessary to build and walk a DOM
- * tree.</p>
- *
- * <p>Since the choice of CatalogReaders (in the InputStream case) can only
- * be made on the basis of MIME type, the following problem occurs: only
- * one CatalogReader can exist for all XML mime types. In order to get
- * around this problem, the DOMCatalogReader relies on a set of external
- * CatalogParsers to actually build the catalog.</p>
- *
- * <p>The selection of CatalogParsers is made on the basis of the QName
- * of the root element of the document.</p>
- *
- *
- * @see Catalog
- * @see CatalogReader
- * @see SAXCatalogReader
- * @see TextCatalogReader
- * @see DOMCatalogParser
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class DOMCatalogReader implements CatalogReader {
- /**
- * Mapping table from QNames to CatalogParser classes.
- *
- * <p>Each key in this hash table has the form "elementname"
- * or "{namespaceuri}elementname". The former is used if the
- * namespace URI is null.</p>
- */
- protected Map<String, String> namespaceMap = new HashMap<>();
-
- /**
- * Add a new parser to the reader.
- *
- * <p>This method associates the specified parserClass with the
- * namespaceURI/rootElement names specified.</p>
- *
- * @param namespaceURI The namespace URI. <em>Not</em> the prefix.
- * @param rootElement The name of the root element.
- * @param parserClass The name of the parserClass to instantiate
- * for this kind of catalog.
- */
- public void setCatalogParser(String namespaceURI,
- String rootElement,
- String parserClass) {
- if (namespaceURI == null) {
- namespaceMap.put(rootElement, parserClass);
- } else {
- namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
- }
- }
-
- /**
- * Get the name of the parser class for a given catalog type.
- *
- * <p>This method returns the parserClass associated with the
- * namespaceURI/rootElement names specified.</p>
- *
- * @param namespaceURI The namespace URI. <em>Not</em> the prefix.
- * @param rootElement The name of the root element.
- * @return The parser class.
- */
- public String getCatalogParser(String namespaceURI,
- String rootElement) {
- if (namespaceURI == null) {
- return namespaceMap.get(rootElement);
- } else {
- return namespaceMap.get("{"+namespaceURI+"}"+rootElement);
- }
- }
-
- /**
- * Null constructor; something for subclasses to call.
- */
- public DOMCatalogReader() { }
-
- /**
- * Read a catalog from an input stream.
- *
- * <p>This class reads a catalog from an input stream:</p>
- *
- * <ul>
- * <li>Based on the QName of the root element, it determines which
- * parser to instantiate for this catalog.</li>
- * <li>It constructs a DOM Document from the catalog and</li>
- * <li>For each child of the root node, it calls the parser's
- * parseCatalogEntry method. This method is expected to make
- * appropriate calls back into the catalog to add entries for the
- * entries in the catalog. It is free to do this in whatever manner
- * is appropriate (perhaps using just the node passed in, perhaps
- * wandering arbitrarily throughout the tree).</li>
- * </ul>
- *
- * @param catalog The catalog for which this reader is called.
- * @param is The input stream that is to be read.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed or
- * if the parser class cannot be instantiated.)
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws IOException, CatalogException {
-
- DocumentBuilderFactory factory = null;
- DocumentBuilder builder = null;
-
- factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(false);
- factory.setValidating(false);
- try {
- builder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- Document doc = null;
-
- try {
- doc = builder.parse(is);
- } catch (SAXException se) {
- throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
- }
-
- Element root = doc.getDocumentElement();
-
- String namespaceURI = Namespaces.getNamespaceURI(root);
- String localName = Namespaces.getLocalName(root);
-
- String domParserClass = getCatalogParser(namespaceURI,
- localName);
-
- if (domParserClass == null) {
- if (namespaceURI == null) {
- catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
- + localName);
- } else {
- catalog.getCatalogManager().debug.message(1, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + localName);
- }
- return;
- }
-
- DOMCatalogParser domParser = null;
-
- try {
- domParser = (DOMCatalogParser) ReflectUtil.forName(domParserClass).newInstance();
- } catch (ClassNotFoundException cnfe) {
- catalog.getCatalogManager().debug.message(1, "Cannot load XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (InstantiationException ie) {
- catalog.getCatalogManager().debug.message(1, "Cannot instantiate XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (IllegalAccessException iae) {
- catalog.getCatalogManager().debug.message(1, "Cannot access XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (ClassCastException cce ) {
- catalog.getCatalogManager().debug.message(1, "Cannot cast XML Catalog Parser class", domParserClass);
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- Node node = root.getFirstChild();
- while (node != null) {
- domParser.parseCatalogEntry(catalog, node);
- node = node.getNextSibling();
- }
- }
-
- /**
- * Read the catalog behind the specified URL.
- *
- * @see #readCatalog(Catalog, InputStream)
- *
- * @param catalog The catalog for which we are reading.
- * @param fileUrl The URL of the document that should be read.
- *
- * @throws MalformedURLException if the specified URL cannot be
- * turned into a URL object.
- * @throws IOException if the URL cannot be read.
- * @throws UnknownCatalogFormatException if the catalog format is
- * not recognized.
- * @throws UnparseableCatalogException if the catalog cannot be parsed.
- * (For example, if it is supposed to be XML and isn't well-formed.)
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException, CatalogException {
- URL url = new URL(fileUrl);
- URLConnection urlCon = url.openConnection();
- readCatalog(catalog, urlCon.getInputStream());
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/ExtendedXMLCatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.Resolver;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-
-import org.xml.sax.*;
-import org.w3c.dom.*;
-
-/**
- * Parse Extended OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class ExtendedXMLCatalogReader extends OASISXMLCatalogReader {
- /** The namespace name of extended catalog elements */
- public static final String extendedNamespaceName = "http://nwalsh.com/xcatalog/1.0";
-
- /**
- * The SAX <code>startElement</code> method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- // Check before calling the super because super will report our
- // namespace as an extension namespace, but that doesn't count
- // for this element.
- boolean inExtension = inExtensionNamespace();
-
- super.startElement(namespaceURI, localName, qName, atts);
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null && extendedNamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an Extended XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.URISUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "suffix", "uri")) {
- entryType = Resolver.SYSTEMSUFFIX;
- entryArgs.add(atts.getValue("suffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("suffix"),
- atts.getValue("uri"));
- }
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- /** The SAX <code>endElement</code> method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- super.endElement(namespaceURI, localName, qName);
-
- // Check after popping the stack so we don't erroneously think we
- // are our own extension namespace...
- boolean inExtension = inExtensionNamespace();
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (namespaceURI != null
- && (extendedNamespaceName.equals(namespaceURI))
- && !inExtension) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/OASISXMLCatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,546 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-import java.util.Enumeration;
-import java.util.Stack;
-import java.util.Vector;
-import javax.xml.parsers.SAXParserFactory;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-/**
- * Parse OASIS Entity Resolution Technical Committee
- * XML Catalog files.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class OASISXMLCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
- /** The catalog object needs to be stored by the object so that
- * SAX callbacks can use it.
- */
- protected Catalog catalog = null;
-
- /** The namespace name of OASIS ERTC catalogs */
- public static final String namespaceName = "urn:oasis:names:tc:entity:xmlns:xml:catalog";
-
- /** The namespace name of OASIS ERTC TR9401 catalog extension */
- public static final String tr9401NamespaceName = "urn:oasis:names:tc:entity:xmlns:tr9401:catalog";
-
- protected Stack baseURIStack = new Stack();
- protected Stack overrideStack = new Stack();
- protected Stack namespaceStack = new Stack();
-
- /** Set the current catalog. */
- public void setCatalog (Catalog catalog) {
- this.catalog = catalog;
- debug = catalog.getCatalogManager().debug;
- }
-
- /** Get the current catalog. */
- public Catalog getCatalog () {
- return catalog;
- }
-
- /** Default constructor */
- public OASISXMLCatalogReader() {
- super();
- }
-
- /** Constructor allowing for providing custom SAX parser factory */
- public OASISXMLCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
- super(parserFactory);
- setCatalog(catalog);
- }
-
- /**
- * Are we in an extension namespace?
- *
- * @return true if the current stack of open namespaces includes
- * an extension namespace.
- */
- protected boolean inExtensionNamespace() {
- boolean inExtension = false;
-
- Enumeration elements = namespaceStack.elements();
- while (!inExtension && elements.hasMoreElements()) {
- String ns = (String) elements.nextElement();
- if (ns == null) {
- inExtension = true;
- } else {
- inExtension = (!ns.equals(tr9401NamespaceName)
- && !ns.equals(namespaceName));
- }
- }
-
- return inExtension;
- }
-
- // ----------------------------------------------------------------------
- // Implement the SAX ContentHandler interface
-
- /** The SAX <code>setDocumentLocator</code> method does nothing. */
- public void setDocumentLocator (Locator locator) {
- return;
- }
-
- /** The SAX <code>startDocument</code> */
- public void startDocument ()
- throws SAXException {
- baseURIStack.push(catalog.getCurrentBase());
- overrideStack.push(catalog.getDefaultOverride());
- return;
- }
-
- /** The SAX <code>endDocument</code> method does nothing. */
- public void endDocument ()
- throws SAXException {
- return;
- }
-
- /**
- * The SAX <code>startElement</code> method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- namespaceStack.push(namespaceURI);
-
- boolean inExtension = inExtensionNamespace();
-
- if (namespaceURI != null && namespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is an XML Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if ((localName.equals("catalog") || localName.equals("group"))
- && atts.getValue("prefer") != null) {
- String override = atts.getValue("prefer");
-
- if (override.equals("public")) {
- override = "yes";
- } else if (override.equals("system")) {
- override = "no";
- } else {
- debug.message(1,
- "Invalid prefer: must be 'system' or 'public'",
- localName);
- override = catalog.getDefaultOverride();
- }
-
- entryType = Catalog.OVERRIDE;
- entryArgs.add(override);
- overrideStack.push(override);
-
- debug.message(4, "override", override);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (override)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- overrideStack.push(overrideStack.peek());
- }
-
- if (localName.equals("delegatePublic")) {
- if (checkAttributes(atts, "publicIdStartString", "catalog")) {
- entryType = Catalog.DELEGATE_PUBLIC;
- entryArgs.add(atts.getValue("publicIdStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegatePublic",
- PublicId.normalize(atts.getValue("publicIdStartString")),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("delegateSystem")) {
- if (checkAttributes(atts, "systemIdStartString", "catalog")) {
- entryType = Catalog.DELEGATE_SYSTEM;
- entryArgs.add(atts.getValue("systemIdStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegateSystem",
- atts.getValue("systemIdStartString"),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("delegateURI")) {
- if (checkAttributes(atts, "uriStartString", "catalog")) {
- entryType = Catalog.DELEGATE_URI;
- entryArgs.add(atts.getValue("uriStartString"));
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "delegateURI",
- atts.getValue("uriStartString"),
- atts.getValue("catalog"));
- }
- } else if (localName.equals("rewriteSystem")) {
- if (checkAttributes(atts, "systemIdStartString", "rewritePrefix")) {
- entryType = Catalog.REWRITE_SYSTEM;
- entryArgs.add(atts.getValue("systemIdStartString"));
- entryArgs.add(atts.getValue("rewritePrefix"));
-
- debug.message(4, "rewriteSystem",
- atts.getValue("systemIdStartString"),
- atts.getValue("rewritePrefix"));
- }
- } else if (localName.equals("systemSuffix")) {
- if (checkAttributes(atts, "systemIdSuffix", "uri")) {
- entryType = Catalog.SYSTEM_SUFFIX;
- entryArgs.add(atts.getValue("systemIdSuffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "systemSuffix",
- atts.getValue("systemIdSuffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("rewriteURI")) {
- if (checkAttributes(atts, "uriStartString", "rewritePrefix")) {
- entryType = Catalog.REWRITE_URI;
- entryArgs.add(atts.getValue("uriStartString"));
- entryArgs.add(atts.getValue("rewritePrefix"));
-
- debug.message(4, "rewriteURI",
- atts.getValue("uriStartString"),
- atts.getValue("rewritePrefix"));
- }
- } else if (localName.equals("uriSuffix")) {
- if (checkAttributes(atts, "uriSuffix", "uri")) {
- entryType = Catalog.URI_SUFFIX;
- entryArgs.add(atts.getValue("uriSuffix"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uriSuffix",
- atts.getValue("uriSuffix"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("nextCatalog")) {
- if (checkAttributes(atts, "catalog")) {
- entryType = Catalog.CATALOG;
- entryArgs.add(atts.getValue("catalog"));
-
- debug.message(4, "nextCatalog", atts.getValue("catalog"));
- }
- } else if (localName.equals("public")) {
- if (checkAttributes(atts, "publicId", "uri")) {
- entryType = Catalog.PUBLIC;
- entryArgs.add(atts.getValue("publicId"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "public",
- PublicId.normalize(atts.getValue("publicId")),
- atts.getValue("uri"));
- }
- } else if (localName.equals("system")) {
- if (checkAttributes(atts, "systemId", "uri")) {
- entryType = Catalog.SYSTEM;
- entryArgs.add(atts.getValue("systemId"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "system",
- atts.getValue("systemId"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("uri")) {
- if (checkAttributes(atts, "name", "uri")) {
- entryType = Catalog.URI;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
-
- debug.message(4, "uri",
- atts.getValue("name"),
- atts.getValue("uri"));
- }
- } else if (localName.equals("catalog")) {
- // nop, start of catalog
- } else if (localName.equals("group")) {
- // nop, a group
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
-
- if (namespaceURI != null && tr9401NamespaceName.equals(namespaceURI)
- && !inExtension) {
- // This is a TR9401 Catalog entry
-
- if (atts.getValue("xml:base") != null) {
- String baseURI = atts.getValue("xml:base");
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
- baseURIStack.push(baseURI);
-
- debug.message(4, "xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (base)", localName);
- }
- }
-
- entryType = -1;
- entryArgs = new Vector();
-
- } else {
- baseURIStack.push(baseURIStack.peek());
- }
-
- if (localName.equals("doctype")) {
- entryType = Catalog.DOCTYPE;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("document")) {
- entryType = Catalog.DOCUMENT;
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("dtddecl")) {
- entryType = Catalog.DTDDECL;
- entryArgs.add(atts.getValue("publicId"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("entity")) {
- entryType = Catalog.ENTITY;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("linktype")) {
- entryType = Catalog.LINKTYPE;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("notation")) {
- entryType = Catalog.NOTATION;
- entryArgs.add(atts.getValue("name"));
- entryArgs.add(atts.getValue("uri"));
- } else if (localName.equals("sgmldecl")) {
- entryType = Catalog.SGMLDECL;
- entryArgs.add(atts.getValue("uri"));
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
- }
-
- public boolean checkAttributes (Attributes atts, String attName) {
- if (atts.getValue(attName) == null) {
- debug.message(1, "Error: required attribute " + attName + " missing.");
- return false;
- } else {
- return true;
- }
- }
-
- public boolean checkAttributes (Attributes atts,
- String attName1,
- String attName2) {
- return checkAttributes(atts, attName1)
- && checkAttributes(atts, attName2);
- }
-
- /** The SAX <code>endElement</code> */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- boolean inExtension = inExtensionNamespace();
-
- if (namespaceURI != null
- && !inExtension
- && (namespaceName.equals(namespaceURI)
- || tr9401NamespaceName.equals(namespaceURI))) {
-
- String popURI = (String) baseURIStack.pop();
- String baseURI = (String) baseURIStack.peek();
-
- if (!baseURI.equals(popURI)) {
- entryType = Catalog.BASE;
- entryArgs.add(baseURI);
-
- debug.message(4, "(reset) xml:base", baseURI);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (rbase)", localName);
- }
- }
- }
- }
-
- if (namespaceURI != null && namespaceName.equals(namespaceURI)
- && !inExtension) {
- if (localName.equals("catalog") || localName.equals("group")) {
- String popOverride = (String) overrideStack.pop();
- String override = (String) overrideStack.peek();
-
- if (!override.equals(popOverride)) {
- entryType = Catalog.OVERRIDE;
- entryArgs.add(override);
- overrideStack.push(override);
-
- debug.message(4, "(reset) override", override);
-
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry (roverride)", localName);
- }
- }
- }
- }
- }
-
- namespaceStack.pop();
-
- return;
- }
-
- /** The SAX <code>characters</code> method does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>ignorableWhitespace</code> method does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>processingInstruction</code> method does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>skippedEntity</code> method does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>startPrefixMapping</code> method does nothing. */
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>endPrefixMapping</code> method does nothing. */
- public void endPrefixMapping(String prefix)
- throws SAXException {
- return;
- }
-
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogParser.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import org.xml.sax.*;
-
-/**
- * The SAXCatalogParser interface.
- *
- * <p>This interface must be implemented in order for a class to
- * participate as a parser for the SAXCatalogReader.
- *
- * @see Catalog
- * @see SAXCatalogReader
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public interface SAXCatalogParser extends ContentHandler, DocumentHandler {
- /** Set the Catalog for which parsing is being performed. */
- public void setCatalog(Catalog catalog);
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import sun.reflect.misc.ReflectUtil;
-
-/**
- * A SAX-based CatalogReader.
- *
- * <p>This class is used to read XML Catalogs using the SAX. This reader
- * has an advantage over the DOM-based reader in that it functions on
- * the stream of SAX events. It has the disadvantage
- * that it cannot look around in the tree.</p>
- *
- * <p>Since the choice of CatalogReaders (in the InputStream case) can only
- * be made on the basis of MIME type, the following problem occurs: only
- * one CatalogReader can exist for all XML mime types. In order to get
- * around this problem, the SAXCatalogReader relies on a set of external
- * CatalogParsers to actually build the catalog.</p>
- *
- * <p>The selection of CatalogParsers is made on the basis of the QName
- * of the root element of the document.</p>
- *
- * @see Catalog
- * @see CatalogReader
- * @see SAXCatalogReader
- * @see TextCatalogReader
- * @see DOMCatalogParser
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class SAXCatalogReader implements CatalogReader, ContentHandler, DocumentHandler {
- /** The SAX Parser Factory */
- protected SAXParserFactory parserFactory = null;
-
- /** The SAX Parser Class */
- protected String parserClass = null;
-
- /**
- * Mapping table from QNames to CatalogParser classes.
- *
- * <p>Each key in this hash table has the form "elementname"
- * or "{namespaceuri}elementname". The former is used if the
- * namespace URI is null.</p>
- */
- protected Map<String, String> namespaceMap = new HashMap<>();
-
- /** The parser in use for the current catalog. */
- private SAXCatalogParser saxParser = null;
-
- /** Set if something goes horribly wrong. It allows the class to
- * ignore the rest of the events that are received.
- */
- private boolean abandonHope = false;
-
- /** The Catalog that we're working for. */
- private Catalog catalog;
-
- /** Set the XML SAX Parser Factory.
- */
- public void setParserFactory(SAXParserFactory parserFactory) {
- this.parserFactory = parserFactory;
- }
-
- /** Set the XML SAX Parser Class
- */
- public void setParserClass(String parserClass) {
- this.parserClass = parserClass;
- }
-
- /** Get the parser factory currently in use. */
- public SAXParserFactory getParserFactory() {
- return parserFactory;
- }
-
- /** Get the parser class currently in use. */
- public String getParserClass() {
- return parserClass;
- }
-
- /** The debug class to use for this reader.
- *
- * This is a bit of a hack. Anyway, whenever we read for a catalog,
- * we extract the debug object
- * from the catalog's manager so that we can use it to print messages.
- *
- * In production, we don't really expect any messages so it doesn't
- * really matter. But it's still a bit of a hack.
- */
- protected Debug debug = CatalogManager.getStaticManager().debug;
-
- /** The constructor */
- public SAXCatalogReader() {
- parserFactory = null;
- parserClass = null;
- }
-
- /** The constructor */
- public SAXCatalogReader(SAXParserFactory parserFactory) {
- this.parserFactory = parserFactory;
- }
-
- /** The constructor */
- public SAXCatalogReader(String parserClass) {
- this.parserClass = parserClass;
- }
-
- /**
- * Set the SAXCatalogParser class for the given namespace/root
- * element type.
- */
- public void setCatalogParser(String namespaceURI,
- String rootElement,
- String parserClass) {
- namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
- namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
- }
-
- /**
- * Get the SAXCatalogParser class for the given namespace/root
- * element type.
- */
- public String getCatalogParser(String namespaceURI,
- String rootElement) {
- namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
- return namespaceMap.get("{"+namespaceURI+"}"+rootElement);
- }
-
- /**
- * Parse an XML Catalog file.
- *
- * @param catalog The catalog to which this catalog file belongs
- * @param fileUrl The URL or filename of the catalog file to process
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException,
- CatalogException {
-
- URL url = null;
-
- try {
- url = new URL(fileUrl);
- } catch (MalformedURLException e) {
- url = new URL("file:///" + fileUrl);
- }
-
- debug = catalog.getCatalogManager().debug;
-
- try {
- URLConnection urlCon = url.openConnection();
- readCatalog(catalog, urlCon.getInputStream());
- } catch (FileNotFoundException e) {
- catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found",
- url.toString());
- }
- }
-
- /**
- * Parse an XML Catalog stream.
- *
- * @param catalog The catalog to which this catalog file belongs
- * @param is The input stream from which the catalog will be read
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- * @throws CatalogException A Catalog exception
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws IOException, CatalogException {
-
- // Create an instance of the parser
- if (parserFactory == null && parserClass == null) {
- debug.message(1, "Cannot read SAX catalog without a parser");
- throw new CatalogException(CatalogException.UNPARSEABLE);
- }
-
- debug = catalog.getCatalogManager().debug;
- EntityResolver bResolver = catalog.getCatalogManager().getBootstrapResolver();
-
- this.catalog = catalog;
-
- try {
- if (parserFactory != null) {
- SAXParser parser = parserFactory.newSAXParser();
- SAXParserHandler spHandler = new SAXParserHandler();
- spHandler.setContentHandler(this);
- if (bResolver != null) {
- spHandler.setEntityResolver(bResolver);
- }
- parser.parse(new InputSource(is), spHandler);
- } else {
- Class<?> c = ReflectUtil.forName(parserClass);
- if (!Parser.class.isAssignableFrom(c)) {
- throw new ClassCastException(parserClass
- + " cannot be cast to "
- + Parser.class.getName());
- }
- Parser parser = (Parser) c.newInstance();
- parser.setDocumentHandler(this);
- if (bResolver != null) {
- parser.setEntityResolver(bResolver);
- }
- parser.parse(new InputSource(is));
- }
- } catch (ClassNotFoundException cnfe) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (IllegalAccessException iae) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (InstantiationException ie) {
- throw new CatalogException(CatalogException.UNPARSEABLE);
- } catch (ParserConfigurationException pce) {
- throw new CatalogException(CatalogException.UNKNOWN_FORMAT);
- } catch (SAXException se) {
- Exception e = se.getException();
- // FIXME: there must be a better way
- UnknownHostException uhe = new UnknownHostException();
- FileNotFoundException fnfe = new FileNotFoundException();
- if (e != null) {
- if (e.getClass() == uhe.getClass()) {
- throw new CatalogException(CatalogException.PARSE_FAILED,
- e.toString());
- } else if (e.getClass() == fnfe.getClass()) {
- throw new CatalogException(CatalogException.PARSE_FAILED,
- e.toString());
- }
- }
- throw new CatalogException(se);
- }
- }
-
- // ----------------------------------------------------------------------
- // Implement the SAX ContentHandler interface
-
- /** The SAX <code>setDocumentLocator</code> method. Does nothing. */
- public void setDocumentLocator (Locator locator) {
- if (saxParser != null) {
- saxParser.setDocumentLocator(locator);
- }
- }
-
- /** The SAX <code>startDocument</code> method. Does nothing. */
- public void startDocument () throws SAXException {
- saxParser = null;
- abandonHope = false;
- return;
- }
-
- /** The SAX <code>endDocument</code> method. Does nothing. */
- public void endDocument ()throws SAXException {
- if (saxParser != null) {
- saxParser.endDocument();
- }
- }
-
- /**
- * The SAX <code>startElement</code> method.
- *
- * <p>The catalog parser is selected based on the namespace of the
- * first element encountered in the catalog.</p>
- */
- public void startElement (String name,
- AttributeList atts)
- throws SAXException {
-
- if (abandonHope) {
- return;
- }
-
- if (saxParser == null) {
- String prefix = "";
- if (name.indexOf(':') > 0) {
- prefix = name.substring(0, name.indexOf(':'));
- }
-
- String localName = name;
- if (localName.indexOf(':') > 0) {
- localName = localName.substring(localName.indexOf(':')+1);
- }
-
- String namespaceURI = null;
- if (prefix.length() == 0) {
- namespaceURI = atts.getValue("xmlns");
- } else {
- namespaceURI = atts.getValue("xmlns:" + prefix);
- }
-
- String saxParserClass = getCatalogParser(namespaceURI,
- localName);
-
- if (saxParserClass == null) {
- abandonHope = true;
- if (namespaceURI == null) {
- debug.message(2, "No Catalog parser for " + name);
- } else {
- debug.message(2, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + name);
- }
- return;
- }
-
- try {
- saxParser = (SAXCatalogParser)
- ReflectUtil.forName(saxParserClass).newInstance();
-
- saxParser.setCatalog(catalog);
- saxParser.startDocument();
- saxParser.startElement(name, atts);
- } catch (ClassNotFoundException cnfe) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cnfe.toString());
- } catch (InstantiationException ie) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, ie.toString());
- } catch (IllegalAccessException iae) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, iae.toString());
- } catch (ClassCastException cce ) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cce.toString());
- }
- } else {
- saxParser.startElement(name, atts);
- }
- }
-
- /**
- * The SAX2 <code>startElement</code> method.
- *
- * <p>The catalog parser is selected based on the namespace of the
- * first element encountered in the catalog.</p>
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- if (abandonHope) {
- return;
- }
-
- if (saxParser == null) {
- String saxParserClass = getCatalogParser(namespaceURI,
- localName);
-
- if (saxParserClass == null) {
- abandonHope = true;
- if (namespaceURI == null) {
- debug.message(2, "No Catalog parser for " + localName);
- } else {
- debug.message(2, "No Catalog parser for "
- + "{" + namespaceURI + "}"
- + localName);
- }
- return;
- }
-
- try {
- saxParser = (SAXCatalogParser)
- ReflectUtil.forName(saxParserClass).newInstance();
-
- saxParser.setCatalog(catalog);
- saxParser.startDocument();
- saxParser.startElement(namespaceURI, localName, qName, atts);
- } catch (ClassNotFoundException cnfe) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cnfe.toString());
- } catch (InstantiationException ie) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, ie.toString());
- } catch (IllegalAccessException iae) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, iae.toString());
- } catch (ClassCastException cce ) {
- saxParser = null;
- abandonHope = true;
- debug.message(2, cce.toString());
- }
- } else {
- saxParser.startElement(namespaceURI, localName, qName, atts);
- }
- }
-
- /** The SAX <code>endElement</code> method. Does nothing. */
- public void endElement (String name) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(name);
- }
- }
-
- /** The SAX2 <code>endElement</code> method. Does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName) throws SAXException {
- if (saxParser != null) {
- saxParser.endElement(namespaceURI, localName, qName);
- }
- }
-
- /** The SAX <code>characters</code> method. Does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.characters(ch, start, length);
- }
- }
-
- /** The SAX <code>ignorableWhitespace</code> method. Does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- if (saxParser != null) {
- saxParser.ignorableWhitespace(ch, start, length);
- }
- }
-
- /** The SAX <code>processingInstruction</code> method. Does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- if (saxParser != null) {
- saxParser.processingInstruction(target, data);
- }
- }
-
- /** The SAX <code>startPrefixMapping</code> method. Does nothing. */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException {
- if (saxParser != null) {
- saxParser.startPrefixMapping (prefix, uri);
- }
- }
-
- /** The SAX <code>endPrefixMapping</code> method. Does nothing. */
- public void endPrefixMapping (String prefix)
- throws SAXException {
- if (saxParser != null) {
- saxParser.endPrefixMapping (prefix);
- }
- }
-
- /** The SAX <code>skippedentity</code> method. Does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- if (saxParser != null) {
- saxParser.skippedEntity(name);
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXParserHandler.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.io.IOException;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * An entity-resolving DefaultHandler.
- *
- * <p>This class provides a SAXParser DefaultHandler that performs
- * entity resolution.
- * </p>
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- */
-public class SAXParserHandler extends DefaultHandler {
- private EntityResolver er = null;
- private ContentHandler ch = null;
-
- public SAXParserHandler() {
- super();
- }
-
- public void setEntityResolver(EntityResolver er) {
- this.er = er;
- }
-
- public void setContentHandler(ContentHandler ch) {
- this.ch = ch;
- }
-
- // Entity Resolver
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException {
-
- if (er != null) {
- try {
- return er.resolveEntity(publicId, systemId);
- } catch (IOException e) {
- System.out.println("resolveEntity threw IOException!");
- return null;
- }
- } else {
- return null;
- }
- }
-
- // Content Handler
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- if (this.ch != null) {
- this.ch.characters(ch, start, length);
- }
- }
-
- public void endDocument()
- throws SAXException {
- if (ch != null) {
- ch.endDocument();
- }
- }
-
- public void endElement(String namespaceURI, String localName, String qName)
- throws SAXException {
- if (ch != null) {
- ch.endElement(namespaceURI, localName, qName);
- }
- }
-
- public void endPrefixMapping(String prefix)
- throws SAXException {
- if (ch != null) {
- ch.endPrefixMapping(prefix);
- }
- }
-
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
- if (this.ch != null) {
- this.ch.ignorableWhitespace(ch, start, length);
- }
- }
-
- public void processingInstruction(String target, String data)
- throws SAXException {
- if (ch != null) {
- ch.processingInstruction(target, data);
- }
- }
-
- public void setDocumentLocator(Locator locator) {
- if (ch != null) {
- ch.setDocumentLocator(locator);
- }
- }
-
- public void skippedEntity(String name)
- throws SAXException {
- if (ch != null) {
- ch.skippedEntity(name);
- }
- }
-
- public void startDocument()
- throws SAXException {
- if (ch != null) {
- ch.startDocument();
- }
- }
-
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts)
- throws SAXException {
- if (ch != null) {
- ch.startElement(namespaceURI, localName, qName, atts);
- }
- }
-
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- if (ch != null) {
- ch.startPrefixMapping(prefix, uri);
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TR9401CatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.Locale;
-import java.util.Vector;
-
-/**
- * Parses OASIS Open Catalog files.
- *
- * <p>This class reads OASIS Open Catalog files, returning a stream
- * of tokens.</p>
- *
- * <p>This code interrogates the following non-standard system properties:</p>
- *
- * <dl>
- * <dt><b>xml.catalog.debug</b></dt>
- * <dd><p>Sets the debug level. A value of 0 is assumed if the
- * property is not set or is not a number.</p></dd>
- * </dl>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class TR9401CatalogReader extends TextCatalogReader {
-
- /**
- * Start parsing an OASIS TR9401 Open Catalog file. The file is
- * actually read and parsed
- * as needed by <code>nextEntry</code>.
- *
- * <p>In a TR9401 Catalog the 'DELEGATE' entry delegates public
- * identifiers. There is no delegate entry for system identifiers
- * or URIs.</p>
- *
- * @param catalog The Catalog to populate
- * @param is The input stream from which to read the TR9401 Catalog
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- */
- public void readCatalog(Catalog catalog, InputStream is)
- throws MalformedURLException, IOException {
-
- catfile = is;
-
- if (catfile == null) {
- return;
- }
-
- Vector unknownEntry = null;
-
- try {
- while (true) {
- String token = nextToken();
-
- if (token == null) {
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
- catfile.close();
- catfile = null;
- return;
- }
-
- String entryToken = null;
- if (caseSensitive) {
- entryToken = token;
- } else {
- entryToken = token.toUpperCase(Locale.ENGLISH);
- }
-
- if (entryToken.equals("DELEGATE")) {
- entryToken = "DELEGATE_PUBLIC";
- }
-
- try {
- int type = CatalogEntry.getEntryType(entryToken);
- int numArgs = CatalogEntry.getEntryArgCount(type);
- Vector args = new Vector();
-
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
-
- for (int count = 0; count < numArgs; count++) {
- args.addElement(nextToken());
- }
-
- catalog.addEntry(new CatalogEntry(entryToken, args));
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- if (unknownEntry == null) {
- unknownEntry = new Vector();
- }
- unknownEntry.addElement(token);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
- unknownEntry = null;
- } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex.getMessage());
- }
- }
- }
- } catch (CatalogException cex2) {
- if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex2.getMessage());
- }
- }
-
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/TextCatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.readers.CatalogReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Locale;
-import java.util.Stack;
-import java.util.Vector;
-
-/**
- * Parses plain text Catalog files.
- *
- * <p>This class reads plain text Open Catalog files.</p>
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class TextCatalogReader implements CatalogReader {
- /** The input stream used to read the catalog */
- protected InputStream catfile = null;
-
- /**
- * Character lookahead stack. Reading a catalog sometimes requires
- * up to two characters of lookahead.
- */
- protected int[] stack = new int[3];
-
- /**
- * Token stack. Recognizing an unexpected catalog entry requires
- * the ability to "push back" a token.
- */
- protected Stack tokenStack = new Stack();
-
- /** The current position on the lookahead stack */
- protected int top = -1;
-
- /** Are keywords in the catalog case sensitive? */
- protected boolean caseSensitive = false;
-
- /**
- * Construct a CatalogReader object.
- */
- public TextCatalogReader() { }
-
- public void setCaseSensitive(boolean isCaseSensitive) {
- caseSensitive = isCaseSensitive;
- }
-
- public boolean getCaseSensitive() {
- return caseSensitive;
- }
-
- /**
- * Start parsing a text catalog file. The file is
- * actually read and parsed
- * as needed by <code>nextEntry</code>.</p>
- *
- * @param fileUrl The URL or filename of the catalog file to process
- *
- * @throws MalformedURLException Improper fileUrl
- * @throws IOException Error reading catalog file
- */
- public void readCatalog(Catalog catalog, String fileUrl)
- throws MalformedURLException, IOException {
- URL catURL = null;
-
- try {
- catURL = new URL(fileUrl);
- } catch (MalformedURLException e) {
- catURL = new URL("file:///" + fileUrl);
- }
-
- URLConnection urlCon = catURL.openConnection();
- try {
- readCatalog(catalog, urlCon.getInputStream());
- } catch (FileNotFoundException e) {
- catalog.getCatalogManager().debug.message(1, "Failed to load catalog, file not found",
- catURL.toString());
- }
- }
-
- public void readCatalog(Catalog catalog, InputStream is)
- throws MalformedURLException, IOException {
-
- catfile = is;
-
- if (catfile == null) {
- return;
- }
-
- Vector unknownEntry = null;
-
- try {
- while (true) {
- String token = nextToken();
-
- if (token == null) {
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
- catfile.close();
- catfile = null;
- return;
- }
-
- String entryToken = null;
- if (caseSensitive) {
- entryToken = token;
- } else {
- entryToken = token.toUpperCase(Locale.ENGLISH);
- }
-
- try {
- int type = CatalogEntry.getEntryType(entryToken);
- int numArgs = CatalogEntry.getEntryArgCount(type);
- Vector args = new Vector();
-
- if (unknownEntry != null) {
- catalog.unknownEntry(unknownEntry);
- unknownEntry = null;
- }
-
- for (int count = 0; count < numArgs; count++) {
- args.addElement(nextToken());
- }
-
- catalog.addEntry(new CatalogEntry(entryToken, args));
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- if (unknownEntry == null) {
- unknownEntry = new Vector();
- }
- unknownEntry.addElement(token);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
- unknownEntry = null;
- } else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex.getMessage());
- }
- }
- }
- } catch (CatalogException cex2) {
- if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
- catalog.getCatalogManager().debug.message(1, cex2.getMessage());
- }
- }
- }
-
- /**
- * The destructor.
- *
- * <p>Makes sure the catalog file is closed.</p>
- */
- protected void finalize() {
- if (catfile != null) {
- try {
- catfile.close();
- } catch (IOException e) {
- // whatever...
- }
- }
- catfile = null;
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Return the next token in the catalog file.
- *
- * <p>FYI: This code does not throw any sort of exception for
- * a file that contains an n
- *
- * @return The Catalog file token from the input stream.
- * @throws IOException If an error occurs reading from the stream.
- */
- protected String nextToken() throws IOException, CatalogException {
- String token = "";
- int ch, nextch;
-
- if (!tokenStack.empty()) {
- return (String) tokenStack.pop();
- }
-
- // Skip over leading whitespace and comments
- while (true) {
- // skip leading whitespace
- ch = catfile.read();
- while (ch <= ' ') { // all ctrls are whitespace
- ch = catfile.read();
- if (ch < 0) {
- return null;
- }
- }
-
- // now 'ch' is the current char from the file
- nextch = catfile.read();
- if (nextch < 0) {
- return null;
- }
-
- if (ch == '-' && nextch == '-') {
- // we've found a comment, skip it...
- ch = ' ';
- nextch = nextChar();
- while ((ch != '-' || nextch != '-') && nextch > 0) {
- ch = nextch;
- nextch = nextChar();
- }
-
- if (nextch < 0) {
- throw new CatalogException(CatalogException.UNENDED_COMMENT,
- "Unterminated comment in catalog file; EOF treated as end-of-comment.");
- }
-
- // Ok, we've found the end of the comment,
- // loop back to the top and start again...
- } else {
- stack[++top] = nextch;
- stack[++top] = ch;
- break;
- }
- }
-
- ch = nextChar();
- if (ch == '"' || ch == '\'') {
- int quote = ch;
- while ((ch = nextChar()) != quote) {
- char[] chararr = new char[1];
- chararr[0] = (char) ch;
- String s = new String(chararr);
- token = token.concat(s);
- }
- return token;
- } else {
- // return the next whitespace or comment delimited
- // string
- while (ch > ' ') {
- nextch = nextChar();
- if (ch == '-' && nextch == '-') {
- stack[++top] = ch;
- stack[++top] = nextch;
- return token;
- } else {
- char[] chararr = new char[1];
- chararr[0] = (char) ch;
- String s = new String(chararr);
- token = token.concat(s);
- ch = nextch;
- }
- }
- return token;
- }
- }
-
- /**
- * Return the next logical character from the input stream.
- *
- * @return The next (logical) character from the input stream. The
- * character may be buffered from a previous lookahead.
- *
- * @throws IOException If an error occurs reading from the stream.
- */
- protected int nextChar() throws IOException {
- if (top < 0) {
- return catfile.read();
- } else {
- return stack[top--];
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/XCatalogReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.readers;
-
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogEntry;
-import com.sun.org.apache.xml.internal.resolver.CatalogException;
-import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
-
-import org.xml.sax.*;
-
-import javax.xml.parsers.*;
-
-/**
- * Parse "XCatalog" XML Catalog files, this is the XML Catalog format
- * developed by John Cowan and supported by Apache.
- *
- * @see Catalog
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- */
-public class XCatalogReader extends SAXCatalogReader implements SAXCatalogParser {
- /** The catalog object needs to be stored by the object so that
- * SAX callbacks can use it.
- */
- protected Catalog catalog = null;
-
- /** Set the current catalog. */
- public void setCatalog (Catalog catalog) {
- this.catalog = catalog;
- debug = catalog.getCatalogManager().debug;
- }
-
- /** Get the current catalog. */
- public Catalog getCatalog () {
- return catalog;
- }
-
- /** Default constructor */
- public XCatalogReader() {
- super();
- }
-
- /** Constructor allowing for providing custom SAX parser factory */
- public XCatalogReader(SAXParserFactory parserFactory, Catalog catalog) {
- super(parserFactory);
- setCatalog(catalog);
- }
-
- // ----------------------------------------------------------------------
- // Implement the SAX ContentHandler interface
-
- /** The SAX <code>setDocumentLocator</code> method does nothing. */
- public void setDocumentLocator (Locator locator) {
- return;
- }
-
- /** The SAX <code>startDocument</code> method does nothing. */
- public void startDocument ()
- throws SAXException {
- return;
- }
-
- /** The SAX <code>endDocument</code> method does nothing. */
- public void endDocument ()
- throws SAXException {
- return;
- }
-
- /**
- * The SAX <code>startElement</code> method recognizes elements
- * from the plain catalog format and instantiates CatalogEntry
- * objects for them.
- *
- * @param namespaceURI The namespace name of the element.
- * @param localName The local name of the element.
- * @param qName The QName of the element.
- * @param atts The list of attributes on the element.
- *
- * @see CatalogEntry
- */
- public void startElement (String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
-
- int entryType = -1;
- Vector entryArgs = new Vector();
-
- if (localName.equals("Base")) {
- entryType = Catalog.BASE;
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Base", atts.getValue("HRef"));
- } else if (localName.equals("Delegate")) {
- entryType = Catalog.DELEGATE_PUBLIC;
- entryArgs.add(atts.getValue("PublicID"));
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Delegate",
- PublicId.normalize(atts.getValue("PublicID")),
- atts.getValue("HRef"));
- } else if (localName.equals("Extend")) {
- entryType = Catalog.CATALOG;
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Extend", atts.getValue("HRef"));
- } else if (localName.equals("Map")) {
- entryType = Catalog.PUBLIC;
- entryArgs.add(atts.getValue("PublicID"));
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Map",
- PublicId.normalize(atts.getValue("PublicID")),
- atts.getValue("HRef"));
- } else if (localName.equals("Remap")) {
- entryType = Catalog.SYSTEM;
- entryArgs.add(atts.getValue("SystemID"));
- entryArgs.add(atts.getValue("HRef"));
-
- debug.message(4, "Remap",
- atts.getValue("SystemID"),
- atts.getValue("HRef"));
- } else if (localName.equals("XCatalog")) {
- // nop, start of catalog
- } else {
- // This is equivalent to an invalid catalog entry type
- debug.message(1, "Invalid catalog entry type", localName);
- }
-
- if (entryType >= 0) {
- try {
- CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
- catalog.addEntry(ce);
- } catch (CatalogException cex) {
- if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
- debug.message(1, "Invalid catalog entry type", localName);
- } else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
- debug.message(1, "Invalid catalog entry", localName);
- }
- }
- }
- }
-
- /** The SAX <code>endElement</code> method does nothing. */
- public void endElement (String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>characters</code> method does nothing. */
- public void characters (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>ignorableWhitespace</code> method does nothing. */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>processingInstruction</code> method does nothing. */
- public void processingInstruction (String target, String data)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>skippedEntity</code> method does nothing. */
- public void skippedEntity (String name)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>startPrefixMapping</code> method does nothing. */
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- return;
- }
-
- /** The SAX <code>endPrefixMapping</code> method does nothing. */
- public void endPrefixMapping(String prefix)
- throws SAXException {
- return;
- }
-
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/CatalogResolver.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
-import org.xml.sax.EntityResolver;
-
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.Source;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.TransformerException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
-/**
- * A SAX EntityResolver/JAXP URIResolver that uses catalogs.
- *
- * <p>This class implements both a SAX EntityResolver and a JAXP URIResolver.
- * </p>
- *
- * <p>This resolver understands OASIS TR9401 catalogs, XCatalogs, and the
- * current working draft of the OASIS Entity Resolution Technical
- * Committee specification.</p>
- *
- * @see Catalog
- * @see org.xml.sax.EntityResolver
- * @see javax.xml.transform.URIResolver
- * @deprecated The JDK internal Catalog API in package
- * {@code com.sun.org.apache.xml.internal.resolver}
- * is encapsulated in JDK 9. The entire implementation under the package is now
- * deprecated and subject to removal in a future release. Users of the API
- * should migrate to the {@linkplain javax.xml.catalog new public API}.
- * <p>
- * The new Catalog API is supported throughout the JDK XML Processors, which allows
- * the use of Catalog by simply setting a path to a Catalog file as a property.
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-@Deprecated(since="9", forRemoval=true)
-public class CatalogResolver implements EntityResolver, URIResolver {
- /** Make the parser Namespace aware? */
- public boolean namespaceAware = true;
-
- /** Make the parser validating? */
- public boolean validating = false;
-
- /** The underlying catalog */
- private Catalog catalog = null;
-
- /** The catalog manager */
- private CatalogManager catalogManager = CatalogManager.getStaticManager();
-
- /** Constructor */
- public CatalogResolver() {
- initializeCatalogs(false);
- }
-
- /** Constructor */
- public CatalogResolver(boolean privateCatalog) {
- initializeCatalogs(privateCatalog);
- }
-
- /** Constructor */
- public CatalogResolver(CatalogManager manager) {
- catalogManager = manager;
- initializeCatalogs(!catalogManager.getUseStaticCatalog());
- }
-
- /** Initialize catalog */
- private void initializeCatalogs(boolean privateCatalog) {
- catalog = catalogManager.getCatalog();
- }
-
- /** Return the underlying catalog */
- public Catalog getCatalog() {
- return catalog;
- }
-
- /**
- * Implements the guts of the <code>resolveEntity</code> method
- * for the SAX interface.
- *
- * <p>Presented with an optional public identifier and a system
- * identifier, this function attempts to locate a mapping in the
- * catalogs.</p>
- *
- * <p>If such a mapping is found, it is returned. If no mapping is
- * found, null is returned.</p>
- *
- * @param publicId The public identifier for the entity in question.
- * This may be null.
- *
- * @param systemId The system identifier for the entity in question.
- * XML requires a system identifier on all external entities, so this
- * value is always specified.
- *
- * @return The resolved identifier (a URI reference).
- */
- public String getResolvedEntity (String publicId, String systemId) {
- String resolved = null;
-
- if (catalog == null) {
- catalogManager.debug.message(1, "Catalog resolution attempted with null catalog; ignored");
- return null;
- }
-
- if (systemId != null) {
- try {
- resolved = catalog.resolveSystem(systemId);
- } catch (MalformedURLException me) {
- catalogManager.debug.message(1, "Malformed URL exception trying to resolve",
- publicId);
- resolved = null;
- } catch (IOException ie) {
- catalogManager.debug.message(1, "I/O exception trying to resolve", publicId);
- resolved = null;
- }
- }
-
- if (resolved == null) {
- if (publicId != null) {
- try {
- resolved = catalog.resolvePublic(publicId, systemId);
- } catch (MalformedURLException me) {
- catalogManager.debug.message(1, "Malformed URL exception trying to resolve",
- publicId);
- } catch (IOException ie) {
- catalogManager.debug.message(1, "I/O exception trying to resolve", publicId);
- }
- }
-
- if (resolved != null) {
- catalogManager.debug.message(2, "Resolved public", publicId, resolved);
- }
- } else {
- catalogManager.debug.message(2, "Resolved system", systemId, resolved);
- }
-
- return resolved;
- }
-
- /**
- * Implements the <code>resolveEntity</code> method
- * for the SAX interface.
- *
- * <p>Presented with an optional public identifier and a system
- * identifier, this function attempts to locate a mapping in the
- * catalogs.</p>
- *
- * <p>If such a mapping is found, the resolver attempts to open
- * the mapped value as an InputSource and return it. Exceptions are
- * ignored and null is returned if the mapped value cannot be opened
- * as an input source.</p>
- *
- * <p>If no mapping is found (or an error occurs attempting to open
- * the mapped value as an input source), null is returned and the system
- * will use the specified system identifier as if no entityResolver
- * was specified.</p>
- *
- * @param publicId The public identifier for the entity in question.
- * This may be null.
- *
- * @param systemId The system identifier for the entity in question.
- * XML requires a system identifier on all external entities, so this
- * value is always specified.
- *
- * @return An InputSource for the mapped identifier, or null.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- String resolved = getResolvedEntity(publicId, systemId);
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- }
-
- return null;
- }
-
- /** JAXP URIResolver API */
- public Source resolve(String href, String base)
- throws TransformerException {
-
- String uri = href;
- String fragment = null;
- int hashPos = href.indexOf("#");
- if (hashPos >= 0) {
- uri = href.substring(0, hashPos);
- fragment = href.substring(hashPos+1);
- }
-
- String result = null;
-
- try {
- result = catalog.resolveURI(href);
- } catch (Exception e) {
- // nop;
- }
-
- if (result == null) {
- try {
- URL url = null;
-
- if (base==null) {
- url = new URL(uri);
- result = url.toString();
- } else {
- URL baseURL = new URL(base);
- url = (href.length()==0 ? baseURL : new URL(baseURL, uri));
- result = url.toString();
- }
- } catch (java.net.MalformedURLException mue) {
- // try to make an absolute URI from the current base
- String absBase = makeAbsolute(base);
- if (!absBase.equals(base)) {
- // don't bother if the absBase isn't different!
- return resolve(href, absBase);
- } else {
- throw new TransformerException("Malformed URL "
- + href + "(base " + base + ")",
- mue);
- }
- }
- }
-
- catalogManager.debug.message(2, "Resolved URI", href, result);
-
- SAXSource source = new SAXSource();
- source.setInputSource(new InputSource(result));
- setEntityResolver(source);
- return source;
- }
-
- /**
- * <p>Establish an entityResolver for newly resolved URIs.</p>
- *
- * <p>This is called from the URIResolver to set an EntityResolver
- * on the SAX parser to be used for new XML documents that are
- * encountered as a result of the document() function, xsl:import,
- * or xsl:include. This is done because the XSLT processor calls
- * out to the SAXParserFactory itself to create a new SAXParser to
- * parse the new document. The new parser does not automatically
- * inherit the EntityResolver of the original (although arguably
- * it should). See below:</p>
- *
- * <tt>"If an application wants to set the ErrorHandler or
- * EntityResolver for an XMLReader used during a transformation,
- * it should use a URIResolver to return the SAXSource which
- * provides (with getXMLReader) a reference to the XMLReader"</tt>
- *
- * <p>...quoted from page 118 of the Java API for XML
- * Processing 1.1 specification</p>
- *
- */
- private void setEntityResolver(SAXSource source) throws TransformerException {
- XMLReader reader = source.getXMLReader();
- if (reader == null) {
- SAXParserFactory spFactory = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spFactory.setNamespaceAware(true);
- try {
- reader = spFactory.newSAXParser().getXMLReader();
- }
- catch (ParserConfigurationException ex) {
- throw new TransformerException(ex);
- }
- catch (SAXException ex) {
- throw new TransformerException(ex);
- }
- }
- reader.setEntityResolver(this);
- source.setXMLReader(reader);
- }
-
- /** Attempt to construct an absolute URI */
- private String makeAbsolute(String uri) {
- if (uri == null) {
- uri = "";
- }
-
- try {
- URL url = new URL(uri);
- return url.toString();
- } catch (MalformedURLException mue) {
- try {
- URL fileURL = FileURL.makeURL(uri);
- return fileURL.toString();
- } catch (MalformedURLException mue2) {
- // bail
- return uri;
- }
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,434 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Locale;
-
-import org.xml.sax.Parser;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.AttributeList;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.SAXParser;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
-/**
- * A SAX Parser that performs catalog-based entity resolution.
- *
- * <p>This class implements a SAX Parser that performs entity resolution
- * using the CatalogResolver. The actual, underlying parser is obtained
- * from a SAXParserFactory.</p>
- * </p>
- *
- * @deprecated This interface has been replaced by the
- * {@link com.sun.org.apache.xml.internal.resolver.tools.ResolvingXMLReader} for SAX2.
- * @see CatalogResolver
- * @see org.xml.sax.Parser
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public class ResolvingParser
- implements Parser, DTDHandler, DocumentHandler, EntityResolver {
-
- /** Suppress explanatory message?
- *
- * @see #parse(InputSource)
- */
- private static final boolean suppressExplanation = false;
-
- /** The underlying parser. */
- private SAXParser saxParser = null;
-
- /** The underlying reader. */
- private Parser parser = null;
-
- /** The underlying DocumentHandler. */
- private DocumentHandler documentHandler = null;
-
- /** The underlying DTDHandler. */
- private DTDHandler dtdHandler = null;
-
- /** The manager for the underlying resolver. */
- private CatalogManager catalogManager = CatalogManager.getStaticManager();
-
- /** The underlying catalog resolver. */
- private CatalogResolver catalogResolver = null;
-
- /** A separate resolver for oasis-xml-pi catalogs. */
- private CatalogResolver piCatalogResolver = null;
-
- /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
- private boolean allowXMLCatalogPI = false;
-
- /** The base URI of the input document, if known. */
- private URL baseURL = null;
-
- /** Constructor. */
- public ResolvingParser() {
- initParser();
- }
-
- /** Constructor. */
- public ResolvingParser(CatalogManager manager) {
- catalogManager = manager;
- initParser();
- }
-
- /** Initialize the parser. */
- private void initParser() {
- catalogResolver = new CatalogResolver(catalogManager);
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(true);
- spf.setValidating(false);
-
- try {
- saxParser = spf.newSAXParser();
- parser = saxParser.getParser();
- documentHandler = null;
- dtdHandler = null;
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- /** Return the Catalog being used. */
- public Catalog getCatalog() {
- return catalogResolver.getCatalog();
- }
-
- /**
- * SAX Parser API.
- *
- * <p>Note that the JAXP 1.1ea2 parser crashes with an InternalError if
- * it encounters a system identifier that appears to be a relative URI
- * that begins with a slash. For example, the declaration:</p>
- *
- * <pre>
- * <!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd">
- * </pre>
- *
- * <p>would cause such an error. As a convenience, this method catches
- * that error and prints an explanation. (Unfortunately, it's not possible
- * to identify the particular system identifier that causes the problem.)
- * </p>
- *
- * <p>The underlying error is forwarded after printing the explanatory
- * message. The message is only every printed once and if
- * <code>suppressExplanation</code> is set to <code>false</code> before
- * parsing, it will never be printed.</p>
- */
- public void parse(InputSource input)
- throws IOException,
- SAXException {
- setupParse(input.getSystemId());
- try {
- parser.parse(input);
- } catch (InternalError ie) {
- explain(input.getSystemId());
- throw ie;
- }
- }
-
- /** SAX Parser API.
- *
- * @see #parse(InputSource)
- */
- public void parse(String systemId)
- throws IOException,
- SAXException {
- setupParse(systemId);
- try {
- parser.parse(systemId);
- } catch (InternalError ie) {
- explain(systemId);
- throw ie;
- }
- }
-
- /** SAX Parser API. */
- public void setDocumentHandler(DocumentHandler handler) {
- documentHandler = handler;
- }
-
- /** SAX Parser API. */
- public void setDTDHandler(DTDHandler handler) {
- dtdHandler = handler;
- }
-
- /**
- * SAX Parser API.
- *
- * <p>The purpose of this class is to implement an entity resolver.
- * Attempting to set a different one is pointless (and ignored).</p>
- */
- public void setEntityResolver(EntityResolver resolver) {
- // nop
- }
-
- /** SAX Parser API. */
- public void setErrorHandler(ErrorHandler handler) {
- parser.setErrorHandler(handler);
- }
-
- /** SAX Parser API. */
- public void setLocale(Locale locale) throws SAXException {
- parser.setLocale(locale);
- }
-
- /** SAX DocumentHandler API. */
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- if (documentHandler != null) {
- documentHandler.characters(ch,start,length);
- }
- }
-
- /** SAX DocumentHandler API. */
- public void endDocument() throws SAXException {
- if (documentHandler != null) {
- documentHandler.endDocument();
- }
- }
-
- /** SAX DocumentHandler API. */
- public void endElement(String name) throws SAXException {
- if (documentHandler != null) {
- documentHandler.endElement(name);
- }
- }
-
- /** SAX DocumentHandler API. */
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
- if (documentHandler != null) {
- documentHandler.ignorableWhitespace(ch,start,length);
- }
- }
-
- /** SAX DocumentHandler API. */
- public void processingInstruction(String target, String pidata)
- throws SAXException {
-
- if (target.equals("oasis-xml-catalog")) {
- URL catalog = null;
- String data = pidata;
-
- int pos = data.indexOf("catalog=");
- if (pos >= 0) {
- data = data.substring(pos+8);
- if (data.length() > 1) {
- String quote = data.substring(0,1);
- data = data.substring(1);
- pos = data.indexOf(quote);
- if (pos >= 0) {
- data = data.substring(0, pos);
- try {
- if (baseURL != null) {
- catalog = new URL(baseURL, data);
- } else {
- catalog = new URL(data);
- }
- } catch (MalformedURLException mue) {
- // nevermind
- }
- }
- }
- }
-
- if (allowXMLCatalogPI) {
- if (catalogManager.getAllowOasisXMLCatalogPI()) {
- catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata);
-
- if (catalog != null) {
- try {
- catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
-
- if (piCatalogResolver == null) {
- piCatalogResolver = new CatalogResolver(true);
- }
-
- piCatalogResolver.getCatalog().parseCatalog(catalog.toString());
- } catch (Exception e) {
- catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: "
- + catalog.toString());
- }
- } else {
- catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata);
- }
- } else {
- catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata);
- }
- } else {
- catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: "
- + pidata);
- }
- } else {
- if (documentHandler != null) {
- documentHandler.processingInstruction(target, pidata);
- }
- }
- }
-
- /** SAX DocumentHandler API. */
- public void setDocumentLocator(Locator locator) {
- if (documentHandler != null) {
- documentHandler.setDocumentLocator(locator);
- }
- }
-
- /** SAX DocumentHandler API. */
- public void startDocument() throws SAXException {
- if (documentHandler != null) {
- documentHandler.startDocument();
- }
- }
-
- /** SAX DocumentHandler API. */
- public void startElement(String name, AttributeList atts)
- throws SAXException {
- allowXMLCatalogPI = false;
- if (documentHandler != null) {
- documentHandler.startElement(name,atts);
- }
- }
-
- /** SAX DTDHandler API. */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException {
- allowXMLCatalogPI = false;
- if (dtdHandler != null) {
- dtdHandler.notationDecl(name,publicId,systemId);
- }
- }
-
- /** SAX DTDHandler API. */
- public void unparsedEntityDecl (String name,
- String publicId,
- String systemId,
- String notationName)
- throws SAXException {
- allowXMLCatalogPI = false;
- if (dtdHandler != null) {
- dtdHandler.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
- }
-
- /**
- * Implements the <code>resolveEntity</code> method
- * for the SAX interface, using an underlying CatalogResolver
- * to do the real work.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- allowXMLCatalogPI = false;
- String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
- if (resolved == null && piCatalogResolver != null) {
- resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /** Setup for parsing. */
- private void setupParse(String systemId) {
- allowXMLCatalogPI = true;
- parser.setEntityResolver(this);
- parser.setDocumentHandler(this);
- parser.setDTDHandler(this);
-
- URL cwd = null;
-
- try {
- cwd = FileURL.makeURL("basename");
- } catch (MalformedURLException mue) {
- cwd = null;
- }
-
- try {
- baseURL = new URL(systemId);
- } catch (MalformedURLException mue) {
- if (cwd != null) {
- try {
- baseURL = new URL(cwd, systemId);
- } catch (MalformedURLException mue2) {
- // give up
- baseURL = null;
- }
- } else {
- // give up
- baseURL = null;
- }
- }
- }
-
- /** Provide one possible explanation for an InternalError. */
- private void explain(String systemId) {
- if (!suppressExplanation) {
- System.out.println("Parser probably encountered bad URI in " + systemId);
- System.out.println("For example, replace '/some/uri' with 'file:/some/uri'.");
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-import com.sun.org.apache.xml.internal.resolver.Catalog;
-import com.sun.org.apache.xml.internal.resolver.CatalogManager;
-
-import com.sun.org.apache.xml.internal.resolver.helpers.FileURL;
-
-/**
- * A SAX XMLFilter that performs catalog-based entity resolution.
- *
- * <p>This class implements a SAX XMLFilter that performs entity resolution
- * using the CatalogResolver. The actual, underlying parser is obtained
- * from a SAXParserFactory.</p>
- * </p>
- *
- * @see CatalogResolver
- * @see org.xml.sax.XMLFilter
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public class ResolvingXMLFilter extends XMLFilterImpl {
- /**
- * Suppress explanatory message?
- *
- * @see #parse(InputSource)
- */
- private static boolean suppressExplanation = false;
-
- /** The manager for the underlying resolver. */
- CatalogManager catalogManager = CatalogManager.getStaticManager();
-
- /** The underlying catalog resolver. */
- private CatalogResolver catalogResolver = null;
-
- /** A separate resolver for oasis-xml-pi catalogs. */
- private CatalogResolver piCatalogResolver = null;
-
- /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
- private boolean allowXMLCatalogPI = false;
-
- /** The base URI of the input document, if known. */
- private URL baseURL = null;
-
- /** Construct an empty XML Filter with no parent. */
- public ResolvingXMLFilter() {
- super();
- catalogResolver = new CatalogResolver(catalogManager);
- }
-
- /** Construct an XML filter with the specified parent. */
- public ResolvingXMLFilter(XMLReader parent) {
- super(parent);
- catalogResolver = new CatalogResolver(catalogManager);
- }
-
- /** Construct an XML filter with the specified parent. */
- public ResolvingXMLFilter(CatalogManager manager) {
- super();
- catalogManager = manager;
- catalogResolver = new CatalogResolver(catalogManager);
- }
-
- /** Construct an XML filter with the specified parent. */
- public ResolvingXMLFilter(XMLReader parent, CatalogManager manager) {
- super(parent);
- catalogManager = manager;
- catalogResolver = new CatalogResolver(catalogManager);
- }
-
- /**
- * Provide accessto the underlying Catalog.
- */
- public Catalog getCatalog() {
- return catalogResolver.getCatalog();
- }
-
- /**
- * SAX XMLReader API.
- *
- * <p>Note that the JAXP 1.1ea2 parser crashes with an InternalError if
- * it encounters a system identifier that appears to be a relative URI
- * that begins with a slash. For example, the declaration:</p>
- *
- * <pre>
- * <!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd">
- * </pre>
- *
- * <p>would cause such an error. As a convenience, this method catches
- * that error and prints an explanation. (Unfortunately, it's not possible
- * to identify the particular system identifier that causes the problem.)
- * </p>
- *
- * <p>The underlying error is forwarded after printing the explanatory
- * message. The message is only every printed once and if
- * <code>suppressExplanation</code> is set to <code>false</code> before
- * parsing, it will never be printed.</p>
- */
- public void parse(InputSource input)
- throws IOException, SAXException {
- allowXMLCatalogPI = true;
-
- setupBaseURI(input.getSystemId());
-
- try {
- super.parse(input);
- } catch (InternalError ie) {
- explain(input.getSystemId());
- throw ie;
- }
- }
-
- /** SAX XMLReader API.
- *
- * @see #parse(InputSource)
- */
- public void parse(String systemId)
- throws IOException, SAXException {
- allowXMLCatalogPI = true;
-
- setupBaseURI(systemId);
-
- try {
- super.parse(systemId);
- } catch (InternalError ie) {
- explain(systemId);
- throw ie;
- }
- }
-
- /**
- * Implements the <code>resolveEntity</code> method
- * for the SAX interface, using an underlying CatalogResolver
- * to do the real work.
- */
- public InputSource resolveEntity (String publicId, String systemId) {
- allowXMLCatalogPI = false;
- String resolved = catalogResolver.getResolvedEntity(publicId, systemId);
-
- if (resolved == null && piCatalogResolver != null) {
- resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
- }
-
- if (resolved != null) {
- try {
- InputSource iSource = new InputSource(resolved);
- iSource.setPublicId(publicId);
-
- // Ideally this method would not attempt to open the
- // InputStream, but there is a bug (in Xerces, at least)
- // that causes the parser to mistakenly open the wrong
- // system identifier if the returned InputSource does
- // not have a byteStream.
- //
- // It could be argued that we still shouldn't do this here,
- // but since the purpose of calling the entityResolver is
- // almost certainly to open the input stream, it seems to
- // do little harm.
- //
- URL url = new URL(resolved);
- InputStream iStream = url.openStream();
- iSource.setByteStream(iStream);
-
- return iSource;
- } catch (Exception e) {
- catalogManager.debug.message(1,
- "Failed to create InputSource ("
- + e.toString()
- + ")", resolved);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /** SAX DTDHandler API.
- *
- * <p>Captured here only to detect the end of the prolog so that
- * we can ignore subsequent oasis-xml-catalog PIs. Otherwise
- * the events are just passed through.</p>
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException {
- allowXMLCatalogPI = false;
- super.notationDecl(name,publicId,systemId);
- }
-
- /** SAX DTDHandler API.
- *
- * <p>Captured here only to detect the end of the prolog so that
- * we can ignore subsequent oasis-xml-catalog PIs. Otherwise
- * the events are just passed through.</p>
- */
- public void unparsedEntityDecl (String name,
- String publicId,
- String systemId,
- String notationName)
- throws SAXException {
- allowXMLCatalogPI = false;
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
- /** SAX ContentHandler API.
- *
- * <p>Captured here only to detect the end of the prolog so that
- * we can ignore subsequent oasis-xml-catalog PIs. Otherwise
- * the events are just passed through.</p>
- */
- public void startElement (String uri, String localName, String qName,
- Attributes atts)
- throws SAXException {
- allowXMLCatalogPI = false;
- super.startElement(uri,localName,qName,atts);
- }
-
- /** SAX ContentHandler API.
- *
- * <p>Detect and use the oasis-xml-catalog PI if it occurs.</p>
- */
- public void processingInstruction(String target, String pidata)
- throws SAXException {
- if (target.equals("oasis-xml-catalog")) {
- URL catalog = null;
- String data = pidata;
-
- int pos = data.indexOf("catalog=");
- if (pos >= 0) {
- data = data.substring(pos+8);
- if (data.length() > 1) {
- String quote = data.substring(0,1);
- data = data.substring(1);
- pos = data.indexOf(quote);
- if (pos >= 0) {
- data = data.substring(0, pos);
- try {
- if (baseURL != null) {
- catalog = new URL(baseURL, data);
- } else {
- catalog = new URL(data);
- }
- } catch (MalformedURLException mue) {
- // nevermind
- }
- }
- }
- }
-
- if (allowXMLCatalogPI) {
- if (catalogManager.getAllowOasisXMLCatalogPI()) {
- catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata);
-
- if (catalog != null) {
- try {
- catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
-
- if (piCatalogResolver == null) {
- piCatalogResolver = new CatalogResolver(true);
- }
-
- piCatalogResolver.getCatalog().parseCatalog(catalog.toString());
- } catch (Exception e) {
- catalogManager.debug.message(3, "Exception parsing oasis-xml-catalog: "
- + catalog.toString());
- }
- } else {
- catalogManager.debug.message(3, "PI oasis-xml-catalog unparseable: " + pidata);
- }
- } else {
- catalogManager.debug.message(4,"PI oasis-xml-catalog ignored: " + pidata);
- }
- } else {
- catalogManager.debug.message(3, "PI oasis-xml-catalog occurred in an invalid place: "
- + pidata);
- }
- } else {
- super.processingInstruction(target, pidata);
- }
- }
-
- /** Save the base URI of the document being parsed. */
- private void setupBaseURI(String systemId) {
- URL cwd = null;
-
- try {
- cwd = FileURL.makeURL("basename");
- } catch (MalformedURLException mue) {
- cwd = null;
- }
-
- try {
- baseURL = new URL(systemId);
- } catch (MalformedURLException mue) {
- if (cwd != null) {
- try {
- baseURL = new URL(cwd, systemId);
- } catch (MalformedURLException mue2) {
- // give up
- baseURL = null;
- }
- } else {
- // give up
- baseURL = null;
- }
- }
- }
-
- /** Provide one possible explanation for an InternalError. */
- private void explain(String systemId) {
- if (!suppressExplanation) {
- System.out.println("XMLReader probably encountered bad URI in " + systemId);
- System.out.println("For example, replace '/some/uri' with 'file:/some/uri'.");
- }
- suppressExplanation = true;
- }
-}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLReader.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.sun.org.apache.xml.internal.resolver.tools;
-
-
-import javax.xml.parsers.*;
-
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.sun.org.apache.xml.internal.resolver.*;
-
-/**
- * A SAX XMLReader that performs catalog-based entity resolution.
- *
- * <p>This class implements a SAX XMLReader that performs entity resolution
- * using the CatalogResolver. The actual, underlying parser is obtained
- * from a SAXParserFactory.</p>
- * </p>
- *
- * @see CatalogResolver
- * @see org.xml.sax.XMLReader
- *
- * @author Norman Walsh
- * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
- *
- * @version 1.0
- */
-public class ResolvingXMLReader extends ResolvingXMLFilter {
- /** Make the parser Namespace aware? */
- private static final boolean namespaceAware = true;
-
- /** Make the parser validating? */
- private static final boolean validating = false;
-
- /**
- * Construct a new reader from the JAXP factory.
- *
- * <p>In order to do its job, a ResolvingXMLReader must in fact be
- * a filter. So the only difference between this code and the filter
- * code is that the constructor builds a new reader.</p>
- */
- public ResolvingXMLReader() {
- super();
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(namespaceAware);
- spf.setValidating(validating);
- try {
- SAXParser parser = spf.newSAXParser();
- setParent(parser.getXMLReader());
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- /**
- * Construct a new reader from the JAXP factory.
- *
- * <p>In order to do its job, a ResolvingXMLReader must in fact be
- * a filter. So the only difference between this code and the filter
- * code is that the constructor builds a new reader.</p>
- */
- public ResolvingXMLReader(CatalogManager manager) {
- super(manager);
- SAXParserFactory spf = catalogManager.useServicesMechanism() ?
- SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
- spf.setNamespaceAware(namespaceAware);
- spf.setValidating(validating);
- try {
- SAXParser parser = spf.newSAXParser();
- setParent(parser.getXMLReader());
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-}
--- a/jaxp/src/java.xml/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jaxp/src/java.xml/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,6 +27,17 @@
* Defines the Java API for XML Processing (JAXP), the Streaming API for XML (StAX),
* the Simple API for XML (SAX), and the W3C Document Object Model (DOM) API.
*
+ * @uses javax.xml.datatype.DatatypeFactory
+ * @uses javax.xml.parsers.DocumentBuilderFactory
+ * @uses javax.xml.parsers.SAXParserFactory
+ * @uses javax.xml.stream.XMLEventFactory
+ * @uses javax.xml.stream.XMLInputFactory
+ * @uses javax.xml.stream.XMLOutputFactory
+ * @uses javax.xml.transform.TransformerFactory
+ * @uses javax.xml.validation.SchemaFactory
+ * @uses javax.xml.xpath.XPathFactory
+ * @uses org.xml.sax.XMLReader
+ *
* @moduleGraph
* @since 9
*/
@@ -56,6 +67,7 @@
exports org.xml.sax;
exports org.xml.sax.ext;
exports org.xml.sax.helpers;
+
exports com.sun.org.apache.xml.internal.dtm to
java.xml.crypto;
exports com.sun.org.apache.xml.internal.utils to
@@ -70,8 +82,7 @@
java.xml.crypto;
exports com.sun.org.apache.xpath.internal.res to
java.xml.crypto;
- // reflection access from com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory
- exports com.sun.xml.internal.stream.writers to java.xml.ws;
+
uses javax.xml.datatype.DatatypeFactory;
uses javax.xml.parsers.DocumentBuilderFactory;
uses javax.xml.parsers.SAXParserFactory;
--- a/jaxp/src/jdk.xml.dom/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jaxp/src/jdk.xml.dom/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -32,6 +32,7 @@
*/
module jdk.xml.dom {
requires transitive java.xml;
+
exports org.w3c.dom.css;
exports org.w3c.dom.html;
exports org.w3c.dom.stylesheets;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/css/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 Style Specification. Refer to the
+ * <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>
+ * Document Object Model (DOM) Level 2 Style Specification</a>,
+ * the CSS and stylesheets modules define the Document Object Model Level 2 Style
+ * Sheets and Cascading Style Sheets (CSS) that allow programs and scripts to
+ * dynamically access and update the content of style sheets documents.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.css;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/html/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 HTML Specification. Refer to the
+ * <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>
+ * Document Object Model (DOM) Level 2 Specification</a>,
+ * the HTML module extends the Core API to describe objects and methods specific
+ * to HTML documents that comply with
+ * <a href='https://www.w3.org/TR/1998/REC-html40-19980424/'>
+ * HTML 4.0 Specification</a>.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.html;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/stylesheets/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 2 Style Specification. Refer to the
+ * <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>
+ * Document Object Model (DOM) Level 2 Style Specification</a>,
+ * the CSS and stylesheets modules define the Document Object Model Level 2 Style
+ * Sheets and Cascading Style Sheets (CSS) that allow programs and scripts to
+ * dynamically access and update the content of style sheets documents.
+ *
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.stylesheets;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/jdk.xml.dom/share/classes/org/w3c/dom/xpath/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides interfaces for DOM Level 3 XPath Specification. The XPath module
+ * provides simple functionalities to access a DOM tree using
+ * <a href='https://www.w3.org/TR/1999/REC-xpath-19991116/'>XPath 1.0</a>.
+ * <p>
+ * The interfaces and classes in this package came from
+ * Document Object Model (DOM) Level 3 XPath Specification,
+ * Working Draft 20 August 2002. Refer to
+ * <a href='https://www.w3.org/TR/DOM-Level-3-XPath/'>
+ * Document Object Model (DOM) Level 3 XPath Specification, Version 1.0,
+ * W3C Working Group Note 26 February 2004</a> except that the values of
+ * {@link XPathException#INVALID_EXPRESSION_ERR} and {@link XPathException#TYPE_ERR}
+ * are 1 and 2 respectively (instead of 51 and 52).
+ *
+ * @since 1.4
+ */
+
+package org.w3c.dom.xpath;
--- a/jdk/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -428,3 +428,7 @@
0ff9ad7d067cd4fa14450cf208bf019175a0aaba jdk-9+172
7c54889c0ec649ee04643e5cace434623d0dc667 jdk-10+11
a5506b425f1bf91530d8417b57360e5d89328c0c jdk-9+173
+42f18c931bd4fae5c206ccf6d8e591e4c4e69d31 jdk-9+174
+5f504872a75b71f2fb19299f0d1e3395cf32eaa0 jdk-10+12
+e6c4f6ef717d104dba880e2dae538690c993b46f jdk-9+175
+4540d6376f3ef22305cca546f85f9b2ce9a210c4 jdk-10+13
--- a/jdk/.jcheck/conf Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/.jcheck/conf Thu Aug 24 16:24:44 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/jdk/make/ModuleTools.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/make/ModuleTools.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -49,7 +49,4 @@
--add-exports java.base/jdk.internal.module=ALL-UNNAMED \
build.tools.jigsaw.AddPackagesAttribute
-TOOL_GEN_DOCS_BUNDLE_PAGE := $(BUILD_JAVA) -esa -ea -cp $(TOOLS_CLASSES_DIR) \
- build.tools.docs.GenDocsBundlePage
-
endif # _MODULE_TOOLS_GMK
--- a/jdk/make/copy/Copy-java.desktop.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/make/copy/Copy-java.desktop.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -77,6 +77,13 @@
endif
TARGETS += $(FREETYPE_TARGET_LIB)
+
+ $(eval $(call SetupCopyFiles, COPY_FREETYPE_LICENSE, \
+ FILES := $(FREETYPE_LICENSE), \
+ DEST := $(LEGAL_DST_DIR), \
+ ))
+
+ TARGETS += $(COPY_FREETYPE_LICENSE)
endif
################################################################################
--- a/jdk/make/mapfiles/libjava/mapfile-vers Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Thu Aug 24 16:24:44 2017 +0200
@@ -278,7 +278,6 @@
Java_java_lang_Module_addExports0;
Java_java_lang_Module_addExportsToAll0;
Java_java_lang_Module_addExportsToAllUnnamed0;
- Java_java_lang_Module_addPackage0;
Java_jdk_internal_loader_BootLoader_getSystemPackageLocation;
Java_jdk_internal_loader_BootLoader_getSystemPackageNames;
--- a/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package build.tools.docs;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReference;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-import static java.util.stream.Collectors.*;
-
-/**
- * Build tool to generate the docs bundle index page.
- */
-public class GenDocsBundlePage {
- private static String DOCS_BUNDLE_PAGE = "docs-bundle-page.html";
- private static String MODULE_GROUPS_PROPS = "docs-module-groups.properties";
-
- private static String USAGE =
- "GenDocsBundlePage --output <file path> --title <title>" +
- " [--template <template>]";
-
- public static void main(String... args) throws IOException {
- String title = null;
- Path outputfile = null;
- Path template = null;
- for (int i=0; i < args.length; i++) {
- String option = args[i];
- if (option.equals("--output")) {
- outputfile = Paths.get(getArgument(args, option, ++i));
- } else if (option.equals("--title")) {
- title = getArgument(args, option, ++i);
- } else if (option.equals("--template")) {
- template = Paths.get(getArgument(args, option, ++i));
- } else if (option.startsWith("-")) {
- throw new IllegalArgumentException("Invalid option: " + option);
- }
- }
-
- if (outputfile == null) {
- System.err.println("ERROR: must specify --output option");
- System.exit(1);
- }
- if (title == null) {
- System.err.println("ERROR: must specify --title option");
- System.exit(1);
- }
-
- try (InputStream is = readTemplate(template);
- BufferedReader reader = new BufferedReader(new InputStreamReader(is)))
- {
- new GenDocsBundlePage(title, outputfile).run(reader);
- }
- }
-
- private static String getArgument(String[] args, String option, int index) {
- if (index < args.length) {
- return args[index];
- }
- throw new IllegalArgumentException("Argument must be specified for " + option);
- }
-
- private static InputStream readTemplate(Path template) throws IOException {
- if (template != null) {
- return Files.newInputStream(template);
- } else {
- return GenDocsBundlePage.class.getResourceAsStream(DOCS_BUNDLE_PAGE);
- }
- }
-
- private static final String HEADER_TITLE = "@HEADER_TITLE@";
-
-
- final Path outputfile;
- final String title;
- final Map<String, Set<ModuleDescriptor>> moduleGroups = new HashMap<>();
- GenDocsBundlePage(String title, Path outputfile) throws IOException
- {
- this.outputfile = outputfile;
- this.title = title;
-
- // read module groups
- ModuleFinder finder = ModuleFinder.ofSystem();
- try (InputStream in = GenDocsBundlePage.class.getResourceAsStream(MODULE_GROUPS_PROPS)) {
- Properties props = new Properties();
- props.load(in);
- for (String key: props.stringPropertyNames()) {
- Set<ModuleDescriptor> mods =
- Stream.of(props.getProperty(key).split("\\s+"))
- .map(String::trim)
- .flatMap(mn -> finder.find(mn).stream())
- .map(ModuleReference::descriptor)
- .collect(toSet());
-
- String name = "@" + key.toUpperCase(Locale.ENGLISH) + "@";
- moduleGroups.put(name, mods);
- };
- }
- }
-
- void run(BufferedReader reader) throws IOException {
- if (Files.notExists(outputfile.getParent())) {
- Files.createDirectories(outputfile.getParent());
- }
- try (BufferedWriter bw = Files.newBufferedWriter(outputfile, StandardCharsets.UTF_8);
- PrintWriter writer = new PrintWriter(bw)) {
- reader.lines().map(this::genOutputLine)
- .forEach(writer::println);
- }
- }
-
- String genOutputLine(String line) {
- if (line.contains(HEADER_TITLE)) {
- line = line.replace(HEADER_TITLE, title);
- }
- int i = line.indexOf('@');
- int j = line.indexOf('@', i+1);
- if (i >= 0 && i < j) {
- String name = line.substring(i, j+1);
- if (moduleGroups.containsKey(name)) {
- line = line.replace(name, formatModuleGroup(name));
- }
- }
- return line;
- }
-
- String toHRef(ModuleDescriptor md) {
- String mn = md.name();
- String formattedName;
- if (hasExportedAPIs(md)) {
- // has exported APIs
- formattedName = mn;
- } else if (!md.provides().isEmpty()) {
- // a provider
- formattedName = "<i>" + mn + "</i>";
- } else {
- // a tool
- formattedName = "<i>" + mn + "</i>";
- }
- return String.format("<a href=\"api/%s-summary.html\">%s</a>",
- mn, formattedName);
- }
-
- String formatModuleGroup(String groupName) {
- StringBuilder sb = new StringBuilder();
- // organize in Java SE, JDK, JavaFX, JCP groups
- Set<ModuleDescriptor> modules = moduleGroups.get(groupName);
- Arrays.stream(ModuleGroup.values())
- .forEach(g -> {
- Set<ModuleDescriptor> mods = modules.stream()
- .filter(md -> g.predicate.test(md.name()))
- .collect(toSet());
- if (!mods.isEmpty()) {
- sb.append("<div class=" + g.cssClass + ">\n");
- // modules with exported API
- mods.stream()
- .filter(this::hasExportedAPIs)
- .sorted(Comparator.comparing(ModuleDescriptor::name))
- .map(this::toHRef)
- .forEach(m -> sb.append(m).append("\n"));
-
- // tools and providers
- mods.stream()
- .filter(md -> !hasExportedAPIs(md))
- .sorted(Comparator.comparing(ModuleDescriptor::name))
- .map(this::toHRef)
- .forEach(m -> sb.append(m).append("\n"));
- sb.append("</div>");
- }
- });
- return sb.toString();
- }
-
- private boolean hasExportedAPIs(ModuleDescriptor md) {
- if (md.exports().stream().anyMatch(e -> !e.isQualified())) {
- return true;
- }
- // this should check if any indirect exports
- // checking requires transitive would be sufficient for JDK modules
- if (md.requires().stream()
- .map(ModuleDescriptor.Requires::modifiers)
- .anyMatch(mods -> mods.contains(ModuleDescriptor.Requires.Modifier.TRANSITIVE))) {
- return true;
- }
- return false;
- }
-
- private static final Set<String> NON_JAVA_SE_MODULES =
- Set.of("java.jnlp", "java.smartcardio");
-
- /**
- * CSS class names are defined in docs-bundle-page.html
- */
- enum ModuleGroup {
- JAVA_SE("javase", mn -> mn.startsWith("java.") && !NON_JAVA_SE_MODULES.contains(mn)),
- JDK("jdk", mn -> mn.startsWith("jdk.")),
- JAVAFX("javafx", mn -> mn.startsWith("javafx.")),
- NON_JAVA_SE("jcp", NON_JAVA_SE_MODULES::contains);
-
- final String cssClass;
- final Predicate<String> predicate;
- ModuleGroup(String cssClass, Predicate<String> predicate) {
- this.cssClass = cssClass;
- this.predicate = predicate;
- }
- }
-}
--- a/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-<!--
-Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation. Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
-<title>@HEADER_TITLE@</title>
-
-<meta http-equiv="content-type" content="text/html;" charset="utf-8">
-<link rel="stylesheet" href="resources/jdk-default.css" type="text/css" />
-<style type="text/css">
-
-table a { text-decoration: none }
-table { border: none }
-th, td { border: 2px solid white; }
-thead th { background-color: #DDD }
-tbody th { background-color: #EEE }
-
-table div.javase, ul.key span.javase { background-color: #C6E7F3 }
-table div.jdk, ul.key span.jdk { background-color: #ECE1C5 }
-table div.javafx, ul.key span.javafx { background-color: #ECEDCC }
-table div.jcp, ul.key span.jcp { background-color: #E9E9E9 }
-td div { padding: 3px 5px; color: blue }
-table tbody td div a { padding: 0 .5em; margin: 0: 1em; }
-table tbody td div a:link { color: black }
-table tbody td div a:visited { color: black }
-table tbody td div a[href]:hover { color: black; text-decoration: underline }
-td { padding: 0 }
-table tbody td div a { padding: 0 .5em; margin: 0: 1em }
-
-.key { font-size: smaller; }
-ul.key li { display:inline-block; padding: 0 1em }
-ul.key span {
- border: 1px solid black;
- font-family: DejaVu Sans Mono, monospace;
-}
-ul.key span:before { content: " " }
-ul.key span:after { content: " " }
-
-caption {
- text-align: center;
-}
-
-tr:nth-child(even), tr:nth-child(even) th[scope=row] {
- background-color: #EEE;
-}
-tr:nth-child(odd), tr:nth-child(odd) th[scope=row] {
- background-color: #EEE;
-}
-
-</style>
-</head>
-
-<h1>@HEADER_TITLE@</h1>
-
-<ul>
-<li><a href="api/index.html">JDK API Specification</a></li>
-<li><a href="https://docs.oracle.com/javase/specs/">
- Java Language and Virtual Machine Specifications</a></li>
-<li><a href="https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=tools_reference_overview">
- Tools Reference</a></li>
-</ul>
-
-
-<table>
-<caption style="display:none">JDK Modules</caption>
-<thead>
-<tr>
- <th scope="col">Group</th>
- <th scope="col">Modules</th>
-</tr>
-</thead>
-<tbody>
-<tr>
- <th scope="row">Foundation</th>
- <td>@JAVA_BASE@</td>
-</tr>
-<tr>
- <th scope="row">Integration</th>
- <td>@INTEGRATION_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">User Interface</th>
- <td>@UI_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Compilation</th>
- <td>@COMPILER_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Scripting</th>
- <td>@SCRIPTING_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Security</th>
- <td>@SECURITY_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Management</th>
- <td>@MANAGEMENT_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Instrumentation</th>
- <td>@INSTRUMENT_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Serviceability</th>
- <td>@SVC_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Packaging</th>
- <td>@PACKAGING_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Incubator</th>
- <td>@INCUBATOR_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Non-Java SE</th>
- <td>@OTHER_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Java EE</th>
- <td>@JAVA_EE_MODULES@</td>
-</tr>
-<tr>
- <th scope="row">Aggregator</th>
- <td>@AGGREGATOR_MODULES@</td>
-</tr>
-</tbody>
-</table>
-
-<p class="key">Key:
-<ul class="key">
-<li><span class="javase"> </span> Java SE
-<li><span class="jdk"> </span> JDK
-<li><span class="javafx"> </span> JavaFX
-<li><span class="jcp"> </span> Non-Java SE
-<li><i>italic</i> No Exported API (e.g. a tool or provider)</li>
-</ul>
-
-<p>
-<hr>
-<a href="legal/cpyr.html">Copyright</a> © 1993, 2017, Oracle and/or its affiliates. All rights reserved.</p>
-
-</body>
-</html>
-
-
--- a/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-# Module Grouping for the docs bundle page
-#
-
-java_base=\
-java.base
-
-java_ee_modules=\
-java.activation \
-java.corba \
-java.transaction \
-java.xml.bind \
-java.xml.ws \
-java.xml.ws.annotation
-
-aggregator_modules=\
-java.se \
-java.se.ee
-
-security_modules=\
-java.security.jgss \
-java.security.sasl \
-java.xml.crypto \
-jdk.security.auth \
-jdk.security.jgss \
-jdk.crypto.cryptoki \
-jdk.crypto.ec \
-jdk.crypto.mscapi \
-jdk.crypto.ucrypto \
-jdk.policytool
-
-instrument_modules=\
-java.instrument
-
-management_modules=\
-java.management \
-java.management.rmi \
-jdk.management \
-jdk.management.agent \
-jdk.management.cmm \
-jdk.management.jfr \
-jdk.management.resource \
-jdk.snmp \
-jdk.jconsole
-
-integration_modules=\
-java.logging \
-java.naming \
-java.prefs \
-java.rmi \
-java.sql \
-java.sql.rowset \
-java.xml \
-jdk.charsets \
-jdk.localedata \
-jdk.net \
-jdk.sctp \
-jdk.jsobject \
-jdk.httpserver \
-jdk.naming.dns \
-jdk.naming.rmi \
-jdk.xml.dom \
-jdk.zipfs
-
-ui_modules=\
-java.datatransfer \
-java.desktop \
-javafx.base \
-javafx.controls \
-javafx.fxml \
-javafx.graphics \
-javafx.media \
-javafx.swing \
-javafx.web \
-jdk.accessibility
-
-svc_modules=\
-jdk.jfr \
-jdk.attach \
-jdk.jcmd \
-jdk.jdi \
-jdk.jdwp.agent \
-jdk.jstatd \
-jdk.hotspot.agent
-
-packaging_modules=\
-jdk.jartool \
-jdk.jlink \
-jdk.pack \
-jdk.packager.services
-
-compiler_modules=\
-java.compiler \
-jdk.compiler \
-jdk.javadoc \
-jdk.jdeps \
-jdk.editpad \
-jdk.jshell \
-jdk.rmic
-
-scripting_modules=\
-java.scripting \
-jdk.dynalink \
-jdk.scripting.nashorn \
-jdk.scripting.nashorn.shell
-
-other_modules=\
-java.jnlp \
-java.smartcardio
-
-incubator_modules=\
-jdk.incubator.httpclient
-
--- a/jdk/make/src/classes/build/tools/jigsaw/technology-summary.html Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/make/src/classes/build/tools/jigsaw/technology-summary.html Thu Aug 24 16:24:44 2017 +0200
@@ -1,625 +1,534 @@
<html>
<head>
-<title>JDK Technology Summary</title>
+<title>JCP Technologies in JDK 9</title>
<style type="text/css">
table { border: 1px solid black; border-collapse: collapse; }
-tr.se-base { background-color: bisque; }
-tr.se-misc { background-color: lavender; }
-tr.se-ee { background-color: lightgreen; }
+tr.se-base { background-color: yellow; }
+tr.se-misc { background-color: bisque; }
+tr.se-ee { background-color: sandybrown; }
tr.se-ext { background-color: pink; }
-td { font-family: monospace; padding: 4px; border: 1px solid; }
+tr.non-se { background-color: lightsteelblue; }
+td { font-family: monospace; padding: 5px; border: 1px solid; }
+td.agg { background-color: lightgray; }
</style>
</head>
-<h1>JCP Technologies in the Modular JDK</h1>
+<h1>JCP Technologies in JDK 9</h1>
-<p><em>Last updated 2015-03-06 (Added java.datatransfer. Assumes JNLP is modularized, and StAX joins the Java SE Platform.)</em></p>
+<p><em>Last updated 2017-06-08</em></p>
-<p><a href="module-summary.html">JDK Module Summary</a> | Technologies in the <a href="https://docs.oracle.com/javase/8/docs/">Java SE Documentation</a></p>
+<p><a href="module-summary.html">JDK 9 Module Summary</a> | Technologies in the <a href="https://docs.oracle.com/javase/8/docs/">Java SE 8 Documentation</a></p>
<table>
<tr><th>Legend</th></tr>
<tr class="se-base"><td><a href="https://jcp.org/en/jsr/platform?listBy=2&listByType=platform">JCP technology in the Java SE Platform only -- in java.base</a></td></tr>
<tr class="se-misc"><td><a href="https://jcp.org/en/jsr/platform?listBy=2&listByType=platform">JCP technology in the Java SE Platform only -- not in java.base</a></td></tr>
-<tr class="se-ee"><td><a href="https://jcp.org/en/jsr/platform?listBy=3&listByType=platform">JCP technology in the Java SE Platform and the Java EE Platform</a></a></td></tr>
-<tr class="se-ext"><td><a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#endorsed-standards-apis">JCP technology in the Java SE Platform based on non-JCP standards</a></a></td></tr>
-<tr><td>JCP technology in neither the Java SE or EE Platforms</td></tr>
+<tr class="se-ee"><td><a href="https://jcp.org/en/jsr/platform?listBy=3&listByType=platform">JCP technology in the Java SE Platform derived from the Java EE Platform</a></a></td></tr>
+<tr class="se-ext"><td><a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#endorsed-standards-apis">JCP technology in the Java SE Platform derived from non-JCP standards</a></a></td></tr>
+<tr class="non-se"><td>JCP technology in neither the Java SE or EE Platforms</td></tr>
</table>
-<p><em>An <strong>upgradeable</strong> module contains JCP technology that is in the Java SE Platform but is not exclusive to the Java SE Platform, i.e., the green and pink technologies. Most upgradeable modules are defined by loaders other than the bootstrap.</em></p>
-
<br/>
<table>
<tr>
+<th>JSR</th>
<th>Technology</th>
-<th>Original JSR</th>
-<th><a href="https://jcp.org/en/procedures/jcp2#DEF">Original Target</a></th>
+<th><a href="https://jcp.org/en/procedures/jcp2_10#3.3.1.2">Evolved By</a></th>
<th>Module</th>
-<th><a href="https://jcp.org/en/procedures/jcp2#2.1.2">Evolved By</a></th>
-<th>History</th>
-<th>Profile/SE</th>
<th>Loader</th>
<th>Upg?</th>
+<th>Notes</th>
+<th>Aggregator</th>
</tr>
-<tr class="se-misc">
-<td>JMX</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=3">3</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.management">java.management</a></td>
+<tr class="se-base">
+<td>---</td>
+<td>Collections, Concurrency, <br/> Core Reflection, I18N, I/O, <br/> JAAS, JCA, JSSE, Math, Net, Text</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
+<td><a href="module-summary.html#java.base"/>java.base</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
+<td class="agg" rowspan=37><a href="module-summary.html#java.se"/>java.se</a></td>
</tr>
<tr class="se-misc">
-<td>Print Service</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=6">6</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.desktop">java.desktop</a></td>
+<td>---</td>
+<td>A11Y, Applet, AWT, Beans, <br/> Image I/O, Java 2D, <br/> Print, Sound, Swing</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>SE</td>
+<td><a href="module-summary.html#java.desktop"/>java.desktop</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>Preferences</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=10">10</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.prefs">java.prefs</a></td>
+<td>---</td>
+<td>Data Transfer</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
+<td><a href="module-summary.html#java.datatransfer"/>java.datatransfer</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>Image I/O</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=15">15</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.desktop">java.desktop</a></td>
+<td>---</td>
+<td>JNDI</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>SE</td>
+<td><a href="module-summary.html#java.naming"/>java.naming</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>SASL</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=28">28</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.security.sasl"/>java.security.sasl</a></td>
+<td>---</td>
+<td>RMI</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
+<td><a href="module-summary.html#java.rmi"/>java.rmi</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=3">3</a></td>
+<td>JMX</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.management">java.management</a></td>
+<td>boot</td>
+<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>Logging</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=47">47</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.logging">java.logging</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=6">6</a></td>
+<td>Print Service</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
+<td><a href="module-summary.html#java.desktop">java.desktop</a></td>
<td>boot</td>
<td>No</td>
-</tr>
-
-<tr class="se-base">
-<td>NIO</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=51">51</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
<td></td>
-<td>1</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr>
-<td>JNLP</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=56">56</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.desktop">java.jnlp</a></td>
-<td>Original JSR</td>
-<td></td>
-<td>N/A</td>
-<td>boot</td>
-<td>No</td>
</tr>
<tr class="se-misc">
-<td>Beans Persistence</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=57">57</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.desktop">java.desktop</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=10">10</a></td>
+<td>Preferences</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>SE</td>
+<td><a href="module-summary.html#java.prefs">java.prefs</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>GSS</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=72">72</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.security.jgss">java.security.jgss</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=15">15</a></td>
+<td>Image I/O</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
+<td><a href="module-summary.html#java.desktop">java.desktop</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=28">28</a></td>
+<td>SASL</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.security.sasl"/>java.security.sasl</a></td>
+<td>boot</td>
+<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>XML Digital Signature</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=105">105</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.xml.crypto">java.xml.crypto</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=47">47</a></td>
+<td>Logging</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>JDBC Rowset</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=114">114</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.sql.rowset">java.sql.rowset</a></td>
-<td>Original JSR</td>
-<td>Co-evolved with JDBC</td>
-<td>3</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>JMX Remote</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=160">160</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.management">java.management</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
+<td><a href="module-summary.html#java.logging">java.logging</a></td>
<td>boot</td>
<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>Profiling (Agent)</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=163">163</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.instrument">java.instrument</a></td>
-<td>UJSR for Java SE</td>
<td></td>
-<td>3</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>Profiling (JMX)</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=163">163</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.management">java.management</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-base">
-<td>Concurrency Utilities</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=166">166</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
-<td>boot</td>
-<td>No</td>
</tr>
<tr class="se-base">
-<td>Annotations</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=175">175</a></td>
-<td>Java SE</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=51">51</a></td>
+<td>NIO</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
+<td></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=57">57</a></td>
+<td>Beans Persistence</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.desktop">java.desktop</a></td>
+<td>boot</td>
+<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>StAX</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=173">173</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.xml">java.xml</a></td>
-<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>2</td>
-<td>boot</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=72">72</a></td>
+<td>GSS</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.security.jgss">java.security.jgss</a></td>
+<td>plat</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>Annotations (Language Model)</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=175">175</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.compiler"/>java.compiler</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=105">105</a></td>
+<td>XML Digital Signature</td>
<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.xml.crypto">java.xml.crypto</a></td>
+<td>plat</td>
+<td>No</td>
<td></td>
-<td>3</td>
-<td>boot</td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=114">114</a></td>
+<td>JDBC Rowset</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.sql.rowset">java.sql.rowset</a></td>
+<td>plat</td>
<td>No</td>
+<td>Co-developed with JDBC</td>
</tr>
<tr class="se-misc">
-<td>Compiler</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=199">199</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.compiler">java.compiler</a></td>
-<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>3</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=160">160</a></td>
+<td>JMX Remote</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.management">java.management</a></td>
+<td>boot</td>
+<td>No</td>
+<td></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=160">160</a></td>
+<td>JMX Remote (RMI)</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.management.rmi">java.management.rmi</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
+</tr>
+
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=163">163</a></td>
+<td>Instrumentation</td> <!-- Profiling (Agent) -->
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.instrument">java.instrument</a></td>
+<td>boot</td>
+<td>No</td>
+<td>Co-developed with JVMTI</td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=163">163</a></td>
+<td>Monitoring & Management</td> <!-- Profiling (JMX) -->
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.management">java.management</a></td>
+<td>boot</td>
+<td>No</td>
+<td></td>
</tr>
<tr class="se-base">
-<td>Pack200</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=200">200</a></td>
-<td>Java SE</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=166">166</a></td>
+<td>Concurrency Utilities</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
+<td></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=173">173</a></td>
+<td>StAX</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.xml">java.xml</a></td>
+<td>boot</td>
+<td>No</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
</tr>
<tr class="se-base">
-<td>NIO.2</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=203">203</a></td>
-<td>Java SE</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=175">175</a></td>
+<td>Annotations (Core Reflection)</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>JAXP</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=206">206</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.xml">java.xml</a></td>
-<td>UJSR for Java SE</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>2</td>
-<td>boot</td>
-<td>No</td>
+<td></td>
</tr>
<tr class="se-misc">
-<td>JDBC</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=221">221</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.sql">java.sql</a></td>
-<td>Original JSR</td>
-<td>Co-evolved with JDBC Rowset</td>
-<td>2</td>
-<td>boot</td>
-<td>No</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=175">175</a></td>
+<td>Annotations (Language Model)</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.compiler"/>java.compiler</a></td>
+<td>plat</td>
+<td>Yes</td>
+<td>Co-located with a former Standalone Technology</td>
</tr>
<tr class="se-misc">
-<td>Scripting</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=223">223</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.scripting">java.scripting</a></td>
-<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>1</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr>
-<td>Smart Card I/O</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=268">268</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.smartcardio">java.smartcardio</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=199">199</a></td>
+<td>Compiler</td>
<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
-<td>N/A</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>Annotation Processing</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=269">269</a></td>
-<td>Java SE</td>
<td><a href="module-summary.html#java.compiler">java.compiler</a></td>
-<td>Original JSR</td>
+<td>plat</td>
+<td>Yes</td>
<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>3</td>
-<td>boot</td>
-<td>No</td>
</tr>
<tr class="se-base">
-<td>InvokeDynamic</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=292">292</a></td>
-<td>Java SE</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=200">200</a></td>
+<td>Pack200</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-base">
-<td>Type Annotations</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=308">308</a></td>
-<td>Java SE</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=203">203</a></td>
+<td>NIO.2</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
+<td></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=206">206</a></td>
+<td>JAXP</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.xml">java.xml</a></td>
+<td>boot</td>
+<td>No</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
</tr>
<tr class="se-misc">
-<td>Type Annotations (Language Model)</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=308">308</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.compiler"/>java.compiler</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
-<td>boot</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=221">221</a></td>
+<td>JDBC</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.sql">java.sql</a></td>
+<td>plat</td>
<td>No</td>
+<td>Co-developed with JDBC Rowset</td>
</tr>
-<tr class="se-base">
-<td>Date and Time</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=310">310</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.base"/>java.base</a></td>
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=223">223</a></td>
+<td>Scripting</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
-<td>boot</td>
+<td><a href="module-summary.html#java.scripting">java.scripting</a></td>
+<td>plat</td>
<td>No</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
+</tr>
+
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=269">269</a></td>
+<td>Annotation Processing</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.compiler">java.compiler</a></td>
+<td>plat</td>
+<td>Yes</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
</tr>
<tr class="se-base">
-<td>Streams</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=335">335</a></td>
-<td>Java SE</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=292">292</a></td>
+<td>InvokeDynamic</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
<tr class="se-base">
-<td>Collections, Math, I18N, I/O, Net, Reflection</td>
-<td>---</td>
-<td>---</td>
+<td><a href="https://jcp.org/en/jsr/detail?id=308">308</a></td>
+<td>Type Annotations (Core Reflection)</td>
+<td>UJSR for Java SE</td>
<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>1</td>
<td>boot</td>
<td>No</td>
-</tr>
-
-<tr class="se-base">
-<td>JCA, JAAS, JSSE</td>
-<td>---</td>
-<td>---</td>
-<td><a href="module-summary.html#java.base"/>java.base</a></td>
-<td>UJSR for Java SE</td>
<td></td>
-<td>1</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>Applet, AWT, Swing, Java 2D, Beans, A11Y, Sound</td>
-<td>---</td>
-<td>---</td>
-<td><a href="module-summary.html#java.desktop"/>java.desktop</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>SE</td>
-<td>boot</td>
-<td>No</td>
</tr>
<tr class="se-misc">
-<td>Data Transfer</td>
-<td>---</td>
-<td>---</td>
-<td><a href="module-summary.html#java.datatransfer"/>java.datatransfer</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=308">308</a></td>
+<td>Type Annotations (Language Model)</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>SE</td>
-<td>boot</td>
-<td>No</td>
-</tr>
-
-<tr class="se-misc">
-<td>JNDI</td>
-<td>---</td>
-<td>---</td>
-<td><a href="module-summary.html#java.naming"/>java.naming</a></td>
-<td>UJSR for Java SE</td>
-<td></td>
-<td>3</td>
-<td>boot</td>
-<td>No</td>
+<td><a href="module-summary.html#java.compiler"/>java.compiler</a></td>
+<td>plat</td>
+<td>Yes</td>
+<td>Co-located with a former Standalone Technology</td>
</tr>
-<tr class="se-misc">
-<td>RMI</td>
-<td>---</td>
-<td>---</td>
-<td><a href="module-summary.html#java.rmi"/>java.rmi</a></td>
+<tr class="se-base">
+<td><a href="https://jcp.org/en/jsr/detail?id=310">310</a></td>
+<td>Date and Time</td>
<td>UJSR for Java SE</td>
-<td></td>
-<td>2</td>
+<td><a href="module-summary.html#java.base"/>java.base</a></td>
<td>boot</td>
<td>No</td>
+<td></td>
</tr>
-<tr class="se-misc">
-<td>JAF</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=925">925</a></td>
-<td>---</td>
-<td><a href="module-summary.html#java.activation">java.activation</a></a></td>
-<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
-<td>SE</td>
-<td>ext</td>
-<td>Yes</td>
+<tr class="se-base">
+<td><a href="https://jcp.org/en/jsr/detail?id=335">335</a></td>
+<td>Streams</td>
+<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.base"/>java.base</a></td>
+<td>boot</td>
+<td>No</td>
+<td></td>
</tr>
<tr class="se-ext">
-<td>RMI-IIOP, IDL</td>
-<td>(OMG)</td>
-<td>---</td>
-<td><a href="module-summary.html#java.corba"/>java.corba</a></td>
+<td>(W3C)</td>
+<td>DOM, SAX</td>
<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.xml">java.xml</a></td>
+<td>boot</td>
+<td>No</td>
<td>Formerly an <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#endorsed-standards-apis">Endorsed Standard</a></td>
-<td>SE</td>
-<td>ext</td>
-<td>Yes</td>
</tr>
<tr class="se-ext">
-<td>DOM, SAX</td>
-<td>(W3C)</td>
-<td>---</td>
-<td><a href="module-summary.html#java.xml">java.xml</a></td>
+<td>(OMG)</td>
+<td>RMI-IIOP, IDL</td>
<td>UJSR for Java SE</td>
+<td><a href="module-summary.html#java.corba"/>java.corba</a></td>
+<td>plat</td>
+<td>Yes</td>
<td>Formerly an <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#endorsed-standards-apis">Endorsed Standard</a></td>
-<td>2</td>
-<td>boot</td>
-<td>No</td>
+<td class="agg" rowspan=7><a href="module-summary.html#java.se.ee"/>java.se.ee</a></td>
+</tr>
+
+<tr class="se-ee">
+<td><a href="https://jcp.org/en/jsr/detail?id=67">67</a></td>
+<td>SAAJ</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.xml.ws">java.xml.ws</a></td>
+<td>plat</td>
+<td>Yes</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (f.k.a. JAXM)</td>
+</tr>
+
+<tr class="se-ee">
+<td><a href="https://jcp.org/en/jsr/detail?id=181">181</a></td>
+<td>Web Services Metadata</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.xml.ws">java.xml.ws</a></td>
+<td>plat</td>
+<td>Yes</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
</tr>
<tr class="se-ee">
-<td>SAAJ</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=67">67</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.xml.ws">java.xml.ws</a></td>
-<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (f.k.a. JAXM)</td>
-<td>SE</td>
-<td>ext</td>
-<td>Yes</td>
-</tr>
-
-<tr class="se-ee">
-<td>Web Services Metadata</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=181">181</a></td>
-<td>Java EE</td>
-<td><a href="module-summary.html#java.xml.ws">java.xml.ws</a></td>
+<td><a href="https://jcp.org/en/jsr/detail?id=222">222</a></td>
+<td>JAXB</td>
<td>Original JSR</td>
-<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
-<td>SE</td>
-<td>ext</td>
+<td><a href="module-summary.html#java.xml.bind">java.xml.bind</a></td>
+<td>plat</td>
<td>Yes</td>
-</tr>
-
-<tr class="se-ee">
-<td>JAXB</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=222">222</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.xml.bind">java.xml.bind</a></td>
-<td>Original JSR</td>
<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>SE</td>
-<td>ext</td>
-<td>Yes</td>
</tr>
<tr class="se-ee">
+<td><a href="https://jcp.org/en/jsr/detail?id=224">224</a></td>
<td>JAXWS</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=224">224</a></td>
-<td>Java SE</td>
-<td><a href="module-summary.html#java.xml.ws">java.xml.ws</a></td>
<td>Original JSR</td>
+<td><a href="module-summary.html#java.xml.ws">java.xml.ws</a></td>
+<td>plat</td>
+<td>Yes</td>
<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a></td>
-<td>SE</td>
-<td>ext</td>
-<td>Yes</td>
</tr>
-<!-- Alex: The Java SE Platform incorporates a cutdown version of the javax.annotation package from the Java EE Platform. -->
+<!-- The Java SE Platform incorporates a smaller version of the javax.annotation package than the Java EE Platform. -->
<tr class="se-ee">
+<td><a href="https://jcp.org/en/jsr/detail?id=250">250</a></td>
<td>Common Annotations</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=250">250</a></td>
-<td>Java SE,EE</td>
+<td>Original JSR</td>
<td><a href="module-summary.html#java.xml.ws.annotation">java.xml.ws.annotation</a></td>
-<td>Original JSR</td>
+<td>plat</td>
+<td>Yes</td>
<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
-<td>SE</td>
-<td>ext</td>
+</tr>
+
+<!-- The Java SE Platform incorporates a smaller version of the javax.transaction package than the Java EE Platform. -->
+<tr class="se-ee">
+<td><a href="https://jcp.org/en/jsr/detail?id=907">907</a></td>
+<td>JTA (non-XA)</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.transaction">java.transaction</a></td>
+<td>plat</td>
<td>Yes</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
</tr>
-<!-- Alex: The Java SE Platform incorporates a cutdown version of the javax.transaction package from the Java EE Platform. -->
+<!-- The Java SE Platform incorporates the same version of the javax.transaction.xa package as the Java EE Platform. -->
<tr class="se-ee">
-<td>JTA (non-XA)</td>
<td><a href="https://jcp.org/en/jsr/detail?id=907">907</a></td>
-<td>---</td>
-<td><a href="module-summary.html#java.transaction">java.transaction</a></td>
+<td>JTA (XA)</td>
<td>Original JSR</td>
+<td><a href="module-summary.html#java.sql"/>java.sql</a></td>
+<td>plat</td>
+<td>No</td>
<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
-<td>SE</td>
-<td>ext</td>
-<td>Yes</td>
+<td class="agg"><a href="module-summary.html#java.se"/>java.se</a></td>
</tr>
-<!-- Alex: The Java SE Platform incorporates the same version of the javax.transaction.xa package as the Java EE Platform. -->
-<tr class="se-ee">
-<td>JTA (XA)</td>
-<td><a href="https://jcp.org/en/jsr/detail?id=907">907</a></td>
-<td>---</td>
-<td><a href="module-summary.html#java.sql"/>java.sql</a></td>
+<tr class="se-misc">
+<td><a href="https://jcp.org/en/jsr/detail?id=925">925</a></td>
+<td>JAF</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.activation">java.activation</a></a></td>
+<td>plat</td>
+<td>Yes</td>
+<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
+<td class="agg"><a href="module-summary.html#java.se.ee"/>java.se.ee</a></td>
+</tr>
+
+<tr class="non-se">
+<td><a href="https://jcp.org/en/jsr/detail?id=56">56</a></td>
+<td>JNLP</td>
<td>Original JSR</td>
+<td><a href="module-summary.html#java.desktop">java.jnlp</a></td>
+<td>plat</td>
+<td>Yes</td>
+<td></td>
+<td class="agg" rowspan=2>None</td>
+</tr>
+
+<tr class="non-se">
+<td><a href="https://jcp.org/en/jsr/detail?id=268">268</a></td>
+<td>Smart Card I/O</td>
+<td>Original JSR</td>
+<td><a href="module-summary.html#java.smartcardio">java.smartcardio</a></td>
+<td>plat</td>
+<td>No</td>
<td>Formerly a <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/standards/#standalone-technologies">Standalone Technology</a> (unlisted)</td>
-<td>2</td>
-<td>boot</td>
-<td>No</td>
</tr>
</table>
--- a/jdk/make/src/classes/build/tools/taglet/ExtLink.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/make/src/classes/build/tools/taglet/ExtLink.java Thu Aug 24 16:24:44 2017 +0200
@@ -58,7 +58,7 @@
static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=";
- static final Pattern TAG_PATTERN = Pattern.compile("(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)");
+ static final Pattern TAG_PATTERN = Pattern.compile("(?s)(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)$");
/**
* Returns the set of locations in which the tag may be used.
--- a/jdk/make/test/JtregNative.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/make/test/JtregNative.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -42,12 +42,22 @@
# Add more directories here when needed.
BUILD_JDK_JTREG_NATIVE_SRC := \
$(JDK_TOPDIR)/test/native_sanity \
+ $(JDK_TOPDIR)/test/java/lang/String/nativeEncoding \
#
BUILD_JDK_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/jdk/jtreg/native
BUILD_JDK_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/jdk/jtreg
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ WIN_LIB_JAVA := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
+ BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := $(WIN_LIB_JAVA)
+else ifeq ($(OPENJDK_TARGET_OS), solaris)
+ BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava -lc
+else
+ BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava
+endif
+
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_LIBRARIES, \
TYPE := LIBRARY, \
SOURCE_DIRS := $(BUILD_JDK_JTREG_NATIVE_SRC), \
--- a/jdk/src/java.base/share/classes/java/io/File.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/io/File.java Thu Aug 24 16:24:44 2017 +0200
@@ -916,23 +916,28 @@
* Returns the time that the file denoted by this abstract pathname was
* last modified.
*
+ * @apiNote
+ * While the unit of time of the return value is milliseconds, the
+ * granularity of the value depends on the underlying file system and may
+ * be larger. For example, some file systems use time stamps in units of
+ * seconds.
+ *
* <p> Where it is required to distinguish an I/O exception from the case
* where {@code 0L} is returned, or where several attributes of the
* same file are required at the same time, or where the time of last
* access or the creation time are required, then the {@link
* java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
- * Files.readAttributes} method may be used.
- *
- * @apiNote
- * While the unit of time of the return value is milliseconds,
- * the granularity of the value depends on the underlying
- * file system and may be larger. For example, some
- * file systems use time stamps in units of seconds.
+ * Files.readAttributes} method may be used. If however only the
+ * time of last modification is required, then the
+ * {@link java.nio.file.Files#getLastModifiedTime(Path,LinkOption[])
+ * Files.getLastModifiedTime} method may be used instead.
*
* @return A <code>long</code> value representing the time the file was
* last modified, measured in milliseconds since the epoch
* (00:00:00 GMT, January 1, 1970), or <code>0L</code> if the
- * file does not exist or if an I/O error occurs
+ * file does not exist or if an I/O error occurs. The value may
+ * be negative indicating the number of milliseconds before the
+ * epoch
*
* @throws SecurityException
* If a security manager exists and its {@link
--- a/jdk/src/java.base/share/classes/java/lang/Class.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java Thu Aug 24 16:24:44 2017 +0200
@@ -50,6 +50,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -2067,25 +2068,6 @@
}
/**
- * Returns a {@code Method} object that reflects the specified public
- * member method of the class or interface represented by this
- * {@code Class} object.
- *
- * @param name the name of the method
- * @param parameterTypes the list of parameters
- * @return the {@code Method} object that matches the specified
- * {@code name} and {@code parameterTypes}; {@code null}
- * if the method is not found or the name is
- * "<init>"or "<clinit>".
- */
- Method getMethodOrNull(String name, Class<?>... parameterTypes) {
- Objects.requireNonNull(name);
- Method method = getMethod0(name, parameterTypes);
- return method == null ? null : getReflectionFactory().copyMethod(method);
- }
-
-
- /**
* Returns a {@code Constructor} object that reflects the specified
* public constructor of the class represented by this {@code Class}
* object. The {@code parameterTypes} parameter is an array of
@@ -2225,7 +2207,6 @@
/**
- *
* Returns an array containing {@code Method} objects reflecting all the
* declared methods of the class or interface represented by this {@code
* Class} object, including public, protected, default (package)
@@ -2453,6 +2434,30 @@
return getReflectionFactory().copyMethod(method);
}
+ /**
+ * Returns the list of {@code Method} objects for the declared public
+ * methods of this class or interface that have the specified method name
+ * and parameter types.
+ *
+ * @param name the name of the method
+ * @param parameterTypes the parameter array
+ * @return the list of {@code Method} objects for the public methods of
+ * this class matching the specified name and parameters
+ */
+ List<Method> getDeclaredPublicMethods(String name, Class<?>... parameterTypes) {
+ Method[] methods = privateGetDeclaredMethods(/* publicOnly */ true);
+ ReflectionFactory factory = getReflectionFactory();
+ List<Method> result = new ArrayList<>();
+ for (Method method : methods) {
+ if (method.getName().equals(name)
+ && Arrays.equals(
+ factory.getExecutableSharedParameterTypes(method),
+ parameterTypes)) {
+ result.add(factory.copyMethod(method));
+ }
+ }
+ return result;
+ }
/**
* Returns a {@code Constructor} object that reflects the specified
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Thu Aug 24 16:24:44 2017 +0200
@@ -93,12 +93,20 @@
* <p> Class loaders may typically be used by security managers to indicate
* security domains.
*
+ * <p> In addition to loading classes, a class loader is also responsible for
+ * locating resources. A resource is some data (a "{@code .class}" file,
+ * configuration data, or an image for example) that is identified with an
+ * abstract '/'-separated path name. Resources are typically packaged with an
+ * application or library so that they can be located by code in the
+ * application or library. In some cases, the resources are included so that
+ * they can be located by other libraries.
+ *
* <p> The {@code ClassLoader} class uses a delegation model to search for
* classes and resources. Each instance of {@code ClassLoader} has an
- * associated parent class loader. When requested to find a class or
- * resource, a {@code ClassLoader} instance will delegate the search for the
- * class or resource to its parent class loader before attempting to find the
- * class or resource itself.
+ * associated parent class loader. When requested to find a class or
+ * resource, a {@code ClassLoader} instance will usually delegate the search
+ * for the class or resource to its parent class loader before attempting to
+ * find the class or resource itself.
*
* <p> Class loaders that support concurrent loading of classes are known as
* <em>{@linkplain #isRegisteredAsParallelCapable() parallel capable}</em> class
@@ -129,11 +137,13 @@
* classes and JDK-specific run-time classes that are defined by the
* platform class loader or its ancestors.
* <p> To allow for upgrading/overriding of modules defined to the platform
- * class loader, and where classes in the upgraded version link to
- * classes in modules defined to the application class loader, the
- * platform class loader may delegate to the application class loader.
- * In other words, classes in named modules defined to the application
- * class loader may be visible to the platform class loader. </li>
+ * class loader, and where upgraded modules read modules defined to class
+ * loaders other than the platform class loader and its ancestors, then
+ * the platform class loader may have to delegate to other class loaders,
+ * the application class loader for example.
+ * In other words, classes in named modules defined to class loaders
+ * other than the platform class loader and its ancestors may be visible
+ * to the platform class loader. </li>
* <li><p>{@linkplain #getSystemClassLoader() System class loader}.
* It is also known as <em>application class loader</em> and is distinct
* from the platform class loader.
@@ -498,7 +508,7 @@
*
* <li><p> Invoke the {@link #loadClass(String) loadClass} method
* on the parent class loader. If the parent is {@code null} the class
- * loader built-in to the virtual machine is used, instead. </p></li>
+ * loader built into the virtual machine is used, instead. </p></li>
*
* <li><p> Invoke the {@link #findClass(String)} method to find the
* class. </p></li>
@@ -681,8 +691,9 @@
* This method should be overridden by class loader implementations that
* follow the delegation model for loading classes, and will be invoked by
* the {@link #loadClass loadClass} method after checking the
- * parent class loader for the requested class. The default implementation
- * throws a {@code ClassNotFoundException}.
+ * parent class loader for the requested class.
+ *
+ * @implSpec The default implementation throws {@code ClassNotFoundException}.
*
* @param name
* The <a href="#name">binary name</a> of the class
@@ -1127,8 +1138,9 @@
putIfAbsent(pname, (certs == null? nocerts:certs));
}
if (pcerts != null && !compareCerts(pcerts, certs)) {
- throw new SecurityException("class \""+ name +
- "\"'s signer information does not match signer information of other classes in the same package");
+ throw new SecurityException("class \"" + name
+ + "\"'s signer information does not match signer information"
+ + " of other classes in the same package");
}
}
@@ -1329,12 +1341,7 @@
* that is independent of the location of the code.
*
* <p> The name of a resource is a '{@code /}'-separated path name that
- * identifies the resource.
- *
- * <p> This method will first search the parent class loader for the
- * resource; if the parent is {@code null} the path of the class loader
- * built-in to the virtual machine is searched. That failing, this method
- * will invoke {@link #findResource(String)} to find the resource. </p>
+ * identifies the resource. </p>
*
* <p> Resources in named modules are subject to the encapsulation rules
* specified by {@link Module#getResourceAsStream Module.getResourceAsStream}.
@@ -1344,6 +1351,11 @@
* opened} unconditionally (even if the caller of this method is in the
* same module as the resource). </p>
*
+ * @implSpec The default implementation will first search the parent class
+ * loader for the resource; if the parent is {@code null} the path of the
+ * class loader built into the virtual machine is searched. If not found,
+ * this method will invoke {@link #findResource(String)} to find the resource.
+ *
* @apiNote Where several modules are defined to the same class loader,
* and where more than one module contains a resource with the given name,
* then the ordering that modules are searched is not specified and may be
@@ -1387,10 +1399,7 @@
* that is independent of the location of the code.
*
* <p> The name of a resource is a {@code /}-separated path name that
- * identifies the resource.
- *
- * <p> The delegation order for searching is described in the documentation
- * for {@link #getResource(String)}. </p>
+ * identifies the resource. </p>
*
* <p> Resources in named modules are subject to the encapsulation rules
* specified by {@link Module#getResourceAsStream Module.getResourceAsStream}.
@@ -1398,7 +1407,15 @@
* name ending with "{@code .class}", this method will only find resources in
* packages of named modules when the package is {@link Module#isOpen(String)
* opened} unconditionally (even if the caller of this method is in the
- * same module as the resource).</p>
+ * same module as the resource). </p>
+ *
+ * @implSpec The default implementation will first search the parent class
+ * loader for the resource; if the parent is {@code null} the path of the
+ * class loader built into the virtual machine is searched. It then
+ * invokes {@link #findResources(String)} to find the resources with the
+ * name in this class loader. It returns an enumeration whose elements
+ * are the URLs found by searching the parent class loader followed by
+ * the elements found with {@code findResources}.
*
* @apiNote Where several modules are defined to the same class loader,
* and where more than one module contains a resource with the given name,
@@ -1424,8 +1441,6 @@
* If I/O errors occur
* @throws NullPointerException If {@code name} is {@code null}
*
- * @see #findResources(String)
- *
* @since 1.2
* @revised 9
* @spec JPMS
@@ -1453,9 +1468,6 @@
* <p> The name of a resource is a {@code /}-separated path name that
* identifies the resource.
*
- * <p> The search order is described in the documentation for {@link
- * #getResource(String)}.
- *
* <p> The resources will be located when the returned stream is evaluated.
* If the evaluation results in an {@code IOException} then the I/O
* exception is wrapped in an {@link UncheckedIOException} that is then
@@ -1469,6 +1481,10 @@
* opened} unconditionally (even if the caller of this method is in the
* same module as the resource). </p>
*
+ * @implSpec The default implementation invokes {@link #getResources(String)
+ * getResources} to find all the resources with the given name and returns
+ * a stream with the elements in the enumeration as the source.
+ *
* @apiNote When overriding this method it is recommended that an
* implementation ensures that any delegation is consistent with the {@link
* #getResource(java.lang.String) getResource(String)} method. This should
@@ -1486,8 +1502,6 @@
*
* @throws NullPointerException If {@code name} is {@code null}
*
- * @see #findResources(String)
- *
* @since 9
*/
public Stream<URL> resources(String name) {
@@ -1506,7 +1520,7 @@
/**
* Finds the resource with the given name. Class loader implementations
- * should override this method to specify where to find resources.
+ * should override this method.
*
* <p> For resources in named modules then the method must implement the
* rules for encapsulation specified in the {@code Module} {@link
@@ -1515,6 +1529,8 @@
* modules unless the package is {@link Module#isOpen(String) opened}
* unconditionally. </p>
*
+ * @implSpec The default implementation returns {@code null}.
+ *
* @param name
* The resource name
*
@@ -1535,8 +1551,7 @@
/**
* Returns an enumeration of {@link java.net.URL URL} objects
* representing all the resources with the given name. Class loader
- * implementations should override this method to specify where to load
- * resources from.
+ * implementations should override this method.
*
* <p> For resources in named modules then the method must implement the
* rules for encapsulation specified in the {@code Module} {@link
@@ -1545,6 +1560,9 @@
* modules unless the package is {@link Module#isOpen(String) opened}
* unconditionally. </p>
*
+ * @implSpec The default implementation returns an enumeration that
+ * contains no elements.
+ *
* @param name
* The resource name
*
@@ -1899,7 +1917,8 @@
// the system class loader is the built-in app class loader during startup
return getBuiltinAppClassLoader();
case 3:
- throw new InternalError("getSystemClassLoader should only be called after VM booted");
+ String msg = "getSystemClassLoader should only be called after VM booted";
+ throw new InternalError(msg);
case 4:
// system fully initialized
assert VM.isBooted() && scl != null;
@@ -2146,9 +2165,7 @@
* @revised 9
* @spec JPMS
*
- * @see <a href="../../../technotes/guides/jar/jar.html#versioning">
- * The JAR File Specification: Package Versioning</a>
- * @see <a href="../../../technotes/guides/jar/jar.html#sealing">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#sealing">
* The JAR File Specification: Package Sealing</a>
*/
protected Package definePackage(String name, String specTitle,
--- a/jdk/src/java.base/share/classes/java/lang/FdLibm.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/FdLibm.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -116,6 +116,10 @@
private static final double F = 0x1.9b6db6db6db6ep0; // 45/28 ~= 1.60714285714285720630e+00
private static final double G = 0x1.6db6db6db6db7p-2; // 5/14 ~= 3.57142857142857150787e-01
+ private Cbrt() {
+ throw new UnsupportedOperationException();
+ }
+
public static strictfp double compute(double x) {
double t = 0.0;
double sign;
@@ -195,6 +199,10 @@
public static final double TWO_MINUS_600 = 0x1.0p-600;
public static final double TWO_PLUS_600 = 0x1.0p+600;
+ private Hypot() {
+ throw new UnsupportedOperationException();
+ }
+
public static strictfp double compute(double x, double y) {
double a = Math.abs(x);
double b = Math.abs(y);
@@ -331,6 +339,10 @@
* representable.
*/
public static class Pow {
+ private Pow() {
+ throw new UnsupportedOperationException();
+ }
+
public static strictfp double compute(final double x, final double y) {
double z;
double r, s, t, u, v, w;
@@ -664,6 +676,10 @@
private static final double P4 = -0x1.bbd41c5d26bf1p-20; // -1.65339022054652515390e-06
private static final double P5 = 0x1.6376972bea4d0p-25; // 4.13813679705723846039e-08
+ private Exp() {
+ throw new UnsupportedOperationException();
+ }
+
// should be able to forgo strictfp due to controlled over/underflow
public static strictfp double compute(double x) {
double y;
--- a/jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java Thu Aug 24 16:24:44 2017 +0200
@@ -63,8 +63,8 @@
}
/**
- * Constructs a {@code FindException} with the given detail message
- * and cause.
+ * Constructs a {@code LayerInstantiationException} with the given detail
+ * message and cause.
*
* @param msg
* The detail message; can be {@code null}
@@ -74,6 +74,5 @@
public LayerInstantiationException(String msg, Throwable cause) {
super(msg, cause);
}
-
}
--- a/jdk/src/java.base/share/classes/java/lang/Module.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Module.java Thu Aug 24 16:24:44 2017 +0200
@@ -43,6 +43,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -55,8 +56,10 @@
import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.loader.BootLoader;
+import jdk.internal.loader.ClassLoaders;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
+import jdk.internal.module.IllegalAccessLogger;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.module.ServicesCatalog;
import jdk.internal.module.Resources;
@@ -162,7 +165,6 @@
}
-
/**
* Returns {@code true} if this module is a named module.
*
@@ -249,12 +251,10 @@
// special Module to mean "all unnamed modules"
private static final Module ALL_UNNAMED_MODULE = new Module(null);
+ private static final Set<Module> ALL_UNNAMED_MODULE_SET = Set.of(ALL_UNNAMED_MODULE);
// special Module to mean "everyone"
private static final Module EVERYONE_MODULE = new Module(null);
-
- // set contains EVERYONE_MODULE, used when a package is opened or
- // exported unconditionally
private static final Set<Module> EVERYONE_SET = Set.of(EVERYONE_MODULE);
@@ -534,12 +534,12 @@
return true;
// all packages are exported/open to self
- if (other == this && containsPackage(pn))
+ if (other == this && descriptor.packages().contains(pn))
return true;
// all packages in open and automatic modules are open
if (descriptor.isOpen() || descriptor.isAutomatic())
- return containsPackage(pn);
+ return descriptor.packages().contains(pn);
// exported/opened via module declaration/descriptor
if (isStaticallyExportedOrOpen(pn, other, open))
@@ -555,42 +555,48 @@
/**
* Returns {@code true} if this module exports or opens a package to
- * the given module via its module declaration.
+ * the given module via its module declaration or CLI options.
*/
private boolean isStaticallyExportedOrOpen(String pn, Module other, boolean open) {
- // package is open to everyone or <other>
+ // test if package is open to everyone or <other>
Map<String, Set<Module>> openPackages = this.openPackages;
- if (openPackages != null) {
- Set<Module> targets = openPackages.get(pn);
- if (targets != null) {
- if (targets.contains(EVERYONE_MODULE))
- return true;
- if (other != EVERYONE_MODULE && targets.contains(other))
- return true;
- }
+ if (openPackages != null && allows(openPackages.get(pn), other)) {
+ return true;
}
if (!open) {
- // package is exported to everyone or <other>
+ // test package is exported to everyone or <other>
Map<String, Set<Module>> exportedPackages = this.exportedPackages;
- if (exportedPackages != null) {
- Set<Module> targets = exportedPackages.get(pn);
- if (targets != null) {
- if (targets.contains(EVERYONE_MODULE))
- return true;
- if (other != EVERYONE_MODULE && targets.contains(other))
- return true;
- }
+ if (exportedPackages != null && allows(exportedPackages.get(pn), other)) {
+ return true;
}
}
return false;
}
+ /**
+ * Returns {@code true} if targets is non-null and contains EVERYONE_MODULE
+ * or the given module. Also returns true if the given module is an unnamed
+ * module and targets contains ALL_UNNAMED_MODULE.
+ */
+ private boolean allows(Set<Module> targets, Module module) {
+ if (targets != null) {
+ if (targets.contains(EVERYONE_MODULE))
+ return true;
+ if (module != EVERYONE_MODULE) {
+ if (targets.contains(module))
+ return true;
+ if (!module.isNamed() && targets.contains(ALL_UNNAMED_MODULE))
+ return true;
+ }
+ }
+ return false;
+ }
/**
- * Returns {@code true} if this module reflectively exports or opens given
- * package package to the given module.
+ * Returns {@code true} if this module reflectively exports or opens the
+ * given package to the given module.
*/
private boolean isReflectivelyExportedOrOpen(String pn, Module other, boolean open) {
// exported or open to all modules
@@ -632,6 +638,22 @@
return false;
}
+ /**
+ * Returns {@code true} if this module reflectively exports the
+ * given package to the given module.
+ */
+ boolean isReflectivelyExported(String pn, Module other) {
+ return isReflectivelyExportedOrOpen(pn, other, false);
+ }
+
+ /**
+ * Returns {@code true} if this module reflectively opens the
+ * given package to the given module.
+ */
+ boolean isReflectivelyOpened(String pn, Module other) {
+ return isReflectivelyExportedOrOpen(pn, other, true);
+ }
+
/**
* If the caller's module is this module then update this module to export
@@ -800,7 +822,7 @@
}
/**
- * Updates this module to export a package to all unnamed modules.
+ * Updates this module to open a package to all unnamed modules.
*
* @apiNote Used by the --add-opens command line option.
*/
@@ -808,7 +830,6 @@
implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, true, true);
}
-
/**
* Updates a module to export or open a module to another module.
*
@@ -825,12 +846,31 @@
if (!isNamed() || descriptor.isOpen() || descriptor.isAutomatic())
return;
- // nothing to do if already exported/open to other
- if (implIsExportedOrOpen(pn, other, open))
- return;
+ // check if the package is already exported/open to other
+ if (implIsExportedOrOpen(pn, other, open)) {
+
+ // if the package is exported/open for illegal access then we need
+ // to record that it has also been exported/opened reflectively so
+ // that the IllegalAccessLogger doesn't emit a warning.
+ boolean needToAdd = false;
+ if (!other.isNamed()) {
+ IllegalAccessLogger l = IllegalAccessLogger.illegalAccessLogger();
+ if (l != null) {
+ if (open) {
+ needToAdd = l.isOpenForIllegalAccess(this, pn);
+ } else {
+ needToAdd = l.isExportedForIllegalAccess(this, pn);
+ }
+ }
+ }
+ if (!needToAdd) {
+ // nothing to do
+ return;
+ }
+ }
// can only export a package in the module
- if (!containsPackage(pn)) {
+ if (!descriptor.packages().contains(pn)) {
throw new IllegalArgumentException("package " + pn
+ " not in contents");
}
@@ -850,7 +890,6 @@
Map<String, Boolean> map = reflectivelyExports
.computeIfAbsent(this, other,
(m1, m2) -> new ConcurrentHashMap<>());
-
if (open) {
map.put(pn, Boolean.TRUE); // may need to promote from FALSE to TRUE
} else {
@@ -858,6 +897,38 @@
}
}
+ /**
+ * Updates a module to open all packages returned by the given iterator to
+ * all unnamed modules.
+ *
+ * @apiNote Used during startup to open packages for illegal access.
+ */
+ void implAddOpensToAllUnnamed(Iterator<String> iterator) {
+ if (jdk.internal.misc.VM.isModuleSystemInited()) {
+ throw new IllegalStateException("Module system already initialized");
+ }
+
+ // replace this module's openPackages map with a new map that opens
+ // the packages to all unnamed modules.
+ Map<String, Set<Module>> openPackages = this.openPackages;
+ if (openPackages == null) {
+ openPackages = new HashMap<>();
+ } else {
+ openPackages = new HashMap<>(openPackages);
+ }
+ while (iterator.hasNext()) {
+ String pn = iterator.next();
+ Set<Module> prev = openPackages.putIfAbsent(pn, ALL_UNNAMED_MODULE_SET);
+ if (prev != null) {
+ prev.add(ALL_UNNAMED_MODULE);
+ }
+
+ // update VM to export the package
+ addExportsToAllUnnamed0(this, pn);
+ }
+ this.openPackages = openPackages;
+ }
+
// -- services --
@@ -947,19 +1018,6 @@
// -- packages --
- // Additional packages that are added to the module at run-time.
- private volatile Map<String, Boolean> extraPackages;
-
- private boolean containsPackage(String pn) {
- if (descriptor.packages().contains(pn))
- return true;
- Map<String, Boolean> extraPackages = this.extraPackages;
- if (extraPackages != null && extraPackages.containsKey(pn))
- return true;
- return false;
- }
-
-
/**
* Returns the set of package names for the packages in this module.
*
@@ -974,89 +1032,19 @@
*/
public Set<String> getPackages() {
if (isNamed()) {
-
- Set<String> packages = descriptor.packages();
- Map<String, Boolean> extraPackages = this.extraPackages;
- if (extraPackages == null) {
- return packages;
- } else {
- return Stream.concat(packages.stream(),
- extraPackages.keySet().stream())
- .collect(Collectors.toSet());
- }
-
+ return descriptor.packages();
} else {
// unnamed module
Stream<Package> packages;
if (loader == null) {
packages = BootLoader.packages();
} else {
- packages = SharedSecrets.getJavaLangAccess().packages(loader);
+ packages = loader.packages();
}
return packages.map(Package::getName).collect(Collectors.toSet());
}
}
- /**
- * Add a package to this module without notifying the VM.
- *
- * @apiNote This method is VM white-box testing.
- */
- void implAddPackageNoSync(String pn) {
- implAddPackage(pn.replace('/', '.'), false);
- }
-
- /**
- * Add a package to this module.
- *
- * If {@code syncVM} is {@code true} then the VM is notified. This method is
- * a no-op if this is an unnamed module or the module already contains the
- * package.
- *
- * @throws IllegalArgumentException if the package name is not legal
- * @throws IllegalStateException if the package is defined to another module
- */
- private void implAddPackage(String pn, boolean syncVM) {
- // no-op if unnamed module
- if (!isNamed())
- return;
-
- // no-op if module contains the package
- if (containsPackage(pn))
- return;
-
- // check package name is legal for named modules
- if (pn.isEmpty())
- throw new IllegalArgumentException("Cannot add <unnamed> package");
- for (int i=0; i<pn.length(); i++) {
- char c = pn.charAt(i);
- if (c == '/' || c == ';' || c == '[') {
- throw new IllegalArgumentException("Illegal character: " + c);
- }
- }
-
- // create extraPackages if needed
- Map<String, Boolean> extraPackages = this.extraPackages;
- if (extraPackages == null) {
- synchronized (this) {
- extraPackages = this.extraPackages;
- if (extraPackages == null)
- this.extraPackages = extraPackages = new ConcurrentHashMap<>();
- }
- }
-
- // update VM first in case it fails. This is a no-op if another thread
- // beats us to add the package first
- if (syncVM) {
- // throws IllegalStateException if defined to another module
- addPackage0(this, pn);
- if (descriptor.isOpen() || descriptor.isAutomatic()) {
- addExportsToAll0(this, pn);
- }
- }
- extraPackages.putIfAbsent(pn, Boolean.TRUE);
- }
-
// -- creating Module objects --
@@ -1075,18 +1063,22 @@
Map<String, Module> nameToModule = new HashMap<>();
Map<String, ClassLoader> moduleToLoader = new HashMap<>();
- boolean isBootLayer = (ModuleLayer.boot() == null);
Set<ClassLoader> loaders = new HashSet<>();
+ boolean hasPlatformModules = false;
// map each module to a class loader
for (ResolvedModule resolvedModule : cf.modules()) {
String name = resolvedModule.name();
ClassLoader loader = clf.apply(name);
- if (loader != null) {
- moduleToLoader.put(name, loader);
+ moduleToLoader.put(name, loader);
+ if (loader == null || loader == ClassLoaders.platformClassLoader()) {
+ if (!(clf instanceof ModuleLoaderMap.Mapper)) {
+ throw new IllegalArgumentException("loader can't be 'null'"
+ + " or the platform class loader");
+ }
+ hasPlatformModules = true;
+ } else {
loaders.add(loader);
- } else if (!(clf instanceof ModuleLoaderMap.Mapper)) {
- throw new IllegalArgumentException("loader can't be 'null'");
}
}
@@ -1098,7 +1090,7 @@
URI uri = mref.location().orElse(null);
ClassLoader loader = moduleToLoader.get(resolvedModule.name());
Module m;
- if (loader == null && isBootLayer && name.equals("java.base")) {
+ if (loader == null && name.equals("java.base")) {
// java.base is already defined to the VM
m = Object.class.getModule();
} else {
@@ -1157,8 +1149,12 @@
initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
}
- // register the modules in the boot layer
- if (isBootLayer) {
+ // if there are modules defined to the boot or platform class loaders
+ // then register the modules in the class loader's services catalog
+ if (hasPlatformModules) {
+ ClassLoader pcl = ClassLoaders.platformClassLoader();
+ ServicesCatalog bootCatalog = BootLoader.getServicesCatalog();
+ ServicesCatalog pclCatalog = ServicesCatalog.getServicesCatalog(pcl);
for (ResolvedModule resolvedModule : cf.modules()) {
ModuleReference mref = resolvedModule.reference();
ModuleDescriptor descriptor = mref.descriptor();
@@ -1166,13 +1162,11 @@
String name = descriptor.name();
Module m = nameToModule.get(name);
ClassLoader loader = moduleToLoader.get(name);
- ServicesCatalog catalog;
if (loader == null) {
- catalog = BootLoader.getServicesCatalog();
- } else {
- catalog = ServicesCatalog.getServicesCatalog(loader);
+ bootCatalog.register(m);
+ } else if (loader == pcl) {
+ pclCatalog.register(m);
}
- catalog.register(m);
}
}
}
@@ -1587,7 +1581,4 @@
// JVM_AddModuleExportsToAllUnnamed
private static native void addExportsToAllUnnamed0(Module from, String pn);
-
- // JVM_AddModulePackage
- private static native void addPackage0(Module m, String pn);
}
--- a/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java Thu Aug 24 16:24:44 2017 +0200
@@ -245,6 +245,32 @@
}
/**
+ * Updates module {@code source} in the layer to export a package to
+ * module {@code target}. This method is a no-op if {@code source}
+ * already exports the package to at least {@code target}.
+ *
+ * @param source
+ * The source module
+ * @param pn
+ * The package name
+ * @param target
+ * The target module
+ *
+ * @return This controller
+ *
+ * @throws IllegalArgumentException
+ * If {@code source} is not in the module layer or the package
+ * is not in the source module
+ *
+ * @see Module#addExports
+ */
+ public Controller addExports(Module source, String pn, Module target) {
+ ensureInLayer(source);
+ source.implAddExports(pn, target);
+ return this;
+ }
+
+ /**
* Updates module {@code source} in the layer to open a package to
* module {@code target}. This method is a no-op if {@code source}
* already opens the package to at least {@code target}.
@@ -254,7 +280,7 @@
* @param pn
* The package name
* @param target
- * The target module to read
+ * The target module
*
* @return This controller
*
@@ -397,7 +423,7 @@
* class loader and defines all modules to that class loader.
*
* <p> The class loader created by this method implements <em>direct
- * delegation</em> when loading types from modules. When its {@link
+ * delegation</em> when loading classes from modules. If the {@link
* ClassLoader#loadClass(String, boolean) loadClass} method is invoked to
* load a class then it uses the package name of the class to map it to a
* module. This may be a module in this layer and hence defined to the same
@@ -408,6 +434,12 @@
* When {@code loadClass} is invoked to load classes that do not map to a
* module then it delegates to the parent class loader. </p>
*
+ * <p> The class loader created by this method locates resources
+ * ({@link ClassLoader#getResource(String) getResource}, {@link
+ * ClassLoader#getResources(String) getResources}, and other resource
+ * methods) in all modules in the layer before searching the parent class
+ * loader. </p>
+ *
* <p> Attempting to create a layer with all modules defined to the same
* class loader can fail for the following reasons:
*
@@ -417,8 +449,8 @@
* configuration have the same package. </p></li>
*
* <li><p> <em>Split delegation</em>: The resulting class loader would
- * need to delegate to more than one class loader in order to load types
- * in a specific package. </p></li>
+ * need to delegate to more than one class loader in order to load
+ * classes in a specific package. </p></li>
*
* </ul>
*
@@ -481,7 +513,7 @@
* class loader.
*
* <p> The class loaders created by this method implement <em>direct
- * delegation</em> when loading types from modules. When {@link
+ * delegation</em> when loading classes from modules. If the {@link
* ClassLoader#loadClass(String, boolean) loadClass} method is invoked to
* load a class then it uses the package name of the class to map it to a
* module. The package may be in the module defined to the class loader.
@@ -489,9 +521,15 @@
* module defined to the class loader. It may be in a package exported by a
* module in a parent layer. The class loader delegates to the class loader
* of the module, throwing {@code ClassNotFoundException} if not found by
- * that class loader.
- * When {@code loadClass} is invoked to load classes that do not map to a
- * module then it delegates to the parent class loader. </p>
+ * that class loader. When {@code loadClass} is invoked to load a class
+ * that does not map to a module then it delegates to the parent class
+ * loader. </p>
+ *
+ * <p> The class loaders created by this method locate resources
+ * ({@link ClassLoader#getResource(String) getResource}, {@link
+ * ClassLoader#getResources(String) getResources}, and other resource
+ * methods) in the module defined to the class loader before searching
+ * the parent class loader. </p>
*
* <p> If there is a security manager then the class loaders created by
* this method will load classes and resources with privileges that are
@@ -576,10 +614,9 @@
* <p> In addition, a layer cannot be created if the configuration contains
* a module named "{@code java.base}", a configuration contains a module
* with a package named "{@code java}" or a package name starting with
- * "{@code java.}" and the module is mapped to a class loader other than
- * the {@link ClassLoader#getPlatformClassLoader() platform class loader},
- * or the function to map a module name to a class loader returns
- * {@code null}. </p>
+ * "{@code java.}", or the function to map a module name to a class loader
+ * returns {@code null} or the {@linkplain ClassLoader#getPlatformClassLoader()
+ * platform class loader}. </p>
*
* <p> If the function to map a module name to class loader throws an error
* or runtime exception then it is propagated to the caller of this method.
--- a/jdk/src/java.base/share/classes/java/lang/Package.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java Thu Aug 24 16:24:44 2017 +0200
@@ -102,10 +102,14 @@
* with the {@link Package#getPackages Package.getPackages()} and
* {@link ClassLoader#getDefinedPackages} methods.
*
+ * @implNote
+ * The <a href="ClassLoader.html#builtinLoaders">builtin class loaders</a>
+ * do not explicitly define {@code Package} objects for packages in
+ * <em>named modules</em>. Instead those packages are automatically defined
+ * and have no specification and implementation versioning information.
+ *
* @jvms 5.3 Run-time package
- * @see <a href="../../../technotes/guides/jar/jar.html#versioning">
- * The JAR File Specification: Package Versioning</a>
- * @see <a href="../../../technotes/guides/jar/jar.html#sealing">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#sealing">
* The JAR File Specification: Package Sealing</a>
* @see ClassLoader#definePackage(String, String, String, String, String, String, String, URL)
*
--- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Thu Aug 24 16:24:44 2017 +0200
@@ -194,18 +194,15 @@
* of system administrators who might need to perform multiple
* tasks that require all (or numerous) permissions.
* <p>
- * See <a href ="../../../technotes/guides/security/permissions.html">
- * Permissions in the JDK</a> for permission-related information.
+ * See {@extLink security_guide_permissions
+ * Permissions in the Java Development Kit (JDK)}
+ * for permission-related information.
* This document includes, for example, a table listing the various SecurityManager
* <code>check</code> methods and the permission(s) the default
* implementation of each such method requires.
* It also contains a table of all the version 1.2 methods
* that require permissions, and for each such method tells
* which permission it requires.
- * <p>
- * For more information about <code>SecurityManager</code> changes made in
- * the JDK and advice regarding porting of 1.1-style security managers,
- * see the <a href="../../../technotes/guides/security/index.html">security documentation</a>.
*
* @author Arthur van Hoff
* @author Roland Schemers
@@ -1496,7 +1493,10 @@
* Throws a {@code SecurityException} if the calling thread is not allowed
* to access the specified package.
* <p>
- * This method is called by the {@code loadClass} method of class loaders.
+ * During class loading, this method may be called by the {@code loadClass}
+ * method of class loaders and by the Java Virtual Machine to ensure that
+ * the caller is allowed to access the package of the class that is
+ * being loaded.
* <p>
* This method checks if the specified package starts with or equals
* any of the packages in the {@code package.access} Security Property.
--- a/jdk/src/java.base/share/classes/java/lang/String.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/String.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,6 +27,7 @@
import java.io.ObjectStreamField;
import java.io.UnsupportedEncodingException;
+import java.lang.annotation.Native;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
@@ -3063,8 +3064,8 @@
return COMPACT_STRINGS && coder == LATIN1;
}
- static final byte LATIN1 = 0;
- static final byte UTF16 = 1;
+ @Native static final byte LATIN1 = 0;
+ @Native static final byte UTF16 = 1;
/*
* StringIndexOutOfBoundsException if {@code index} is
--- a/jdk/src/java.base/share/classes/java/lang/System.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Thu Aug 24 16:24:44 2017 +0200
@@ -47,6 +47,8 @@
import java.security.PrivilegedAction;
import java.nio.channels.Channel;
import java.nio.channels.spi.SelectorProvider;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
@@ -2069,8 +2071,8 @@
private static void setJavaLangAccess() {
// Allow privileged classes outside of java.lang
SharedSecrets.setJavaLangAccess(new JavaLangAccess() {
- public Method getMethodOrNull(Class<?> klass, String name, Class<?>... parameterTypes) {
- return klass.getMethodOrNull(name, parameterTypes);
+ public List<Method> getDeclaredPublicMethods(Class<?> klass, String name, Class<?>... parameterTypes) {
+ return klass.getDeclaredPublicMethods(name, parameterTypes);
}
public jdk.internal.reflect.ConstantPool getConstantPool(Class<?> klass) {
return klass.getConstantPool();
@@ -2094,7 +2096,7 @@
return Class.getExecutableTypeAnnotationBytes(executable);
}
public <E extends Enum<E>>
- E[] getEnumConstantsShared(Class<E> klass) {
+ E[] getEnumConstantsShared(Class<E> klass) {
return klass.getEnumConstantsShared();
}
public void blockedOn(Thread t, Interruptible b) {
@@ -2122,9 +2124,6 @@
public Class<?> findBootstrapClassOrNull(ClassLoader cl, String name) {
return cl.findBootstrapClassOrNull(name);
}
- public Stream<Package> packages(ClassLoader cl) {
- return cl.packages();
- }
public Package definePackage(ClassLoader cl, String name, Module module) {
return cl.definePackage(name, module);
}
@@ -2163,9 +2162,18 @@
public void addOpensToAllUnnamed(Module m, String pn) {
m.implAddOpensToAllUnnamed(pn);
}
+ public void addOpensToAllUnnamed(Module m, Iterator<String> packages) {
+ m.implAddOpensToAllUnnamed(packages);
+ }
public void addUses(Module m, Class<?> service) {
m.implAddUses(service);
}
+ public boolean isReflectivelyExported(Module m, String pn, Module other) {
+ return m.isReflectivelyExported(pn, other);
+ }
+ public boolean isReflectivelyOpened(Module m, String pn, Module other) {
+ return m.isReflectivelyOpened(pn, other);
+ }
public ServicesCatalog getServicesCatalog(ModuleLayer layer) {
return layer.getServicesCatalog();
}
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Aug 24 16:24:44 2017 +0200
@@ -212,7 +212,7 @@
if (!callerModule.isNamed() && targetModule.isNamed()) {
IllegalAccessLogger logger = IllegalAccessLogger.illegalAccessLogger();
if (logger != null) {
- logger.logIfOpenedByBackdoor(lookup, targetClass);
+ logger.logIfOpenedForIllegalAccess(lookup, targetClass);
}
}
return new Lookup(targetClass);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Aug 24 16:24:44 2017 +0200
@@ -110,6 +110,20 @@
* boolean r = avh.compareAndSet(sa, 10, "expected", "new");
* }</pre>
*
+ * <p>Access modes control atomicity and consistency properties.
+ * <em>Plain</em> read ({@code get}) and write ({@code set})
+ * accesses are guaranteed to be bitwise atomic only for references
+ * and for primitive values of at most 32 bits, and impose no observable
+ * ordering constraints with respect to threads other than the
+ * executing thread. <em>Opaque</em> operations are bitwise atomic and
+ * coherently ordered with respect to accesses to the same variable.
+ * In addition to obeying Opaque properties, <em>Acquire</em> mode
+ * reads and their subsequent accesses are ordered after matching
+ * <em>Release</em> mode writes and their previous accesses. In
+ * addition to obeying Acquire and Release properties, all
+ * <em>Volatile</em> operations are totally ordered with respect to
+ * each other.
+ *
* <p>Access modes are grouped into the following categories:
* <ul>
* <li>read access modes that get the value of a variable under specified
--- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java Thu Aug 24 16:24:44 2017 +0200
@@ -43,11 +43,10 @@
/**
* A configuration that is the result of <a href="package-summary.html#resolution">
- * resolution</a> or resolution with <a href="package-summary.html#servicebinding">
- * service binding</a>.
+ * resolution</a> or resolution with <a href="#service-binding">service binding</a>.
*
* <p> A configuration encapsulates the <em>readability graph</em> that is the
- * output of resolution. A readability graph is a directed graph where the nodes
+ * output of resolution. A readability graph is a directed graph whose vertices
* are of type {@link ResolvedModule} and the edges represent the readability
* amongst the modules. {@code Configuration} defines the {@link #modules()
* modules()} method to get the set of resolved modules in the graph. {@code
@@ -176,8 +175,8 @@
* If resolution fails for any of the observability-related reasons
* specified by the static {@code resolve} method
* @throws ResolutionException
- * If any of the post-resolution consistency checks specified by
- * the static {@code resolve} method fail
+ * If resolution fails any of the consistency checks specified by
+ * the static {@code resolve} method
* @throws SecurityException
* If locating a module is denied by the security manager
*/
@@ -219,8 +218,8 @@
* If resolution fails for any of the observability-related reasons
* specified by the static {@code resolve} method
* @throws ResolutionException
- * If any of the post-resolution consistency checks specified by
- * the static {@code resolve} method fail
+ * If resolution fails any of the consistency checks specified by
+ * the static {@code resolve} method
* @throws SecurityException
* If locating a module is denied by the security manager
*/
@@ -234,7 +233,7 @@
/**
* Resolves a collection of root modules, with service binding, and with
- * the empty configuration as its parent. The post resolution checks
+ * the empty configuration as its parent. The consistency checks
* are optionally run.
*
* This method is used to create the configuration for the boot layer.
@@ -264,10 +263,9 @@
* or dependences that are located in a parent configuration are resolved
* no further and are not included in the resulting configuration. </p>
*
- * <p> When all modules have been resolved then the resulting dependency
- * graph is checked to ensure that it does not contain cycles. A
- * readability graph is constructed, and in conjunction with the module
- * exports and service use, checked for consistency. </p>
+ * <p> When all modules have been enumerated then a readability graph
+ * is computed, and in conjunction with the module exports and service use,
+ * checked for consistency. </p>
*
* <p> Resolution may fail with {@code FindException} for the following
* <em>observability-related</em> reasons: </p>
@@ -284,8 +282,8 @@
*
* </ul>
*
- * <p> Post-resolution consistency checks may fail with {@code
- * ResolutionException} for the following reasons: </p>
+ * <p> Resolution may fail with {@code ResolutionException} if any of the
+ * following consistency checks fail: </p>
*
* <ul>
*
@@ -329,9 +327,11 @@
* root modules
*
* @throws FindException
- * If resolution fails for an observability-related reason
+ * If resolution fails for any of observability-related reasons
+ * specified above
* @throws ResolutionException
- * If a post-resolution consistency checks fails
+ * If resolution fails for any of the consistency checks specified
+ * above
* @throws IllegalArgumentException
* If the list of parents is empty, or the list has two or more
* parents with modules for different target operating systems,
@@ -368,11 +368,11 @@
* resolve} except that the graph of resolved modules is augmented
* with modules induced by the service-use dependence relation. </p>
*
- * <p> More specifically, the root modules are resolved as if by calling
- * {@code resolve}. The resolved modules, and all modules in the
- * parent configurations, with {@link ModuleDescriptor#uses() service
- * dependences} are then examined. All modules found by the given module
- * finders that {@link ModuleDescriptor#provides() provide} an
+ * <p id="service-binding"> More specifically, the root modules are
+ * resolved as if by calling {@code resolve}. The resolved modules, and
+ * all modules in the parent configurations, with {@link ModuleDescriptor#uses()
+ * service dependences} are then examined. All modules found by the given
+ * module finders that {@link ModuleDescriptor#provides() provide} an
* implementation of one or more of the service types are added to the
* module graph and then resolved as if by calling the {@code
* resolve} method. Adding modules to the module graph may introduce new
@@ -402,8 +402,8 @@
* If resolution fails for any of the observability-related reasons
* specified by the static {@code resolve} method
* @throws ResolutionException
- * If any of the post-resolution consistency checks specified by
- * the static {@code resolve} method fail
+ * If resolution fails any of the consistency checks specified by
+ * the static {@code resolve} method
* @throws IllegalArgumentException
* If the list of parents is empty, or the list has two or more
* parents with modules for different target operating systems,
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java Thu Aug 24 16:24:44 2017 +0200
@@ -48,7 +48,7 @@
/**
* A finder of modules. A {@code ModuleFinder} is used to find modules during
* <a href="package-summary.html#resolution">resolution</a> or
- * <a href="package-summary.html#servicebinding">service binding</a>.
+ * <a href="Configuration.html#service-binding">service binding</a>.
*
* <p> A {@code ModuleFinder} can only find one module with a given name. A
* {@code ModuleFinder} that finds modules in a sequence of directories, for
@@ -239,30 +239,35 @@
*
* <ul>
*
- * <li><p> The module {@link ModuleDescriptor#name() name}, and {@link
- * ModuleDescriptor#version() version} if applicable, is derived from
- * the file name of the JAR file as follows: </p>
+ * <li><p> If the JAR file has the attribute "{@code Automatic-Module-Name}"
+ * in its main manifest then its value is the {@linkplain
+ * ModuleDescriptor#name() module name}. The module name is otherwise
+ * derived from the name of the JAR file. </p></li>
+ *
+ * <li><p> The {@link ModuleDescriptor#version() version}, and the
+ * module name when the attribute "{@code Automatic-Module-Name}" is not
+ * present, are derived from the file name of the JAR file as follows: </p>
*
* <ul>
*
- * <li><p> The {@code .jar} suffix is removed. </p></li>
+ * <li><p> The "{@code .jar}" suffix is removed. </p></li>
*
* <li><p> If the name matches the regular expression {@code
* "-(\\d+(\\.|$))"} then the module name will be derived from the
* subsequence preceding the hyphen of the first occurrence. The
* subsequence after the hyphen is parsed as a {@link
- * ModuleDescriptor.Version} and ignored if it cannot be parsed as
- * a {@code Version}. </p></li>
+ * ModuleDescriptor.Version Version} and ignored if it cannot be
+ * parsed as a {@code Version}. </p></li>
*
* <li><p> All non-alphanumeric characters ({@code [^A-Za-z0-9]})
* in the module name are replaced with a dot ({@code "."}), all
* repeating dots are replaced with one dot, and all leading and
* trailing dots are removed. </p></li>
*
- * <li><p> As an example, a JAR file named {@code foo-bar.jar} will
- * derive a module name {@code foo.bar} and no version. A JAR file
- * named {@code foo-bar-1.2.3-SNAPSHOT.jar} will derive a module
- * name {@code foo.bar} and {@code 1.2.3-SNAPSHOT} as the version.
+ * <li><p> As an example, a JAR file named "{@code foo-bar.jar}" will
+ * derive a module name "{@code foo.bar}" and no version. A JAR file
+ * named "{@code foo-bar-1.2.3-SNAPSHOT.jar}" will derive a module
+ * name "{@code foo.bar}" and "{@code 1.2.3-SNAPSHOT}" as the version.
* </p></li>
*
* </ul></li>
@@ -295,11 +300,12 @@
* <p> If a {@code ModuleDescriptor} cannot be created (by means of the
* {@link ModuleDescriptor.Builder ModuleDescriptor.Builder} API) for an
* automatic module then {@code FindException} is thrown. This can arise
- * when a legal module name cannot be derived from the file name of the JAR
- * file, where the JAR file contains a {@code .class} in the top-level
- * directory of the JAR file, where an entry in a service configuration
- * file is not a legal class name or its package name is not in the set of
- * packages derived for the module. </p>
+ * when the value of the "{@code Automatic-Module-Name}" attribute is not a
+ * legal module name, a legal module name cannot be derived from the file
+ * name of the JAR file, where the JAR file contains a {@code .class} in
+ * the top-level directory of the JAR file, where an entry in a service
+ * configuration file is not a legal class name or its package name is not
+ * in the set of packages derived for the module. </p>
*
* <p> In addition to JAR files, an implementation may also support modules
* that are packaged in other implementation specific module formats. If
--- a/jdk/src/java.base/share/classes/java/lang/module/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,118 +27,185 @@
* Classes to support module descriptors and creating configurations of modules
* by means of resolution and service binding.
*
- * <h2><a id="resolution">Resolution</a></h2>
- *
- * <p> Resolution is the process of computing the transitive closure of a set
- * of root modules over a set of observable modules by resolving the
- * dependences expressed by {@link
- * java.lang.module.ModuleDescriptor.Requires requires} clauses.
- * The <em>dependence graph</em> is augmented with edges that take account of
- * implicitly declared dependences ({@code requires transitive}) to create a
- * <em>readability graph</em>. The result of resolution is a {@link
- * java.lang.module.Configuration Configuration} that encapsulates the
- * readability graph. </p>
- *
- * <p> As an example, suppose we have the following observable modules: </p>
- * <pre> {@code
- * module m1 { requires m2; }
- * module m2 { requires transitive m3; }
- * module m3 { }
- * module m4 { }
- * } </pre>
- *
- * <p> If the module {@code m1} is resolved then the resulting configuration
- * contains three modules ({@code m1}, {@code m2}, {@code m3}). The edges in
- * its readability graph are: </p>
- * <pre> {@code
- * m1 --> m2 (meaning m1 reads m2)
- * m1 --> m3
- * m2 --> m3
- * } </pre>
- *
- * <p> Resolution is an additive process. When computing the transitive closure
- * then the dependence relation may include dependences on modules in {@link
- * java.lang.module.Configuration#parents() parent} configurations. The result
- * is a <em>relative configuration</em> that is relative to one or more parent
- * configurations and where the readability graph may have edges from modules
- * in the configuration to modules in parent configurations. </p>
- *
- * <p> As an example, suppose we have the following observable modules: </p>
- * <pre> {@code
- * module m1 { requires m2; requires java.xml; }
- * module m2 { }
- * } </pre>
- *
- * <p> If module {@code m1} is resolved with the configuration for the {@link
- * java.lang.ModuleLayer#boot() boot} layer as the parent then the resulting
- * configuration contains two modules ({@code m1}, {@code m2}). The edges in
- * its readability graph are:
- * <pre> {@code
- * m1 --> m2
- * m1 --> java.xml
- * } </pre>
- * where module {@code java.xml} is in the parent configuration. For
- * simplicity, this example omits the implicitly declared dependence on the
- * {@code java.base} module.
- *
- * <p> Requires clauses that are "{@code requires static}" express an optional
- * dependence (except at compile-time). If a module declares that it
- * "{@code requires static M}" then resolution does not search the observable
- * modules for "{@code M}". However, if "{@code M}" is resolved (because resolution
- * resolves a module that requires "{@code M}" without the {@link
- * java.lang.module.ModuleDescriptor.Requires.Modifier#STATIC static} modifier)
- * then the readability graph will contain read edges for each module that
- * "{@code requires static M}". </p>
- *
- * <p> {@link java.lang.module.ModuleDescriptor#isAutomatic() Automatic} modules
- * receive special treatment during resolution. Each automatic module is resolved
- * as if it "{@code requires transitive}" all observable automatic modules and
- * all automatic modules in the parent configurations. Each automatic module is
- * resolved so that it reads all other modules in the resulting configuration and
- * all modules in parent configurations. </p>
- *
- * <h2><a id="servicebinding">Service binding</a></h2>
- *
- * <p> Service binding is the process of augmenting a graph of resolved modules
- * from the set of observable modules induced by the service-use dependence
- * ({@code uses} and {@code provides} clauses). Any module that was not
- * previously in the graph requires resolution to compute its transitive
- * closure. Service binding is an iterative process in that adding a module
- * that satisfies some service-use dependence may introduce new service-use
- * dependences. </p>
- *
- * <p> Suppose we have the following observable modules: </p>
- * <pre> {@code
- * module m1 { exports p; uses p.S; }
- * module m2 { requires m1; provides p.S with p2.S2; }
- * module m3 { requires m1; requires m4; provides p.S with p3.S3; }
- * module m4 { }
- * } </pre>
- *
- * <p> If the module {@code m1} is resolved then the resulting graph of modules
- * has one module ({@code m1}). If the graph is augmented with modules induced
- * by the service-use dependence relation then the configuration will contain
- * four modules ({@code m1}, {@code m2}, {@code m3}, {@code m4}). The edges in
- * its readability graph are: </p>
- * <pre> {@code
- * m2 --> m1
- * m3 --> m1
- * m3 --> m4
- * } </pre>
- * <p> The edges in the conceptual service-use graph are: </p>
- * <pre> {@code
- * m1 --> m2 (meaning m1 uses a service that is provided by m2)
- * m1 --> m3
- * } </pre>
- *
- * <h2>General Exceptions</h2>
- *
* <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method of any class or interface in this package will cause a {@link
* java.lang.NullPointerException NullPointerException} to be thrown. Additionally,
* invoking a method with an array or collection containing a {@code null} element
* will cause a {@code NullPointerException}, unless otherwise specified. </p>
*
+ *
+ * <h1><a id="resolution">Resolution</a></h1>
+ *
+ * <p> Resolution is the process of computing how modules depend on each other.
+ * The process occurs at compile time and run time. </p>
+ *
+ * <p> Resolution is a two-step process. The first step recursively enumerates
+ * the 'requires' directives of a set of root modules. If all the enumerated
+ * modules are observable, then the second step computes their readability graph.
+ * The readability graph embodies how modules depend on each other, which in
+ * turn controls access across module boundaries. </p>
+ *
+ * <h2> Step 1: Recursive enumeration </h2>
+ *
+ * <p> Recursive enumeration takes a set of module names, looks up each of their
+ * module declarations, and for each module declaration, recursively enumerates:
+ *
+ * <ul>
+ * <li> <p> the module names given by the 'requires' directives with the
+ * 'transitive' modifier, and </p></li>
+ * <li> <p> at the discretion of the host system, the module names given by
+ * the 'requires' directives without the 'transitive' modifier. </p></li>
+ * </ul>
+ *
+ * <p> Module declarations are looked up in a set of observable modules. The set
+ * of observable modules is determined in an implementation specific manner. The
+ * set of observable modules may include modules with explicit declarations
+ * (that is, with a {@code module-info.java} source file or {@code module-info.class}
+ * file) and modules with implicit declarations (that is,
+ * <a href="ModuleFinder.html#automatic-modules">automatic modules</a>).
+ * Because an automatic module has no explicit module declaration, it has no
+ * 'requires' directives of its own, although its name may be given by a
+ * 'requires' directive of an explicit module declaration. </p>
+
+ * <p> The set of root modules, whose names are the initial input to this
+ * algorithm, is determined in an implementation specific manner. The set of
+ * root modules may include automatic modules. </p>
+ *
+ * <p> If at least one automatic module is enumerated by this algorithm, then
+ * every observable automatic module must be enumerated, regardless of whether
+ * any of their names are given by 'requires' directives of explicit module
+ * declarations. </p>
+ *
+ * <p> If any of the following conditions occur, then resolution fails:
+ * <ul>
+ * <li><p> Any root module is not observable. </p></li>
+ * <li><p> Any module whose name is given by a 'requires' directive with the
+ * 'transitive' modifier is not observable. </p></li>
+ * <li><p> At the discretion of the host system, any module whose name is given
+ * by a 'requires' directive without the 'transitive' modifier is not
+ * observable. </p></li>
+ * <li><p> The algorithm in this step enumerates the same module name twice. This
+ * indicates a cycle in the 'requires' directives, disregarding any 'transitive'
+ * modifiers. </p></li>
+ * </ul>
+ *
+ * <p> Otherwise, resolution proceeds to step 2. </p>
+ *
+ * <h2> Step 2: Computing the readability graph </h2>
+ *
+ * <p> A 'requires' directive (irrespective of 'transitive') expresses that
+ * one module depends on some other module. The effect of the 'transitive'
+ * modifier is to cause additional modules to also depend on the other module.
+ * If module M 'requires transitive N', then not only does M depend on N, but
+ * any module that depends on M also depends on N. This allows M to be
+ * refactored so that some or all of its content can be moved to a new module N
+ * without breaking modules that have a 'requires M' directive. </p>
+ *
+ * <p> Module dependencies are represented by the readability graph. The
+ * readability graph is a directed graph whose vertices are the modules
+ * enumerated in step 1 and whose edges represent readability between pairs of
+ * modules. The edges are specified as follows:
+ *
+ * <p> First, readability is determined by the 'requires' directives of the
+ * enumerated modules, disregarding any 'transitive' modifiers:
+ *
+ * <ul>
+ * <li><p> For each enumerated module A that 'requires' B: A "reads" B. </p></li>
+ * <li><p> For each enumerated module X that is automatic: X "reads" every
+ * other enumerated module (it is "as if" an automatic module has 'requires'
+ * directives for every other enumerated module). </p></li>
+ * </ul>
+ *
+ * <p> Second, readability is augmented to account for 'transitive' modifiers:
+ * <ul>
+ * <li> <p> For each enumerated module A that "reads" B: </p>
+ * <ul>
+ * <li><p> If B 'requires transitive' C, then A "reads" C as well as B. This
+ * augmentation is recursive: since A "reads" C, if C 'requires transitive'
+ * D, then A "reads" D as well as C and B. </p></li>
+ * <li><p> If B is an automatic module, then A "reads" every other enumerated
+ * automatic module. (It is "as if" an automatic module has 'requires transitive'
+ * directives for every other enumerated automatic module).</p> </li>
+ * </ul>
+ * </li>
+ * </ul>
+ *
+ * <p> Finally, every module "reads" itself. </p>
+ *
+ * <p> If any of the following conditions occur in the readability graph, then
+ * resolution fails:
+ * <ul>
+ * <li><p> A module "reads" two or more modules with the same name. This includes
+ * the case where a module "reads" another with the same name as itself. </p></li>
+ * <li><p> Two or more modules export a package with the same name to a module
+ * that "reads" both. This includes the case where a module M containing package
+ * p "reads" another module that exports p to M. </p></li>
+ * <li><p> A module M declares that it 'uses p.S' or 'provides p.S with ...' but
+ * package p is neither in module M nor exported to M by any module that M
+ * "reads". </p></li>
+ * </ul>
+ * <p> Otherwise, resolution succeeds, and the result of resolution is the
+ * readability graph.
+ *
+ * <h2> Root modules </h2>
+ *
+ * <p> The set of root modules at compile-time is usually the set of modules
+ * being compiled. At run-time, the set of root modules is usually the
+ * application module specified to the 'java' launcher. When compiling code in
+ * the unnamed module, or at run-time when the main application class is loaded
+ * from the class path, then the default set of root modules is implementation
+ * specific (In the JDK implementation it is the module "java.se", if observable,
+ * and every observable module that exports an API). </p>
+ *
+ * <h2> Observable modules </h2>
+ *
+ * <p> The set of observable modules at both compile-time and run-time is
+ * determined by searching several different paths, and also by searching
+ * the compiled modules built in to the environment. The search order is as
+ * follows: </p>
+ *
+ * <ol>
+ * <li><p> At compile time only, the compilation module path. This path
+ * contains module definitions in source form. </p></li>
+ *
+ * <li><p> The upgrade module path. This path contains compiled definitions of
+ * modules that will be observed in preference to the compiled definitions of
+ * any <i>upgradeable modules</i> that are present in (3) and (4). See the Java
+ * SE Platform for the designation of which standard modules are upgradeable.
+ * </p></li>
+ *
+ * <li><p> The system modules, which are the compiled definitions built in to
+ * the environment. </p></li>
+ *
+ * <li><p> The application module path. This path contains compiled definitions
+ * of library and application modules. </p></li>
+ *
+ * </ol>
+ *
+ * <h2> 'requires' directives with 'static' modifier </h2>
+ *
+ * <p> 'requires' directives that have the 'static' modifier express an optional
+ * dependence at run time. If a module declares that it 'requires static M' then
+ * resolution does not search the observable modules for M to satisfy the dependency.
+ * However, if M is recursively enumerated at step 1 then all modules that are
+ * enumerated and `requires static M` will read M. </p>
+ *
+ * <h2> Completeness </h2>
+ *
+ * <p> Resolution may be partial at compile-time in that the complete transitive
+ * closure may not be required to compile a set of modules. Minimally, the
+ * readability graph that is constructed and validated at compile-time includes
+ * the modules being compiled, their direct dependences, and all implicitly
+ * declared dependences (requires transitive). </p>
+ *
+ * <p> At run-time, resolution is an additive process. The recursive enumeration
+ * at step 1 may be relative to previous resolutions so that a root module,
+ * or a module named in a 'requires' directive, is not enumerated when it was
+ * enumerated by a previous (or parent) resolution. The readability graph that
+ * is the result of resolution may therefore have a vertex for a module enumerated
+ * in step 1 but with an edge to represent that the module reads a module that
+ * was enumerated by previous (or parent) resolution. </p>
+ *
* @since 9
* @spec JPMS
*/
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Thu Aug 24 16:24:44 2017 +0200
@@ -304,7 +304,7 @@
if (isClassPublic && declaringModule.isExported(pn, callerModule)) {
// member is public
if (Modifier.isPublic(modifiers)) {
- logIfExportedByBackdoor(caller, declaringClass);
+ logIfExportedForIllegalAccess(caller, declaringClass);
return true;
}
@@ -312,14 +312,14 @@
if (Modifier.isProtected(modifiers)
&& Modifier.isStatic(modifiers)
&& isSubclassOf(caller, declaringClass)) {
- logIfExportedByBackdoor(caller, declaringClass);
+ logIfExportedForIllegalAccess(caller, declaringClass);
return true;
}
}
// package is open to caller
if (declaringModule.isOpen(pn, callerModule)) {
- logIfOpenedByBackdoor(caller, declaringClass);
+ logIfOpenedForIllegalAccess(caller, declaringClass);
return true;
}
@@ -353,26 +353,26 @@
return false;
}
- private void logIfOpenedByBackdoor(Class<?> caller, Class<?> declaringClass) {
+ private void logIfOpenedForIllegalAccess(Class<?> caller, Class<?> declaringClass) {
Module callerModule = caller.getModule();
Module targetModule = declaringClass.getModule();
// callerModule is null during early startup
if (callerModule != null && !callerModule.isNamed() && targetModule.isNamed()) {
IllegalAccessLogger logger = IllegalAccessLogger.illegalAccessLogger();
if (logger != null) {
- logger.logIfOpenedByBackdoor(caller, declaringClass, this::toShortString);
+ logger.logIfOpenedForIllegalAccess(caller, declaringClass, this::toShortString);
}
}
}
- private void logIfExportedByBackdoor(Class<?> caller, Class<?> declaringClass) {
+ private void logIfExportedForIllegalAccess(Class<?> caller, Class<?> declaringClass) {
Module callerModule = caller.getModule();
Module targetModule = declaringClass.getModule();
// callerModule is null during early startup
if (callerModule != null && !callerModule.isNamed() && targetModule.isNamed()) {
IllegalAccessLogger logger = IllegalAccessLogger.illegalAccessLogger();
if (logger != null) {
- logger.logIfExportedByBackdoor(caller, declaringClass, this::toShortString);
+ logger.logIfExportedForIllegalAccess(caller, declaringClass, this::toShortString);
}
}
}
@@ -634,7 +634,7 @@
}
// access okay
- logIfExportedByBackdoor(caller, memberClass);
+ logIfExportedForIllegalAccess(caller, memberClass);
// Success: Update the cache.
Object cache = (targetClass != null
--- a/jdk/src/java.base/share/classes/java/lang/reflect/MalformedParameterizedTypeException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/MalformedParameterizedTypeException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, 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
@@ -36,4 +36,21 @@
*/
public class MalformedParameterizedTypeException extends RuntimeException {
private static final long serialVersionUID = -5696557788586220964L;
+
+ /**
+ * Constructs a {@code MalformedParameterizedTypeException} with
+ * no detail message.
+ */
+ public MalformedParameterizedTypeException() {
+ super();
+ }
+
+ /**
+ * Constructs a {@code MalformedParameterizedTypeException} with
+ * the given detail message.
+ * @param message the detail message; may be {@code null}
+ */
+ public MalformedParameterizedTypeException(String message) {
+ super(message);
+ }
}
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -195,12 +195,10 @@
if (max$ItypesPerOtype$ <= 0.0f)
throw new IllegalArgumentException("Non-positive "
+ "max$ItypesPerOtype$");
- if (!Charset.atBugLevel("1.4")) {
- if (average$ItypesPerOtype$ > max$ItypesPerOtype$)
- throw new IllegalArgumentException("average$ItypesPerOtype$"
- + " exceeds "
- + "max$ItypesPerOtype$");
- }
+ if (average$ItypesPerOtype$ > max$ItypesPerOtype$)
+ throw new IllegalArgumentException("average$ItypesPerOtype$"
+ + " exceeds "
+ + "max$ItypesPerOtype$");
this.replacement = replacement;
this.average$ItypesPerOtype$ = average$ItypesPerOtype$;
this.max$ItypesPerOtype$ = max$ItypesPerOtype$;
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Thu Aug 24 16:24:44 2017 +0200
@@ -281,19 +281,6 @@
/* -- Static methods -- */
- private static volatile String bugLevel;
-
- static boolean atBugLevel(String bl) { // package-private
- String level = bugLevel;
- if (level == null) {
- if (!VM.isBooted())
- return false;
- bugLevel = level = GetPropertyAction
- .privilegedGetProperty("sun.nio.cs.bugLevel", "");
- }
- return level.equals(bl);
- }
-
/**
* Checks that the given string is a legal charset name. </p>
*
@@ -305,7 +292,7 @@
*/
private static void checkName(String s) {
int n = s.length();
- if (n == 0 && !atBugLevel("1.4")) {
+ if (n == 0) {
throw new IllegalCharsetNameException(s);
}
for (int i = 0; i < n; i++) {
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Thu Aug 24 16:24:44 2017 +0200
@@ -64,8 +64,7 @@
* AlgorithmParameterGenerator (via a call to an {@code init} method),
* each provider must supply (and document) a default initialization.
* See the Keysize Restriction sections of the
- * <a href="{@docRoot}/../technotes/guides/security/SunProviders.html">
- * JDK Providers</a>
+ * {@extLink security_guide_jdk_providers JDK Providers}
* document for information on the AlgorithmParameterGenerator defaults
* used by JDK providers.
* However, note that defaults may vary across different providers.
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java Thu Aug 24 16:24:44 2017 +0200
@@ -40,8 +40,7 @@
* AlgorithmParameterGenerator (via a call to an {@code engineInit}
* method), each provider must supply (and document) a default initialization.
* See the Keysize Restriction sections of the
- * <a href="{@docRoot}/../technotes/guides/security/SunProviders.html">
- * JDK Providers</a>
+ * {@extLink security_guide_jdk_providers JDK Providers}
* document for information on the AlgorithmParameterGenerator defaults
* used by JDK providers.
* However, note that defaults may vary across different providers.
--- a/jdk/src/java.base/share/classes/java/security/Key.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/Key.java Thu Aug 24 16:24:44 2017 +0200
@@ -114,10 +114,10 @@
/**
* Returns the standard algorithm name for this key. For
* example, "DSA" would indicate that this key is a DSA key.
- * See Appendix A in the <a href=
- * "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture API Specification & Reference </a>
- * for information about standard algorithm names.
+ * See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
+ * for more information.
*
* @return the name of the algorithm associated with this key.
*/
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Thu Aug 24 16:24:44 2017 +0200
@@ -96,8 +96,7 @@
* (via a call to an {@code initialize} method), each provider must
* supply (and document) a default initialization.
* See the Keysize Restriction sections of the
- * <a href="{@docRoot}/../technotes/guides/security/SunProviders.html">
- * JDK Providers</a>
+ * {@extLink security_guide_jdk_providers JDK Providers}
* document for information on the KeyPairGenerator defaults used by
* JDK providers.
* However, note that defaults may vary across different providers.
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGeneratorSpi.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGeneratorSpi.java Thu Aug 24 16:24:44 2017 +0200
@@ -40,8 +40,7 @@
* (via a call to an {@code initialize} method), each provider must
* supply (and document) a default initialization.
* See the Keysize Restriction sections of the
- * <a href="{@docRoot}/../technotes/guides/security/SunProviders.html">
- * JDK Providers</a>
+ * {@extLink security_guide_jdk_providers JDK Providers}
* document for information on the KeyPairGenerator defaults used by
* JDK providers.
* However, note that defaults may vary across different providers.
--- a/jdk/src/java.base/share/classes/java/security/Provider.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/Provider.java Thu Aug 24 16:24:44 2017 +0200
@@ -94,9 +94,9 @@
* The JDK implementation supports static registration of the security
* providers via the {@code conf/security/java.security} file in the Java
* installation directory. These providers are automatically installed by
- * the JDK runtime, see <a href =
- * "../../../technotes/guides/security/crypto/CryptoSpec.html#Provider">The Provider Class</a>
- * in the "Java Cryptography Architecture API Specification & Reference"
+ * the JDK runtime, see {@extLink security_guide_jca_provider
+ * The Provider Class}
+ * in the Java Cryptography Architecture (JCA) Reference Guide
* for information about how a particular type of provider, the cryptographic
* service provider, works and is installed.
*
@@ -1310,8 +1310,8 @@
* it is replaced by the new service.
* This method also places information about this service
* in the provider's Hashtable values in the format described in the
- * <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">
- * Java Cryptography Architecture API Specification & Reference </a>.
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}.
*
* <p>Also, if there is a security manager, its
* {@code checkSecurityAccess} method is called with the string
@@ -1593,8 +1593,8 @@
* suitable services and instantiates them. The valid arguments to those
* methods depend on the type of service. For the service types defined
* within Java SE, see the
- * <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">
- * Java Cryptography Architecture API Specification & Reference </a>
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}
* for the valid values.
* Note that components outside of Java SE can define additional types of
* services and their behavior.
@@ -1769,9 +1769,8 @@
* instantiation in a different way.
* For details and the values of constructorParameter that are
* valid for the various types of services see the
- * <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">
- * Java Cryptography Architecture API Specification &
- * Reference</a>.
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}.
*
* @param constructorParameter the value to pass to the constructor,
* or null if this type of service does not use a constructorParameter.
@@ -1878,9 +1877,8 @@
*
* <p>For details and the values of parameter that are valid for the
* various types of services see the top of this class and the
- * <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">
- * Java Cryptography Architecture API Specification &
- * Reference</a>.
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}.
* Security providers can override it to implement their own test.
*
* @param parameter the parameter to test
--- a/jdk/src/java.base/share/classes/java/security/Security.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/Security.java Thu Aug 24 16:24:44 2017 +0200
@@ -1041,8 +1041,8 @@
* an empty Set if there is no provider that supports the
* specified service or if serviceName is null. For a complete list
* of Java cryptographic services, please see the
- * <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">Java
- * Cryptography Architecture API Specification & Reference</a>.
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}.
* Note: the returned set is immutable.
*
* @param serviceName the name of the Java cryptographic
--- a/jdk/src/java.base/share/classes/java/security/cert/CRL.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/CRL.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -52,9 +52,9 @@
* Creates a CRL of the specified type.
*
* @param type the standard name of the CRL type.
- * See Appendix A in the <a href=
- * "../../../../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture API Specification & Reference </a>
+ * See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard CRL types.
*/
protected CRL(String type) {
--- a/jdk/src/java.base/share/classes/java/security/cert/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/cert/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -32,15 +32,14 @@
* <h2>Package Specification</h2>
*
* <ul>
- * <li><a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™
- * Cryptography Architecture (JCA) Reference Guide</b></a>
+ * <li>{@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}
* <li>RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
* Certificate Revocation List (CRL) Profile
* <li>RFC 2560: X.509 Internet Public Key Infrastructure Online Certificate
* Status Protocol - OCSP
* <li><a href="{@docRoot}/../specs/security/standard-names.html">
- * <b>Java™ Security Standard Algorithm Names Specification
+ * <b>Java Security Standard Algorithm Names Specification
* </b></a></li>
* </ul>
*
@@ -50,12 +49,7 @@
* <ul>
* <li><a href="http://www.ietf.org/rfc/rfc5280.txt">
* http://www.ietf.org/rfc/rfc5280.txt</a>
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/certpath/CertPathProgGuide.html">
- * <b>Java™
- * PKI Programmer's Guide</b></a>
- * <li><a href="{@docRoot}/../technotes/guides/security/cert3.html">
- * <b>X.509 Certificates and Certificate Revocation Lists (CRLs)</b></a>
+ * <li> {@extLink security_guide_pki Java PKI Programmer's Guide}
* </ul>
*
* @since 1.2
--- a/jdk/src/java.base/share/classes/java/security/interfaces/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/interfaces/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 +42,10 @@
* {@code Key} classes for hardware devices, please refer
* to these cryptographic provider developer guides:
* <ul>
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- * <b>How to Implement a Provider for the
- * Java™ Cryptography Architecture
- * </b></a></li>
+ * <li>
+ * {@extLink security_guide_impl_provider
+ * How to Implement a Provider in the Java Cryptography Architecture}
+ * </li>
* </ul>
*
* <h2>Package Specification</h2>
@@ -61,12 +60,8 @@
*
* For further documentation, please see:
* <ul>
- * <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™
- * Cryptography Architecture API Specification and Reference
- * </b></a></li>
+ * <li> {extLink security_guide_jca
+ * Java Cryptography Architecture Reference Guide}</li>
* </ul>
*
* @since 1.1
--- a/jdk/src/java.base/share/classes/java/security/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,63 +46,36 @@
* <h2>Package Specification</h2>
*
* <ul>
- * <li><a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™
- * Cryptography Architecture (JCA) Reference Guide</b></a></li>
+ * <li> {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}</li>
*
* <li>PKCS #8: Private-Key Information Syntax Standard, Version 1.2,
* November 1993</li>
*
* <li><a href="{@docRoot}/../specs/security/standard-names.html">
- * <b>Java™ Security Standard Algorithm Names Specification
- * </b></a></li>
+ * Java Security Standard Algorithm Names Specification
+ * </a></li>
* </ul>
*
* <h2>Related Documentation</h2>
*
* For further documentation, please see:
* <ul>
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/spec/security-spec.doc.html">
- * <b>Java™
- * SE Platform Security Architecture</b></a></li>
+ * <li> {@extLink security_guide_overview
+ * Java Security Overview} </li>
*
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- * <b>How to Implement a Provider in the
- * Java™ Cryptography Architecture
- * </b></a></li>
- *
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/PolicyFiles.html"><b>
- * Default Policy Implementation and Policy File Syntax
- * </b></a></li>
+ * <li> {@extLink security_guide_impl_provider
+ * How to Implement a Provider in the Java Cryptography Architecture}</li>
*
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/permissions.html"><b>
- * Permissions in the
- * Java™ SE Development Kit (JDK)
- * </b></a></li>
- *
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/SecurityToolsSummary.html"><b>
- * Summary of Tools for
- * Java™ Platform Security
- * </b></a></li>
+ * <li> {@extLink security_guide_default_policy
+ * Default Policy Implementation and Policy File Syntax}</li>
*
- * <li><b>keytool</b>
- * (<a href="{@docRoot}/../technotes/tools/unix/keytool.html">
- * for Solaris/Linux</a>)
- * (<a href="{@docRoot}/../technotes/tools/windows/keytool.html">
- * for Windows</a>)
- * </li>
+ * <li> {@extLink security_guide_permissions
+ * Permissions in the Java Development Kit (JDK)}</li>
*
- * <li><b>jarsigner</b>
- * (<a href="{@docRoot}/../technotes/tools/unix/jarsigner.html">
- * for Solaris/Linux</a>)
- * (<a href="{@docRoot}/../technotes/tools/windows/jarsigner.html">
- * for Windows</a>)
- * </li>
+ * <li> {@extLink security_guide_tools
+ * Summary of Tools for Java Platform Security}
+ * (for example {@code keytool} and {@code jarsigner}),</li>
*
* </ul>
*
--- a/jdk/src/java.base/share/classes/java/security/spec/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/security/spec/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -54,18 +54,10 @@
* For documentation that includes information about algorithm parameter
* and key specifications, please see:
* <ul>
- * <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™
- * Cryptography Architecture API Specification and Reference
- * </b></a></li>
- * <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- * <b>How to Implement a Provider for the
- * Java™ Cryptography Architecture
- * </b></a></li>
+ * <li> {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}</li>
+ * <li> {@extLink security_guide_impl_provider
+ * How to Implement a Provider in the Java Cryptography Architecture}</li>
* </ul>
*
* @since 1.2
--- a/jdk/src/java.base/share/classes/java/util/BitSet.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/BitSet.java Thu Aug 24 16:24:44 2017 +0200
@@ -1212,7 +1212,7 @@
*
* <p>The stream binds to this bit set when the terminal stream operation
* commences (specifically, the spliterator for the stream is
- * <a href="../Spliterator.html#binding"><em>late-binding</em></a>). If the
+ * <a href="Spliterator.html#binding"><em>late-binding</em></a>). If the
* bit set is modified during that operation then the result is undefined.
*
* @return a stream of integers representing set indices
--- a/jdk/src/java.base/share/classes/java/util/Deque.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Deque.java Thu Aug 24 16:24:44 2017 +0200
@@ -72,24 +72,24 @@
* </tr>
* <tr>
* <td><b>Insert</b></td>
- * <td>{@link Deque#addFirst addFirst(e)}</td>
- * <td>{@link Deque#offerFirst offerFirst(e)}</td>
- * <td>{@link Deque#addLast addLast(e)}</td>
- * <td>{@link Deque#offerLast offerLast(e)}</td>
+ * <td>{@link #addFirst(Object) addFirst(e)}</td>
+ * <td>{@link #offerFirst(Object) offerFirst(e)}</td>
+ * <td>{@link #addLast(Object) addLast(e)}</td>
+ * <td>{@link #offerLast(Object) offerLast(e)}</td>
* </tr>
* <tr>
* <td><b>Remove</b></td>
- * <td>{@link Deque#removeFirst removeFirst()}</td>
- * <td>{@link Deque#pollFirst pollFirst()}</td>
- * <td>{@link Deque#removeLast removeLast()}</td>
- * <td>{@link Deque#pollLast pollLast()}</td>
+ * <td>{@link #removeFirst() removeFirst()}</td>
+ * <td>{@link #pollFirst() pollFirst()}</td>
+ * <td>{@link #removeLast() removeLast()}</td>
+ * <td>{@link #pollLast() pollLast()}</td>
* </tr>
* <tr>
* <td><b>Examine</b></td>
- * <td>{@link Deque#getFirst getFirst()}</td>
- * <td>{@link Deque#peekFirst peekFirst()}</td>
- * <td>{@link Deque#getLast getLast()}</td>
- * <td>{@link Deque#peekLast peekLast()}</td>
+ * <td>{@link #getFirst() getFirst()}</td>
+ * <td>{@link #peekFirst() peekFirst()}</td>
+ * <td>{@link #getLast() getLast()}</td>
+ * <td>{@link #peekLast() peekLast()}</td>
* </tr>
* </table>
*
@@ -106,28 +106,28 @@
* <td style="text-align:center"> <b>Equivalent {@code Deque} Method</b></td>
* </tr>
* <tr>
- * <td>{@link java.util.Queue#add add(e)}</td>
- * <td>{@link #addLast addLast(e)}</td>
+ * <td>{@link #add(Object) add(e)}</td>
+ * <td>{@link #addLast(Object) addLast(e)}</td>
* </tr>
* <tr>
- * <td>{@link java.util.Queue#offer offer(e)}</td>
- * <td>{@link #offerLast offerLast(e)}</td>
+ * <td>{@link #offer(Object) offer(e)}</td>
+ * <td>{@link #offerLast(Object) offerLast(e)}</td>
* </tr>
* <tr>
- * <td>{@link java.util.Queue#remove remove()}</td>
- * <td>{@link #removeFirst removeFirst()}</td>
+ * <td>{@link #remove() remove()}</td>
+ * <td>{@link #removeFirst() removeFirst()}</td>
* </tr>
* <tr>
- * <td>{@link java.util.Queue#poll poll()}</td>
- * <td>{@link #pollFirst pollFirst()}</td>
+ * <td>{@link #poll() poll()}</td>
+ * <td>{@link #pollFirst() pollFirst()}</td>
* </tr>
* <tr>
- * <td>{@link java.util.Queue#element element()}</td>
- * <td>{@link #getFirst getFirst()}</td>
+ * <td>{@link #element() element()}</td>
+ * <td>{@link #getFirst() getFirst()}</td>
* </tr>
* <tr>
- * <td>{@link java.util.Queue#peek peek()}</td>
- * <td>{@link #peek peekFirst()}</td>
+ * <td>{@link #peek() peek()}</td>
+ * <td>{@link #peekFirst() peekFirst()}</td>
* </tr>
* </table>
*
@@ -144,16 +144,16 @@
* <td style="text-align:center"> <b>Equivalent {@code Deque} Method</b></td>
* </tr>
* <tr>
- * <td>{@link #push push(e)}</td>
- * <td>{@link #addFirst addFirst(e)}</td>
+ * <td>{@link #push(Object) push(e)}</td>
+ * <td>{@link #addFirst(Object) addFirst(e)}</td>
* </tr>
* <tr>
- * <td>{@link #pop pop()}</td>
- * <td>{@link #removeFirst removeFirst()}</td>
+ * <td>{@link #pop() pop()}</td>
+ * <td>{@link #removeFirst() removeFirst()}</td>
* </tr>
* <tr>
- * <td>{@link #peek peek()}</td>
- * <td>{@link #peekFirst peekFirst()}</td>
+ * <td>{@link #peek() peek()}</td>
+ * <td>{@link #peekFirst() peekFirst()}</td>
* </tr>
* </table>
*
@@ -430,8 +430,8 @@
/**
* Retrieves and removes the head of the queue represented by this deque
* (in other words, the first element of this deque).
- * This method differs from {@link #poll poll} only in that it throws an
- * exception if this deque is empty.
+ * This method differs from {@link #poll() poll()} only in that it
+ * throws an exception if this deque is empty.
*
* <p>This method is equivalent to {@link #removeFirst()}.
*
@@ -477,6 +477,31 @@
*/
E peek();
+ /**
+ * Adds all of the elements in the specified collection at the end
+ * of this deque, as if by calling {@link #addLast} on each one,
+ * in the order that they are returned by the collection's iterator.
+ *
+ * <p>When using a capacity-restricted deque, it is generally preferable
+ * to call {@link #offer(Object) offer} separately on each element.
+ *
+ * <p>An exception encountered while trying to add an element may result
+ * in only some of the elements having been successfully added when
+ * the associated exception is thrown.
+ *
+ * @param c the elements to be inserted into this deque
+ * @return {@code true} if this deque changed as a result of the call
+ * @throws IllegalStateException if not all the elements can be added at
+ * this time due to insertion restrictions
+ * @throws ClassCastException if the class of an element of the specified
+ * collection prevents it from being added to this deque
+ * @throws NullPointerException if the specified collection contains a
+ * null element and this deque does not permit null elements,
+ * or if the specified collection is null
+ * @throws IllegalArgumentException if some property of an element of the
+ * specified collection prevents it from being added to this deque
+ */
+ boolean addAll(Collection<? extends E> c);
// *** Stack methods ***
--- a/jdk/src/java.base/share/classes/java/util/ServiceConfigurationError.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/ServiceConfigurationError.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,33 +27,12 @@
/**
- * Error thrown when something goes wrong while loading a service provider.
- *
- * <p> This error will be thrown in the following situations:
- *
- * <ul>
- *
- * <li> The format of a provider-configuration file violates the <a
- * href="ServiceLoader.html#format">specification</a>; </li>
- *
- * <li> An {@link java.io.IOException IOException} occurs while reading a
- * provider-configuration file; </li>
- *
- * <li> A concrete provider class named in a provider-configuration file
- * cannot be found; </li>
- *
- * <li> A concrete provider class is not a subclass of the service class;
- * </li>
- *
- * <li> A concrete provider class cannot be instantiated; or
- *
- * <li> Some other kind of error occurs. </li>
- *
- * </ul>
- *
+ * Error thrown when something goes wrong while locating, loading, or
+ * instantiating a service provider.
*
* @author Mark Reinhold
* @since 1.6
+ * @see ServiceLoader
*/
public class ServiceConfigurationError
--- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -57,187 +57,309 @@
/**
- * A simple service-provider loading facility.
+ * A facility to load implementations of a service.
*
- * <p> A <i>service</i> is a well-known set of interfaces and (usually
- * abstract) classes. A <i>service provider</i> is a specific implementation
- * of a service. The classes in a provider typically implement the interfaces
- * and subclass the classes defined in the service itself.
- * Providers may be developed and deployed as modules and made available using
- * the application module path. Providers may alternatively be packaged as JAR
- * files and made available by adding them to the application class path. The
- * advantage of developing a provider as a module is that the provider can be
- * fully encapsulated to hide all details of its implementation.
+ * <p> A <i>service</i> is a well-known interface or class for which zero, one,
+ * or many service providers exist. A <i>service provider</i> (or just
+ * <i>provider</i>) is a class that implements or subclasses the well-known
+ * interface or class. A {@code ServiceLoader} is an object that locates and
+ * loads service providers deployed in the run time environment at a time of an
+ * application's choosing. Application code refers only to the service, not to
+ * service providers, and is assumed to be capable of differentiating between
+ * multiple service providers as well as handling the possibility that no service
+ * providers are located.
+ *
+ * <h3> Obtaining a service loader </h3>
*
- * <p> For the purpose of loading, a service is represented by a single type,
- * that is, a single interface or abstract class. (A concrete class can be
- * used, but this is not recommended.) A provider of a given service contains
- * one or more concrete classes that extend this <i>service type</i> with data
- * and code specific to the provider. The <i>provider class</i> is typically
- * not the entire provider itself but rather a proxy which contains enough
- * information to decide whether the provider is able to satisfy a particular
- * request together with code that can create the actual provider on demand.
- * The details of provider classes tend to be highly service-specific; no
- * single class or interface could possibly unify them, so no such type is
- * defined here.
+ * <p> An application obtains a service loader for a given service by invoking
+ * one of the static {@code load} methods of ServiceLoader. If the application
+ * is a module, then its module declaration must have a <i>uses</i> directive
+ * that specifies the service; this helps to locate providers and ensure they
+ * will execute reliably. In addition, if the service is not in the application
+ * module, then the module declaration must have a <i>requires</i> directive
+ * that specifies the module which exports the service.
*
- * <p> Providers deployed as explicit modules on the module path are
- * instantiated by a <em>provider factory</em> or directly via the provider's
- * constructor. In the module declaration then the class name specified in the
- * <i>provides</i> clause is a provider factory if it is public and defines a
- * public static no-args method named "{@code provider}". The return type of
- * the method must be assignable to the <i>service</i> type. If the class is
- * not a provider factory then it is public with a public zero-argument
- * constructor. The requirement that the provider factory or provider class
- * be public helps to document the intent that the provider will be
- * instantiated by the service-provider loading facility.
+ * <p> A service loader can be used to locate and instantiate providers of the
+ * service by means of the {@link #iterator() iterator} method. {@code ServiceLoader}
+ * also defines the {@link #stream() stream} method to obtain a stream of providers
+ * that can be inspected and filtered without instantiating them.
*
- * <p> As an example, suppose a module declares the following:
+ * <p> As an example, suppose the service is {@code com.example.CodecFactory}, an
+ * interface that defines methods for producing encoders and decoders:
*
* <pre>{@code
- * provides com.example.CodecSet with com.example.impl.StandardCodecs;
- * provides com.example.CodecSet with com.example.impl.ExtendedCodecsFactory;
+ * package com.example;
+ * public interface CodecFactory {
+ * Encoder getEncoder(String encodingName);
+ * Decoder getDecoder(String encodingName);
+ * }
+ * }</pre>
+ *
+ * <p> The following code obtains a service loader for the {@code CodecFactory}
+ * service, then uses its iterator (created automatically by the enhanced-for
+ * loop) to yield instances of the service providers that are located:
+ *
+ * <pre>{@code
+ * ServiceLoader<CodecFactory> loader = ServiceLoader.load(CodecFactory.class);
+ * for (CodecFactory factory : loader) {
+ * Encoder enc = factory.getEncoder("PNG");
+ * if (enc != null)
+ * ... use enc to encode a PNG file
+ * break;
+ * }
+ * }</pre>
+ *
+ * <p> If this code resides in a module, then in order to refer to the
+ * {@code com.example.CodecFactory} interface, the module declaration would
+ * require the module which exports the interface. The module declaration would
+ * also specify use of {@code com.example.CodecFactory}:
+ * <pre>{@code
+ * requires com.example.codec.core;
+ * uses com.example.CodecFactory;
* }</pre>
*
- * <p> where {@code com.example.CodecSet} is the service type, {@code
- * com.example.impl.StandardCodecs} is a provider class that is public with a
- * public no-args constructor, {@code com.example.impl.ExtendedCodecsFactory}
- * is a public class that defines a public static no-args method named
- * "{@code provider}" with a return type that is {@code CodecSet} or a subtype
- * of. For this example then {@code StandardCodecs}'s no-arg constructor will
- * be used to instantiate {@code StandardCodecs}. {@code ExtendedCodecsFactory}
- * will be treated as a provider factory and {@code
- * ExtendedCodecsFactory.provider()} will be invoked to obtain the provider.
+ * <p> Sometimes an application may wish to inspect a service provider before
+ * instantiating it, in order to determine if an instance of that service
+ * provider would be useful. For example, a service provider for {@code
+ * CodecFactory} that is capable of producing a "PNG" encoder may be annotated
+ * with {@code @PNG}. The following code uses service loader's {@code stream}
+ * method to yield instances of {@code Provider<CodecFactory>} in contrast to
+ * how the iterator yields instances of {@code CodecFactory}:
+ * <pre>{@code
+ * ServiceLoader<CodecFactory> loader = ServiceLoader.load(CodecFactory.class);
+ * Set<CodecFactory> pngFactories = loader
+ * .stream() // Note a below
+ * .filter(p -> p.type().isAnnotationPresent(PNG.class)) // Note b
+ * .map(Provider::get) // Note c
+ * .collect(Collectors.toSet());
+ * }</pre>
+ * <ol type="a">
+ * <li> A stream of {@code Provider<CodecFactory>} objects </li>
+ * <li> {@code p.type()} yields a {@code Class<CodecFactory>} </li>
+ * <li> {@code get()} yields an instance of {@code CodecFactory} </li>
+ * </ol>
*
- * <p> Providers deployed on the class path or as {@link
- * java.lang.module.ModuleDescriptor#isAutomatic automatic-modules} on the
- * module path must have a public zero-argument constructor.
- *
- * <p> An application or library using this loading facility and developed
- * and deployed as an explicit module must have an appropriate <i>uses</i>
- * clause in its <i>module descriptor</i> to declare that the module uses
- * implementations of the service. A corresponding requirement is that a
- * provider deployed as an explicit module must have an appropriate
- * <i>provides</i> clause in its module descriptor to declare that the module
- * provides an implementation of the service. The <i>uses</i> and
- * <i>provides</i> allow consumers of a service to be <i>linked</i> to modules
- * containing providers of the service.
+ * <h3> Designing services </h3>
*
- * <p> A service provider that is packaged as a JAR file for the class path is
- * identified by placing a <i>provider-configuration file</i> in the resource
- * directory {@code META-INF/services}. The file's name is the fully-qualified
- * <a href="../lang/ClassLoader.html#name">binary name</a> of the service's
- * type. The file contains a list of fully-qualified binary names of concrete
- * provider classes, one per line. Space and tab characters surrounding each
- * name, as well as blank lines, are ignored. The comment character is
- * {@code '#'} (<code>'\u0023'</code>,
- * <span style="font-size:smaller;">NUMBER SIGN</span>); on
- * each line all characters following the first comment character are ignored.
- * The file must be encoded in UTF-8.
- * If a particular concrete provider class is named in more than one
- * configuration file, or is named in the same configuration file more than
- * once, then the duplicates are ignored. The configuration file naming a
- * particular provider need not be in the same JAR file or other distribution
- * unit as the provider itself. The provider must be visible from the same
- * class loader that was initially queried to locate the configuration file;
- * note that this is not necessarily the class loader from which the file was
- * actually loaded.
+ * <p> A service is a single type, usually an interface or abstract class. A
+ * concrete class can be used, but this is not recommended. The type may have
+ * any accessibility. The methods of a service are highly domain-specific, so
+ * this API specification cannot give concrete advice about their form or
+ * function. However, there are two general guidelines:
+ * <ol>
+ * <li><p> A service should declare as many methods as needed to allow service
+ * providers to communicate their domain-specific properties and other
+ * quality-of-implementation factors. An application which obtains a service
+ * loader for the service may then invoke these methods on each instance of
+ * a service provider, in order to choose the best provider for the
+ * application. </p></li>
+ * <li><p> A service should express whether its service providers are intended
+ * to be direct implementations of the service or to be an indirection
+ * mechanism such as a "proxy" or a "factory". Service providers tend to be
+ * indirection mechanisms when domain-specific objects are relatively
+ * expensive to instantiate; in this case, the service should be designed
+ * so that service providers are abstractions which create the "real"
+ * implementation on demand. For example, the {@code CodecFactory} service
+ * expresses through its name that its service providers are factories
+ * for codecs, rather than codecs themselves, because it may be expensive
+ * or complicated to produce certain codecs. </p></li>
+ * </ol>
*
- * <p> Providers are located and instantiated lazily, that is, on demand. A
- * service loader maintains a cache of the providers that have been loaded so
- * far. Each invocation of the {@link #iterator iterator} method returns an
- * iterator that first yields all of the elements cached from previous
- * iteration, in instantiation order, and then lazily locates and instantiates
- * any remaining providers, adding each one to the cache in turn. Similarly,
- * each invocation of the {@link #stream stream} method returns a stream that
- * first processes all providers loaded by previous stream operations, in load
- * order, and then lazily locates any remaining providers. Caches are cleared
- * via the {@link #reload reload} method.
+ * <h3> <a id="developing-service-providers">Developing service providers</a> </h3>
*
- * <h2> Locating providers </h2>
- *
- * <p> The {@code load} methods locate providers using a class loader or module
- * {@link ModuleLayer layer}. When locating providers using a class loader then
- * providers in both named and unnamed modules may be located. When locating
- * providers using a module layer then only providers in named modules in
- * the layer (or parent layers) are located.
+ * <p> A service provider is a single type, usually a concrete class. An
+ * interface or abstract class is permitted because it may declare a static
+ * provider method, discussed later. The type must be public and must not be
+ * an inner class.
*
- * <p> When locating providers using a class loader then any providers in named
- * modules defined to the class loader, or any class loader that is reachable
- * via parent delegation, are located. Additionally, providers in module layers
- * other than the {@link ModuleLayer#boot() boot} layer, where the module layer
- * contains modules defined to the class loader, or any class loader reachable
- * via parent delegation, are also located. For example, suppose there is a
- * module layer where each module is defined to its own class loader (see {@link
- * ModuleLayer#defineModulesWithManyLoaders defineModulesWithManyLoaders}). If the
- * {@code load} method is invoked to locate providers using any of these class
- * loaders for this layer then it will locate all of the providers in that
- * layer, irrespective of their defining class loader.
+ * <p> A service provider and its supporting code may be developed in a module,
+ * which is then deployed on the application module path or in a modular
+ * image. Alternatively, a service provider and its supporting code may be
+ * packaged as a JAR file and deployed on the application class path. The
+ * advantage of developing a service provider in a module is that the provider
+ * can be fully encapsulated to hide all details of its implementation.
*
- * <p> In the case of unnamed modules then the service configuration files are
- * located using the class loader's {@link ClassLoader#getResources(String)
- * ClassLoader.getResources(String)} method. Any providers listed should be
- * visible via the class loader specified to the {@code load} method. If a
- * provider in a named module is listed then it is ignored - this is to avoid
- * duplicates that would otherwise arise when a module has both a
- * <i>provides</i> clause and a service configuration file in {@code
- * META-INF/services} that lists the same provider.
+ * <p> An application that obtains a service loader for a given service is
+ * indifferent to whether providers of the service are deployed in modules or
+ * packaged as JAR files. The application instantiates service providers via
+ * the service loader's iterator, or via {@link Provider Provider} objects in
+ * the service loader's stream, without knowledge of the service providers'
+ * locations.
+ *
+ * <h3> Deploying service providers as modules </h3>
*
- * <h2> Ordering </h2>
+ * <p> A service provider that is developed in a module must be specified in a
+ * <i>provides</i> directive in the module declaration. The provides directive
+ * specifies both the service and the service provider; this helps to locate the
+ * provider when another module, with a <i>uses</i> directive for the service,
+ * obtains a service loader for the service. It is strongly recommended that the
+ * module does not export the package containing the service provider. There is
+ * no support for a module specifying, in a <i>provides</i> directive, a service
+ * provider in another module.
+
+ * <p> A service provider that is developed in a module has no control over when
+ * it is instantiated, since that occurs at the behest of the application, but it
+ * does have control over how it is instantiated:
*
- * <p> Service loaders created to locate providers using a {@code ClassLoader}
- * locate providers as follows:
* <ul>
- * <li> Providers in named modules are located before providers on the
- * class path (or more generally, unnamed modules). </li>
*
- * <li> When locating providers in named modules then the service loader
- * will locate providers in modules defined to the class loader, then its
- * parent class loader, its parent parent, and so on to the bootstrap class
- * loader. If a {@code ClassLoader}, or any class loader in the parent
- * delegation chain, defines modules in a custom module {@link ModuleLayer} then
- * all providers in that layer are located, irrespective of their class
- * loader. The ordering of modules defined to the same class loader, or the
- * ordering of modules in a layer, is not defined. </li>
+ * <li> If the service provider declares a provider method, then the service
+ * loader invokes that method to obtain an instance of the service provider. A
+ * provider method is a public static method named "provider" with no formal
+ * parameters and a return type that is assignable to the service's interface
+ * or class.
+ * <p> In this case, the service provider itself need not be assignable to the
+ * service's interface or class. </li>
*
- * <li> If a named module declares more than one provider then the providers
- * are located in the iteration order of the {@link
- * java.lang.module.ModuleDescriptor.Provides#providers() providers} list.
- * Providers added dynamically by instrumentation agents ({@link
- * java.lang.instrument.Instrumentation#redefineModule redefineModule})
- * are always located after providers declared by the module. </li>
+ * <li> If the service provider does not declare a provider method, then the
+ * service provider is instantiated directly, via its provider constructor. A
+ * provider constructor is a public constructor with no formal parameters.
+ * <p> In this case, the service provider must be assignable to the service's
+ * interface or class </li>
*
- * <li> When locating providers in unnamed modules then the ordering is
- * based on the order that the class loader's {@link
- * ClassLoader#getResources(String) ClassLoader.getResources(String)}
- * method finds the service configuration files. </li>
* </ul>
*
- * <p> Service loaders created to locate providers in a {@linkplain ModuleLayer
- * module layer} will first locate providers in the layer, before locating
- * providers in parent layers. Traversal of parent layers is depth-first with
- * each layer visited at most once. For example, suppose L0 is the boot layer,
- * L1 and L2 are custom layers with L0 as their parent. Now suppose that L3 is
- * created with L1 and L2 as the parents (in that order). Using a service
- * loader to locate providers with L3 as the content will locate providers
- * in the following order: L3, L1, L0, L2. The ordering of modules in a layer
- * is not defined.
+ * <p> A service provider that is deployed as an
+ * {@linkplain java.lang.module.ModuleDescriptor#isAutomatic automatic module} on
+ * the application module path must have a provider constructor. There is no
+ * support for a provider method in this case.
*
- * <h2> Selection and filtering </h2>
- *
- * <p> Selecting a provider or filtering providers will usually involve invoking
- * a provider method. Where selection or filtering based on the provider class is
- * needed then it can be done using a {@link #stream() stream}. For example, the
- * following collects the providers that have a specific annotation:
+ * <p> As an example, suppose a module specifies the following directives:
* <pre>{@code
- * Set<CodecSet> providers = ServiceLoader.load(CodecSet.class)
- * .stream()
- * .filter(p -> p.type().isAnnotationPresent(Managed.class))
- * .map(Provider::get)
- * .collect(Collectors.toSet());
+ * provides com.example.CodecFactory with com.example.impl.StandardCodecs;
+ * provides com.example.CodecFactory with com.example.impl.ExtendedCodecsFactory;
* }</pre>
*
- * <h2> Security </h2>
+ * <p> where
+ *
+ * <ul>
+ * <li> {@code com.example.CodecFactory} is the two-method service from
+ * earlier. </li>
+ *
+ * <li> {@code com.example.impl.StandardCodecs} is a public class that implements
+ * {@code CodecFactory} and has a public no-args constructor. </li>
+ *
+ * <li> {@code com.example.impl.ExtendedCodecsFactory} is a public class that
+ * does not implement CodecFactory, but it declares a public static no-args
+ * method named "provider" with a return type of {@code CodecFactory}. </li>
+ * </ul>
+ *
+ * <p> A service loader will instantiate {@code StandardCodecs} via its
+ * constructor, and will instantiate {@code ExtendedCodecsFactory} by invoking
+ * its {@code provider} method. The requirement that the provider constructor or
+ * provider method is public helps to document the intent that the class (that is,
+ * the service provider) will be instantiated by an entity (that is, a service
+ * loader) which is outside the class's package.
+ *
+ * <h3> Deploying service providers on the class path </h3>
+ *
+ * A service provider that is packaged as a JAR file for the class path is
+ * identified by placing a <i>provider-configuration file</i> in the resource
+ * directory {@code META-INF/services}. The name of the provider-configuration
+ * file is the fully qualified binary name of the service. The provider-configuration
+ * file contains a list of fully qualified binary names of service providers, one
+ * per line.
+ *
+ * <p> For example, suppose the service provider
+ * {@code com.example.impl.StandardCodecs} is packaged in a JAR file for the
+ * class path. The JAR file will contain a provider-configuration file named:
+ *
+ * <blockquote>{@code
+ * META-INF/services/com.example.CodecFactory
+ * }</blockquote>
+ *
+ * that contains the line:
+ *
+ * <blockquote>{@code
+ * com.example.impl.StandardCodecs # Standard codecs
+ * }</blockquote>
+ *
+ * <p><a id="format">The provider-configuration file must be encoded in UTF-8. </a>
+ * Space and tab characters surrounding each service provider's name, as well as
+ * blank lines, are ignored. The comment character is {@code '#'}
+ * ({@code '\u0023'} <span style="font-size:smaller;">NUMBER SIGN</span>);
+ * on each line all characters following the first comment character are ignored.
+ * If a service provider class name is listed more than once in a
+ * provider-configuration file then the duplicate is ignored. If a service
+ * provider class is named in more than one configuration file then the duplicate
+ * is ignored.
+ *
+ * <p> A service provider that is mentioned in a provider-configuration file may
+ * be located in the same JAR file as the provider-configuration file or in a
+ * different JAR file. The service provider must be visible from the class loader
+ * that is initially queried to locate the provider-configuration file; this is
+ * not necessarily the class loader which ultimately locates the
+ * provider-configuration file.
+ *
+ * <h3> Timing of provider discovery </h3>
+ *
+ * <p> Service providers are loaded and instantiated lazily, that is, on demand.
+ * A service loader maintains a cache of the providers that have been loaded so
+ * far. Each invocation of the {@code iterator} method returns an {@code Iterator}
+ * that first yields all of the elements cached from previous iteration, in
+ * instantiation order, and then lazily locates and instantiates any remaining
+ * providers, adding each one to the cache in turn. Similarly, each invocation
+ * of the stream method returns a {@code Stream} that first processes all
+ * providers loaded by previous stream operations, in load order, and then lazily
+ * locates any remaining providers. Caches are cleared via the {@link #reload
+ * reload} method.
+ *
+ * <h3> <a id="errors">Errors</a> </h3>
+ *
+ * <p> When using the service loader's {@code iterator}, the {@link
+ * Iterator#hasNext() hasNext} and {@link Iterator#next() next} methods will
+ * fail with {@link ServiceConfigurationError} if an error occurs locating,
+ * loading or instantiating a service provider. When processing the service
+ * loader's stream then {@code ServiceConfigurationError} may be thrown by any
+ * method that causes a service provider to be located or loaded.
+ *
+ * <p> When loading or instantiating a service provider in a module, {@code
+ * ServiceConfigurationError} can be thrown for the following reasons:
+ *
+ * <ul>
+ *
+ * <li> The service provider cannot be loaded. </li>
+ *
+ * <li> The service provider does not declare a provider method, and either
+ * it is not assignable to the service's interface/class or does not have a
+ * provider constructor. </li>
+ *
+ * <li> The service provider declares a public static no-args method named
+ * "provider" with a return type that is not assignable to the service's
+ * interface or class. </li>
+ *
+ * <li> The service provider class file has more than one public static
+ * no-args method named "{@code provider}". </li>
+ *
+ * <li> The service provider declares a provider method and it fails by
+ * returning {@code null} or throwing an exception. </li>
+ *
+ * <li> The service provider does not declare a provider method, and its
+ * provider constructor fails by throwing an exception. </li>
+ *
+ * </ul>
+ *
+ * <p> When reading a provider-configuration file, or loading or instantiating
+ * a provider class named in a provider-configuration file, then {@code
+ * ServiceConfigurationError} can be thrown for the following reasons:
+ *
+ * <ul>
+ *
+ * <li> The format of the provider-configuration file violates the <a
+ * href="ServiceLoader.html#format">format</a> specified above; </li>
+ *
+ * <li> An {@link IOException IOException} occurs while reading the
+ * provider-configuration file; </li>
+ *
+ * <li> A service provider cannot be loaded; </li>
+ *
+ * <li> A service provider is not assignable to the service's interface or
+ * class, or does not define a provider constructor, or cannot be
+ * instantiated. </li>
+ *
+ * </ul>
+ *
+ * <h3> Security </h3>
*
* <p> Service loaders always execute in the security context of the caller
* of the iterator or stream methods and may also be restricted by the security
@@ -246,91 +368,16 @@
* the methods of the iterators which they return, from within a privileged
* security context.
*
- * <h2> Concurrency </h2>
+ * <h3> Concurrency </h3>
*
* <p> Instances of this class are not safe for use by multiple concurrent
* threads.
*
- * <h2> Null handling </h2>
+ * <h3> Null handling </h3>
*
* <p> Unless otherwise specified, passing a {@code null} argument to any
* method in this class will cause a {@link NullPointerException} to be thrown.
*
- * <h2> Example </h2>
- * <p> Suppose we have a service type {@code com.example.CodecSet} which is
- * intended to represent sets of encoder/decoder pairs for some protocol. In
- * this case it is an abstract class with two abstract methods:
- *
- * <blockquote><pre>
- * public abstract Encoder getEncoder(String encodingName);
- * public abstract Decoder getDecoder(String encodingName);</pre></blockquote>
- *
- * Each method returns an appropriate object or {@code null} if the provider
- * does not support the given encoding. Typical providers support more than
- * one encoding.
- *
- * <p> The {@code CodecSet} class creates and saves a single service instance
- * at initialization:
- *
- * <pre>{@code
- * private static ServiceLoader<CodecSet> codecSetLoader
- * = ServiceLoader.load(CodecSet.class);
- * }</pre>
- *
- * <p> To locate an encoder for a given encoding name it defines a static
- * factory method which iterates through the known and available providers,
- * returning only when it has located a suitable encoder or has run out of
- * providers.
- *
- * <pre>{@code
- * public static Encoder getEncoder(String encodingName) {
- * for (CodecSet cp : codecSetLoader) {
- * Encoder enc = cp.getEncoder(encodingName);
- * if (enc != null)
- * return enc;
- * }
- * return null;
- * }}</pre>
- *
- * <p> A {@code getDecoder} method is defined similarly.
- *
- * <p> If the code creating and using the service loader is developed as
- * a module then its module descriptor will declare the usage with:
- * <pre>{@code uses com.example.CodecSet;}</pre>
- *
- * <p> Now suppose that {@code com.example.impl.StandardCodecs} is an
- * implementation of the {@code CodecSet} service and developed as a module.
- * In that case then the module with the service provider module will declare
- * this in its module descriptor:
- * <pre>{@code provides com.example.CodecSet with com.example.impl.StandardCodecs;
- * }</pre>
- *
- * <p> On the other hand, suppose {@code com.example.impl.StandardCodecs} is
- * packaged in a JAR file for the class path then the JAR file will contain a
- * file named:
- * <pre>{@code META-INF/services/com.example.CodecSet}</pre>
- * that contains the single line:
- * <pre>{@code com.example.impl.StandardCodecs # Standard codecs}</pre>
- *
- * <p><span style="font-weight: bold; padding-right: 1em">Usage Note</span> If
- * the class path of a class loader that is used for provider loading includes
- * remote network URLs then those URLs will be dereferenced in the process of
- * searching for provider-configuration files.
- *
- * <p> This activity is normal, although it may cause puzzling entries to be
- * created in web-server logs. If a web server is not configured correctly,
- * however, then this activity may cause the provider-loading algorithm to fail
- * spuriously.
- *
- * <p> A web server should return an HTTP 404 (Not Found) response when a
- * requested resource does not exist. Sometimes, however, web servers are
- * erroneously configured to return an HTTP 200 (OK) response along with a
- * helpful HTML error page in such cases. This will cause a {@link
- * ServiceConfigurationError} to be thrown when this class attempts to parse
- * the HTML page as a provider-configuration file. The best solution to this
- * problem is to fix the misconfigured web server to return the correct
- * response code (HTTP 404) along with the HTML error page.
- *
* @param <S>
* The type of the service to be loaded by this loader
*
@@ -548,32 +595,83 @@
}
/**
- * Uses Class.forName to load a provider class in a module.
+ * Returns {@code true} if the provider is in an explicit module
+ */
+ private boolean inExplicitModule(Class<?> clazz) {
+ Module module = clazz.getModule();
+ return module.isNamed() && !module.getDescriptor().isAutomatic();
+ }
+
+ /**
+ * Returns the public static "provider" method if found.
*
- * @throws ServiceConfigurationError
- * If the class cannot be loaded
+ * @throws ServiceConfigurationError if there is an error finding the
+ * provider method or there is more than one public static
+ * provider method
*/
- private Class<?> loadProviderInModule(Module module, String cn) {
- Class<?> clazz = null;
- if (acc == null) {
- try {
- clazz = Class.forName(module, cn);
- } catch (LinkageError e) {
- fail(service, "Unable to load " + cn, e);
- }
- } else {
- PrivilegedExceptionAction<Class<?>> pa = () -> Class.forName(module, cn);
- try {
- clazz = AccessController.doPrivileged(pa);
- } catch (PrivilegedActionException pae) {
- Throwable x = pae.getCause();
- fail(service, "Unable to load " + cn, x);
- return null;
+ private Method findStaticProviderMethod(Class<?> clazz) {
+ List<Method> methods = null;
+ try {
+ methods = LANG_ACCESS.getDeclaredPublicMethods(clazz, "provider");
+ } catch (Throwable x) {
+ fail(service, "Unable to get public provider() method", x);
+ }
+ if (methods.isEmpty()) {
+ // does not declare a public provider method
+ return null;
+ }
+
+ // locate the static methods, can be at most one
+ Method result = null;
+ for (Method method : methods) {
+ int mods = method.getModifiers();
+ assert Modifier.isPublic(mods);
+ if (Modifier.isStatic(mods)) {
+ if (result != null) {
+ fail(service, clazz + " declares more than one"
+ + " public static provider() method");
+ }
+ result = method;
}
}
- if (clazz == null)
- fail(service, "Provider " + cn + " not found");
- return clazz;
+ if (result != null) {
+ Method m = result;
+ PrivilegedAction<Void> pa = () -> {
+ m.setAccessible(true);
+ return null;
+ };
+ AccessController.doPrivileged(pa);
+ }
+ return result;
+ }
+
+ /**
+ * Returns the public no-arg constructor of a class.
+ *
+ * @throws ServiceConfigurationError if the class does not have
+ * public no-arg constructor
+ */
+ private Constructor<?> getConstructor(Class<?> clazz) {
+ PrivilegedExceptionAction<Constructor<?>> pa
+ = new PrivilegedExceptionAction<>() {
+ @Override
+ public Constructor<?> run() throws Exception {
+ Constructor<?> ctor = clazz.getConstructor();
+ if (inExplicitModule(clazz))
+ ctor.setAccessible(true);
+ return ctor;
+ }
+ };
+ Constructor<?> ctor = null;
+ try {
+ ctor = AccessController.doPrivileged(pa);
+ } catch (Throwable x) {
+ if (x instanceof PrivilegedActionException)
+ x = x.getCause();
+ String cn = clazz.getName();
+ fail(service, cn + " Unable to get public no-arg constructor", x);
+ }
+ return ctor;
}
/**
@@ -581,65 +679,33 @@
* permissions, the static factory to obtain the provider or the
* provider's no-arg constructor.
*/
- private final static class ProviderImpl<S> implements Provider<S> {
+ private static class ProviderImpl<S> implements Provider<S> {
final Class<S> service;
+ final Class<? extends S> type;
+ final Method factoryMethod; // factory method or null
+ final Constructor<? extends S> ctor; // public no-args constructor or null
final AccessControlContext acc;
- final Method factoryMethod; // factory method or null
- final Class<? extends S> type;
- final Constructor<? extends S> ctor; // public no-args constructor or null
-
- /**
- * Creates a Provider.
- *
- * @param service
- * The service type
- * @param clazz
- * The provider (or provider factory) class
- * @param acc
- * The access control context when running with security manager
- *
- * @throws ServiceConfigurationError
- * If the class is not public; If the class defines a public
- * static provider() method with a return type that is assignable
- * to the service type or the class is not a provider class with
- * a public no-args constructor.
- */
- @SuppressWarnings("unchecked")
- ProviderImpl(Class<?> service, Class<?> clazz, AccessControlContext acc) {
- this.service = (Class<S>) service;
+ ProviderImpl(Class<S> service,
+ Class<? extends S> type,
+ Method factoryMethod,
+ AccessControlContext acc) {
+ this.service = service;
+ this.type = type;
+ this.factoryMethod = factoryMethod;
+ this.ctor = null;
this.acc = acc;
+ }
- int mods = clazz.getModifiers();
- if (!Modifier.isPublic(mods)) {
- fail(service, clazz + " is not public");
- }
-
- // if the class is in an explicit module then see if it is
- // a provider factory class
- Method factoryMethod = null;
- if (inExplicitModule(clazz)) {
- factoryMethod = findStaticProviderMethod(clazz);
- if (factoryMethod != null) {
- Class<?> returnType = factoryMethod.getReturnType();
- if (!service.isAssignableFrom(returnType)) {
- fail(service, factoryMethod + " return type not a subtype");
- }
- }
- }
- this.factoryMethod = factoryMethod;
-
- if (factoryMethod == null) {
- // no factory method so must have a public no-args constructor
- if (!service.isAssignableFrom(clazz)) {
- fail(service, clazz.getName() + " not a subtype");
- }
- this.type = (Class<? extends S>) clazz;
- this.ctor = (Constructor<? extends S>) getConstructor(clazz);
- } else {
- this.type = (Class<? extends S>) factoryMethod.getReturnType();
- this.ctor = null;
- }
+ ProviderImpl(Class<S> service,
+ Class<? extends S> type,
+ Constructor<? extends S> ctor,
+ AccessControlContext acc) {
+ this.service = service;
+ this.type = type;
+ this.factoryMethod = null;
+ this.ctor = ctor;
+ this.acc = acc;
}
@Override
@@ -657,72 +723,6 @@
}
/**
- * Returns {@code true} if the provider is in an explicit module
- */
- private boolean inExplicitModule(Class<?> clazz) {
- Module module = clazz.getModule();
- return module.isNamed() && !module.getDescriptor().isAutomatic();
- }
-
- /**
- * Returns the public static provider method if found.
- *
- * @throws ServiceConfigurationError if there is an error finding the
- * provider method
- */
- private Method findStaticProviderMethod(Class<?> clazz) {
- Method method = null;
- try {
- method = LANG_ACCESS.getMethodOrNull(clazz, "provider");
- } catch (Throwable x) {
- fail(service, "Unable to get public provider() method", x);
- }
- if (method != null) {
- int mods = method.getModifiers();
- if (Modifier.isStatic(mods)) {
- assert Modifier.isPublic(mods);
- Method m = method;
- PrivilegedAction<Void> pa = () -> {
- m.setAccessible(true);
- return null;
- };
- AccessController.doPrivileged(pa);
- return method;
- }
- }
- return null;
- }
-
- /**
- * Returns the public no-arg constructor of a class.
- *
- * @throws ServiceConfigurationError if the class does not have
- * public no-arg constructor
- */
- private Constructor<?> getConstructor(Class<?> clazz) {
- PrivilegedExceptionAction<Constructor<?>> pa
- = new PrivilegedExceptionAction<>() {
- @Override
- public Constructor<?> run() throws Exception {
- Constructor<?> ctor = clazz.getConstructor();
- if (inExplicitModule(clazz))
- ctor.setAccessible(true);
- return ctor;
- }
- };
- Constructor<?> ctor = null;
- try {
- ctor = AccessController.doPrivileged(pa);
- } catch (Throwable x) {
- if (x instanceof PrivilegedActionException)
- x = x.getCause();
- String cn = clazz.getName();
- fail(service, cn + " Unable to get public no-arg constructor", x);
- }
- return ctor;
- }
-
- /**
* Invokes the provider's "provider" method to instantiate a provider.
* When running with a security manager then the method runs with
* permissions that are restricted by the security context of whatever
@@ -808,7 +808,7 @@
@Override
public int hashCode() {
- return Objects.hash(type, acc);
+ return Objects.hash(service, type, acc);
}
@Override
@@ -817,12 +817,84 @@
return false;
@SuppressWarnings("unchecked")
ProviderImpl<?> that = (ProviderImpl<?>)ob;
- return this.type == that.type
+ return this.service == that.service
+ && this.type == that.type
&& Objects.equals(this.acc, that.acc);
}
}
/**
+ * Loads a service provider in a module.
+ *
+ * Returns {@code null} if the service provider's module doesn't read
+ * the module with the service type.
+ *
+ * @throws ServiceConfigurationError if the class cannot be loaded or
+ * isn't the expected sub-type (or doesn't define a provider
+ * factory method that returns the expected type)
+ */
+ private Provider<S> loadProvider(ServiceProvider provider) {
+ Module module = provider.module();
+ if (!module.canRead(service.getModule())) {
+ // module does not read the module with the service type
+ return null;
+ }
+
+ String cn = provider.providerName();
+ Class<?> clazz = null;
+ if (acc == null) {
+ try {
+ clazz = Class.forName(module, cn);
+ } catch (LinkageError e) {
+ fail(service, "Unable to load " + cn, e);
+ }
+ } else {
+ PrivilegedExceptionAction<Class<?>> pa = () -> Class.forName(module, cn);
+ try {
+ clazz = AccessController.doPrivileged(pa);
+ } catch (PrivilegedActionException pae) {
+ Throwable x = pae.getCause();
+ fail(service, "Unable to load " + cn, x);
+ return null;
+ }
+ }
+ if (clazz == null) {
+ fail(service, "Provider " + cn + " not found");
+ }
+
+ int mods = clazz.getModifiers();
+ if (!Modifier.isPublic(mods)) {
+ fail(service, clazz + " is not public");
+ }
+
+ // if provider in explicit module then check for static factory method
+ if (inExplicitModule(clazz)) {
+ Method factoryMethod = findStaticProviderMethod(clazz);
+ if (factoryMethod != null) {
+ Class<?> returnType = factoryMethod.getReturnType();
+ if (!service.isAssignableFrom(returnType)) {
+ fail(service, factoryMethod + " return type not a subtype");
+ }
+
+ @SuppressWarnings("unchecked")
+ Class<? extends S> type = (Class<? extends S>) returnType;
+ return new ProviderImpl<S>(service, type, factoryMethod, acc);
+ }
+ }
+
+ // no factory method so must be a subtype
+ if (!service.isAssignableFrom(clazz)) {
+ fail(service, clazz.getName() + " not a subtype");
+ }
+
+ @SuppressWarnings("unchecked")
+ Class<? extends S> type = (Class<? extends S>) clazz;
+ @SuppressWarnings("unchecked")
+ Constructor<? extends S> ctor = (Constructor<? extends S> ) getConstructor(clazz);
+ return new ProviderImpl<S>(service, type, ctor, acc);
+ }
+
+ /**
* Implements lazy service provider lookup of service providers that
* are provided by modules in a module layer (or parent layers)
*/
@@ -832,7 +904,9 @@
Deque<ModuleLayer> stack = new ArrayDeque<>();
Set<ModuleLayer> visited = new HashSet<>();
Iterator<ServiceProvider> iterator;
- ServiceProvider next; // next provider to load
+
+ Provider<T> nextProvider;
+ ServiceConfigurationError nextError;
LayerLookupIterator() {
visited.add(layer);
@@ -846,33 +920,36 @@
@Override
public boolean hasNext() {
- // already have the next provider cached
- if (next != null)
- return true;
+ while (nextProvider == null && nextError == null) {
+ // get next provider to load
+ while (iterator == null || !iterator.hasNext()) {
+ // next layer (DFS order)
+ if (stack.isEmpty())
+ return false;
- while (true) {
-
- // next provider (or provider factory)
- if (iterator != null && iterator.hasNext()) {
- next = iterator.next();
- return true;
+ ModuleLayer layer = stack.pop();
+ List<ModuleLayer> parents = layer.parents();
+ for (int i = parents.size() - 1; i >= 0; i--) {
+ ModuleLayer parent = parents.get(i);
+ if (!visited.contains(parent)) {
+ visited.add(parent);
+ stack.push(parent);
+ }
+ }
+ iterator = providers(layer);
}
- // next layer (DFS order)
- if (stack.isEmpty())
- return false;
-
- ModuleLayer layer = stack.pop();
- List<ModuleLayer> parents = layer.parents();
- for (int i = parents.size() - 1; i >= 0; i--) {
- ModuleLayer parent = parents.get(i);
- if (!visited.contains(parent)) {
- visited.add(parent);
- stack.push(parent);
- }
+ // attempt to load provider
+ ServiceProvider provider = iterator.next();
+ try {
+ @SuppressWarnings("unchecked")
+ Provider<T> next = (Provider<T>) loadProvider(provider);
+ nextProvider = next;
+ } catch (ServiceConfigurationError e) {
+ nextError = e;
}
- iterator = providers(layer);
}
+ return true;
}
@Override
@@ -880,15 +957,16 @@
if (!hasNext())
throw new NoSuchElementException();
- // take next provider
- ServiceProvider provider = next;
- next = null;
-
- // attempt to load provider
- Module module = provider.module();
- String cn = provider.providerName();
- Class<?> clazz = loadProviderInModule(module, cn);
- return new ProviderImpl<T>(service, clazz, acc);
+ Provider<T> provider = nextProvider;
+ if (provider != null) {
+ nextProvider = null;
+ return provider;
+ } else {
+ ServiceConfigurationError e = nextError;
+ assert e != null;
+ nextError = null;
+ throw e;
+ }
}
}
@@ -902,7 +980,9 @@
{
ClassLoader currentLoader;
Iterator<ServiceProvider> iterator;
- ServiceProvider next; // next provider to load
+
+ Provider<T> nextProvider;
+ ServiceConfigurationError nextError;
ModuleServicesLookupIterator() {
this.currentLoader = loader;
@@ -919,13 +999,25 @@
}
/**
+ * Returns the class loader that a module is defined to
+ */
+ private ClassLoader loaderFor(Module module) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null) {
+ return module.getClassLoader();
+ } else {
+ PrivilegedAction<ClassLoader> pa = module::getClassLoader;
+ return AccessController.doPrivileged(pa);
+ }
+ }
+
+ /**
* Returns an iterator to iterate over the implementations of {@code
* service} in modules defined to the given class loader or in custom
* layers with a module defined to this class loader.
*/
private Iterator<ServiceProvider> iteratorFor(ClassLoader loader) {
-
- // modules defined to this class loader
+ // modules defined to the class loader
ServicesCatalog catalog;
if (loader == null) {
catalog = BootLoader.getServicesCatalog();
@@ -939,17 +1031,20 @@
providers = catalog.findServices(serviceName);
}
- // modules in custom layers that define modules to the class loader
- if (loader == null) {
+ // modules in layers that define modules to the class loader
+ ClassLoader platformClassLoader = ClassLoaders.platformClassLoader();
+ if (loader == null || loader == platformClassLoader) {
return providers.iterator();
} else {
List<ServiceProvider> allProviders = new ArrayList<>(providers);
- ModuleLayer bootLayer = ModuleLayer.boot();
Iterator<ModuleLayer> iterator = LANG_ACCESS.layers(loader).iterator();
while (iterator.hasNext()) {
ModuleLayer layer = iterator.next();
- if (layer != bootLayer) {
- allProviders.addAll(providers(layer));
+ for (ServiceProvider sp : providers(layer)) {
+ ClassLoader l = loaderFor(sp.module());
+ if (l != null && l != platformClassLoader) {
+ allProviders.add(sp);
+ }
}
}
return allProviders.iterator();
@@ -958,24 +1053,28 @@
@Override
public boolean hasNext() {
- // already have the next provider cached
- if (next != null)
- return true;
-
- while (true) {
- if (iterator.hasNext()) {
- next = iterator.next();
- return true;
+ while (nextProvider == null && nextError == null) {
+ // get next provider to load
+ while (!iterator.hasNext()) {
+ if (currentLoader == null) {
+ return false;
+ } else {
+ currentLoader = currentLoader.getParent();
+ iterator = iteratorFor(currentLoader);
+ }
}
- // move to the next class loader if possible
- if (currentLoader == null) {
- return false;
- } else {
- currentLoader = currentLoader.getParent();
- iterator = iteratorFor(currentLoader);
+ // attempt to load provider
+ ServiceProvider provider = iterator.next();
+ try {
+ @SuppressWarnings("unchecked")
+ Provider<T> next = (Provider<T>) loadProvider(provider);
+ nextProvider = next;
+ } catch (ServiceConfigurationError e) {
+ nextError = e;
}
}
+ return true;
}
@Override
@@ -983,15 +1082,16 @@
if (!hasNext())
throw new NoSuchElementException();
- // take next provider
- ServiceProvider provider = next;
- next = null;
-
- // attempt to load provider
- Module module = provider.module();
- String cn = provider.providerName();
- Class<?> clazz = loadProviderInModule(module, cn);
- return new ProviderImpl<T>(service, clazz, acc);
+ Provider<T> provider = nextProvider;
+ if (provider != null) {
+ nextProvider = null;
+ return provider;
+ } else {
+ ServiceConfigurationError e = nextError;
+ assert e != null;
+ nextError = null;
+ throw e;
+ }
}
}
@@ -1008,8 +1108,9 @@
Set<String> providerNames = new HashSet<>(); // to avoid duplicates
Enumeration<URL> configs;
Iterator<String> pending;
- Class<?> nextClass;
- String nextErrorMessage; // when hasNext fails with CNFE
+
+ Provider<T> nextProvider;
+ ServiceConfigurationError nextError;
LazyClassPathLookupIterator() { }
@@ -1068,51 +1169,71 @@
return names.iterator();
}
- private boolean hasNextService() {
- if (nextClass != null || nextErrorMessage != null) {
- return true;
- }
-
- Class<?> clazz;
- do {
- if (configs == null) {
- try {
- String fullName = PREFIX + service.getName();
- if (loader == null) {
- configs = ClassLoader.getSystemResources(fullName);
- } else if (loader == ClassLoaders.platformClassLoader()) {
- // The platform classloader doesn't have a class path,
- // but the boot loader might.
- if (BootLoader.hasClassPath()) {
- configs = BootLoader.findResources(fullName);
- } else {
- configs = Collections.emptyEnumeration();
- }
+ /**
+ * Loads and returns the next provider class.
+ */
+ private Class<?> nextProviderClass() {
+ if (configs == null) {
+ try {
+ String fullName = PREFIX + service.getName();
+ if (loader == null) {
+ configs = ClassLoader.getSystemResources(fullName);
+ } else if (loader == ClassLoaders.platformClassLoader()) {
+ // The platform classloader doesn't have a class path,
+ // but the boot loader might.
+ if (BootLoader.hasClassPath()) {
+ configs = BootLoader.findResources(fullName);
} else {
- configs = loader.getResources(fullName);
+ configs = Collections.emptyEnumeration();
}
- } catch (IOException x) {
- fail(service, "Error locating configuration files", x);
+ } else {
+ configs = loader.getResources(fullName);
}
+ } catch (IOException x) {
+ fail(service, "Error locating configuration files", x);
}
- while ((pending == null) || !pending.hasNext()) {
- if (!configs.hasMoreElements()) {
- return false;
- }
- pending = parse(configs.nextElement());
+ }
+ while ((pending == null) || !pending.hasNext()) {
+ if (!configs.hasMoreElements()) {
+ return null;
}
- String cn = pending.next();
+ pending = parse(configs.nextElement());
+ }
+ String cn = pending.next();
+ try {
+ return Class.forName(cn, false, loader);
+ } catch (ClassNotFoundException x) {
+ fail(service, "Provider " + cn + " not found");
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean hasNextService() {
+ while (nextProvider == null && nextError == null) {
try {
- clazz = Class.forName(cn, false, loader);
- } catch (ClassNotFoundException x) {
- // don't throw SCE here to long standing behavior
- nextErrorMessage = "Provider " + cn + " not found";
- return true;
+ Class<?> clazz = nextProviderClass();
+ if (clazz == null)
+ return false;
+
+ if (clazz.getModule().isNamed()) {
+ // ignore class if in named module
+ continue;
+ }
+
+ if (service.isAssignableFrom(clazz)) {
+ Class<? extends S> type = (Class<? extends S>) clazz;
+ Constructor<? extends S> ctor
+ = (Constructor<? extends S>)getConstructor(clazz);
+ ProviderImpl<S> p = new ProviderImpl<S>(service, type, ctor, acc);
+ nextProvider = (ProviderImpl<T>) p;
+ } else {
+ fail(service, clazz.getName() + " not a subtype");
+ }
+ } catch (ServiceConfigurationError e) {
+ nextError = e;
}
-
- } while (clazz.getModule().isNamed()); // ignore if in named module
-
- nextClass = clazz;
+ }
return true;
}
@@ -1120,17 +1241,16 @@
if (!hasNextService())
throw new NoSuchElementException();
- // throw any SCE with error recorded by hasNext
- if (nextErrorMessage != null) {
- String msg = nextErrorMessage;
- nextErrorMessage = null;
- fail(service, msg);
+ Provider<T> provider = nextProvider;
+ if (provider != null) {
+ nextProvider = null;
+ return provider;
+ } else {
+ ServiceConfigurationError e = nextError;
+ assert e != null;
+ nextError = null;
+ throw e;
}
-
- // return next provider
- Class<?> clazz = nextClass;
- nextClass = null;
- return new ProviderImpl<T>(service, clazz, acc);
}
@Override
@@ -1188,42 +1308,26 @@
}
/**
- * Lazily load and instantiate the available providers of this loader's
- * service.
- *
- * <p> The iterator returned by this method first yields all of the
- * elements of the provider cache, in the order that they were loaded.
- * It then lazily loads and instantiates any remaining providers,
- * adding each one to the cache in turn.
+ * Returns an iterator to lazily load and instantiate the available
+ * providers of this loader's service.
*
* <p> To achieve laziness the actual work of locating and instantiating
- * providers must be done by the iterator itself. Its {@link
- * java.util.Iterator#hasNext hasNext} and {@link java.util.Iterator#next
- * next} methods can therefore throw a {@link ServiceConfigurationError}
- * if a provider class cannot be loaded, doesn't have an appropriate static
- * factory method or constructor, can't be assigned to the service type or
- * if any other kind of exception or error is thrown as the next provider
- * is located and instantiated. To write robust code it is only necessary
- * to catch {@link ServiceConfigurationError} when using a service iterator.
- *
- * <p> If such an error is thrown then subsequent invocations of the
+ * providers is done by the iterator itself. Its {@link Iterator#hasNext
+ * hasNext} and {@link Iterator#next next} methods can therefore throw a
+ * {@link ServiceConfigurationError} for any of the reasons specified in
+ * the <a href="#errors">Errors</a> section above. To write robust code it
+ * is only necessary to catch {@code ServiceConfigurationError} when using
+ * the iterator. If an error is thrown then subsequent invocations of the
* iterator will make a best effort to locate and instantiate the next
* available provider, but in general such recovery cannot be guaranteed.
*
- * <blockquote style="font-size: smaller; line-height: 1.2"><span
- * style="padding-right: 1em; font-weight: bold">Design Note</span>
- * Throwing an error in these cases may seem extreme. The rationale for
- * this behavior is that a malformed provider-configuration file, like a
- * malformed class file, indicates a serious problem with the way the Java
- * virtual machine is configured or is being used. As such it is
- * preferable to throw an error rather than try to recover or, even worse,
- * fail silently.</blockquote>
- *
- * <p> If this loader's provider caches are cleared by invoking the {@link
- * #reload() reload} method then existing iterators for this service
- * loader should be discarded.
- * The {@link java.util.Iterator#hasNext() hasNext} and {@link
- * java.util.Iterator#next() next} methods of the iterator throw {@link
+ * <p> Caching: The iterator returned by this method first yields all of
+ * the elements of the provider cache, in the order that they were loaded.
+ * It then lazily loads and instantiates any remaining service providers,
+ * adding each one to the cache in turn. If this loader's provider caches are
+ * cleared by invoking the {@link #reload() reload} method then existing
+ * iterators for this service loader should be discarded.
+ * The {@code hasNext} and {@code next} methods of the iterator throw {@link
* java.util.ConcurrentModificationException ConcurrentModificationException}
* if used after the provider cache has been cleared.
*
@@ -1231,6 +1335,12 @@
* Invoking its {@link java.util.Iterator#remove() remove} method will
* cause an {@link UnsupportedOperationException} to be thrown.
*
+ * @apiNote Throwing an error in these cases may seem extreme. The rationale
+ * for this behavior is that a malformed provider-configuration file, like a
+ * malformed class file, indicates a serious problem with the way the Java
+ * virtual machine is configured or is being used. As such it is preferable
+ * to throw an error rather than try to recover or, even worse, fail silently.
+ *
* @return An iterator that lazily loads providers for this loader's
* service
*
@@ -1287,35 +1397,36 @@
}
/**
- * Returns a stream that lazily loads the available providers of this
- * loader's service. The stream elements are of type {@link Provider
- * Provider}, the {@code Provider}'s {@link Provider#get() get} method
- * must be invoked to get or instantiate the provider.
+ * Returns a stream to lazily load available providers of this loader's
+ * service. The stream elements are of type {@link Provider Provider}, the
+ * {@code Provider}'s {@link Provider#get() get} method must be invoked to
+ * get or instantiate the provider.
*
- * <p> When processing the stream then providers that were previously
- * loaded by stream operations are processed first, in load order. It then
- * lazily loads any remaining providers. If a provider class cannot be
- * loaded, can't be assigned to the service type, or some other error is
- * thrown when locating the provider then it is wrapped with a {@code
- * ServiceConfigurationError} and thrown by whatever method caused the
- * provider to be loaded. </p>
+ * <p> To achieve laziness the actual work of locating providers is done
+ * when processing the stream. If a service provider cannot be loaded for any
+ * of the the reasons specified in the <a href="#errors">Errors</a> section
+ * above then {@link ServiceConfigurationError} is thrown by whatever method
+ * caused the service provider to be loaded. </p>
*
- * <p> If this loader's provider caches are cleared by invoking the {@link
- * #reload() reload} method then existing streams for this service loader
- * should be discarded. The returned stream's source {@code Spliterator} is
- * <em>fail-fast</em> and will throw {@link ConcurrentModificationException}
- * if the provider cache has been cleared. </p>
+ * <p> Caching: When processing the stream then providers that were previously
+ * loaded by stream operations are processed first, in load order. It then
+ * lazily loads any remaining service providers. If this loader's provider
+ * caches are cleared by invoking the {@link #reload() reload} method then
+ * existing streams for this service loader should be discarded. The returned
+ * stream's source {@link Spliterator spliterator} is <em>fail-fast</em> and
+ * will throw {@link ConcurrentModificationException} if the provider cache
+ * has been cleared. </p>
*
- * <p> The following examples demonstrate usage. The first example
- * creates a stream of providers, the second example is the same except
- * that it sorts the providers by provider class name (and so locate all
- * providers).
+ * <p> The following examples demonstrate usage. The first example creates
+ * a stream of {@code CodecFactory} objects, the second example is the same
+ * except that it sorts the providers by provider class name (and so locate
+ * all providers).
* <pre>{@code
- * Stream<CodecSet> providers = ServiceLoader.load(CodecSet.class)
+ * Stream<CodecFactory> providers = ServiceLoader.load(CodecFactory.class)
* .stream()
* .map(Provider::get);
*
- * Stream<CodecSet> providers = ServiceLoader.load(CodecSet.class)
+ * Stream<CodecFactory> providers = ServiceLoader.load(CodecFactory.class)
* .stream()
* .sorted(Comparator.comparing(p -> p.type().getName()))
* .map(Provider::get);
@@ -1419,8 +1530,86 @@
}
/**
- * Creates a new service loader for the given service type and class
- * loader.
+ * Creates a new service loader for the given service. The service loader
+ * uses the given class loader as the starting point to locate service
+ * providers for the service. The service loader's {@link #iterator()
+ * iterator} and {@link #stream() stream} locate providers in both named
+ * and unnamed modules, as follows:
+ *
+ * <ul>
+ * <li> <p> Step 1: Locate providers in named modules. </p>
+ *
+ * <p> Service providers are located in all named modules of the class
+ * loader or to any class loader reachable via parent delegation. </p>
+ *
+ * <p> In addition, if the class loader is not the bootstrap or {@linkplain
+ * ClassLoader#getPlatformClassLoader() platform class loader}, then service
+ * providers may be located in the named modules of other class loaders.
+ * Specifically, if the class loader, or any class loader reachable via
+ * parent delegation, has a module in a {@linkplain ModuleLayer module
+ * layer}, then service providers in all modules in the module layer are
+ * located. </p>
+ *
+ * <p> For example, suppose there is a module layer where each module is
+ * in its own class loader (see {@link ModuleLayer#defineModulesWithManyLoaders
+ * defineModulesWithManyLoaders}). If this {@code ServiceLoader.load} method
+ * is invoked to locate providers using any of the class loaders created for
+ * the module layer, then it will locate all of the providers in the module
+ * layer, irrespective of their defining class loader. </p>
+ *
+ * <p> Ordering: The service loader will first locate any service providers
+ * in modules defined to the class loader, then its parent class loader,
+ * its parent parent, and so on to the bootstrap class loader. If a class
+ * loader has modules in a module layer then all providers in that module
+ * layer are located (irrespective of their class loader) before the
+ * providers in the parent class loader are located. The ordering of
+ * modules in same class loader, or the ordering of modules in a module
+ * layer, is not defined. </p>
+ *
+ * <p> If a module declares more than one provider then the providers
+ * are located in the order that its module descriptor {@linkplain
+ * java.lang.module.ModuleDescriptor.Provides#providers() lists the
+ * providers}. Providers added dynamically by instrumentation agents (see
+ * {@link java.lang.instrument.Instrumentation#redefineModule redefineModule})
+ * are always located after providers declared by the module. </p> </li>
+ *
+ * <li> <p> Step 2: Locate providers in unnamed modules. </p>
+ *
+ * <p> Service providers in unnamed modules are located if their class names
+ * are listed in provider-configuration files located by the class loader's
+ * {@link ClassLoader#getResources(String) getResources} method. </p>
+ *
+ * <p> The ordering is based on the order that the class loader's {@code
+ * getResources} method finds the service configuration files and within
+ * that, the order that the class names are listed in the file. </p>
+ *
+ * <p> In a provider-configuration file, any mention of a service provider
+ * that is deployed in a named module is ignored. This is to avoid
+ * duplicates that would otherwise arise when a named module has both a
+ * <i>provides</i> directive and a provider-configuration file that mention
+ * the same service provider. </p>
+ *
+ * <p> The provider class must be visible to the class loader. </p> </li>
+ *
+ * </ul>
+ *
+ * @apiNote If the class path of the class loader includes remote network
+ * URLs then those URLs may be dereferenced in the process of searching for
+ * provider-configuration files.
+ *
+ * <p> This activity is normal, although it may cause puzzling entries to be
+ * created in web-server logs. If a web server is not configured correctly,
+ * however, then this activity may cause the provider-loading algorithm to fail
+ * spuriously.
+ *
+ * <p> A web server should return an HTTP 404 (Not Found) response when a
+ * requested resource does not exist. Sometimes, however, web servers are
+ * erroneously configured to return an HTTP 200 (OK) response along with a
+ * helpful HTML error page in such cases. This will cause a {@link
+ * ServiceConfigurationError} to be thrown when this class attempts to parse
+ * the HTML page as a provider-configuration file. The best solution to this
+ * problem is to fix the misconfigured web server to return the correct
+ * response code (HTTP 404) along with the HTML error page.
*
* @param <S> the class of the service type
*
@@ -1457,13 +1646,13 @@
*
* <p> An invocation of this convenience method of the form
* <pre>{@code
- * ServiceLoader.load(service)
+ * ServiceLoader.load(service)
* }</pre>
*
* is equivalent to
*
* <pre>{@code
- * ServiceLoader.load(service, Thread.currentThread().getContextClassLoader())
+ * ServiceLoader.load(service, Thread.currentThread().getContextClassLoader())
* }</pre>
*
* @apiNote Service loader objects obtained with this method should not be
@@ -1502,7 +1691,7 @@
* <p> This convenience method is equivalent to: </p>
*
* <pre>{@code
- * ServiceLoader.load(service, ClassLoader.getPlatformClassLoader())
+ * ServiceLoader.load(service, ClassLoader.getPlatformClassLoader())
* }</pre>
*
* <p> This method is intended for use when only installed providers are
@@ -1532,9 +1721,29 @@
}
/**
- * Creates a new service loader for the given service type that loads
- * service providers from modules in the given {@code ModuleLayer} and its
- * ancestors.
+ * Creates a new service loader for the given service type to load service
+ * providers from modules in the given module layer and its ancestors. It
+ * does not locate providers in unnamed modules. The ordering that the service
+ * loader's {@link #iterator() iterator} and {@link #stream() stream} locate
+ * providers and yield elements is as follows:
+ *
+ * <ul>
+ * <li><p> Providers are located in a module layer before locating providers
+ * in parent layers. Traversal of parent layers is depth-first with each
+ * layer visited at most once. For example, suppose L0 is the boot layer, L1
+ * and L2 are modules layers with L0 as their parent. Now suppose that L3 is
+ * created with L1 and L2 as the parents (in that order). Using a service
+ * loader to locate providers with L3 as the context will locate providers
+ * in the following order: L3, L1, L0, L2. </p></li>
+ *
+ * <li><p> If a module declares more than one provider then the providers
+ * are located in the order that its module descriptor
+ * {@linkplain java.lang.module.ModuleDescriptor.Provides#providers()
+ * lists the providers}. Providers added dynamically by instrumentation
+ * agents are always located after providers declared by the module. </p></li>
+ *
+ * <li><p> The ordering of modules in a module layer is not defined. </p></li>
+ * </ul>
*
* @apiNote Unlike the other load methods defined here, the service type
* is the second parameter. The reason for this is to avoid source
@@ -1564,26 +1773,25 @@
}
/**
- * Load the first available provider of this loader's service. This
+ * Load the first available service provider of this loader's service. This
* convenience method is equivalent to invoking the {@link #iterator()
* iterator()} method and obtaining the first element. It therefore
* returns the first element from the provider cache if possible, it
* otherwise attempts to load and instantiate the first provider.
*
- * <p> The following example loads the first available provider. If there
- * are no providers deployed then it uses a default implementation.
+ * <p> The following example loads the first available service provider. If
+ * no service providers are located then it uses a default implementation.
* <pre>{@code
- * CodecSet provider =
- * ServiceLoader.load(CodecSet.class).findFirst().orElse(DEFAULT_CODECSET);
+ * CodecFactory factory = ServiceLoader.load(CodecFactory.class)
+ * .findFirst()
+ * .orElse(DEFAULT_CODECSET_FACTORY);
* }</pre>
- * @return The first provider or empty {@code Optional} if no providers
- * are located
+ * @return The first service provider or empty {@code Optional} if no
+ * service providers are located
*
* @throws ServiceConfigurationError
- * If a provider class cannot be loaded, doesn't have the
- * appropriate static factory method or constructor, can't be
- * assigned to the service type, or if any other kind of exception
- * or error is thrown when locating or instantiating the provider.
+ * If a provider class cannot be loaded for any of the reasons
+ * specified in the <a href="#errors">Errors</a> section above.
*
* @since 9
* @spec JPMS
@@ -1603,11 +1811,11 @@
*
* <p> After invoking this method, subsequent invocations of the {@link
* #iterator() iterator} or {@link #stream() stream} methods will lazily
- * look up providers (and instantiate in the case of {@code iterator})
- * from scratch, just as is done by a newly-created loader.
+ * locate providers (and instantiate in the case of {@code iterator})
+ * from scratch, just as is done by a newly-created service loader.
*
- * <p> This method is intended for use in situations in which new providers
- * can be installed into a running Java virtual machine.
+ * <p> This method is intended for use in situations in which new service
+ * providers can be installed into a running Java virtual machine.
*/
public void reload() {
lookupIterator1 = null;
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java Thu Aug 24 16:24:44 2017 +0200
@@ -249,7 +249,8 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function, returning the previous value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
@@ -270,7 +271,8 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function, returning the updated value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
@@ -291,13 +293,14 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function to the current and given values,
* returning the previous value. The function should be
* side-effect-free, since it may be re-applied when attempted
- * updates fail due to contention among threads. The function
- * is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * updates fail due to contention among threads. The function is
+ * applied with the current value as its first argument, and the
+ * given update as the second argument.
*
* @param x the update value
* @param accumulatorFunction a side-effect-free function of two arguments
@@ -317,13 +320,14 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function to the current and given values,
* returning the updated value. The function should be
* side-effect-free, since it may be re-applied when attempted
- * updates fail due to contention among threads. The function
- * is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * updates fail due to contention among threads. The function is
+ * applied with the current value as its first argument, and the
+ * given update as the second argument.
*
* @param x the update value
* @param accumulatorFunction a side-effect-free function of two arguments
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Thu Aug 24 16:24:44 2017 +0200
@@ -260,10 +260,12 @@
}
/**
- * Atomically updates the element at index {@code i} with the results
- * of applying the given function, returning the previous value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function, returning the
+ * previous value. The function should be side-effect-free, since
+ * it may be re-applied when attempted updates fail due to
+ * contention among threads.
*
* @param i the index
* @param updateFunction a side-effect-free function
@@ -282,10 +284,12 @@
}
/**
- * Atomically updates the element at index {@code i} with the results
- * of applying the given function, returning the updated value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function, returning the
+ * updated value. The function should be side-effect-free, since it
+ * may be re-applied when attempted updates fail due to contention
+ * among threads.
*
* @param i the index
* @param updateFunction a side-effect-free function
@@ -304,10 +308,11 @@
}
/**
- * Atomically updates the element at index {@code i} with the
- * results of applying the given function to the current and given
- * values, returning the previous value. The function should be
- * side-effect-free, since it may be re-applied when attempted
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function to the current and
+ * given values, returning the previous value. The function should
+ * be side-effect-free, since it may be re-applied when attempted
* updates fail due to contention among threads. The function is
* applied with the current value of the element at index {@code i}
* as its first argument, and the given update as the second
@@ -332,10 +337,11 @@
}
/**
- * Atomically updates the element at index {@code i} with the
- * results of applying the given function to the current and given
- * values, returning the updated value. The function should be
- * side-effect-free, since it may be re-applied when attempted
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function to the current and
+ * given values, returning the updated value. The function should
+ * be side-effect-free, since it may be re-applied when attempted
* updates fail due to contention among threads. The function is
* applied with the current value of the element at index {@code i}
* as its first argument, and the given update as the second
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,6 +46,7 @@
import jdk.internal.misc.Unsafe;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
+import java.lang.invoke.VarHandle;
/**
* A reflection-based utility that enables atomic updates to
@@ -275,10 +276,12 @@
}
/**
- * Atomically updates the field of the given object managed by this updater
- * with the results of applying the given function, returning the previous
- * value. The function should be side-effect-free, since it may be
- * re-applied when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given
+ * function, returning the previous value. The function should be
+ * side-effect-free, since it may be re-applied when attempted
+ * updates fail due to contention among threads.
*
* @param obj An object whose field to get and set
* @param updateFunction a side-effect-free function
@@ -295,10 +298,12 @@
}
/**
- * Atomically updates the field of the given object managed by this updater
- * with the results of applying the given function, returning the updated
- * value. The function should be side-effect-free, since it may be
- * re-applied when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given
+ * function, returning the updated value. The function should be
+ * side-effect-free, since it may be re-applied when attempted
+ * updates fail due to contention among threads.
*
* @param obj An object whose field to get and set
* @param updateFunction a side-effect-free function
@@ -315,13 +320,14 @@
}
/**
- * Atomically updates the field of the given object managed by this
- * updater with the results of applying the given function to the
- * current and given values, returning the previous value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads. The
- * function is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given function
+ * to the current and given values, returning the previous value.
+ * The function should be side-effect-free, since it may be
+ * re-applied when attempted updates fail due to contention among
+ * threads. The function is applied with the current value as its
+ * first argument, and the given update as the second argument.
*
* @param obj An object whose field to get and set
* @param x the update value
@@ -340,13 +346,14 @@
}
/**
- * Atomically updates the field of the given object managed by this
- * updater with the results of applying the given function to the
- * current and given values, returning the updated value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads. The
- * function is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given function
+ * to the current and given values, returning the updated value.
+ * The function should be side-effect-free, since it may be
+ * re-applied when attempted updates fail due to contention among
+ * threads. The function is applied with the current value as its
+ * first argument, and the given update as the second argument.
*
* @param obj An object whose field to get and set
* @param x the update value
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java Thu Aug 24 16:24:44 2017 +0200
@@ -118,8 +118,7 @@
* @param newValue the new value
*/
public final void set(long newValue) {
- // Use putLongVolatile instead of ordinary volatile store when
- // using compareAndSetLong, for sake of some 32bit systems.
+ // See JDK-8180620: Clarify VarHandle mixed-access subtleties
U.putLongVolatile(this, VALUE, newValue);
}
@@ -265,7 +264,8 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function, returning the previous value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
@@ -286,7 +286,8 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function, returning the updated value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
@@ -307,13 +308,14 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function to the current and given values,
* returning the previous value. The function should be
* side-effect-free, since it may be re-applied when attempted
- * updates fail due to contention among threads. The function
- * is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * updates fail due to contention among threads. The function is
+ * applied with the current value as its first argument, and the
+ * given update as the second argument.
*
* @param x the update value
* @param accumulatorFunction a side-effect-free function of two arguments
@@ -333,13 +335,14 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function to the current and given values,
* returning the updated value. The function should be
* side-effect-free, since it may be re-applied when attempted
- * updates fail due to contention among threads. The function
- * is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * updates fail due to contention among threads. The function is
+ * applied with the current value as its first argument, and the
+ * given update as the second argument.
*
* @param x the update value
* @param accumulatorFunction a side-effect-free function of two arguments
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Thu Aug 24 16:24:44 2017 +0200
@@ -260,10 +260,12 @@
}
/**
- * Atomically updates the element at index {@code i} with the results
- * of applying the given function, returning the previous value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function, returning the
+ * previous value. The function should be side-effect-free, since
+ * it may be re-applied when attempted updates fail due to
+ * contention among threads.
*
* @param i the index
* @param updateFunction a side-effect-free function
@@ -282,10 +284,12 @@
}
/**
- * Atomically updates the element at index {@code i} with the results
- * of applying the given function, returning the updated value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function, returning the
+ * updated value. The function should be side-effect-free, since it
+ * may be re-applied when attempted updates fail due to contention
+ * among threads.
*
* @param i the index
* @param updateFunction a side-effect-free function
@@ -304,10 +308,11 @@
}
/**
- * Atomically updates the element at index {@code i} with the
- * results of applying the given function to the current and given
- * values, returning the previous value. The function should be
- * side-effect-free, since it may be re-applied when attempted
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function to the current and
+ * given values, returning the previous value. The function should
+ * be side-effect-free, since it may be re-applied when attempted
* updates fail due to contention among threads. The function is
* applied with the current value of the element at index {@code i}
* as its first argument, and the given update as the second
@@ -332,10 +337,11 @@
}
/**
- * Atomically updates the element at index {@code i} with the
- * results of applying the given function to the current and given
- * values, returning the updated value. The function should be
- * side-effect-free, since it may be re-applied when attempted
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function to the current and
+ * given values, returning the updated value. The function should
+ * be side-effect-free, since it may be re-applied when attempted
* updates fail due to contention among threads. The function is
* applied with the current value of the element at index {@code i}
* as its first argument, and the given update as the second
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,6 +46,7 @@
import jdk.internal.misc.Unsafe;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
+import java.lang.invoke.VarHandle;
/**
* A reflection-based utility that enables atomic updates to
@@ -278,10 +279,12 @@
}
/**
- * Atomically updates the field of the given object managed by this updater
- * with the results of applying the given function, returning the previous
- * value. The function should be side-effect-free, since it may be
- * re-applied when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given
+ * function, returning the previous value. The function should be
+ * side-effect-free, since it may be re-applied when attempted
+ * updates fail due to contention among threads.
*
* @param obj An object whose field to get and set
* @param updateFunction a side-effect-free function
@@ -298,10 +301,12 @@
}
/**
- * Atomically updates the field of the given object managed by this updater
- * with the results of applying the given function, returning the updated
- * value. The function should be side-effect-free, since it may be
- * re-applied when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given
+ * function, returning the updated value. The function should be
+ * side-effect-free, since it may be re-applied when attempted
+ * updates fail due to contention among threads.
*
* @param obj An object whose field to get and set
* @param updateFunction a side-effect-free function
@@ -318,13 +323,14 @@
}
/**
- * Atomically updates the field of the given object managed by this
- * updater with the results of applying the given function to the
- * current and given values, returning the previous value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads. The
- * function is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given function
+ * to the current and given values, returning the previous value.
+ * The function should be side-effect-free, since it may be
+ * re-applied when attempted updates fail due to contention among
+ * threads. The function is applied with the current value as its
+ * first argument, and the given update as the second argument.
*
* @param obj An object whose field to get and set
* @param x the update value
@@ -343,13 +349,14 @@
}
/**
- * Atomically updates the field of the given object managed by this
- * updater with the results of applying the given function to the
- * current and given values, returning the updated value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads. The
- * function is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given function
+ * to the current and given values, returning the updated value.
+ * The function should be side-effect-free, since it may be
+ * re-applied when attempted updates fail due to contention among
+ * threads. The function is applied with the current value as its
+ * first argument, and the given update as the second argument.
*
* @param obj An object whose field to get and set
* @param x the update value
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java Thu Aug 24 16:24:44 2017 +0200
@@ -170,7 +170,8 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function, returning the previous value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
@@ -191,7 +192,8 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function, returning the updated value. The
* function should be side-effect-free, since it may be re-applied
* when attempted updates fail due to contention among threads.
@@ -212,13 +214,14 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function to the current and given values,
* returning the previous value. The function should be
* side-effect-free, since it may be re-applied when attempted
- * updates fail due to contention among threads. The function
- * is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * updates fail due to contention among threads. The function is
+ * applied with the current value as its first argument, and the
+ * given update as the second argument.
*
* @param x the update value
* @param accumulatorFunction a side-effect-free function of two arguments
@@ -238,13 +241,14 @@
}
/**
- * Atomically updates the current value with the results of
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the current value with the results of
* applying the given function to the current and given values,
* returning the updated value. The function should be
* side-effect-free, since it may be re-applied when attempted
- * updates fail due to contention among threads. The function
- * is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * updates fail due to contention among threads. The function is
+ * applied with the current value as its first argument, and the
+ * given update as the second argument.
*
* @param x the update value
* @param accumulatorFunction a side-effect-free function of two arguments
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Thu Aug 24 16:24:44 2017 +0200
@@ -190,10 +190,12 @@
}
/**
- * Atomically updates the element at index {@code i} with the results
- * of applying the given function, returning the previous value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function, returning the
+ * previous value. The function should be side-effect-free, since
+ * it may be re-applied when attempted updates fail due to
+ * contention among threads.
*
* @param i the index
* @param updateFunction a side-effect-free function
@@ -212,10 +214,12 @@
}
/**
- * Atomically updates the element at index {@code i} with the results
- * of applying the given function, returning the updated value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function, returning the
+ * updated value. The function should be side-effect-free, since it
+ * may be re-applied when attempted updates fail due to contention
+ * among threads.
*
* @param i the index
* @param updateFunction a side-effect-free function
@@ -234,10 +238,11 @@
}
/**
- * Atomically updates the element at index {@code i} with the
- * results of applying the given function to the current and given
- * values, returning the previous value. The function should be
- * side-effect-free, since it may be re-applied when attempted
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function to the current and
+ * given values, returning the previous value. The function should
+ * be side-effect-free, since it may be re-applied when attempted
* updates fail due to contention among threads. The function is
* applied with the current value of the element at index {@code i}
* as its first argument, and the given update as the second
@@ -262,10 +267,11 @@
}
/**
- * Atomically updates the element at index {@code i} with the
- * results of applying the given function to the current and given
- * values, returning the updated value. The function should be
- * side-effect-free, since it may be re-applied when attempted
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the element at index {@code i} with
+ * the results of applying the given function to the current and
+ * given values, returning the updated value. The function should
+ * be side-effect-free, since it may be re-applied when attempted
* updates fail due to contention among threads. The function is
* applied with the current value of the element at index {@code i}
* as its first argument, and the given update as the second
--- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,6 +46,7 @@
import jdk.internal.misc.Unsafe;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
+import java.lang.invoke.VarHandle;
/**
* A reflection-based utility that enables atomic updates to
@@ -199,10 +200,12 @@
}
/**
- * Atomically updates the field of the given object managed by this updater
- * with the results of applying the given function, returning the previous
- * value. The function should be side-effect-free, since it may be
- * re-applied when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given
+ * function, returning the previous value. The function should be
+ * side-effect-free, since it may be re-applied when attempted
+ * updates fail due to contention among threads.
*
* @param obj An object whose field to get and set
* @param updateFunction a side-effect-free function
@@ -219,10 +222,12 @@
}
/**
- * Atomically updates the field of the given object managed by this updater
- * with the results of applying the given function, returning the updated
- * value. The function should be side-effect-free, since it may be
- * re-applied when attempted updates fail due to contention among threads.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given
+ * function, returning the updated value. The function should be
+ * side-effect-free, since it may be re-applied when attempted
+ * updates fail due to contention among threads.
*
* @param obj An object whose field to get and set
* @param updateFunction a side-effect-free function
@@ -239,13 +244,14 @@
}
/**
- * Atomically updates the field of the given object managed by this
- * updater with the results of applying the given function to the
- * current and given values, returning the previous value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads. The
- * function is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given function
+ * to the current and given values, returning the previous value.
+ * The function should be side-effect-free, since it may be
+ * re-applied when attempted updates fail due to contention among
+ * threads. The function is applied with the current value as its
+ * first argument, and the given update as the second argument.
*
* @param obj An object whose field to get and set
* @param x the update value
@@ -264,13 +270,14 @@
}
/**
- * Atomically updates the field of the given object managed by this
- * updater with the results of applying the given function to the
- * current and given values, returning the updated value. The
- * function should be side-effect-free, since it may be re-applied
- * when attempted updates fail due to contention among threads. The
- * function is applied with the current value as its first argument,
- * and the given update as the second argument.
+ * Atomically updates (with memory effects as specified by {@link
+ * VarHandle#compareAndSet}) the field of the given object managed
+ * by this updater with the results of applying the given function
+ * to the current and given values, returning the updated value.
+ * The function should be side-effect-free, since it may be
+ * re-applied when attempted updates fail due to contention among
+ * threads. The function is applied with the current value as its
+ * first argument, and the given update as the second argument.
*
* @param obj An object whose field to get and set
* @param x the update value
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/doc-files/coll-designfaq.html Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,399 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang=
+"en-US">
+<head>
+<title>Java Collections API Design FAQ</title>
+</head>
+<body>
+<h2>Java Collections API Design FAQ</h2>
+<!-- Body text begins here -->
+<hr />
+This document answers frequently asked questions concerning the
+design of the Java collections framework. It is derived from the
+large volume of traffic on the collections-comments alias. It
+serves as a design rationale for the collections framework.
+<h3>Core Interfaces - General Questions</h3>
+<ol>
+<li><a href="#a1"><b>Why don't you support immutability directly in
+the core collection interfaces so that you can do away with
+<em>optional operations</em> (and
+UnsupportedOperationException)?</b></a></li>
+<li><a href="#a2"><b>Won't programmers have to surround any code
+that calls optional operations with a try-catch clause in case they
+throw an UnsupportedOperationException?</b></a></li>
+<li><a href="#a3"><b>Why isn't there a core interface for "bags"
+(AKA multisets)?</b></a></li>
+<li><a href="#a28"><b>Why didn't you use "Beans-style names" for
+consistency?</b></a></li>
+</ol>
+<h3>Collection Interface</h3>
+<ol>
+<li><a href="#a5"><b>Why doesn't Collection extend Cloneable and
+Serializable?</b></a></li>
+<li><a href="#a6"><b>Why don't you provide an "apply" method in
+Collection to apply a given method ("upcall") to all the elements
+of the Collection?</b></a></li>
+<li><a href="#a7"><b>Why didn't you provide a "Predicate" interface,
+and related methods (e.g., a method to find the first element in
+the Collection satisfying the predicate)?</b></a></li>
+<li><a href="#a8"><b>Why don't you provide a form of the addAll
+method that takes an Enumeration (or an Iterator)?</b></a></li>
+<li><a href="#a9"><b>Why don't the concrete implementations in the
+JDK have Enumeration (or Iterator) constructors?</b></a></li>
+<li><a href="#a10"><b>Why don't you provide an Iterator.add
+method?</b></a></li>
+</ol>
+<h3>List Interface</h3>
+<ol>
+<li><a href="#a11"><b>Why don't you rename the List interface to
+Sequence; doesn't "list" generally suggest "linked list"? Also,
+doesn't it conflict with java.awt.List?</b></a></li>
+<li><a href="#a12"><b>Why don't you rename List's set method to
+replace, to avoid confusion with Set.</b></a></li>
+</ol>
+<h3>Map Interface</h3>
+<ol>
+<li><a href="#a14"><b>Why doesn't Map extend
+Collection?</b></a></li>
+</ol>
+<h3>Iterator Interface</h3>
+<ol>
+<li><a href="#a18"><b>Why doesn't Iterator extend
+Enumeration?</b></a></li>
+<li><a href="#a19"><b>Why don't you provide an Iterator.peek method
+that allows you to look at the next element in an iteration without
+advancing the iterator?</b></a></li>
+</ol>
+<h3>Miscellaneous</h3>
+<ol>
+<li><a href="#a23"><b>Why did you write a new collections framework
+instead of adopting JGL (a preexisting collections package from
+ObjectSpace, Inc.) into the JDK?</b></a></li>
+<li><a href="#a26"><b>Why don't you eliminate all of the methods and
+classes that return "views" (Collections backed by other
+collection-like objects). This would greatly reduce
+aliasing.</b></a></li>
+<li><a href="#a27"><b>Why don't you provide for "observable"
+collections that send out Events when they're
+modified?</b></a></li>
+</ol>
+<hr size="3" noshade="noshade" />
+<h3>Core Interfaces - General Questions</h3>
+<ol>
+<li><a name="a1" id="a1"><b>Why don't you support immutability
+directly in the core collection interfaces so that you can do away
+with <em>optional operations</em> (and
+UnsupportedOperationException)?</b></a>
+<p>This is the most controversial design decision in the whole API.
+Clearly, static (compile time) type checking is highly desirable,
+and is the norm in Java. We would have supported it if we believed
+it were feasible. Unfortunately, attempts to achieve this goal
+cause an explosion in the size of the interface hierarchy, and do
+not succeed in eliminating the need for runtime exceptions (though
+they reduce it substantially).</p>
+<p>Doug Lea, who wrote a popular Java collections package that did
+reflect mutability distinctions in its interface hierarchy, no
+longer believes it is a viable approach, based on user experience
+with his collections package. In his words (from personal
+correspondence) "Much as it pains me to say it, strong static
+typing does not work for collection interfaces in Java."</p>
+<p>To illustrate the problem in gory detail, suppose you want to
+add the notion of modifiability to the Hierarchy. You need four new
+interfaces: ModifiableCollection, ModifiableSet, ModifiableList,
+and ModifiableMap. What was previously a simple hierarchy is now a
+messy heterarchy. Also, you need a new Iterator interface for use
+with unmodifiable Collections, that does not contain the remove
+operation. Now can you do away with UnsupportedOperationException?
+Unfortunately not.</p>
+<p>Consider arrays. They implement most of the List operations, but
+not remove and add. They are "fixed-size" Lists. If you want to
+capture this notion in the hierarchy, you have to add two new
+interfaces: VariableSizeList and VariableSizeMap. You don't have to
+add VariableSizeCollection and VariableSizeSet, because they'd be
+identical to ModifiableCollection and ModifiableSet, but you might
+choose to add them anyway for consistency's sake. Also, you need a
+new variety of ListIterator that doesn't support the add and remove
+operations, to go along with unmodifiable List. Now we're up to ten
+or twelve interfaces, plus two new Iterator interfaces, instead of
+our original four. Are we done? No.</p>
+<p>Consider logs (such as error logs, audit logs and journals for
+recoverable data objects). They are natural append-only sequences,
+that support all of the List operations except for remove and set
+(replace). They require a new core interface, and a new
+iterator.</p>
+<p>And what about immutable Collections, as opposed to unmodifiable
+ones? (i.e., Collections that cannot be changed by the client AND
+will never change for any other reason). Many argue that this is
+the most important distinction of all, because it allows multiple
+threads to access a collection concurrently without the need for
+synchronization. Adding this support to the type hierarchy requires
+four more interfaces.</p>
+<p>Now we're up to twenty or so interfaces and five iterators, and
+it's almost certain that there are still collections arising in
+practice that don't fit cleanly into any of the interfaces. For
+example, the <em>collection-views</em> returned by Map are natural
+delete-only collections. Also, there are collections that will
+reject certain elements on the basis of their value, so we still
+haven't done away with runtime exceptions.</p>
+<p>When all was said and done, we felt that it was a sound
+engineering compromise to sidestep the whole issue by providing a
+very small set of core interfaces that can throw a runtime
+exception.</p>
+</li>
+<li><a name="a2" id="a2"><b>Won't programmers have to surround any
+code that calls optional operations with a try-catch clause in case
+they throw an UnsupportedOperationException?</b></a>
+<p>It was never our intention that programs should catch these
+exceptions: that's why they're unchecked (runtime) exceptions. They
+should only arise as a result of programming errors, in which case,
+your program will halt due to the uncaught exception.</p>
+</li>
+<li><a name="a3" id="a3"><b>Why isn't there a core interface for
+"bags" (AKA multisets)?</b></a>
+<p>The Collection interface provides this functionality. We are not
+providing any public implementations of this interface, as we think
+that it wouldn't be used frequently enough to "pull its weight." We
+occasionally return such Collections, which are implemented easily
+atop AbstractCollection (for example, the Collection returned by
+Map.values).</p>
+</li>
+<li><a name="a28" id="a28"><b>Why didn't you use "Beans-style
+names" for consistency?</b></a>
+<p>While the names of the new collections methods do not adhere to
+the "Beans naming conventions", we believe that they are
+reasonable, consistent and appropriate to their purpose. It should
+be remembered that the Beans naming conventions do not apply to the
+JDK as a whole; the AWT did adopt these conventions, but that
+decision was somewhat controversial. We suspect that the
+collections APIs will be used quite pervasively, often with
+multiple method calls on a single line of code, so it is important
+that the names be short. Consider, for example, the Iterator
+methods. Currently, a loop over a collection looks like this:</p>
+<pre>
+ for (Iterator i = c.iterator(); i.hasNext(); )
+ System.out.println(i.next());
+</pre>
+Everything fits neatly on one line, even if the Collection name is
+a long expression. If we named the methods "getIterator",
+"hasNextElement" and "getNextElement", this would no longer be the
+case. Thus, we adopted the "traditional" JDK style rather than the
+Beans style.</li>
+</ol>
+<hr />
+<h3>Collection Interface</h3>
+<ol>
+<li><a name="a5" id="a5"><b>Why doesn't Collection extend Cloneable
+and Serializable?</b></a>
+<p>Many Collection implementations (including all of the ones
+provided by the JDK) will have a public clone method, but it would
+be mistake to require it of all Collections. For example, what does
+it mean to clone a Collection that's backed by a terabyte SQL
+database? Should the method call cause the company to requisition a
+new disk farm? Similar arguments hold for serializable.</p>
+<p>If the client doesn't know the actual type of a Collection, it's
+much more flexible and less error prone to have the client decide
+what type of Collection is desired, create an empty Collection of
+this type, and use the addAll method to copy the elements of the
+original collection into the new one.</p>
+</li>
+<li><a name="a6" id="a6"><b>Why don't you provide an "apply" method
+in Collection to apply a given method ("upcall") to all the
+elements of the Collection?</b></a>
+<p>This is what is referred to as an "Internal Iterator" in the
+"Design Patterns" book (Gamma et al.). We considered providing it,
+but decided not to as it seems somewhat redundant to support
+internal and external iterators, and Java already has a precedent
+for external iterators (with Enumerations). The "throw weight" of
+this functionality is increased by the fact that it requires a
+public interface to describe upcalls.</p>
+</li>
+<li><a name="a7" id="a7"><b>Why didn't you provide a "Predicate"
+interface, and related methods (e.g., a method to find the first
+element in the Collection satisfying the predicate)?</b></a>
+<p>It's easy to implement this functionality atop Iterators, and
+the resulting code may actually look cleaner as the user can inline
+the predicate. Thus, it's not clear whether this facility pulls its
+weight. It could be added to the Collections class at a later date
+(implemented atop Iterator), if it's deemed useful.</p>
+</li>
+<li><a name="a8" id="a8"><b>Why don't you provide a form of the
+addAll method that takes an Enumeration (or an Iterator)?</b></a>
+<p>Because we don't believe in using Enumerations (or Iterators) as
+"poor man's collections." This was occasionally done in prior
+releases, but now that we have the Collection interface, it is the
+preferred way to pass around abstract collections of objects.</p>
+</li>
+<li><a name="a9" id="a9"><b>Why don't the concrete implementations
+in the JDK have Enumeration (or Iterator) constructors?</b></a>
+<p>Again, this is an instance of an Enumeration serving as a "poor
+man's collection" and we're trying to discourage that. Note
+however, that we strongly suggest that all concrete implementations
+should have constructors that take a Collection (and create a new
+Collection with the same elements).</p>
+</li>
+<li><a name="a10" id="a10"><b>Why don't you provide an Iterator.add
+method?</b></a>
+<p>The semantics are unclear, given that the contract for Iterator
+makes no guarantees about the order of iteration. Note, however,
+that ListIterator does provide an add operation, as it does
+guarantee the order of the iteration.</p>
+</li>
+</ol>
+<hr />
+<h3>List Interface</h3>
+<ol>
+<li><a name="a11" id="a11"><b>Why don't you rename the List
+interface to Sequence; doesn't "list" generally suggest "linked
+list"? Also, doesn't it conflict with java.awt.List?</b></a>
+<p>People were evenly divided as to whether List suggests linked
+lists. Given the implementation naming convention,
+<<em>Implementation</em>><<em>Interface</em>>, there
+was a strong desire to keep the core interface names short. Also,
+several existing names (AbstractSequentialList, LinkedList) would
+have been decidedly worse if we changed List to Sequence. The
+naming conflict can be dealt with by the following incantation:</p>
+<pre>
+ import java.util.*;
+ import java.awt.*;
+ import java.util.List; // Dictates interpretation of "List"
+</pre></li>
+<li><a name="a12" id="a12"><b>Why don't you rename List's set
+method to replace, to avoid confusion with Set.</b></a>
+<p>It was decided that the "set/get" naming convention was strongly
+enough enshrined in the language that we'd stick with it.</p>
+</li>
+</ol>
+<hr />
+<h3>Map Interface</h3>
+<ol>
+<li><a name="a14" id="a14"><b>Why doesn't Map extend
+Collection?</b></a>
+<p>This was by design. We feel that mappings are not collections
+and collections are not mappings. Thus, it makes little sense for
+Map to extend the Collection interface (or vice versa).</p>
+<p>If a Map is a Collection, what are the elements? The only
+reasonable answer is "Key-value pairs", but this provides a very
+limited (and not particularly useful) Map abstraction. You can't
+ask what value a given key maps to, nor can you delete the entry
+for a given key without knowing what value it maps to.</p>
+<p>Collection could be made to extend Map, but this raises the
+question: what are the keys? There's no really satisfactory answer,
+and forcing one leads to an unnatural interface.</p>
+<p>Maps can be <em>viewed</em> as Collections (of keys, values, or
+pairs), and this fact is reflected in the three "Collection view
+operations" on Maps (keySet, entrySet, and values). While it is, in
+principle, possible to view a List as a Map mapping indices to
+elements, this has the nasty property that deleting an element from
+the List changes the Key associated with every element before the
+deleted element. That's why we don't have a map view operation on
+Lists.</p>
+</li>
+</ol>
+<hr />
+<h3>Iterator Interface</h3>
+<ol>
+<li><a name="a18" id="a18"><b>Why doesn't Iterator extend
+Enumeration?</b></a>
+<p>We view the method names for Enumeration as unfortunate. They're
+very long, and very frequently used. Given that we were adding a
+method and creating a whole new framework, we felt that it would be
+foolish not to take advantage of the opportunity to improve the
+names. Of course we could support the new and old names in
+Iterator, but it doesn't seem worthwhile.</p>
+</li>
+<li><a name="a19" id="a19"><b>Why don't you provide an
+Iterator.peek method that allows you to look at the next element in
+an iteration without advancing the iterator?</b></a>
+<p>It can be implemented atop the current Iterators (a similar
+pattern to java.io.PushbackInputStream). We believe that its use
+would be rare enough that it isn't worth including in the interface
+that everyone has to implement.</p>
+</li>
+</ol>
+<hr />
+<h3>Miscellaneous</h3>
+<ol>
+<li><a name="a23" id="a23"><b>Why did you write a new collections
+framework instead of adopting JGL (a preexisting collections
+package from ObjectSpace, Inc.) into the JDK?</b></a>
+<p>If you examine the goals for our Collections framework (in the
+Overview), you'll see that we are not really "playing in the same
+space" as JGL. Quoting from the "Design Goals" Section of the Java
+Collections Overview: "Our main design goal was to produce an API
+that was reasonably small, both in size, and (more importantly) in
+'conceptual weight.'"</p>
+<p>JGL consists of approximately 130 classes and interfaces; its
+main goal was consistency with the C++ Standard Template Library
+(STL). This was <em>not</em> one of our goals. Java has
+traditionally stayed away from C++'s more complex features (e.g.,
+multiple inheritance, operator overloading). Our entire framework,
+including all infrastructure, contains approximately 25 classes and
+interfaces.</p>
+<p>While this may cause some discomfort for some C++ programmers,
+we feel that it will be good for Java in the long run. As the Java
+libraries mature, they inevitably grow, but we are trying as hard
+as we can to keep them small and manageable, so that Java continues
+to be an easy, fun language to learn and to use.</p>
+</li>
+<li><a name="a26" id="a26"><b>Why don't you eliminate all of the
+methods and classes that return "views" (Collections backed by
+other collection-like objects). This would greatly reduce
+aliasing.</b></a>
+<p>Given that we provide core collection interfaces behind which
+programmers can "hide" their own implementations, there will be
+aliased collections whether the JDK provides them or not.
+Eliminating all views from the JDK would greatly increase the cost
+of common operations like making a Collection out of an array, and
+would do away with many useful facilities (like synchronizing
+wrappers). One view that we see as being particularly useful is
+<a href=
+"../List.html#subList-int-int-">List.subList</a>.
+The existence of this method means that people who write methods
+taking List on input do not have to write secondary forms taking an
+offset and a length (as they do for arrays).</p>
+</li>
+<li><a name="a27" id="a27"><b>Why don't you provide for
+"observable" collections that send out Events when they're
+modified?</b></a>
+<p>Primarily, resource constraints. If we're going to commit to
+such an API, it has to be something that works for everyone, that
+we can live with for the long haul. We may provide such a facility
+some day. In the meantime, it's not difficult to implement such a
+facility on top of the public APIs.</p>
+</li>
+</ol>
+<hr />
+<p style="font-size:smaller">
+Copyright © 1998, 2017, Oracle and/or its affiliates. 500 Oracle Parkway<br />
+ Redwood Shores, CA 94065 USA. All rights reserved.</p>
+<!-- Body text ends here -->
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/doc-files/coll-index.html Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang=
+"en-US">
+<head>
+<meta name="generator" content="HTML Tidy, see www.w3.org" />
+<title>The Collections Framework</title>
+
+<style type="text/css">
+/*<![CDATA[*/
+
+ul li, ul ul li {font-weight: normal;}
+pre {margin-left: 42pt;}
+a {font-weight: bold;}
+
+/*]]>*/
+</style>
+</head>
+<body>
+<h1>The Collections Framework</h1>
+<!-- Body text begins here -->
+<p>The collections framework is a unified architecture for
+representing and manipulating collections, enabling them to be
+manipulated independently of the details of their representation.
+It reduces programming effort while increasing performance. It
+enables interoperability among unrelated APIs, reduces effort in
+designing and learning new APIs, and fosters software reuse. The
+framework is based on more than a dozen collection interfaces. It
+includes implementations of these interfaces and algorithms to
+manipulate them.</p>
+<p>The documents in this section are non-normative portions of
+the Java™ Platform, Standard Edition API Specification.</p>
+<ul>
+<li><b><a href="coll-overview.html">Overview</a></b> - An overview of
+the collections framework.</li>
+</ul>
+<ul>
+<li><b><a href="coll-reference.html">Annotated API Outline</a></b> - An
+annotated outline of the classes and interfaces comprising the
+collections framework, with links into the API Specification.</li>
+</ul>
+<ul>
+<li><b><a href="coll-designfaq.html">Design FAQ</a></b> - Answers to
+frequently asked questions (FAQ) about the design of the
+collections framework.</li>
+</ul>
+<hr />
+<p style="font-size:smaller">
+Copyright © 1998, 2017, Oracle and/or its affiliates. 500 Oracle Parkway<br />
+ Redwood Shores, CA 94065 USA. All rights reserved.</p>
+<!-- Body text ends here -->
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/doc-files/coll-overview.html Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,359 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang=
+"en-US">
+<head>
+<title>Collections Framework Overview</title>
+</head>
+<body>
+<h1>Collections Framework Overview</h1>
+<!-- Body text begins here -->
+<h2>Introduction</h2>
+The Java platform includes a <i>collections framework</i>. A
+<i>collection</i> is an object that represents a group of objects
+(such as the classic <a href="../ArrayList.html">ArrayList</a> class).
+A collections framework is a unified architecture for representing
+and manipulating collections, enabling collections to be
+manipulated independently of implementation details.
+<p>The primary advantages of a collections framework are that
+it:</p>
+<ul>
+<li><strong>Reduces programming effort</strong> by providing data
+structures and algorithms so you don't have to write them
+yourself.</li>
+<li><strong>Increases performance</strong> by providing
+high-performance implementations of data structures and algorithms.
+Because the various implementations of each interface are
+interchangeable, programs can be tuned by switching
+implementations.</li>
+<li><strong>Provides interoperability between unrelated
+APIs</strong> by establishing a common language to pass collections
+back and forth.</li>
+<li><strong>Reduces the effort required to learn APIs</strong> by
+requiring you to learn multiple ad hoc collection APIs.</li>
+<li><strong>Reduces the effort required to design and implement
+APIs</strong> by not requiring you to produce ad hoc collections
+APIs.</li>
+<li><strong>Fosters software reuse</strong> by providing a standard
+interface for collections and algorithms with which to manipulate
+them.</li>
+</ul>
+<p>The collections framework consists of:</p>
+<ul>
+<li><strong>Collection interfaces</strong>. Represent different
+types of collections, such as sets, lists, and maps. These
+interfaces form the basis of the framework.</li>
+<li><strong>General-purpose implementations</strong>. Primary
+implementations of the collection interfaces.</li>
+<li><strong>Legacy implementations</strong>. The collection classes
+from earlier releases, <tt>Vector</tt> and <tt>Hashtable</tt>, were
+retrofitted to implement the collection interfaces.</li>
+<li><strong>Special-purpose implementations</strong>.
+Implementations designed for use in special situations. These
+implementations display nonstandard performance characteristics,
+usage restrictions, or behavior.</li>
+<li><strong>Concurrent implementations</strong>. Implementations
+designed for highly concurrent use.</li>
+<li><strong>Wrapper implementations</strong>. Add functionality,
+such as synchronization, to other implementations.</li>
+<li><strong>Convenience implementations</strong>. High-performance
+"mini-implementations" of the collection interfaces.</li>
+<li><strong>Abstract implementations</strong>. Partial
+implementations of the collection interfaces to facilitate custom
+implementations.</li>
+<li><strong>Algorithms</strong>. Static methods that perform useful
+functions on collections, such as sorting a list.</li>
+<li><strong>Infrastructure</strong>. Interfaces that provide
+essential support for the collection interfaces.</li>
+<li><strong>Array Utilities</strong>. Utility functions for arrays
+of primitive types and reference objects. Not, strictly speaking, a
+part of the collections framework, this feature was added to the
+Java platform at the same time as the collections framework and
+relies on some of the same infrastructure.</li>
+</ul>
+<hr />
+<h2>Collection Interfaces</h2>
+<p>The <i>collection interfaces</i> are divided into two groups.
+The most basic interface, <tt><a href=
+"../Collection.html">java.util.Collection</a></tt>,
+has the following descendants:</p>
+<ul>
+<li><tt><a href=
+"../Set.html">java.util.Set</a></tt></li>
+<li><tt><a href=
+"../SortedSet.html">java.util.SortedSet</a></tt></li>
+<li><tt><a href=
+"../NavigableSet.html">java.util.NavigableSet</a></tt></li>
+<li><tt><a href=
+"../Queue.html">java.util.Queue</a></tt></li>
+<li><tt><a href=
+"../concurrent/BlockingQueue.html">java.util.concurrent.BlockingQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/TransferQueue.html">java.util.concurrent.TransferQueue</a></tt></li>
+<li><tt><a href=
+"../Deque.html">java.util.Deque</a></tt></li>
+<li><tt><a href=
+"../concurrent/BlockingDeque.html">java.util.concurrent.BlockingDeque</a></tt></li>
+</ul>
+<p>The other collection interfaces are based on <tt><a href=
+"../Map.html">java.util.Map</a></tt> and are
+not true collections. However, these interfaces contain
+<i>collection-view</i> operations, which enable them to be
+manipulated as collections. <tt>Map</tt> has the following
+offspring:</p>
+<ul>
+<li><tt><a href=
+"../SortedMap.html">java.util.SortedMap</a></tt></li>
+<li><tt><a href=
+"../NavigableMap.html">java.util.NavigableMap</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentMap.html">java.util.concurrent.ConcurrentMap</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentNavigableMap.html">java.util.concurrent.ConcurrentNavigableMap</a></tt></li>
+</ul>
+<p>Many of the modification methods in the collection interfaces
+are labeled <i>optional</i>. Implementations are permitted to not
+perform one or more of these operations, throwing a runtime
+exception (<tt>UnsupportedOperationException</tt>) if they are
+attempted. The documentation for each implementation must specify
+which optional operations are supported. Several terms are
+introduced to aid in this specification:</p>
+<ul>
+<li>Collections that do not support modification operations (such
+as <tt>add</tt>, <tt>remove</tt> and <tt>clear</tt>) are referred
+to as <i>unmodifiable</i>. Collections that are not unmodifiable
+are <i>modifiable.</i></li>
+<li>Collections that additionally guarantee that no change in the
+<tt>Collection</tt> object will be visible are referred to as
+<i>immutable</i>. Collections that are not immutable are
+<i>mutable</i>.</li>
+<li>Lists that guarantee that their size remains constant even
+though the elements can change are referred to as
+<i>fixed-size</i>. Lists that are not fixed-size are referred to as
+<i>variable-size</i>.</li>
+<li>Lists that support fast (generally constant time) indexed
+element access are known as <i>random access</i> lists. Lists that
+do not support fast indexed element access are known as
+<i>sequential access</i> lists. The <tt><a href=
+"../RandomAccess.html">RandomAccess</a></tt>
+marker interface enables lists to advertise the fact that they
+support random access. This enables generic algorithms to change
+their behavior to provide good performance when applied to either
+random or sequential access lists.</li>
+</ul>
+<p>Some implementations restrict what elements (or in the case of
+<tt>Maps</tt>, keys and values) can be stored. Possible
+restrictions include requiring elements to:</p>
+<ul>
+<li>Be of a particular type.</li>
+<li>Be not null.</li>
+<li>Obey some arbitrary predicate.</li>
+</ul>
+<p>Attempting to add an element that violates an implementation's
+restrictions results in a runtime exception, typically a
+<tt>ClassCastException</tt>, an <tt>IllegalArgumentException</tt>,
+or a <tt>NullPointerException</tt>. Attempting to remove or test
+for the presence of an element that violates an implementation's
+restrictions can result in an exception. Some restricted
+collections permit this usage.</p>
+<hr />
+<h2>Collection Implementations</h2>
+<p>Classes that implement the collection interfaces typically have
+names in the form of
+<<em>Implementation-style</em>><<em>Interface</em>>.
+The general purpose implementations are summarized in the following
+table:</p>
+<table border="2" summary=
+"general purpose implementations and interfaces" align="center">
+<thead>
+<tr>
+<th id="interfaces">Interface</th>
+<th id="hashtable">Hash Table</th>
+<th id="resizablearray">Resizable Array</th>
+<th id="balancedtree">Balanced Tree</th>
+<th id="linkedlist">Linked List</th>
+<th id="hashtableandlinkedlist">Hash Table + Linked List</th>
+</tr>
+<tr>
+<td headers="interfaces"><code>Set</code></td>
+<td headers="hashtable"><a href=
+"../HashSet.html"><tt>HashSet</tt></a></td>
+<td headers="resizablearray"> </td>
+<td headers="balancedtree"><a href=
+"../TreeSet.html"><tt>TreeSet</tt></a></td>
+<td headers="linkedlist"> </td>
+<td headers="hashtableandlinkedlist"><a href=
+"../LinkedHashSet.html"><tt>LinkedHashSet</tt></a></td>
+</tr>
+<tr>
+<td headers="interfaces"><code>List</code></td>
+<td headers="hashtable"> </td>
+<td headers="resizablearray"><a href=
+"../ArrayList.html"><tt>ArrayList</tt></a></td>
+<td headers="balancedtree"> </td>
+<td headers="linkedlist"><a href=
+"../LinkedList.html"><tt>LinkedList</tt></a></td>
+<td headers="hashtableandlinkedlist"> </td>
+</tr>
+<tr>
+<td headers="interfaces"><code>Deque</code></td>
+<td headers="hashtable"> </td>
+<td headers="resizablearray"><a href=
+"../ArrayDeque.html"><tt>ArrayDeque</tt></a></td>
+<td headers="balancedtree"> </td>
+<td headers="linkedlist"><a href=
+"../LinkedList.html"><tt>LinkedList</tt></a></td>
+<td headers="hashtableandlinkedlist"> </td>
+</tr>
+<tr>
+<td headers="interfaces"><code>Map</code></td>
+<td headers="hashtable"><a href=
+"../HashMap.html"><tt>HashMap</tt></a></td>
+<td headers="resizablearray"> </td>
+<td headers="balancedtree"><a href=
+"../TreeMap.html"><tt>TreeMap</tt></a></td>
+<td headers="linkedlist"> </td>
+<td headers="hashtableandlinkedlist"><a href=
+"../LinkedHashMap.html"><tt>LinkedHashMap</tt></a></td>
+</tr>
+</thead>
+</table>
+<p>The general-purpose implementations support all of the
+<i>optional operations</i> in the collection interfaces and have no
+restrictions on the elements they may contain. They are
+unsynchronized, but the <tt>Collections</tt> class contains static
+factories called <a href=
+"../Collections.html#synchronizedCollection-java.util.Collection-">
+<em>synchronization wrappers</em></a> that can be used to add
+synchronization to many unsynchronized collections. All of the new
+implementations have <i>fail-fast iterators</i>, which detect
+invalid concurrent modification, and fail quickly and cleanly
+(rather than behaving erratically).</p>
+<p>The <tt>AbstractCollection</tt>, <tt>AbstractSet</tt>,
+<tt>AbstractList</tt>, <tt>AbstractSequentialList</tt> and
+<tt>AbstractMap</tt> classes provide basic implementations of the
+core collection interfaces, to minimize the effort required to
+implement them. The API documentation for these classes describes
+precisely how each method is implemented so the implementer knows
+which methods must be overridden, given the performance of the
+basic operations of a specific implementation.</p>
+<hr />
+<h2>Concurrent Collections</h2>
+<p>Applications that use collections from more than one thread must
+be carefully programmed. In general, this is known as <i>concurrent
+programming</i>. The Java platform includes extensive support for
+concurrent programming. See <a href=
+"../concurrent/package-summary.html">Java Concurrency
+Utilities</a> for details.</p>
+<p>Collections are so frequently used that various concurrent
+friendly interfaces and implementations of collections are included
+in the APIs. These types go beyond the synchronization wrappers
+discussed previously to provide features that are frequently needed
+in concurrent programming.</p>
+<p>These concurrent-aware interfaces are available:</p>
+<ul>
+<li><tt><a href=
+"../concurrent/BlockingQueue.html">BlockingQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/TransferQueue.html">TransferQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/BlockingDeque.html">BlockingDeque</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentMap.html">ConcurrentMap</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentNavigableMap.html">ConcurrentNavigableMap</a></tt></li>
+</ul>
+<p>The following concurrent-aware implementation classes are
+available. See the API documentation for the correct usage of these
+implementations.</p>
+<ul>
+<li><tt><a href=
+"../concurrent/LinkedBlockingQueue.html">LinkedBlockingQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/ArrayBlockingQueue.html">ArrayBlockingQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/PriorityBlockingQueue.html">PriorityBlockingQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/DelayQueue.html">DelayQueue</a></tt></li>
+<li><tt><a href=
+"../concurrent/SynchronousQueue.html">SynchronousQueue</a></tt></li>
+<li><a href=
+"../concurrent/LinkedBlockingDeque.html"><tt>LinkedBlockingDeque</tt></a></li>
+<li><a href=
+"../concurrent/LinkedTransferQueue.html"><tt>LinkedTransferQueue</tt></a></li>
+<li><tt><a href=
+"../concurrent/CopyOnWriteArrayList.html">CopyOnWriteArrayList</a></tt></li>
+<li><tt><a href=
+"../concurrent/CopyOnWriteArraySet.html">CopyOnWriteArraySet</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentSkipListSet.html">ConcurrentSkipListSet</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentHashMap.html">ConcurrentHashMap</a></tt></li>
+<li><tt><a href=
+"../concurrent/ConcurrentSkipListMap.html">ConcurrentSkipListMap</a></tt></li>
+</ul>
+<hr />
+<h2>Design Goals</h2>
+<p>The main design goal was to produce an API that was small in
+size and, more importantly, in "conceptual weight." It
+was critical that the new functionality not seem too different to
+current Java programmers; it had to augment current facilities,
+rather than replace them. At the same time, the new API had to be
+powerful enough to provide all the advantages described
+previously.</p>
+<p>To keep the number of core interfaces small, the interfaces do
+not attempt to capture such subtle distinctions as mutability,
+modifiability, and resizability. Instead, certain calls in the core
+interfaces are <i>optional</i>, enabling implementations to throw
+an <tt>UnsupportedOperationException</tt> to indicate that they do
+not support a specified optional operation. Collection implementers
+must clearly document which optional operations are supported by an
+implementation.</p>
+<p>To keep the number of methods in each core interface small, an
+interface contains a method only if either:</p>
+<ul>
+<li>It is a truly <i>fundamental operation</i>: a basic operations
+in terms of which others could be reasonably defined,</li>
+<li>There is a compelling performance reason why an important
+implementation would want to override it.</li>
+</ul>
+<p>It was critical that all reasonable representations of
+collections interoperate well. This included arrays, which cannot
+be made to implement the <tt>Collection</tt> interface directly
+without changing the language. Thus, the framework includes methods
+to enable collections to be moved into arrays, arrays to be viewed
+as collections, and maps to be viewed as collections.</p>
+<hr />
+<p style="font-size:smaller">
+Copyright © 1998, 2017, Oracle and/or its affiliates. 500 Oracle Parkway<br />
+ Redwood Shores, CA 94065 USA. All rights reserved.</p>
+<!-- Body text ends here -->
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/doc-files/coll-reference.html Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,564 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang=
+"en-US">
+<head>
+<title>Outline of the Collections Framework</title>
+</head>
+<body>
+<h1>Outline of the Collections Framework</h1>
+<!-- Body text begins here -->
+The collections framework consists of:
+<ul>
+<li><strong>Collection interfaces</strong> - The primary means by
+which collections are manipulated.
+<ul>
+<li><a href=
+"../Collection.html"><strong>Collection</strong></a>
+- A group of objects. No assumptions are made about the order of
+the collection (if any) or whether it can contain duplicate
+elements.</li>
+<li><a href=
+"../Set.html"><strong>Set</strong></a> - The
+familiar set abstraction. No duplicate elements permitted. May or
+may not be ordered. Extends the <tt>Collection</tt> interface.</li>
+<li><a href=
+"../List.html"><strong>List</strong></a> -
+Ordered collection, also known as a <i>sequence</i>. Duplicates are
+generally permitted. Allows positional access. Extends the
+<tt>Collection</tt> interface.</li>
+<li><a href=
+"../Queue.html"><strong>Queue</strong></a> - A
+collection designed for holding elements before processing. Besides
+basic <tt>Collection</tt> operations, queues provide additional
+insertion, extraction, and inspection operations.</li>
+<li><a href=
+"../Deque.html"><strong>Deque</strong></a> - A
+<em>double ended queue</em>, supporting element insertion and
+removal at both ends. Extends the <tt>Queue</tt> interface.</li>
+<li><a href=
+"../Map.html"><strong>Map</strong></a> - A
+mapping from keys to values. Each key can map to one value.</li>
+<li><a href=
+"../SortedSet.html"><strong>SortedSet</strong></a>
+- A set whose elements are automatically sorted, either in their
+<i>natural ordering</i> (see the <a href=
+"../../lang/Comparable.html"><tt>Comparable</tt></a>
+interface) or by a <a href=
+"../Comparator.html"><tt>Comparator</tt></a>
+object provided when a <tt>SortedSet</tt> instance is created.
+Extends the <tt>Set</tt> interface.</li>
+<li><a href=
+"../SortedMap.html"><strong>SortedMap</strong></a>
+- A map whose mappings are automatically sorted by key, either
+using the <i>natural ordering</i> of the keys or by a comparator
+provided when a <tt>SortedMap</tt> instance is created. Extends the
+<tt>Map</tt> interface.</li>
+<li><a href=
+"../NavigableSet.html"><strong>NavigableSet</strong></a>
+- A <tt>SortedSet</tt> extended with navigation methods reporting
+closest matches for given search targets. A <tt>NavigableSet</tt>
+may be accessed and traversed in either ascending or descending
+order.</li>
+<li><a href=
+"../NavigableMap.html"><strong>NavigableMap</strong></a>
+- A <tt>SortedMap</tt> extended with navigation methods returning
+the closest matches for given search targets. A
+<tt>NavigableMap</tt> can be accessed and traversed in either
+ascending or descending key order.</li>
+<li><a href=
+"../concurrent/BlockingQueue.html"><strong>BlockingQueue</strong></a>
+- A <tt>Queue</tt> with operations that wait for the queue to
+become nonempty when retrieving an element and that wait for space
+to become available in the queue when storing an element. (This
+interface is part of the <tt><a href=
+"../concurrent/package-summary.html">java.util.concurrent</a></tt>
+package.)</li>
+<li><a href=
+"../concurrent/TransferQueue.html"><strong>TransferQueue</strong></a>
+- A <tt>BlockingQueue</tt> in which producers can wait for
+consumers to receive elements. (This interface is part of the
+<tt><a href=
+"../concurrent/package-summary.html">java.util.concurrent</a></tt>
+package.)</li>
+<li><a href=
+"../concurrent/BlockingDeque.html"><strong>BlockingDeque</strong></a>
+- A <tt>Deque</tt> with operations that wait for the deque to
+become nonempty when retrieving an element and wait for space to
+become available in the deque when storing an element. Extends both
+the <tt>Deque</tt> and <tt>BlockingQueue</tt> interfaces. (This
+interface is part of the <tt><a href=
+"../concurrent/package-summary.html">java.util.concurrent</a></tt>
+package.)</li>
+<li><a href=
+"../concurrent/ConcurrentMap.html"><strong>ConcurrentMap</strong></a>
+- A <tt>Map</tt> with atomic <tt>putIfAbsent</tt>, <tt>remove</tt>,
+and <tt>replace</tt> methods. (This interface is part of the
+<tt>java.util.concurrent</tt> package.)</li>
+<li><a href=
+"../concurrent/ConcurrentNavigableMap.html"><strong>
+ConcurrentNavigableMap</strong></a> - A <tt>ConcurrentMap</tt> that
+is also a <tt>NavigableMap</tt>.</li>
+</ul>
+</li>
+<li><strong>General-purpose implementations</strong> - The primary
+implementations of the collection interfaces.
+<ul>
+<li><strong><a href=
+"../HashSet.html">HashSet</a></strong> - Hash
+table implementation of the <tt>Set</tt> interface. The best
+all-around implementation of the <tt>Set</tt> interface.</li>
+<li><a href=
+"../TreeSet.html"><strong>TreeSet</strong></a>
+- Red-black tree implementation of the <tt>NavigableSet</tt>
+interface.</li>
+<li><strong><a href=
+"../LinkedHashSet.html">LinkedHashSet</a></strong>
+- Hash table and linked list implementation of the <tt>Set</tt>
+interface. An insertion-ordered <tt>Set</tt> implementation that
+runs nearly as fast as <tt>HashSet</tt>.</li>
+<li><strong><a href=
+"../ArrayList.html">ArrayList</a></strong> -
+Resizable array implementation of the <tt>List</tt> interface (an
+unsynchronized <tt>Vector</tt>). The best all-around implementation
+of the <tt>List</tt> interface.</li>
+<li><strong><a href=
+"../ArrayDeque.html">ArrayDeque</a></strong> -
+Efficient, resizable array implementation of the <tt>Deque</tt>
+interface.</li>
+<li><a href=
+"../LinkedList.html"><strong>LinkedList</strong></a>
+- Doubly-linked list implementation of the <tt>List</tt> interface.
+Provides better performance than the <tt>ArrayList</tt>
+implementation if elements are frequently inserted or deleted
+within the list. Also implements the <tt>Deque</tt> interface. When
+accessed through the <tt>Queue</tt> interface, <tt>LinkedList</tt>
+acts as a FIFO queue.</li>
+<li><strong><a href=
+"../PriorityQueue.html">PriorityQueue</a></strong>
+- Heap implementation of an unbounded priority queue.</li>
+<li><strong><a href=
+"../HashMap.html">HashMap</a></strong> - Hash
+table implementation of the <tt>Map</tt> interface (an
+unsynchronized <tt>Hashtable</tt> that supports <tt>null</tt> keys
+and values). The best all-around implementation of the <tt>Map</tt>
+interface.</li>
+<li><a href=
+"../TreeMap.html"><strong>TreeMap</strong></a>
+Red-black tree implementation of the <tt>NavigableMap</tt>
+interface.</li>
+<li><strong><a href=
+"../LinkedHashMap.html">LinkedHashMap</a></strong>
+- Hash table and linked list implementation of the <tt>Map</tt>
+interface. An insertion-ordered <tt>Map</tt> implementation that
+runs nearly as fast as <tt>HashMap</tt>. Also useful for building
+caches (see <a href=
+"../LinkedHashMap.html#removeEldestEntry-java.util.Map.Entry-">
+removeEldestEntry(Map.Entry)</a> ).</li>
+</ul>
+</li>
+<li><strong>Wrapper implementations</strong> -
+Functionality-enhancing implementations for use with other
+implementations. Accessed solely through static factory methods.
+<ul>
+<li><a href=
+"../Collections.html#unmodifiableCollection-java.util.Collection-">
+<strong>Collections.unmodifiable<i>Interface</i></strong></a> -
+Returns an unmodifiable view of a specified collection that throws
+an <tt>UnsupportedOperationException</tt> if the user attempts to
+modify it.</li>
+<li><a name="synchWrappers" href=
+"../Collections.html#synchronizedCollection-java.util.Collection-"
+id=
+"synchWrappers"><strong>Collections.synchronized<i>Interface</i></strong></a>
+- Returns a synchronized collection that is backed by the specified
+(typically unsynchronized) collection. As long as all accesses to
+the backing collection are through the returned collection, thread
+safety is guaranteed.</li>
+<li><a href=
+"../Collections.html#checkedCollection-java.util.Collection-java.lang.Class-">
+<strong>Collections.checked<i>Interface</i></strong></a> - Returns
+a dynamically type-safe view of the specified collection, which
+throws a <tt>ClassCastException</tt> if a client attempts to add an
+element of the wrong type. The generics mechanism in the language
+provides compile-time (static) type checking, but it is possible to
+bypass this mechanism. Dynamically type-safe views eliminate this
+possibility.</li>
+</ul>
+</li>
+<li><strong>Adapter implementations</strong> - Implementations that
+adapt one collections interface to another:
+<ul>
+<li><strong><a href=
+"../Collections.html#newSetFromMap-java.util.Map-">
+newSetFromMap(Map)</a></strong> - Creates a general-purpose
+<tt>Set</tt> implementation from a general-purpose <tt>Map</tt>
+implementation.</li>
+<li><strong><a href=
+"../Collections.html#asLifoQueue-java.util.Deque-">
+asLifoQueue(Deque)</a></strong> - Returns a view of a
+<tt>Deque</tt> as a Last In First Out (LIFO) <tt>Queue</tt>.</li>
+</ul>
+</li>
+<li><strong>Convenience implementations</strong> - High-performance
+"mini-implementations" of the collection interfaces.
+<ul>
+<li><a href=
+"../Arrays.html#asList-T...-"><strong>Arrays.asList</strong></a>
+- Enables an array to be viewed as a list.</li>
+<li><strong><a href=
+"../Collections.html#emptySet--">emptySet</a>,
+<a href=
+"../Collections.html#emptyList--">emptyList</a>
+and <a href=
+"../Collections.html#emptyMap--">emptyMap</a></strong>
+- Return an immutable empty set, list, or map.</li>
+<li><strong><a href=
+"../Collections.html#singleton-java.lang.Object-">
+singleton</a>, <a href=
+"../Collections.html#singletonList-java.lang.Object-">
+singletonList</a>, and <a href=
+"../Collections.html#singletonMap-K-V-">singletonMap</a></strong>
+- Return an immutable singleton set, list, or map, containing only
+the specified object (or key-value mapping).</li>
+<li><a href=
+"../Collections.html#nCopies-int-T-"><strong>
+nCopies</strong></a> - Returns an immutable list consisting of n
+copies of a specified object.</li>
+</ul>
+</li>
+<li><strong>Legacy implementations</strong> - Older collection
+classes were retrofitted to implement the collection interfaces.
+<ul>
+<li><a href=
+"../Vector.html"><strong>Vector</strong></a> -
+Synchronized resizable array implementation of the <tt>List</tt>
+interface with additional legacy methods.</li>
+<li><a href=
+"../Hashtable.html"><strong>Hashtable</strong></a>
+- Synchronized hash table implementation of the <tt>Map</tt>
+interface that does not allow <tt>null</tt> keys or values, plus
+additional legacy methods.</li>
+</ul>
+</li>
+<li><strong>Special-purpose implementations</strong>
+<ul>
+<li><strong><a href=
+"../WeakHashMap.html">WeakHashMap</a></strong>
+- An implementation of the <tt>Map</tt> interface that stores only
+<a href="../../lang/ref/WeakReference.html"><i>weak
+references</i></a> to its keys. Storing only weak references
+enables key-value pairs to be garbage collected when the key is no
+longer referenced outside of the <tt>WeakHashMap</tt>. This class
+is the easiest way to use the power of weak references. It is
+useful for implementing registry-like data structures, where the
+utility of an entry vanishes when its key is no longer reachable by
+any thread.</li>
+<li><strong><a href=
+"../IdentityHashMap.html">IdentityHashMap</a></strong>
+- Identity-based <tt>Map</tt> implementation based on a hash table.
+This class is useful for topology-preserving object graph
+transformations (such as serialization or deep copying). To perform
+these transformations, you must maintain an identity-based "node
+table" that keeps track of which objects have already been seen.
+Identity-based maps are also used to maintain
+object-to-meta-information mappings in dynamic debuggers and
+similar systems. Finally, identity-based maps are useful in
+preventing "spoof attacks" resulting from intentionally perverse
+equals methods. (<tt>IdentityHashMap</tt> never invokes the equals
+method on its keys.) An added benefit of this implementation is
+that it is fast.</li>
+<li><strong><a href=
+"../concurrent/CopyOnWriteArrayList.html">CopyOnWriteArrayList</a></strong>
+- A <tt>List</tt> implementation backed by an copy-on-write array.
+All mutative operations (such as <tt>add</tt>, <tt>set</tt>, and
+<tt>remove</tt>) are implemented by making a new copy of the array.
+No synchronization is necessary, even during iteration, and
+iterators are guaranteed never to throw
+<tt>ConcurrentModificationException</tt>. This implementation is
+well-suited to maintaining event-handler lists (where change is
+infrequent, and traversal is frequent and potentially
+time-consuming).</li>
+<li><strong><a href=
+"../concurrent/CopyOnWriteArraySet.html">CopyOnWriteArraySet</a></strong>
+- A <tt>Set</tt> implementation backed by a copy-on-write array.
+This implementation is similar to <tt>CopyOnWriteArrayList</tt>.
+Unlike most <tt>Set</tt> implementations, the <tt>add</tt>,
+<tt>remove</tt>, and <tt>contains</tt> methods require time
+proportional to the size of the set. This implementation is well
+suited to maintaining event-handler lists that must prevent
+duplicates.</li>
+<li><strong><a href=
+"../EnumSet.html">EnumSet</a></strong> - A
+high-performance <tt>Set</tt> implementation backed by a bit
+vector. All elements of each <tt>EnumSet</tt> instance must be
+elements of a single enum type.</li>
+<li><strong><a href=
+"../EnumMap.html">EnumMap</a></strong> - A
+high-performance <tt>Map</tt> implementation backed by an array.
+All keys in each <tt>EnumMap</tt> instance must be elements of a
+single enum type.</li>
+</ul>
+</li>
+<li><strong>Concurrent implementations</strong> - These
+implementations are part of <tt>java.util.concurrent</tt>.
+<ul>
+<li><strong><a href=
+"../concurrent/ConcurrentLinkedQueue.html">ConcurrentLinkedQueue</a></strong>
+- An unbounded first in, first out (FIFO) queue based on linked
+nodes.</li>
+<li><a href=
+"../concurrent/LinkedBlockingQueue.html"><strong>
+LinkedBlockingQueue</strong></a> - An optionally bounded FIFO
+blocking queue backed by linked nodes.</li>
+<li><a href=
+"../concurrent/ArrayBlockingQueue.html"><strong>
+ArrayBlockingQueue</strong></a> - A bounded FIFO blocking queue
+backed by an array.</li>
+<li><a href=
+"../concurrent/PriorityBlockingQueue.html"><strong>
+PriorityBlockingQueue</strong></a> - An unbounded blocking priority
+queue backed by a priority heap.</li>
+<li><a href=
+"../concurrent/DelayQueue.html"><strong>DelayQueue</strong></a>
+- A time-based scheduling queue backed by a priority heap.</li>
+<li><a href=
+"../concurrent/SynchronousQueue.html"><strong>SynchronousQueue</strong></a>
+- A simple rendezvous mechanism that uses the
+<tt>BlockingQueue</tt> interface.</li>
+<li><a href=
+"../concurrent/LinkedBlockingDeque.html"><strong>
+LinkedBlockingDeque</strong></a> - An optionally bounded FIFO
+blocking deque backed by linked nodes.</li>
+<li><a href=
+"../concurrent/LinkedTransferQueue.html"><strong>
+LinkedTransferQueue</strong></a> - An unbounded
+<tt>TransferQueue</tt> backed by linked nodes.</li>
+<li><a href=
+"../concurrent/ConcurrentHashMap.html"><strong>ConcurrentHashMap</strong></a>
+- A highly concurrent, high-performance <tt>ConcurrentMap</tt>
+implementation based on a hash table. This implementation never
+blocks when performing retrievals and enables the client to select
+the concurrency level for updates. It is intended as a drop-in
+replacement for <tt><a href=
+"../Hashtable.html">Hashtable</a></tt>. In
+addition to implementing <tt>ConcurrentMap</tt>, it supports all of
+the legacy methods of <tt>Hashtable</tt>.</li>
+<li><a href=
+"../concurrent/ConcurrentSkipListSet.html"><strong>
+ConcurrentSkipListSet</strong></a> - Skips list implementation of
+the <tt>NavigableSet</tt> interface.</li>
+<li><a href=
+"../concurrent/ConcurrentSkipListMap.html"><strong>
+ConcurrentSkipListMap</strong></a> - Skips list implementation of
+the <tt>ConcurrentNavigableMap</tt> interface.</li>
+</ul>
+</li>
+<li><strong>Abstract implementations</strong> - Skeletal
+implementations of the collection interfaces to facilitate custom
+implementations.
+<ul>
+<li><a href=
+"../AbstractCollection.html"><strong>AbstractCollection</strong></a>
+- Skeletal <tt>Collection</tt> implementation that is neither a set
+nor a list (such as a "bag" or multiset).</li>
+<li><a href=
+"../AbstractSet.html"><strong>AbstractSet</strong></a>
+- Skeletal <tt>Set</tt> implementation.</li>
+<li><a href=
+"../AbstractList.html"><strong>AbstractList</strong></a>
+- Skeletal <tt>List</tt> implementation backed by a random access
+data store (such as an array).</li>
+<li><a href=
+"../AbstractSequentialList.html"><strong>AbstractSequentialList</strong></a>
+- Skeletal <tt>List</tt> implementation backed by a sequential
+access data store (such as a linked list).</li>
+<li><a href=
+"../AbstractQueue.html"><strong>AbstractQueue</strong></a>
+- Skeletal <tt>Queue</tt> implementation.</li>
+<li><a href=
+"../AbstractMap.html"><strong>AbstractMap</strong></a>
+- Skeletal <tt>Map</tt> implementation.</li>
+</ul>
+</li>
+<li><strong>Algorithms</strong> - The <a href=
+"../Collections.html"><strong>Collections</strong></a>
+class contains these useful static methods.
+<ul>
+<li><strong><a href=
+"../Collections.html#sort-java.util.List-">sort(List)</a></strong>
+- Sorts a list using a merge sort algorithm, which provides average
+case performance comparable to a high quality quicksort, guaranteed
+O(n*log n) performance (unlike quicksort), and <em>stability</em>
+(unlike quicksort). A stable sort is one that does not reorder
+equal elements.</li>
+<li><strong><a href=
+"../Collections.html#binarySearch-java.util.List-T-">
+binarySearch(List, Object)</a></strong> - Searches for an element
+in an ordered list using the binary search algorithm.</li>
+<li><strong><a href=
+"../Collections.html#reverse-java.util.List-">reverse(List)</a></strong>
+- Reverses the order of the elements in a list.</li>
+<li><strong><a href=
+"../Collections.html#shuffle-java.util.List-">shuffle(List)</a></strong>
+- Randomly changes the order of the elements in a list.</li>
+<li><strong><a href=
+"../Collections.html#fill-java.util.List-T-">
+fill(List, Object)</a></strong> - Overwrites every element in a
+list with the specified value.</li>
+<li><strong><a href=
+"../Collections.html#copy-java.util.List-java.util.List-">
+copy(List dest, List src)</a></strong> - Copies the source list
+into the destination list.</li>
+<li><strong><a href=
+"../Collections.html#min-java.util.Collection-">
+min(Collection)</a></strong> - Returns the minimum element in a
+collection.</li>
+<li><strong><a href=
+"../Collections.html#max-java.util.Collection-">
+max(Collection)</a></strong> - Returns the maximum element in a
+collection.</li>
+<li><strong><a href=
+"../Collections.html#rotate-java.util.List-int-">
+rotate(List list, int distance)</a></strong> - Rotates all of the
+elements in the list by the specified distance.</li>
+<li><strong><a href=
+"../Collections.html#replaceAll-java.util.List-T-T-">
+replaceAll(List list, Object oldVal, Object newVal)</a></strong> -
+Replaces all occurrences of one specified value with another.</li>
+<li><strong><a href=
+"../Collections.html#indexOfSubList-java.util.List-java.util.List-">
+indexOfSubList(List source, List target)</a></strong> - Returns the
+index of the first sublist of source that is equal to target.</li>
+<li><strong><a href=
+"../Collections.html#lastIndexOfSubList-java.util.List-java.util.List-">
+lastIndexOfSubList(List source, List target)</a></strong> - Returns
+the index of the last sublist of source that is equal to
+target.</li>
+<li><strong><a href=
+"../Collections.html#swap-java.util.List-int-int-">
+swap(List, int, int)</a></strong> - Swaps the elements at the
+specified positions in the specified list.</li>
+<li><strong><a href=
+"../Collections.html#frequency-java.util.Collection-java.lang.Object-">
+frequency(Collection, Object)</a></strong> - Counts the number of
+times the specified element occurs in the specified
+collection.</li>
+<li><strong><a href=
+"../Collections.html#disjoint-java.util.Collection-java.util.Collection-">
+disjoint(Collection, Collection)</a></strong> - Determines whether
+two collections are disjoint, in other words, whether they contain
+no elements in common.</li>
+<li><strong><a href=
+"../Collections.html#addAll-java.util.Collection-T...-">
+addAll(Collection<? super T>, T...)</a></strong> - Adds all
+of the elements in the specified array to the specified
+collection.</li>
+</ul>
+</li>
+<li><strong>Infrastructure</strong>
+<ul>
+<li><strong>Iterators</strong> - Similar to the familiar <a href=
+"../Enumeration.html">Enumeration</a>
+interface, but more powerful, and with improved method names.
+<ul>
+<li><a href=
+"../Iterator.html"><strong>Iterator</strong></a>
+- In addition to the functionality of the <tt>Enumeration</tt>
+interface, enables the user to remove elements from the backing
+collection with well-defined, useful semantics.</li>
+<li><a href=
+"../ListIterator.html"><strong>ListIterator</strong></a>
+- Iterator for use with lists. In addition to the functionality of
+the <tt>Iterator</tt> interface, supports bidirectional iteration,
+element replacement, element insertion, and index retrieval.</li>
+</ul>
+</li>
+<li><strong>Ordering</strong>
+<ul>
+<li><a href=
+"../../lang/Comparable.html"><strong>Comparable</strong></a>
+- Imparts a <i>natural ordering</i> to classes that implement it.
+The natural ordering can be used to sort a list or maintain order
+in a sorted set or map. Many classes were retrofitted to implement
+this interface.</li>
+<li><a href=
+"../Comparator.html"><strong>Comparator</strong></a>
+- Represents an order relation, which can be used to sort a list or
+maintain order in a sorted set or map. Can override a type's
+natural ordering or order objects of a type that does not implement
+the <tt>Comparable</tt> interface.</li>
+</ul>
+</li>
+<li><strong>Runtime exceptions</strong>
+<ul>
+<li><a href=
+"../../lang/UnsupportedOperationException.html"><strong>
+UnsupportedOperationException</strong></a> - Thrown by collections
+if an unsupported optional operation is called.</li>
+<li><a href=
+"../ConcurrentModificationException.html"><strong>
+ConcurrentModificationException</strong></a> - Thrown by iterators
+and list iterators if the backing collection is changed
+unexpectedly while the iteration is in progress. Also thrown by
+<i>sublist</i> views of lists if the backing list is changed
+unexpectedly.</li>
+</ul>
+</li>
+<li><strong>Performance</strong>
+<ul>
+<li><strong><a href=
+"../RandomAccess.html">RandomAccess</a></strong>
+- Marker interface that lets <tt>List</tt> implementations indicate
+that they support fast (generally constant time) random access.
+This lets generic algorithms change their behavior to provide good
+performance when applied to either random or sequential access
+lists.</li>
+</ul>
+</li>
+</ul>
+</li>
+<li><strong>Array Utilities</strong>
+<ul>
+<li><a href=
+"../Arrays.html"><strong>Arrays</strong></a> -
+Contains static methods to sort, search, compare, hash, copy,
+resize, convert to <tt>String</tt>, and fill arrays of primitives
+and objects.</li>
+</ul>
+</li>
+</ul>
+<hr />
+<p style="font-size:smaller">
+Copyright © 1998, 2017, Oracle and/or its affiliates. 500 Oracle Parkway<br />
+ Redwood Shores, CA 94065 USA. All rights reserved.</p>
+<!-- Body text ends here -->
+</body>
+</html>
--- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Thu Aug 24 16:24:44 2017 +0200
@@ -44,7 +44,7 @@
* the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70
* characters in length. Attribute values can contain any characters and
* will be UTF8-encoded when written to the output stream. See the
- * <a href="../../../../technotes/guides/jar/jar.html">JAR File Specification</a>
+ * <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>
* for more information about valid attribute names and values.
*
* <p>This map and its views have a predictable iteration order, namely the
@@ -443,7 +443,7 @@
* to the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed
* 70 characters in length. Attribute values can contain any characters
* and will be UTF8-encoded when written to the output stream. See the
- * <a href="../../../../technotes/guides/jar/jar.html">JAR File Specification</a>
+ * <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>
* for more information about valid attribute names and values.
*/
public static class Name {
@@ -529,7 +529,7 @@
* {@code Name} object for {@code Manifest-Version}
* manifest attribute. This attribute indicates the version number
* of the manifest standard to which a JAR file's manifest conforms.
- * @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#JAR_Manifest">
* Manifest and Signature Specification</a>
*/
public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
@@ -537,7 +537,7 @@
/**
* {@code Name} object for {@code Signature-Version}
* manifest attribute used when signing JAR files.
- * @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#JAR_Manifest">
* Manifest and Signature Specification</a>
*/
public static final Name SIGNATURE_VERSION = new Name("Signature-Version");
@@ -551,7 +551,7 @@
/**
* {@code Name} object for {@code Class-Path}
* manifest attribute.
- * @see <a href="../../../../technotes/guides/jar/jar.html#classpath">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#classpath">
* JAR file specification</a>
*/
public static final Name CLASS_PATH = new Name("Class-Path");
@@ -568,7 +568,7 @@
/**
* {@code Name} object for {@code Sealed} manifest attribute
* used for sealing.
- * @see <a href="../../../../technotes/guides/jar/jar.html#sealing">
+ * @see <a href="{@docRoot}/../specs/jar/jar.html#sealing">
* Package Sealing</a>
*/
public static final Name SEALED = new Name("Sealed");
--- a/jdk/src/java.base/share/classes/java/util/jar/Manifest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/Manifest.java Thu Aug 24 16:24:44 2017 +0200
@@ -39,7 +39,7 @@
* associated Attributes. There are main Manifest Attributes as well as
* per-entry Attributes. For information on the Manifest format, please
* see the
- * <a href="../../../../technotes/guides/jar/jar.html">
+ * <a href="{@docRoot}/../specs/jar/jar.html">
* Manifest format specification</a>.
*
* @author David Connelly
--- a/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Thu Aug 24 16:24:44 2017 +0200
@@ -34,8 +34,7 @@
/**
* Transforms a JAR file to or from a packed stream in Pack200 format.
- * Please refer to Network Transfer Format JSR 200 Specification at
- * <a href=http://jcp.org/aboutJava/communityprocess/review/jsr200/index.html>http://jcp.org/aboutJava/communityprocess/review/jsr200/index.html</a>
+ * Please refer to <a href="{@docRoot}/../specs/pack-spec.html">Network Transfer Format JSR 200 Specification</a>
* <p>
* Typically the packer engine is used by application developers
* to deploy or host JAR files on a website.
--- a/jdk/src/java.base/share/classes/java/util/jar/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -40,7 +40,7 @@
* <a href="../zip/package-summary.html#package_description">java.util.zip
* package description.</a> <p>
* In JAR files, all file names must be encoded in the UTF-8 encoding.
- * <li><a href="../../../../technotes/guides/jar/jar.html">
+ * <li><a href="{@docRoot}/../specs/jar/jar.html">
* Manifest and Signature Specification</a> - The manifest format specification.
* </ul>
*
--- a/jdk/src/java.base/share/classes/java/util/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/util/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,27 +24,24 @@
*/
/**
- * Contains the collections framework, legacy collection classes,
- * event model, date and time facilities, internationalization, and
- * miscellaneous utility classes (a string tokenizer, a random-number
- * generator, and a bit array).
+ * Contains the collections framework, some internationalization support classes,
+ * a service loader, properties, random number generation, string parsing
+ * and scanning classes, base64 encoding and decoding, a bit array, and
+ * several miscellaneous utility classes. This package also contains
+ * legacy collection classes and legacy date and time classes.
*
* <h2><a id="CollectionsFramework"></a>{@index "Java Collections Framework"}</h2>
+ * <p>For an overview, API outline, and design rationale, please see:
* <ul>
- * <li><a href="../../../technotes/guides/collections/overview.html"><b>Collections Framework Overview</b></a>
- * <li><a href="../../../technotes/guides/collections/reference.html"><b>
- * Collections Framework Annotated Outline</b></a>
+ * <li><a href="doc-files/coll-index.html">
+ * <b>Collections Framework Documentation</b></a>
* </ul>
*
- * <h2>Related Documentation</h2>
- * For overviews, tutorials, examples, guides, and tool documentation,
- * please see:
+ * <p>For a tutorial and programming guide with examples of use
+ * of the collections framework, please see:
* <ul>
- * <li><a href="http://docs.oracle.com/javase/tutorial/collections/index.html">
- * <b>Collections Framework Tutorial</b></a>
- * <li><a
- * href="../../../technotes/guides/collections/designfaq.html"><b>Collections
- * Framework Design FAQ</b></a>
+ * <li><a href="http://docs.oracle.com/javase/tutorial/collections/index.html">
+ * <b>Collections Framework Tutorial</b></a>
* </ul>
*
* @since 1.0
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Aug 24 16:24:44 2017 +0200
@@ -2616,11 +2616,9 @@
* according to the installed JCE jurisdiction policy files. If
* JCE unlimited strength jurisdiction policy files are installed,
* Integer.MAX_VALUE will be returned.
- * For more information on default key size in JCE jurisdiction
- * policy files, please see Appendix E in the
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppC">
- * Java Cryptography Architecture Reference Guide</a>.
+ * For more information on the default key sizes and the JCE jurisdiction
+ * policy files, please see the Cryptographic defaults and limitations in
+ * the {@extLink security_guide_jdk_providers JDK Providers Documentation}.
*
* @param transformation the cipher transformation.
* @return the maximum key length in bits or Integer.MAX_VALUE.
--- a/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, 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
@@ -116,10 +116,9 @@
* e.g. EncryptedPrivateKeyInfo(AlgorithmParameters, byte[]),
* should be used.
*
- * @param algName encryption algorithm name. See Appendix A in the
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture Reference Guide</a>
+ * @param algName encryption algorithm name. See the
+ * <a href="{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard Cipher algorithm names.
* @param encryptedData encrypted data. The contents of
* <code>encrypedData</code> are copied to protect against subsequent
@@ -199,10 +198,8 @@
* Returns the encryption algorithm.
* <p>Note: Standard name is returned instead of the specified one
* in the constructor when such mapping is available.
- * See Appendix A in the
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture Reference Guide</a>
+ * See the <a href="{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard Cipher algorithm names.
*
* @return the encryption algorithm name.
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Thu Aug 24 16:24:44 2017 +0200
@@ -84,8 +84,7 @@
* (via a call to an {@code init} method), each provider must
* supply (and document) a default initialization.
* See the Keysize Restriction sections of the
- * <a href="{@docRoot}/../technotes/guides/security/SunProviders.html">
- * JDK Providers</a>
+ * {@extLink security_guide_jdk_providers JDK Providers}
* document for information on the KeyGenerator defaults used by
* JDK providers.
* However, note that defaults may vary across different providers.
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java Thu Aug 24 16:24:44 2017 +0200
@@ -39,8 +39,7 @@
* (via a call to an {@code init} method), each provider must
* supply (and document) a default initialization.
* See the Keysize Restriction sections of the
- * <a href="{@docRoot}/../technotes/guides/security/SunProviders.html">
- * JDK Providers</a>
+ * {@extLink security_guide_jdk_providers JDK Providers}
* document for information on the KeyGenerator defaults used by
* JDK providers.
* However, note that defaults may vary across different providers.
--- a/jdk/src/java.base/share/classes/javax/crypto/interfaces/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/interfaces/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,8 @@
* developer guide:
*
* <ul>
- * <li><a href=
- * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- * <b>How to Implement a Provider for the Java™ Cryptography Architecture
- * </b></a></li>
+ * <li> {@extLink security_guide_impl_provider
+ * How to Implement a Provider in the Java Cryptography Architecture}</li>
* </ul>
*
* <h2>Package Specification</h2>
@@ -57,10 +55,8 @@
* For further documentation, please see:
* <ul>
* <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™ Cryptography Architecture API Specification and Reference
- * </b></a></li>
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}</li>
* </ul>
*
* @since 1.4
--- a/jdk/src/java.base/share/classes/javax/crypto/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -43,7 +43,7 @@
*
* <ul>
* <li><a href="{@docRoot}/../specs/security/standard-names.html">
- * <b>Java™ Security Standard Algorithm Names Specification
+ * <b>Java Security Standard Algorithm Names Specification
* </b></a></li>
* </ul>
*
@@ -52,15 +52,11 @@
* For further documentation, please see:
* <ul>
* <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™ Cryptography Architecture (JCA) Reference Guide
- * </b></a></li>
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide}</li>
* <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- * <b>How to Implement a Provider in the Java™ Cryptography
- * Architecture </b></a></li>
+ * {@extLink security_guide_impl_provider
+ * How to Implement a Provider in the Java Cryptography Architecture}</li>
* </ul>
*
* @since 1.4
--- a/jdk/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -81,9 +81,8 @@
* the array are copied to protect against subsequent modification.
* @param algorithm the name of the secret-key algorithm to be associated
* with the given key material.
- * See Appendix A in the <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture Reference Guide</a>
+ * See the <a href="{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
* @exception IllegalArgumentException if <code>algorithm</code>
* is null or <code>key</code> is null or empty.
@@ -126,9 +125,8 @@
* @param len the length of the key material.
* @param algorithm the name of the secret-key algorithm to be associated
* with the given key material.
- * See Appendix A in the <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture Reference Guide</a>
+ * See the <a href="{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
* @exception IllegalArgumentException if <code>algorithm</code>
* is null or <code>key</code> is null, empty, or too short,
--- a/jdk/src/java.base/share/classes/javax/crypto/spec/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/crypto/spec/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -57,16 +57,11 @@
*
* <ul>
* <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- * <b>Java™ Cryptography Architecture API Specification and Reference
- * </b></a></li>
+ * {@extLink security_guide_jca
+ * Java Cryptography Architecture (JCA) Reference Guide} </li>
* <li>
- * <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- * <b>How to Implement a Provider for the
- * Java™ Cryptography Architecture
- * </b></a></li>
+ * {@extLink security_guide_impl_provider
+ * How to Implement a Provider in the Java Cryptography Architecture}</li>
* </ul>
*
* @since 1.4
--- a/jdk/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,9 +44,9 @@
* <p>
* The signature algorithm name must be a standard Java Security
* name (such as "SHA1withRSA", "SHA256withECDSA", and so on).
- * See Appendix A in the <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture API Specification & Reference </a>
+ * See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
* <p>
* Note: the local supported signature algorithms should conform to
@@ -72,9 +72,9 @@
* <p>
* The signature algorithm name must be a standard Java Security
* name (such as "SHA1withRSA", "SHA256withECDSA", and so on).
- * See Appendix A in the <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture API Specification & Reference </a>
+ * See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @return An array of supported signature algorithms, in descending
--- a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -127,8 +127,8 @@
*
* @param algorithm the standard name of the requested algorithm.
* See the <a href=
- * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
- * Java Secure Socket Extension Reference Guide </a>
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @return the new {@code KeyManagerFactory} object
@@ -165,8 +165,8 @@
* @param algorithm the standard name of the requested algorithm.
* See the <a href=
- * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
- * Java Secure Socket Extension Reference Guide </a>
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @param provider the name of the provider.
@@ -209,8 +209,8 @@
*
* @param algorithm the standard name of the requested algorithm.
* See the <a href=
- * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
- * Java Secure Socket Extension Reference Guide </a>
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @param provider an instance of the provider.
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java Thu Aug 24 16:24:44 2017 +0200
@@ -294,9 +294,10 @@
* SSL/TLS/DTLS handshaking. This is to prevent man-in-the-middle attacks.
*
* @param algorithm The standard string name of the endpoint
- * identification algorithm (or null). See Appendix A in the <a href=
- * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
- * Java Cryptography Architecture API Specification & Reference </a>
+ * identification algorithm (or null).
+ * See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @see X509ExtendedTrustManager
--- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -141,8 +141,8 @@
*
* @param algorithm the standard name of the requested trust management
* algorithm. See the <a href=
- * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
- * Java Secure Socket Extension Reference Guide </a>
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @return the new {@code TrustManagerFactory} object
@@ -179,8 +179,8 @@
*
* @param algorithm the standard name of the requested trust management
* algorithm. See the <a href=
- * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
- * Java Secure Socket Extension Reference Guide </a>
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @param provider the name of the provider.
@@ -223,8 +223,8 @@
*
* @param algorithm the standard name of the requested trust management
* algorithm. See the <a href=
- * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html">
- * Java Secure Socket Extension Reference Guide </a>
+ * "{@docRoot}/../specs/security/standard-names.html">
+ * Java Security Standard Algorithm Names</a> document
* for information about standard algorithm names.
*
* @param provider an instance of the provider.
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Thu Aug 24 16:24:44 2017 +0200
@@ -49,8 +49,10 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.Attributes;
@@ -336,16 +338,43 @@
}
}
- // search class path
+ // class path (not checked)
Enumeration<URL> e = findResourcesOnClassPath(name);
- while (e.hasMoreElements()) {
- URL url = checkURL(e.nextElement());
- if (url != null) {
- checked.add(url);
+
+ // concat the checked URLs and the (not checked) class path
+ return new Enumeration<>() {
+ final Iterator<URL> iterator = checked.iterator();
+ URL next;
+ private boolean hasNext() {
+ if (next != null) {
+ return true;
+ } else if (iterator.hasNext()) {
+ next = iterator.next();
+ return true;
+ } else {
+ // need to check each URL
+ while (e.hasMoreElements() && next == null) {
+ next = checkURL(e.nextElement());
+ }
+ return next != null;
+ }
}
- }
+ @Override
+ public boolean hasMoreElements() {
+ return hasNext();
+ }
+ @Override
+ public URL nextElement() {
+ if (hasNext()) {
+ URL result = next;
+ next = null;
+ return result;
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+ };
- return Collections.enumeration(checked);
}
/**
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java Thu Aug 24 16:24:44 2017 +0200
@@ -28,6 +28,7 @@
import java.io.File;
import java.io.FilePermission;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleReader;
@@ -52,11 +53,17 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
+import java.util.Spliterator;
+import java.util.Spliterators;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.Resources;
@@ -79,8 +86,8 @@
* loader. This allows automatic modules (for example) to link to types in the
* unnamed module of the parent class loader.
*
- * @see ModuleModuleLayer#defineModulesWithOneLoader
- * @see ModuleModuleLayer#defineModulesWithManyLoaders
+ * @see ModuleLayer#defineModulesWithOneLoader
+ * @see ModuleLayer#defineModulesWithManyLoaders
*/
public final class Loader extends SecureClassLoader {
@@ -303,7 +310,6 @@
// -- resources --
-
/**
* Returns a URL to a resource of the given name in a module defined to
* this class loader.
@@ -388,33 +394,96 @@
@Override
public Enumeration<URL> findResources(String name) throws IOException {
- List<URL> urls = new ArrayList<>();
+ return Collections.enumeration(findResourcesAsList(name));
+ }
+
+ @Override
+ public URL getResource(String name) {
+ Objects.requireNonNull(name);
+
+ // this loader
+ URL url = findResource(name);
+ if (url != null) {
+ return url;
+ } else {
+ // parent loader
+ return parent.getResource(name);
+ }
+ }
+
+ @Override
+ public Enumeration<URL> getResources(String name) throws IOException {
+ Objects.requireNonNull(name);
+
+ // this loader
+ List<URL> urls = findResourcesAsList(name);
+
+ // parent loader
+ Enumeration<URL> e = parent.getResources(name);
+
+ // concat the URLs with the URLs returned by the parent
+ return new Enumeration<>() {
+ final Iterator<URL> iterator = urls.iterator();
+ @Override
+ public boolean hasMoreElements() {
+ return (iterator.hasNext() || e.hasMoreElements());
+ }
+ @Override
+ public URL nextElement() {
+ if (iterator.hasNext()) {
+ return iterator.next();
+ } else {
+ return e.nextElement();
+ }
+ }
+ };
+ }
+
+ @Override
+ public Stream<URL> resources(String name) {
+ Objects.requireNonNull(name);
+ // ordering not specified
+ int characteristics = (Spliterator.NONNULL | Spliterator.IMMUTABLE |
+ Spliterator.SIZED | Spliterator.SUBSIZED);
+ Supplier<Spliterator<URL>> supplier = () -> {
+ try {
+ List<URL> urls = findResourcesAsList(name);
+ return Spliterators.spliterator(urls, characteristics);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ };
+ Stream<URL> s1 = StreamSupport.stream(supplier, characteristics, false);
+ Stream<URL> s2 = parent.resources(name);
+ return Stream.concat(s1, s2);
+ }
+
+ /**
+ * Finds the resources with the given name in this class loader.
+ */
+ private List<URL> findResourcesAsList(String name) throws IOException {
String pn = Resources.toPackageName(name);
LoadedModule module = localPackageToModule.get(pn);
if (module != null) {
- try {
- URL url = findResource(module.name(), name);
- if (url != null
+ URL url = findResource(module.name(), name);
+ if (url != null
&& (name.endsWith(".class")
- || url.toString().endsWith("/")
- || isOpen(module.mref(), pn))) {
- urls.add(url);
- }
- } catch (IOException ioe) {
- // ignore
+ || url.toString().endsWith("/")
+ || isOpen(module.mref(), pn))) {
+ return List.of(url);
+ } else {
+ return Collections.emptyList();
}
} else {
+ List<URL> urls = new ArrayList<>();
for (ModuleReference mref : nameToModule.values()) {
- try {
- URL url = findResource(mref.descriptor().name(), name);
- if (url != null)
- urls.add(url);
- } catch (IOException ioe) {
- // ignore
+ URL url = findResource(mref.descriptor().name(), name);
+ if (url != null) {
+ urls.add(url);
}
}
+ return urls;
}
- return Collections.enumeration(urls);
}
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java Thu Aug 24 16:24:44 2017 +0200
@@ -32,6 +32,8 @@
import java.net.URI;
import java.security.AccessControlContext;
import java.security.ProtectionDomain;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
@@ -44,13 +46,15 @@
public interface JavaLangAccess {
/**
- * Returns a {@code Method} object that reflects the specified public
- * member method of the given class. Returns {@code null} if the
- * method is not defined.
+ * Returns the list of {@code Method} objects for the declared public
+ * methods of this class or interface that have the specified method name
+ * and parameter types.
*/
- Method getMethodOrNull(Class<?> klass, String name, Class<?>... parameterTypes);
+ List<Method> getDeclaredPublicMethods(Class<?> klass, String name, Class<?>... parameterTypes);
- /** Return the constant pool for a class. */
+ /**
+ * Return the constant pool for a class.
+ */
ConstantPool getConstantPool(Class<?> klass);
/**
@@ -95,7 +99,9 @@
*/
<E extends Enum<E>> E[] getEnumConstantsShared(Class<E> klass);
- /** Set thread's blocker field. */
+ /**
+ * Set thread's blocker field.
+ */
void blockedOn(Thread t, Interruptible b);
/**
@@ -155,11 +161,6 @@
Class<?> findBootstrapClassOrNull(ClassLoader cl, String name);
/**
- * Returns the Packages for the given class loader.
- */
- Stream<Package> packages(ClassLoader cl);
-
- /**
* Define a Package of the given name and module by the given class loader.
*/
Package definePackage(ClassLoader cl, String name, Module module);
@@ -223,16 +224,31 @@
void addOpens(Module m1, String pkg, Module m2);
/**
- * Updates a module m to open a package to all unnamed modules.
+ * Updates module m to open a package to all unnamed modules.
*/
void addOpensToAllUnnamed(Module m, String pkg);
/**
- * Updates a module m to use a service.
+ * Updates module m to open all packages returned by the given iterator.
+ */
+ void addOpensToAllUnnamed(Module m, Iterator<String> packages);
+
+ /**
+ * Updates module m to use a service.
*/
void addUses(Module m, Class<?> service);
/**
+ * Returns true if module m reflectively exports a package to other
+ */
+ boolean isReflectivelyExported(Module module, String pn, Module other);
+
+ /**
+ * Returns true if module m reflectively opens a package to other
+ */
+ boolean isReflectivelyOpened(Module module, String pn, Module other);
+
+ /**
* Returns the ServicesCatalog for the given Layer.
*/
ServicesCatalog getServicesCatalog(ModuleLayer layer);
--- a/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java Thu Aug 24 16:24:44 2017 +0200
@@ -33,146 +33,240 @@
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.StringJoiner;
import java.util.WeakHashMap;
import java.util.function.Supplier;
import java.util.stream.Collectors;
+import static java.util.Collections.*;
-import jdk.internal.loader.BootLoader;
-import sun.security.action.GetPropertyAction;
+import jdk.internal.misc.JavaLangAccess;
+import jdk.internal.misc.SharedSecrets;
/**
- * Supports logging of access to members of API packages that are exported or
- * opened via backdoor mechanisms to code in unnamed modules.
+ * Supports logging of access to members of exported and concealed packages
+ * that are opened to code in unnamed modules for illegal access.
*/
public final class IllegalAccessLogger {
/**
- * Holder class to lazily create the StackWalker object and determine
- * if the stack trace should be printed
+ * Logger modes
*/
- static class Holder {
- static final StackWalker STACK_WALKER;
- static final boolean PRINT_STACK_TRACE;
+ public static enum Mode {
+ /**
+ * Prints a warning when an illegal access succeeds and then
+ * discards the logger so that there is no further output.
+ */
+ ONESHOT,
+ /**
+ * Print warnings when illegal access succeeds
+ */
+ WARN,
+ /**
+ * Prints warnings and a stack trace when illegal access succeeds
+ */
+ DEBUG,
+ }
+
+ /**
+ * A builder for IllegalAccessLogger objects.
+ */
+ public static class Builder {
+ private final Mode mode;
+ private final PrintStream warningStream;
+ private final Map<Module, Set<String>> moduleToConcealedPackages;
+ private final Map<Module, Set<String>> moduleToExportedPackages;
+ private boolean complete;
+
+ private void ensureNotComplete() {
+ if (complete) throw new IllegalStateException();
+ }
- static {
- PrivilegedAction<StackWalker> pa = () ->
- StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
- STACK_WALKER = AccessController.doPrivileged(pa);
+ /**
+ * Creates a builder.
+ */
+ public Builder(Mode mode, PrintStream warningStream) {
+ this.mode = mode;
+ this.warningStream = warningStream;
+ this.moduleToConcealedPackages = new HashMap<>();
+ this.moduleToExportedPackages = new HashMap<>();
+ }
- String name = "sun.reflect.debugModuleAccessChecks";
- String value = GetPropertyAction.privilegedGetProperty(name, null);
- PRINT_STACK_TRACE = "access" .equals(value);
+ /**
+ * Adding logging of reflective-access to any member of a type in
+ * otherwise concealed packages.
+ */
+ public Builder logAccessToConcealedPackages(Module m, Set<String> packages) {
+ ensureNotComplete();
+ moduleToConcealedPackages.put(m, unmodifiableSet(packages));
+ return this;
+ }
+
+ /**
+ * Adding logging of reflective-access to non-public members/types in
+ * otherwise exported (not open) packages.
+ */
+ public Builder logAccessToExportedPackages(Module m, Set<String> packages) {
+ ensureNotComplete();
+ moduleToExportedPackages.put(m, unmodifiableSet(packages));
+ return this;
+ }
+
+ /**
+ * Builds the IllegalAccessLogger and sets it as the system-wise logger.
+ */
+ public void complete() {
+ Map<Module, Set<String>> map1 = unmodifiableMap(moduleToConcealedPackages);
+ Map<Module, Set<String>> map2 = unmodifiableMap(moduleToExportedPackages);
+ logger = new IllegalAccessLogger(mode, warningStream, map1, map2);
+ complete = true;
}
}
- // the maximum number of frames to capture
- private static final int MAX_STACK_FRAMES = 32;
-
- // lock to avoid interference when printing stack traces
- private static final Object OUTPUT_LOCK = new Object();
+ // need access to java.lang.Module
+ private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
- // caller -> usages
- private final Map<Class<?>, Set<Usage>> callerToUsages = new WeakHashMap<>();
+ // system-wide IllegalAccessLogger
+ private static volatile IllegalAccessLogger logger;
- // module -> (package name -> CLI option)
- private final Map<Module, Map<String, String>> exported;
- private final Map<Module, Map<String, String>> opened;
+ // logger mode
+ private final Mode mode;
// the print stream to send the warnings
private final PrintStream warningStream;
- private IllegalAccessLogger(Map<Module, Map<String, String>> exported,
- Map<Module, Map<String, String>> opened,
- PrintStream warningStream) {
- this.exported = deepCopy(exported);
- this.opened = deepCopy(opened);
+ // module -> packages open for illegal access
+ private final Map<Module, Set<String>> moduleToConcealedPackages;
+ private final Map<Module, Set<String>> moduleToExportedPackages;
+
+ // caller -> usages
+ private final Map<Class<?>, Usages> callerToUsages = new WeakHashMap<>();
+
+ private IllegalAccessLogger(Mode mode,
+ PrintStream warningStream,
+ Map<Module, Set<String>> moduleToConcealedPackages,
+ Map<Module, Set<String>> moduleToExportedPackages)
+ {
+ this.mode = mode;
this.warningStream = warningStream;
+ this.moduleToConcealedPackages = moduleToConcealedPackages;
+ this.moduleToExportedPackages = moduleToExportedPackages;
}
/**
- * Returns that a Builder that is seeded with the packages known to this logger.
+ * Returns the system-wide IllegalAccessLogger or {@code null} if there is
+ * no logger.
+ */
+ public static IllegalAccessLogger illegalAccessLogger() {
+ return logger;
+ }
+
+ /**
+ * Returns true if the module exports a concealed package for illegal
+ * access.
*/
- public Builder toBuilder() {
- return new Builder(exported, opened);
+ public boolean isExportedForIllegalAccess(Module module, String pn) {
+ Set<String> packages = moduleToConcealedPackages.get(module);
+ if (packages != null && packages.contains(pn))
+ return true;
+ return false;
+ }
+
+ /**
+ * Returns true if the module opens a concealed or exported package for
+ * illegal access.
+ */
+ public boolean isOpenForIllegalAccess(Module module, String pn) {
+ if (isExportedForIllegalAccess(module, pn))
+ return true;
+ Set<String> packages = moduleToExportedPackages.get(module);
+ if (packages != null && packages.contains(pn))
+ return true;
+ return false;
}
/**
* Logs access to the member of a target class by a caller class if the class
- * is in a package that is exported via a backdoor mechanism.
+ * is in a package that is exported for illegal access.
*
* The {@code whatSupplier} supplies the message that describes the member.
*/
- public void logIfExportedByBackdoor(Class<?> caller,
- Class<?> target,
- Supplier<String> whatSupplier) {
- Map<String, String> packages = exported.get(target.getModule());
- if (packages != null) {
- String how = packages.get(target.getPackageName());
- if (how != null) {
- log(caller, whatSupplier.get(), how);
+ public void logIfExportedForIllegalAccess(Class<?> caller,
+ Class<?> target,
+ Supplier<String> whatSupplier) {
+ Module targetModule = target.getModule();
+ String targetPackage = target.getPackageName();
+ if (isExportedForIllegalAccess(targetModule, targetPackage)) {
+ Module callerModule = caller.getModule();
+ if (!JLA.isReflectivelyExported(targetModule, targetPackage, callerModule)) {
+ log(caller, whatSupplier.get());
}
}
}
/**
* Logs access to the member of a target class by a caller class if the class
- * is in a package that is opened via a backdoor mechanism.
+ * is in a package that is opened for illegal access.
*
* The {@code what} parameter supplies the message that describes the member.
*/
- public void logIfOpenedByBackdoor(Class<?> caller,
- Class<?> target,
- Supplier<String> whatSupplier) {
- Map<String, String> packages = opened.get(target.getModule());
- if (packages != null) {
- String how = packages.get(target.getPackageName());
- if (how != null) {
- log(caller, whatSupplier.get(), how);
+ public void logIfOpenedForIllegalAccess(Class<?> caller,
+ Class<?> target,
+ Supplier<String> whatSupplier) {
+ Module targetModule = target.getModule();
+ String targetPackage = target.getPackageName();
+ if (isOpenForIllegalAccess(targetModule, targetPackage)) {
+ Module callerModule = caller.getModule();
+ if (!JLA.isReflectivelyOpened(targetModule, targetPackage, callerModule)) {
+ log(caller, whatSupplier.get());
+ }
+ }
+ }
+
+ /**
+ * Logs access by caller lookup if the target class is in a package that is
+ * opened for illegal access.
+ */
+ public void logIfOpenedForIllegalAccess(MethodHandles.Lookup caller, Class<?> target) {
+ Module targetModule = target.getModule();
+ String targetPackage = target.getPackageName();
+ if (isOpenForIllegalAccess(targetModule, targetPackage)) {
+ Class<?> callerClass = caller.lookupClass();
+ Module callerModule = callerClass.getModule();
+ if (!JLA.isReflectivelyOpened(targetModule, targetPackage, callerModule)) {
+ URL url = codeSource(callerClass);
+ final String source;
+ if (url == null) {
+ source = callerClass.getName();
+ } else {
+ source = callerClass.getName() + " (" + url + ")";
+ }
+ log(callerClass, target.getName(), () ->
+ "WARNING: Illegal reflective access using Lookup on " + source
+ + " to " + target);
}
}
}
/**
* Logs access by a caller class. The {@code what} parameter describes
- * the member is accessed, the {@code how} parameter is the means by which
- * access is allocated (CLI option for example).
+ * the member being accessed.
*/
- private void log(Class<?> caller, String what, String how) {
+ private void log(Class<?> caller, String what) {
log(caller, what, () -> {
- PrivilegedAction<ProtectionDomain> pa = caller::getProtectionDomain;
- CodeSource cs = AccessController.doPrivileged(pa).getCodeSource();
- URL url = (cs != null) ? cs.getLocation() : null;
+ URL url = codeSource(caller);
String source = caller.getName();
if (url != null)
source += " (" + url + ")";
- return "WARNING: Illegal access by " + source + " to " + what
- + " (permitted by " + how + ")";
+ return "WARNING: Illegal reflective access by " + source + " to " + what;
});
}
-
- /**
- * Logs access to caller class if the class is in a package that is opened via
- * a backdoor mechanism.
- */
- public void logIfOpenedByBackdoor(MethodHandles.Lookup caller, Class<?> target) {
- Map<String, String> packages = opened.get(target.getModule());
- if (packages != null) {
- String how = packages.get(target.getPackageName());
- if (how != null) {
- log(caller.lookupClass(), target.getName(), () ->
- "WARNING: Illegal access using Lookup on " + caller.lookupClass()
- + " to " + target + " (permitted by " + how + ")");
- }
- }
- }
-
/**
* Log access by a caller. The {@code what} parameter describes the class or
* member that is being accessed. The {@code msgSupplier} supplies the log
@@ -184,53 +278,73 @@
* keys so it can be expunged when the caller is GC'ed/unloaded.
*/
private void log(Class<?> caller, String what, Supplier<String> msgSupplier) {
+ if (mode == Mode.ONESHOT) {
+ synchronized (IllegalAccessLogger.class) {
+ // discard the system wide logger
+ if (logger == null)
+ return;
+ logger = null;
+ }
+ warningStream.println(loudWarning(caller, msgSupplier));
+ return;
+ }
+
// stack trace without the top-most frames in java.base
- List<StackWalker.StackFrame> stack = Holder.STACK_WALKER.walk(s ->
+ List<StackWalker.StackFrame> stack = StackWalkerHolder.INSTANCE.walk(s ->
s.dropWhile(this::isJavaBase)
- .limit(MAX_STACK_FRAMES)
+ .limit(32)
.collect(Collectors.toList())
);
- // check if the access has already been recorded
+ // record usage if this is the first (or not recently recorded)
Usage u = new Usage(what, hash(stack));
- boolean firstUsage;
+ boolean added;
synchronized (this) {
- firstUsage = callerToUsages.computeIfAbsent(caller, k -> new HashSet<>()).add(u);
+ added = callerToUsages.computeIfAbsent(caller, k -> new Usages()).add(u);
}
- // log message if first usage
- if (firstUsage) {
+ // print warning if this is the first (or not a recent) usage
+ if (added) {
String msg = msgSupplier.get();
- if (Holder.PRINT_STACK_TRACE) {
- synchronized (OUTPUT_LOCK) {
- warningStream.println(msg);
- stack.forEach(f -> warningStream.println("\tat " + f));
- }
- } else {
- warningStream.println(msg);
+ if (mode == Mode.DEBUG) {
+ StringBuilder sb = new StringBuilder(msg);
+ stack.forEach(f ->
+ sb.append(System.lineSeparator()).append("\tat " + f)
+ );
+ msg = sb.toString();
}
+ warningStream.println(msg);
}
}
- private static class Usage {
- private final String what;
- private final int stack;
- Usage(String what, int stack) {
- this.what = what;
- this.stack = stack;
- }
- @Override
- public int hashCode() {
- return what.hashCode() ^ stack;
- }
- @Override
- public boolean equals(Object ob) {
- if (ob instanceof Usage) {
- Usage that = (Usage)ob;
- return what.equals(that.what) && stack == (that.stack);
- } else {
- return false;
- }
+ /**
+ * Returns the code source for the given class or null if there is no code source
+ */
+ private URL codeSource(Class<?> clazz) {
+ PrivilegedAction<ProtectionDomain> pa = clazz::getProtectionDomain;
+ CodeSource cs = AccessController.doPrivileged(pa).getCodeSource();
+ return (cs != null) ? cs.getLocation() : null;
+ }
+
+ private String loudWarning(Class<?> caller, Supplier<String> msgSupplier) {
+ StringJoiner sj = new StringJoiner(System.lineSeparator());
+ sj.add("WARNING: An illegal reflective access operation has occurred");
+ sj.add(msgSupplier.get());
+ sj.add("WARNING: Please consider reporting this to the maintainers of "
+ + caller.getName());
+ sj.add("WARNING: Use --illegal-access=warn to enable warnings of further"
+ + " illegal reflective access operations");
+ sj.add("WARNING: All illegal access operations will be denied in a"
+ + " future release");
+ return sj.toString();
+ }
+
+ private static class StackWalkerHolder {
+ static final StackWalker INSTANCE;
+ static {
+ PrivilegedAction<StackWalker> pa = () ->
+ StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
+ INSTANCE = AccessController.doPrivileged(pa);
}
}
@@ -256,89 +370,39 @@
return hash;
}
- // system-wide IllegalAccessLogger
- private static volatile IllegalAccessLogger logger;
-
- /**
- * Sets the system-wide IllegalAccessLogger
- */
- public static void setIllegalAccessLogger(IllegalAccessLogger l) {
- if (l.exported.isEmpty() && l.opened.isEmpty()) {
- logger = null;
- } else {
- logger = l;
+ private static class Usage {
+ private final String what;
+ private final int stack;
+ Usage(String what, int stack) {
+ this.what = what;
+ this.stack = stack;
+ }
+ @Override
+ public int hashCode() {
+ return what.hashCode() ^ stack;
+ }
+ @Override
+ public boolean equals(Object ob) {
+ if (ob instanceof Usage) {
+ Usage that = (Usage)ob;
+ return what.equals(that.what) && stack == (that.stack);
+ } else {
+ return false;
+ }
}
}
- /**
- * Returns the system-wide IllegalAccessLogger or {@code null} if there is
- * no logger.
- */
- public static IllegalAccessLogger illegalAccessLogger() {
- return logger;
- }
-
- /**
- * A builder for IllegalAccessLogger objects.
- */
- public static class Builder {
- private final Module UNNAMED = BootLoader.getUnnamedModule();
- private Map<Module, Map<String, String>> exported;
- private Map<Module, Map<String, String>> opened;
- private PrintStream warningStream = System.err;
-
- public Builder() { }
-
- public Builder(Map<Module, Map<String, String>> exported,
- Map<Module, Map<String, String>> opened) {
- this.exported = deepCopy(exported);
- this.opened = deepCopy(opened);
- }
-
- public Builder logAccessToExportedPackage(Module m, String pn, String how) {
- if (!m.isExported(pn, UNNAMED)) {
- if (exported == null)
- exported = new HashMap<>();
- exported.computeIfAbsent(m, k -> new HashMap<>()).putIfAbsent(pn, how);
- }
- return this;
+ @SuppressWarnings("serial")
+ private static class Usages extends LinkedHashMap<Usage, Boolean> {
+ Usages() { }
+ boolean add(Usage u) {
+ return (putIfAbsent(u, Boolean.TRUE) == null);
}
-
- public Builder logAccessToOpenPackage(Module m, String pn, String how) {
- // opens implies exported at run-time.
- logAccessToExportedPackage(m, pn, how);
-
- if (!m.isOpen(pn, UNNAMED)) {
- if (opened == null)
- opened = new HashMap<>();
- opened.computeIfAbsent(m, k -> new HashMap<>()).putIfAbsent(pn, how);
- }
- return this;
- }
-
- public Builder warningStream(PrintStream warningStream) {
- this.warningStream = Objects.requireNonNull(warningStream);
- return this;
- }
-
- /**
- * Builds the logger.
- */
- public IllegalAccessLogger build() {
- return new IllegalAccessLogger(exported, opened, warningStream);
- }
- }
-
-
- static Map<Module, Map<String, String>> deepCopy(Map<Module, Map<String, String>> map) {
- if (map == null || map.isEmpty()) {
- return new HashMap<>();
- } else {
- Map<Module, Map<String, String>> newMap = new HashMap<>();
- for (Map.Entry<Module, Map<String, String>> e : map.entrySet()) {
- newMap.put(e.getKey(), new HashMap<>(e.getValue()));
- }
- return newMap;
+ @Override
+ protected boolean removeEldestEntry(Map.Entry<Usage, Boolean> oldest) {
+ // prevent map growing too big, say where a utility class
+ // is used by generated code to do illegal access
+ return size() > 16;
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessMaps.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.module;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UncheckedIOException;
+import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static java.nio.charset.StandardCharsets.*;
+
+/**
+ * Generates the maps of concealed and exported packages to open at run-time.
+ *
+ * This is used at run-time for exploded builds, and at link-time to generate
+ * the maps for the system modules in the run-time image.
+ */
+
+public class IllegalAccessMaps {
+ private final Map<String, Set<String>> concealedPackagesToOpen;
+ private final Map<String, Set<String>> exportedPackagesToOpen;
+
+ private IllegalAccessMaps(Map<String, Set<String>> map1,
+ Map<String, Set<String>> map2) {
+ this.concealedPackagesToOpen = map1;
+ this.exportedPackagesToOpen = map2;
+ }
+
+ /**
+ * Returns the map of concealed packages to open. The map key is the
+ * module name, the value is the set of concealed packages to open.
+ */
+ public Map<String, Set<String>> concealedPackagesToOpen() {
+ return concealedPackagesToOpen;
+ }
+
+ /**
+ * Returns the map of exported packages to open. The map key is the
+ * module name, the value is the set of exported packages to open.
+ */
+ public Map<String, Set<String>> exportedPackagesToOpen() {
+ return exportedPackagesToOpen;
+ }
+
+ /**
+ * Generate the maps of module to concealed and exported packages for
+ * the system modules that are observable with the given module finder.
+ */
+ public static IllegalAccessMaps generate(ModuleFinder finder) {
+ Map<String, ModuleDescriptor> map = new HashMap<>();
+ finder.findAll().stream()
+ .map(ModuleReference::descriptor)
+ .forEach(md -> md.packages().forEach(pn -> map.putIfAbsent(pn, md)));
+
+ Map<String, Set<String>> concealedPackagesToOpen = new HashMap<>();
+ Map<String, Set<String>> exportedPackagesToOpen = new HashMap<>();
+
+ String rn = "jdk8_packages.dat";
+ InputStream in = IllegalAccessMaps.class.getResourceAsStream(rn);
+ if (in == null) {
+ throw new InternalError(rn + " not found");
+ }
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(in, UTF_8))) {
+ br.lines()
+ .filter(line -> !line.isEmpty() && !line.startsWith("#"))
+ .forEach(pn -> {
+ ModuleDescriptor descriptor = map.get(pn);
+ if (descriptor != null && !isOpen(descriptor, pn)) {
+ String name = descriptor.name();
+ if (isExported(descriptor, pn)) {
+ exportedPackagesToOpen.computeIfAbsent(name,
+ k -> new HashSet<>()).add(pn);
+ } else {
+ concealedPackagesToOpen.computeIfAbsent(name,
+ k -> new HashSet<>()).add(pn);
+ }
+ }
+ });
+
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+
+ return new IllegalAccessMaps(concealedPackagesToOpen, exportedPackagesToOpen);
+ }
+
+ private static boolean isExported(ModuleDescriptor descriptor, String pn) {
+ return descriptor.exports()
+ .stream()
+ .anyMatch(e -> e.source().equals(pn) && !e.isQualified());
+ }
+
+ private static boolean isOpen(ModuleDescriptor descriptor, String pn) {
+ return descriptor.opens()
+ .stream()
+ .anyMatch(e -> e.source().equals(pn) && !e.isQualified());
+ }
+}
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java Thu Aug 24 16:24:44 2017 +0200
@@ -39,14 +39,17 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import jdk.internal.loader.BootLoader;
import jdk.internal.loader.BuiltinClassLoader;
+import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.perf.PerfCounter;
@@ -59,7 +62,7 @@
* -m and --add-modules options. The modules are located on a module path that
* is constructed from the upgrade module path, system modules, and application
* module path. The Configuration is instantiated as the boot layer with each
- * module in the the configuration defined to one of the built-in class loaders.
+ * module in the the configuration defined to a class loader.
*/
public final class ModuleBootstrap {
@@ -119,20 +122,20 @@
*/
public static ModuleLayer boot() {
- long t0 = System.nanoTime();
+ // Step 1: Locate system modules (may be patched)
- // system modules (may be patched)
+ long t1 = System.nanoTime();
ModuleFinder systemModules = ModuleFinder.ofSystem();
-
- PerfCounters.systemModulesTime.addElapsedTimeFrom(t0);
+ PerfCounters.systemModulesTime.addElapsedTimeFrom(t1);
- long t1 = System.nanoTime();
+ // Step 2: Define and load java.base. This patches all classes loaded
+ // to date so that they are members of java.base. Once java.base is
+ // loaded then resources in java.base are available for error messages
+ // needed from here on.
- // Once we have the system modules then we define the base module to
- // the VM. We do this here so that java.base is defined as early as
- // possible and also that resources in the base module can be located
- // for error messages that may happen from here on.
+ long t2 = System.nanoTime();
+
ModuleReference base = systemModules.find(JAVA_BASE).orElse(null);
if (base == null)
throw new InternalError(JAVA_BASE + " not found");
@@ -142,15 +145,23 @@
BootLoader.loadModule(base);
Modules.defineModule(null, base.descriptor(), baseUri);
- PerfCounters.defineBaseTime.addElapsedTimeFrom(t1);
+ PerfCounters.defineBaseTime.addElapsedTimeFrom(t2);
+
- // special mode to boot with only java.base, ignores other options
+ // Step 2a: If --validate-modules is specified then the VM needs to
+ // start with only java.base, all other options are ignored.
+
String propValue = getAndRemoveProperty("jdk.module.minimumBoot");
if (propValue != null) {
return createMinimalBootLayer();
}
- long t2 = System.nanoTime();
+
+ // Step 3: Construct the module path and the set of root modules to
+ // resolve. If --limit-modules is specified then it limits the set
+ // modules that are observable.
+
+ long t3 = System.nanoTime();
// --upgrade-module-path option specified to launcher
ModuleFinder upgradeModulePath
@@ -269,10 +280,13 @@
.forEach(mn -> roots.add(mn));
}
- PerfCounters.optionsAndRootsTime.addElapsedTimeFrom(t2);
+ PerfCounters.optionsAndRootsTime.addElapsedTimeFrom(t3);
- long t3 = System.nanoTime();
+ // Step 4: Resolve the root modules, with service binding, to create
+ // the configuration for the boot layer.
+
+ long t4 = System.nanoTime();
// determine if post resolution checks are needed
boolean needPostResolutionChecks = true;
@@ -295,11 +309,17 @@
needPostResolutionChecks,
traceOutput);
- // time to create configuration
- PerfCounters.resolveTime.addElapsedTimeFrom(t3);
+ PerfCounters.resolveTime.addElapsedTimeFrom(t4);
+
- // check module names and incubating status
- checkModuleNamesAndStatus(cf);
+ // Step 5: Map the modules in the configuration to class loaders.
+ // The static configuration provides the mapping of standard and JDK
+ // modules to the boot and platform loaders. All other modules (JDK
+ // tool modules, and both explicit and automatic modules on the
+ // application module path) are defined to the application class
+ // loader.
+
+ long t5 = System.nanoTime();
// mapping of modules to class loaders
Function<String, ClassLoader> clf = ModuleLoaderMap.mappingFunction(cf);
@@ -312,11 +332,9 @@
String name = mref.descriptor().name();
ClassLoader cl = clf.apply(name);
if (cl == null) {
-
if (upgradeModulePath != null
&& upgradeModulePath.find(name).isPresent())
fail(name + ": cannot be loaded from upgrade module path");
-
if (!systemModules.find(name).isPresent())
fail(name + ": cannot be loaded from application module path");
}
@@ -330,55 +348,38 @@
}
}
- // if needed check that there are no split packages in the set of
- // resolved modules for the boot layer
+ // check for split packages in the modules mapped to the built-in loaders
if (SystemModules.hasSplitPackages() || needPostResolutionChecks) {
- Map<String, String> packageToModule = new HashMap<>();
- for (ResolvedModule resolvedModule : cf.modules()) {
- ModuleDescriptor descriptor = resolvedModule.reference().descriptor();
- String name = descriptor.name();
- for (String p : descriptor.packages()) {
- String other = packageToModule.putIfAbsent(p, name);
- if (other != null) {
- String msg = "Package " + p + " in both module "
- + name + " and module " + other;
- throw new LayerInstantiationException(msg);
- }
- }
- }
+ checkSplitPackages(cf, clf);
}
- long t4 = System.nanoTime();
-
- // define modules to VM/runtime
- ModuleLayer bootLayer = ModuleLayer.empty().defineModules(cf, clf);
-
- PerfCounters.layerCreateTime.addElapsedTimeFrom(t4);
-
-
- long t5 = System.nanoTime();
-
- // define the module to its class loader, except java.base
- for (ResolvedModule resolvedModule : cf.modules()) {
- ModuleReference mref = resolvedModule.reference();
- String name = mref.descriptor().name();
- ClassLoader cl = clf.apply(name);
- if (cl == null) {
- if (!name.equals(JAVA_BASE)) BootLoader.loadModule(mref);
- } else {
- ((BuiltinClassLoader)cl).loadModule(mref);
- }
- }
+ // load/register the modules with the built-in class loaders
+ loadModules(cf, clf);
PerfCounters.loadModulesTime.addElapsedTimeFrom(t5);
- // --add-reads, --add-exports/--add-opens
+ // Step 6: Define all modules to the VM
+
+ long t6 = System.nanoTime();
+ ModuleLayer bootLayer = ModuleLayer.empty().defineModules(cf, clf);
+ PerfCounters.layerCreateTime.addElapsedTimeFrom(t6);
+
+
+ // Step 7: Miscellaneous
+
+ // check incubating status
+ checkIncubatingStatus(cf);
+
+ // --add-reads, --add-exports/--add-opens, and -illegal-access
+ long t7 = System.nanoTime();
addExtraReads(bootLayer);
- addExtraExportsAndOpens(bootLayer);
+ boolean extraExportsOrOpens = addExtraExportsAndOpens(bootLayer);
+ addIllegalAccess(bootLayer, upgradeModulePath, extraExportsOrOpens);
+ PerfCounters.adjustModulesTime.addElapsedTimeFrom(t7);
// total time to initialize
- PerfCounters.bootstrapTime.addElapsedTimeFrom(t0);
+ PerfCounters.bootstrapTime.addElapsedTimeFrom(t1);
return bootLayer;
}
@@ -398,6 +399,51 @@
}
/**
+ * Load/register the modules to the built-in class loaders.
+ */
+ private static void loadModules(Configuration cf,
+ Function<String, ClassLoader> clf) {
+ for (ResolvedModule resolvedModule : cf.modules()) {
+ ModuleReference mref = resolvedModule.reference();
+ String name = resolvedModule.name();
+ ClassLoader loader = clf.apply(name);
+ if (loader == null) {
+ // skip java.base as it is already loaded
+ if (!name.equals(JAVA_BASE)) {
+ BootLoader.loadModule(mref);
+ }
+ } else if (loader instanceof BuiltinClassLoader) {
+ ((BuiltinClassLoader) loader).loadModule(mref);
+ }
+ }
+ }
+
+ /**
+ * Checks for split packages between modules defined to the built-in class
+ * loaders.
+ */
+ private static void checkSplitPackages(Configuration cf,
+ Function<String, ClassLoader> clf) {
+ Map<String, String> packageToModule = new HashMap<>();
+ for (ResolvedModule resolvedModule : cf.modules()) {
+ ModuleDescriptor descriptor = resolvedModule.reference().descriptor();
+ String name = descriptor.name();
+ ClassLoader loader = clf.apply(name);
+ if (loader == null || loader instanceof BuiltinClassLoader) {
+ for (String p : descriptor.packages()) {
+ String other = packageToModule.putIfAbsent(p, name);
+ if (other != null) {
+ String msg = "Package " + p + " in both module "
+ + name + " and module " + other;
+ throw new LayerInstantiationException(msg);
+ }
+ }
+ }
+
+ }
+ }
+
+ /**
* Returns a ModuleFinder that limits observability to the given root
* modules, their transitive dependences, plus a set of other modules.
*/
@@ -458,15 +504,14 @@
}
}
-
/**
* Initialize the module patcher for the initial configuration passed on the
* value of the --patch-module options.
*/
private static ModulePatcher initModulePatcher() {
Map<String, List<String>> map = decode("jdk.module.patch.",
- File.pathSeparator,
- false);
+ File.pathSeparator,
+ false);
return new ModulePatcher(map);
}
@@ -538,38 +583,27 @@
* Process the --add-exports and --add-opens options to export/open
* additional packages specified on the command-line.
*/
- private static void addExtraExportsAndOpens(ModuleLayer bootLayer) {
+ private static boolean addExtraExportsAndOpens(ModuleLayer bootLayer) {
+ boolean extraExportsOrOpens = false;
+
// --add-exports
String prefix = "jdk.module.addexports.";
Map<String, List<String>> extraExports = decode(prefix);
if (!extraExports.isEmpty()) {
addExtraExportsOrOpens(bootLayer, extraExports, false);
+ extraExportsOrOpens = true;
}
+
// --add-opens
prefix = "jdk.module.addopens.";
Map<String, List<String>> extraOpens = decode(prefix);
if (!extraOpens.isEmpty()) {
addExtraExportsOrOpens(bootLayer, extraOpens, true);
+ extraExportsOrOpens = true;
}
- // --permit-illegal-access
- if (getAndRemoveProperty("jdk.module.permitIllegalAccess") != null) {
- warn("--permit-illegal-access will be removed in the next major release");
- IllegalAccessLogger.Builder builder = new IllegalAccessLogger.Builder();
- Module unnamed = BootLoader.getUnnamedModule();
- bootLayer.modules().stream().forEach(m -> {
- m.getDescriptor()
- .packages()
- .stream()
- .filter(pn -> !m.isOpen(pn, unnamed)) // skip if opened by --add-opens
- .forEach(pn -> {
- builder.logAccessToOpenPackage(m, pn, "--permit-illegal-access");
- Modules.addOpensToAllUnnamed(m, pn);
- });
- });
- IllegalAccessLogger.setIllegalAccessLogger(builder.build());
- }
+ return extraExportsOrOpens;
}
private static void addExtraExportsOrOpens(ModuleLayer bootLayer,
@@ -639,6 +673,102 @@
}
/**
+ * Process the --illegal-access option (and its default) to open packages
+ * of system modules in the boot layer to code in unnamed modules.
+ */
+ private static void addIllegalAccess(ModuleLayer bootLayer,
+ ModuleFinder upgradeModulePath,
+ boolean extraExportsOrOpens) {
+ String value = getAndRemoveProperty("jdk.module.illegalAccess");
+ IllegalAccessLogger.Mode mode = IllegalAccessLogger.Mode.ONESHOT;
+ if (value != null) {
+ switch (value) {
+ case "deny":
+ return;
+ case "permit":
+ break;
+ case "warn":
+ mode = IllegalAccessLogger.Mode.WARN;
+ break;
+ case "debug":
+ mode = IllegalAccessLogger.Mode.DEBUG;
+ break;
+ default:
+ fail("Value specified to --illegal-access not recognized:"
+ + " '" + value + "'");
+ return;
+ }
+ }
+ IllegalAccessLogger.Builder builder
+ = new IllegalAccessLogger.Builder(mode, System.err);
+
+ Map<String, Set<String>> map1 = SystemModules.concealedPackagesToOpen();
+ Map<String, Set<String>> map2 = SystemModules.exportedPackagesToOpen();
+ if (map1.isEmpty() && map2.isEmpty()) {
+ // need to generate maps when on exploded build
+ IllegalAccessMaps maps = IllegalAccessMaps.generate(limitedFinder());
+ map1 = maps.concealedPackagesToOpen();
+ map2 = maps.exportedPackagesToOpen();
+ }
+
+ // open specific packages in the system modules
+ for (Module m : bootLayer.modules()) {
+ ModuleDescriptor descriptor = m.getDescriptor();
+ String name = m.getName();
+
+ // skip open modules
+ if (descriptor.isOpen()) {
+ continue;
+ }
+
+ // skip modules loaded from the upgrade module path
+ if (upgradeModulePath != null
+ && upgradeModulePath.find(name).isPresent()) {
+ continue;
+ }
+
+ Set<String> concealedPackages = map1.getOrDefault(name, Set.of());
+ Set<String> exportedPackages = map2.getOrDefault(name, Set.of());
+
+ // refresh the set of concealed and exported packages if needed
+ if (extraExportsOrOpens) {
+ concealedPackages = new HashSet<>(concealedPackages);
+ exportedPackages = new HashSet<>(exportedPackages);
+ Iterator<String> iterator = concealedPackages.iterator();
+ while (iterator.hasNext()) {
+ String pn = iterator.next();
+ if (m.isExported(pn, BootLoader.getUnnamedModule())) {
+ // concealed package is exported to ALL-UNNAMED
+ iterator.remove();
+ exportedPackages.add(pn);
+ }
+ }
+ iterator = exportedPackages.iterator();
+ while (iterator.hasNext()) {
+ String pn = iterator.next();
+ if (m.isOpen(pn, BootLoader.getUnnamedModule())) {
+ // exported package is opened to ALL-UNNAMED
+ iterator.remove();
+ }
+ }
+ }
+
+ // log reflective access to all types in concealed packages
+ builder.logAccessToConcealedPackages(m, concealedPackages);
+
+ // log reflective access to non-public members/types in exported packages
+ builder.logAccessToExportedPackages(m, exportedPackages);
+
+ // open the packages to unnamed modules
+ JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
+ jla.addOpensToAllUnnamed(m, concat(concealedPackages.iterator(),
+ exportedPackages.iterator()));
+ }
+
+ builder.complete();
+ }
+
+ /**
* Decodes the values of --add-reads, -add-exports, --add-opens or
* --patch-modules options that are encoded in system properties.
*
@@ -708,17 +838,16 @@
}
/**
- * Checks the names and resolution bit of each module in the configuration,
- * emitting warnings if needed.
+ * Checks incubating status of modules in the configuration
*/
- private static void checkModuleNamesAndStatus(Configuration cf) {
+ private static void checkIncubatingStatus(Configuration cf) {
String incubating = null;
- for (ResolvedModule rm : cf.modules()) {
- ModuleReference mref = rm.reference();
- String mn = mref.descriptor().name();
+ for (ResolvedModule resolvedModule : cf.modules()) {
+ ModuleReference mref = resolvedModule.reference();
// emit warning if the WARN_INCUBATING module resolution bit set
if (ModuleResolution.hasIncubatingWarning(mref)) {
+ String mn = mref.descriptor().name();
if (incubating == null) {
incubating = mn;
} else {
@@ -777,6 +906,21 @@
}
}
+ static <T> Iterator<T> concat(Iterator<T> iterator1, Iterator<T> iterator2) {
+ return new Iterator<T>() {
+ @Override
+ public boolean hasNext() {
+ return iterator1.hasNext() || iterator2.hasNext();
+ }
+ @Override
+ public T next() {
+ if (iterator1.hasNext()) return iterator1.next();
+ if (iterator2.hasNext()) return iterator2.next();
+ throw new NoSuchElementException();
+ }
+ };
+ }
+
static class PerfCounters {
static PerfCounter systemModulesTime
@@ -791,6 +935,8 @@
= PerfCounter.newPerfCounter("jdk.module.bootstrap.layerCreateTime");
static PerfCounter loadModulesTime
= PerfCounter.newPerfCounter("jdk.module.bootstrap.loadModulesTime");
+ static PerfCounter adjustModulesTime
+ = PerfCounter.newPerfCounter("jdk.module.bootstrap.adjustModulesTime");
static PerfCounter bootstrapTime
= PerfCounter.newPerfCounter("jdk.module.bootstrap.totalTime");
}
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java Thu Aug 24 16:24:44 2017 +0200
@@ -35,6 +35,7 @@
import java.lang.module.FindException;
import java.lang.module.InvalidModuleDescriptorException;
import java.lang.module.ModuleDescriptor;
+import java.lang.module.ModuleDescriptor.Builder;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.net.URI;
@@ -404,6 +405,9 @@
private static final String SERVICES_PREFIX = "META-INF/services/";
+ private static final Attributes.Name AUTOMATIC_MODULE_NAME
+ = new Attributes.Name("Automatic-Module-Name");
+
/**
* Returns the service type corresponding to the name of a services
* configuration file if it is a legal type name.
@@ -445,48 +449,68 @@
/**
* Treat the given JAR file as a module as follows:
*
- * 1. The module name (and optionally the version) is derived from the file
- * name of the JAR file
- * 2. All packages are derived from the .class files in the JAR file
- * 3. The contents of any META-INF/services configuration files are mapped
+ * 1. The value of the Automatic-Module-Name attribute is the module name
+ * 2. The version, and the module name when the Automatic-Module-Name
+ * attribute is not present, is derived from the file ame of the JAR file
+ * 3. All packages are derived from the .class files in the JAR file
+ * 4. The contents of any META-INF/services configuration files are mapped
* to "provides" declarations
- * 4. The Main-Class attribute in the main attributes of the JAR manifest
+ * 5. The Main-Class attribute in the main attributes of the JAR manifest
* is mapped to the module descriptor mainClass if possible
*/
private ModuleDescriptor deriveModuleDescriptor(JarFile jf)
throws IOException
{
- // Derive module name and version from JAR file name
+ // Read Automatic-Module-Name attribute if present
+ Manifest man = jf.getManifest();
+ Attributes attrs = null;
+ String moduleName = null;
+ if (man != null) {
+ attrs = man.getMainAttributes();
+ if (attrs != null) {
+ moduleName = attrs.getValue(AUTOMATIC_MODULE_NAME);
+ }
+ }
+ // Derive the version, and the module name if needed, from JAR file name
String fn = jf.getName();
int i = fn.lastIndexOf(File.separator);
if (i != -1)
- fn = fn.substring(i+1);
+ fn = fn.substring(i + 1);
- // drop .jar
- String mn = fn.substring(0, fn.length()-4);
+ // drop ".jar"
+ String name = fn.substring(0, fn.length() - 4);
String vs = null;
// find first occurrence of -${NUMBER}. or -${NUMBER}$
- Matcher matcher = Patterns.DASH_VERSION.matcher(mn);
+ Matcher matcher = Patterns.DASH_VERSION.matcher(name);
if (matcher.find()) {
int start = matcher.start();
// attempt to parse the tail as a version string
try {
- String tail = mn.substring(start+1);
+ String tail = name.substring(start + 1);
ModuleDescriptor.Version.parse(tail);
vs = tail;
} catch (IllegalArgumentException ignore) { }
- mn = mn.substring(0, start);
+ name = name.substring(0, start);
}
- // finally clean up the module name
- mn = cleanModuleName(mn);
+ // Create builder, using the name derived from file name when
+ // Automatic-Module-Name not present
+ Builder builder;
+ if (moduleName != null) {
+ try {
+ builder = ModuleDescriptor.newAutomaticModule(moduleName);
+ } catch (IllegalArgumentException e) {
+ throw new FindException(AUTOMATIC_MODULE_NAME + ": " + e.getMessage());
+ }
+ } else {
+ builder = ModuleDescriptor.newAutomaticModule(cleanModuleName(name));
+ }
- // Builder throws IAE if module name is empty or invalid
- ModuleDescriptor.Builder builder = ModuleDescriptor.newAutomaticModule(mn);
+ // module version if present
if (vs != null)
builder.version(vs);
@@ -541,9 +565,7 @@
}
// Main-Class attribute if it exists
- Manifest man = jf.getManifest();
- if (man != null) {
- Attributes attrs = man.getMainAttributes();
+ if (attrs != null) {
String mainClass = attrs.getValue(Attributes.Name.MAIN_CLASS);
if (mainClass != null) {
mainClass = mainClass.replace("/", ".");
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -41,6 +41,10 @@
public class ModuleReferenceImpl extends ModuleReference {
+ // location of module
+ private final URI location;
+
+ // the module reader
private final Supplier<ModuleReader> readerSupplier;
// non-null if the module is patched
@@ -74,6 +78,7 @@
ModuleResolution moduleResolution)
{
super(descriptor, Objects.requireNonNull(location));
+ this.location = location;
this.readerSupplier = readerSupplier;
this.patcher = patcher;
this.target = target;
@@ -148,7 +153,7 @@
int hc = hash;
if (hc == 0) {
hc = descriptor().hashCode();
- hc = 43 * hc + Objects.hashCode(location());
+ hc = 43 * hc + Objects.hashCode(location);
hc = 43 * hc + Objects.hashCode(patcher);
if (hc == 0)
hc = -1;
@@ -169,7 +174,7 @@
// when the modules have equal module descriptors, are at the
// same location, and are patched by the same patcher.
return Objects.equals(this.descriptor(), that.descriptor())
- && Objects.equals(this.location(), that.location())
+ && Objects.equals(this.location, that.location)
&& Objects.equals(this.patcher, that.patcher);
}
@@ -179,7 +184,7 @@
sb.append("[module ");
sb.append(descriptor().name());
sb.append(", location=");
- sb.append(location().orElseThrow(() -> new InternalError()));
+ sb.append(location);
if (isPatched()) sb.append(" (patched)");
sb.append("]");
return sb.toString();
--- a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java Thu Aug 24 16:24:44 2017 +0200
@@ -136,10 +136,12 @@
public static void addProvides(Module m, Class<?> service, Class<?> impl) {
ModuleLayer layer = m.getLayer();
- if (layer == null || layer == ModuleLayer.boot()) {
+ PrivilegedAction<ClassLoader> pa = m::getClassLoader;
+ ClassLoader loader = AccessController.doPrivileged(pa);
+
+ ClassLoader platformClassLoader = ClassLoaders.platformClassLoader();
+ if (layer == null || loader == null || loader == platformClassLoader) {
// update ClassLoader catalog
- PrivilegedAction<ClassLoader> pa = m::getClassLoader;
- ClassLoader loader = AccessController.doPrivileged(pa);
ServicesCatalog catalog;
if (loader == null) {
catalog = BootLoader.getServicesCatalog();
--- a/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,9 @@
package jdk.internal.module;
import java.lang.module.ModuleDescriptor;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
/**
* SystemModules class will be generated at link time to create
@@ -57,8 +60,7 @@
public static int PACKAGES_IN_BOOT_LAYER = 1024;
/**
- * @return {@code false} if there are no split packages in the run-time
- * image, {@code true} if there are or if it's not been checked.
+ * Return true if there are no split packages in the run-time image.
*/
public static boolean hasSplitPackages() {
return true;
@@ -98,4 +100,20 @@
public static ModuleResolution[] moduleResolutions() {
throw new InternalError("expected to be overridden at link time");
}
+
+ /**
+ * Returns the map of module concealed packages to open. The map key is the
+ * module name, the value is the set of concealed packages to open.
+ */
+ public static Map<String, Set<String>> concealedPackagesToOpen() {
+ return Collections.emptyMap();
+ }
+
+ /**
+ * Returns the map of module exported packages to open. The map key is the
+ * module name, the value is the set of exported packages to open.
+ */
+ public static Map<String, Set<String>> exportedPackagesToOpen() {
+ return Collections.emptyMap();
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/jdk8_packages.dat Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,1340 @@
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+apple.applescript
+apple.laf
+apple.launcher
+apple.security
+com.apple.concurrent
+com.apple.eawt
+com.apple.eawt.event
+com.apple.eio
+com.apple.laf
+com.apple.laf.resources
+com.oracle.jrockit.jfr
+com.oracle.jrockit.jfr.client
+com.oracle.jrockit.jfr.management
+com.oracle.security.ucrypto
+com.oracle.util
+com.oracle.webservices.internal.api
+com.oracle.webservices.internal.api.databinding
+com.oracle.webservices.internal.api.message
+com.oracle.webservices.internal.impl.encoding
+com.oracle.webservices.internal.impl.internalspi.encoding
+com.oracle.xmlns.internal.webservices.jaxws_databinding
+com.sun.accessibility.internal.resources
+com.sun.activation.registries
+com.sun.awt
+com.sun.beans
+com.sun.beans.decoder
+com.sun.beans.editors
+com.sun.beans.finder
+com.sun.beans.infos
+com.sun.beans.util
+com.sun.codemodel.internal
+com.sun.codemodel.internal.fmt
+com.sun.codemodel.internal.util
+com.sun.codemodel.internal.writer
+com.sun.corba.se.impl.activation
+com.sun.corba.se.impl.copyobject
+com.sun.corba.se.impl.corba
+com.sun.corba.se.impl.dynamicany
+com.sun.corba.se.impl.encoding
+com.sun.corba.se.impl.interceptors
+com.sun.corba.se.impl.io
+com.sun.corba.se.impl.ior
+com.sun.corba.se.impl.ior.iiop
+com.sun.corba.se.impl.javax.rmi
+com.sun.corba.se.impl.javax.rmi.CORBA
+com.sun.corba.se.impl.legacy.connection
+com.sun.corba.se.impl.logging
+com.sun.corba.se.impl.monitoring
+com.sun.corba.se.impl.naming.cosnaming
+com.sun.corba.se.impl.naming.namingutil
+com.sun.corba.se.impl.naming.pcosnaming
+com.sun.corba.se.impl.oa
+com.sun.corba.se.impl.oa.poa
+com.sun.corba.se.impl.oa.toa
+com.sun.corba.se.impl.orb
+com.sun.corba.se.impl.orbutil
+com.sun.corba.se.impl.orbutil.closure
+com.sun.corba.se.impl.orbutil.concurrent
+com.sun.corba.se.impl.orbutil.fsm
+com.sun.corba.se.impl.orbutil.graph
+com.sun.corba.se.impl.orbutil.threadpool
+com.sun.corba.se.impl.presentation.rmi
+com.sun.corba.se.impl.protocol
+com.sun.corba.se.impl.protocol.giopmsgheaders
+com.sun.corba.se.impl.resolver
+com.sun.corba.se.impl.transport
+com.sun.corba.se.impl.util
+com.sun.corba.se.internal.CosNaming
+com.sun.corba.se.internal.Interceptors
+com.sun.corba.se.internal.POA
+com.sun.corba.se.internal.corba
+com.sun.corba.se.internal.iiop
+com.sun.corba.se.org.omg.CORBA
+com.sun.corba.se.pept.broker
+com.sun.corba.se.pept.encoding
+com.sun.corba.se.pept.protocol
+com.sun.corba.se.pept.transport
+com.sun.corba.se.spi.activation
+com.sun.corba.se.spi.activation.InitialNameServicePackage
+com.sun.corba.se.spi.activation.LocatorPackage
+com.sun.corba.se.spi.activation.RepositoryPackage
+com.sun.corba.se.spi.copyobject
+com.sun.corba.se.spi.encoding
+com.sun.corba.se.spi.extension
+com.sun.corba.se.spi.ior
+com.sun.corba.se.spi.ior.iiop
+com.sun.corba.se.spi.legacy.connection
+com.sun.corba.se.spi.legacy.interceptor
+com.sun.corba.se.spi.logging
+com.sun.corba.se.spi.monitoring
+com.sun.corba.se.spi.oa
+com.sun.corba.se.spi.orb
+com.sun.corba.se.spi.orbutil.closure
+com.sun.corba.se.spi.orbutil.fsm
+com.sun.corba.se.spi.orbutil.proxy
+com.sun.corba.se.spi.orbutil.threadpool
+com.sun.corba.se.spi.presentation.rmi
+com.sun.corba.se.spi.protocol
+com.sun.corba.se.spi.resolver
+com.sun.corba.se.spi.servicecontext
+com.sun.corba.se.spi.transport
+com.sun.crypto.provider
+com.sun.demo.jvmti.hprof
+com.sun.deploy.uitoolkit.impl.fx
+com.sun.deploy.uitoolkit.impl.fx.ui
+com.sun.deploy.uitoolkit.impl.fx.ui.resources
+com.sun.glass.events
+com.sun.glass.events.mac
+com.sun.glass.ui
+com.sun.glass.ui.delegate
+com.sun.glass.ui.gtk
+com.sun.glass.ui.mac
+com.sun.glass.ui.win
+com.sun.glass.utils
+com.sun.image.codec.jpeg
+com.sun.imageio.plugins.bmp
+com.sun.imageio.plugins.common
+com.sun.imageio.plugins.gif
+com.sun.imageio.plugins.jpeg
+com.sun.imageio.plugins.png
+com.sun.imageio.plugins.wbmp
+com.sun.imageio.spi
+com.sun.imageio.stream
+com.sun.istack.internal
+com.sun.istack.internal.localization
+com.sun.istack.internal.logging
+com.sun.istack.internal.tools
+com.sun.jarsigner
+com.sun.java.accessibility
+com.sun.java.accessibility.util
+com.sun.java.accessibility.util.java.awt
+com.sun.java.browser.dom
+com.sun.java.browser.net
+com.sun.java.swing
+com.sun.java.swing.plaf.gtk
+com.sun.java.swing.plaf.gtk.resources
+com.sun.java.swing.plaf.motif
+com.sun.java.swing.plaf.motif.resources
+com.sun.java.swing.plaf.nimbus
+com.sun.java.swing.plaf.windows
+com.sun.java.swing.plaf.windows.resources
+com.sun.java.util.jar.pack
+com.sun.java_cup.internal.runtime
+com.sun.javadoc
+com.sun.javafx
+com.sun.javafx.animation
+com.sun.javafx.applet
+com.sun.javafx.application
+com.sun.javafx.beans
+com.sun.javafx.beans.event
+com.sun.javafx.binding
+com.sun.javafx.charts
+com.sun.javafx.collections
+com.sun.javafx.css
+com.sun.javafx.css.converters
+com.sun.javafx.css.parser
+com.sun.javafx.cursor
+com.sun.javafx.effect
+com.sun.javafx.embed
+com.sun.javafx.event
+com.sun.javafx.font
+com.sun.javafx.font.coretext
+com.sun.javafx.font.directwrite
+com.sun.javafx.font.freetype
+com.sun.javafx.font.t2k
+com.sun.javafx.fxml
+com.sun.javafx.fxml.builder
+com.sun.javafx.fxml.expression
+com.sun.javafx.geom
+com.sun.javafx.geom.transform
+com.sun.javafx.geometry
+com.sun.javafx.iio
+com.sun.javafx.iio.bmp
+com.sun.javafx.iio.common
+com.sun.javafx.iio.gif
+com.sun.javafx.iio.ios
+com.sun.javafx.iio.jpeg
+com.sun.javafx.iio.png
+com.sun.javafx.image
+com.sun.javafx.image.impl
+com.sun.javafx.jmx
+com.sun.javafx.logging
+com.sun.javafx.media
+com.sun.javafx.menu
+com.sun.javafx.perf
+com.sun.javafx.print
+com.sun.javafx.property
+com.sun.javafx.property.adapter
+com.sun.javafx.robot
+com.sun.javafx.robot.impl
+com.sun.javafx.runtime
+com.sun.javafx.runtime.async
+com.sun.javafx.runtime.eula
+com.sun.javafx.scene
+com.sun.javafx.scene.control
+com.sun.javafx.scene.control.behavior
+com.sun.javafx.scene.control.skin
+com.sun.javafx.scene.control.skin.resources
+com.sun.javafx.scene.input
+com.sun.javafx.scene.layout.region
+com.sun.javafx.scene.paint
+com.sun.javafx.scene.shape
+com.sun.javafx.scene.text
+com.sun.javafx.scene.transform
+com.sun.javafx.scene.traversal
+com.sun.javafx.scene.web
+com.sun.javafx.scene.web.behavior
+com.sun.javafx.scene.web.skin
+com.sun.javafx.sg.prism
+com.sun.javafx.sg.prism.web
+com.sun.javafx.stage
+com.sun.javafx.text
+com.sun.javafx.tk
+com.sun.javafx.tk.quantum
+com.sun.javafx.util
+com.sun.javafx.webkit
+com.sun.javafx.webkit.drt
+com.sun.javafx.webkit.prism
+com.sun.javafx.webkit.prism.theme
+com.sun.javafx.webkit.theme
+com.sun.jdi
+com.sun.jdi.connect
+com.sun.jdi.connect.spi
+com.sun.jdi.event
+com.sun.jdi.request
+com.sun.jmx.defaults
+com.sun.jmx.interceptor
+com.sun.jmx.mbeanserver
+com.sun.jmx.remote.internal
+com.sun.jmx.remote.protocol.iiop
+com.sun.jmx.remote.protocol.rmi
+com.sun.jmx.remote.security
+com.sun.jmx.remote.util
+com.sun.jmx.snmp
+com.sun.jmx.snmp.IPAcl
+com.sun.jmx.snmp.agent
+com.sun.jmx.snmp.daemon
+com.sun.jmx.snmp.defaults
+com.sun.jmx.snmp.internal
+com.sun.jmx.snmp.mpm
+com.sun.jmx.snmp.tasks
+com.sun.jndi.cosnaming
+com.sun.jndi.dns
+com.sun.jndi.ldap
+com.sun.jndi.ldap.ext
+com.sun.jndi.ldap.pool
+com.sun.jndi.ldap.sasl
+com.sun.jndi.rmi.registry
+com.sun.jndi.toolkit.corba
+com.sun.jndi.toolkit.ctx
+com.sun.jndi.toolkit.dir
+com.sun.jndi.toolkit.url
+com.sun.jndi.url.corbaname
+com.sun.jndi.url.dns
+com.sun.jndi.url.iiop
+com.sun.jndi.url.iiopname
+com.sun.jndi.url.ldap
+com.sun.jndi.url.ldaps
+com.sun.jndi.url.rmi
+com.sun.management
+com.sun.management.jmx
+com.sun.media.jfxmedia
+com.sun.media.jfxmedia.control
+com.sun.media.jfxmedia.effects
+com.sun.media.jfxmedia.events
+com.sun.media.jfxmedia.locator
+com.sun.media.jfxmedia.logging
+com.sun.media.jfxmedia.track
+com.sun.media.jfxmediaimpl
+com.sun.media.jfxmediaimpl.platform
+com.sun.media.jfxmediaimpl.platform.gstreamer
+com.sun.media.jfxmediaimpl.platform.ios
+com.sun.media.jfxmediaimpl.platform.java
+com.sun.media.jfxmediaimpl.platform.osx
+com.sun.media.sound
+com.sun.naming.internal
+com.sun.net.httpserver
+com.sun.net.httpserver.spi
+com.sun.net.ssl
+com.sun.net.ssl.internal.ssl
+com.sun.net.ssl.internal.www.protocol.https
+com.sun.nio.file
+com.sun.nio.sctp
+com.sun.nio.zipfs
+com.sun.openpisces
+com.sun.org.apache.bcel.internal
+com.sun.org.apache.bcel.internal.classfile
+com.sun.org.apache.bcel.internal.generic
+com.sun.org.apache.bcel.internal.util
+com.sun.org.apache.regexp.internal
+com.sun.org.apache.xalan.internal
+com.sun.org.apache.xalan.internal.extensions
+com.sun.org.apache.xalan.internal.lib
+com.sun.org.apache.xalan.internal.res
+com.sun.org.apache.xalan.internal.templates
+com.sun.org.apache.xalan.internal.utils
+com.sun.org.apache.xalan.internal.xslt
+com.sun.org.apache.xalan.internal.xsltc
+com.sun.org.apache.xalan.internal.xsltc.cmdline
+com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt
+com.sun.org.apache.xalan.internal.xsltc.compiler
+com.sun.org.apache.xalan.internal.xsltc.compiler.util
+com.sun.org.apache.xalan.internal.xsltc.dom
+com.sun.org.apache.xalan.internal.xsltc.runtime
+com.sun.org.apache.xalan.internal.xsltc.runtime.output
+com.sun.org.apache.xalan.internal.xsltc.trax
+com.sun.org.apache.xalan.internal.xsltc.util
+com.sun.org.apache.xerces.internal.dom
+com.sun.org.apache.xerces.internal.dom.events
+com.sun.org.apache.xerces.internal.impl
+com.sun.org.apache.xerces.internal.impl.dtd
+com.sun.org.apache.xerces.internal.impl.dtd.models
+com.sun.org.apache.xerces.internal.impl.dv
+com.sun.org.apache.xerces.internal.impl.dv.dtd
+com.sun.org.apache.xerces.internal.impl.dv.util
+com.sun.org.apache.xerces.internal.impl.dv.xs
+com.sun.org.apache.xerces.internal.impl.io
+com.sun.org.apache.xerces.internal.impl.msg
+com.sun.org.apache.xerces.internal.impl.validation
+com.sun.org.apache.xerces.internal.impl.xpath
+com.sun.org.apache.xerces.internal.impl.xpath.regex
+com.sun.org.apache.xerces.internal.impl.xs
+com.sun.org.apache.xerces.internal.impl.xs.identity
+com.sun.org.apache.xerces.internal.impl.xs.models
+com.sun.org.apache.xerces.internal.impl.xs.opti
+com.sun.org.apache.xerces.internal.impl.xs.traversers
+com.sun.org.apache.xerces.internal.impl.xs.util
+com.sun.org.apache.xerces.internal.jaxp
+com.sun.org.apache.xerces.internal.jaxp.datatype
+com.sun.org.apache.xerces.internal.jaxp.validation
+com.sun.org.apache.xerces.internal.parsers
+com.sun.org.apache.xerces.internal.util
+com.sun.org.apache.xerces.internal.utils
+com.sun.org.apache.xerces.internal.xinclude
+com.sun.org.apache.xerces.internal.xni
+com.sun.org.apache.xerces.internal.xni.grammars
+com.sun.org.apache.xerces.internal.xni.parser
+com.sun.org.apache.xerces.internal.xpointer
+com.sun.org.apache.xerces.internal.xs
+com.sun.org.apache.xerces.internal.xs.datatypes
+com.sun.org.apache.xml.internal.dtm
+com.sun.org.apache.xml.internal.dtm.ref
+com.sun.org.apache.xml.internal.dtm.ref.dom2dtm
+com.sun.org.apache.xml.internal.dtm.ref.sax2dtm
+com.sun.org.apache.xml.internal.res
+com.sun.org.apache.xml.internal.resolver
+com.sun.org.apache.xml.internal.resolver.helpers
+com.sun.org.apache.xml.internal.resolver.readers
+com.sun.org.apache.xml.internal.resolver.tools
+com.sun.org.apache.xml.internal.security
+com.sun.org.apache.xml.internal.security.algorithms
+com.sun.org.apache.xml.internal.security.algorithms.implementations
+com.sun.org.apache.xml.internal.security.c14n
+com.sun.org.apache.xml.internal.security.c14n.helper
+com.sun.org.apache.xml.internal.security.c14n.implementations
+com.sun.org.apache.xml.internal.security.encryption
+com.sun.org.apache.xml.internal.security.exceptions
+com.sun.org.apache.xml.internal.security.keys
+com.sun.org.apache.xml.internal.security.keys.content
+com.sun.org.apache.xml.internal.security.keys.content.keyvalues
+com.sun.org.apache.xml.internal.security.keys.content.x509
+com.sun.org.apache.xml.internal.security.keys.keyresolver
+com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations
+com.sun.org.apache.xml.internal.security.keys.storage
+com.sun.org.apache.xml.internal.security.keys.storage.implementations
+com.sun.org.apache.xml.internal.security.signature
+com.sun.org.apache.xml.internal.security.signature.reference
+com.sun.org.apache.xml.internal.security.transforms
+com.sun.org.apache.xml.internal.security.transforms.implementations
+com.sun.org.apache.xml.internal.security.transforms.params
+com.sun.org.apache.xml.internal.security.utils
+com.sun.org.apache.xml.internal.security.utils.resolver
+com.sun.org.apache.xml.internal.security.utils.resolver.implementations
+com.sun.org.apache.xml.internal.serialize
+com.sun.org.apache.xml.internal.serializer
+com.sun.org.apache.xml.internal.serializer.utils
+com.sun.org.apache.xml.internal.utils
+com.sun.org.apache.xml.internal.utils.res
+com.sun.org.apache.xpath.internal
+com.sun.org.apache.xpath.internal.axes
+com.sun.org.apache.xpath.internal.compiler
+com.sun.org.apache.xpath.internal.domapi
+com.sun.org.apache.xpath.internal.functions
+com.sun.org.apache.xpath.internal.jaxp
+com.sun.org.apache.xpath.internal.objects
+com.sun.org.apache.xpath.internal.operations
+com.sun.org.apache.xpath.internal.patterns
+com.sun.org.apache.xpath.internal.res
+com.sun.org.glassfish.external.amx
+com.sun.org.glassfish.external.arc
+com.sun.org.glassfish.external.probe.provider
+com.sun.org.glassfish.external.probe.provider.annotations
+com.sun.org.glassfish.external.statistics
+com.sun.org.glassfish.external.statistics.annotations
+com.sun.org.glassfish.external.statistics.impl
+com.sun.org.glassfish.gmbal
+com.sun.org.glassfish.gmbal.util
+com.sun.org.omg.CORBA
+com.sun.org.omg.CORBA.ValueDefPackage
+com.sun.org.omg.CORBA.portable
+com.sun.org.omg.SendingContext
+com.sun.org.omg.SendingContext.CodeBasePackage
+com.sun.pisces
+com.sun.prism
+com.sun.prism.d3d
+com.sun.prism.es2
+com.sun.prism.image
+com.sun.prism.impl
+com.sun.prism.impl.packrect
+com.sun.prism.impl.paint
+com.sun.prism.impl.ps
+com.sun.prism.impl.shape
+com.sun.prism.j2d
+com.sun.prism.j2d.paint
+com.sun.prism.j2d.print
+com.sun.prism.paint
+com.sun.prism.ps
+com.sun.prism.shader
+com.sun.prism.shape
+com.sun.prism.sw
+com.sun.rmi.rmid
+com.sun.rowset
+com.sun.rowset.internal
+com.sun.rowset.providers
+com.sun.scenario
+com.sun.scenario.animation
+com.sun.scenario.animation.shared
+com.sun.scenario.effect
+com.sun.scenario.effect.impl
+com.sun.scenario.effect.impl.es2
+com.sun.scenario.effect.impl.hw
+com.sun.scenario.effect.impl.hw.d3d
+com.sun.scenario.effect.impl.prism
+com.sun.scenario.effect.impl.prism.ps
+com.sun.scenario.effect.impl.prism.sw
+com.sun.scenario.effect.impl.state
+com.sun.scenario.effect.impl.sw
+com.sun.scenario.effect.impl.sw.java
+com.sun.scenario.effect.impl.sw.sse
+com.sun.scenario.effect.light
+com.sun.security.auth
+com.sun.security.auth.callback
+com.sun.security.auth.login
+com.sun.security.auth.module
+com.sun.security.cert.internal.x509
+com.sun.security.jgss
+com.sun.security.ntlm
+com.sun.security.sasl
+com.sun.security.sasl.digest
+com.sun.security.sasl.gsskerb
+com.sun.security.sasl.ntlm
+com.sun.security.sasl.util
+com.sun.source.doctree
+com.sun.source.tree
+com.sun.source.util
+com.sun.swing.internal.plaf.basic.resources
+com.sun.swing.internal.plaf.metal.resources
+com.sun.swing.internal.plaf.synth.resources
+com.sun.tools.attach
+com.sun.tools.attach.spi
+com.sun.tools.classfile
+com.sun.tools.corba.se.idl
+com.sun.tools.corba.se.idl.constExpr
+com.sun.tools.corba.se.idl.som.cff
+com.sun.tools.corba.se.idl.som.idlemit
+com.sun.tools.corba.se.idl.toJavaPortable
+com.sun.tools.doclets
+com.sun.tools.doclets.formats.html
+com.sun.tools.doclets.formats.html.markup
+com.sun.tools.doclets.formats.html.resources
+com.sun.tools.doclets.internal.toolkit
+com.sun.tools.doclets.internal.toolkit.builders
+com.sun.tools.doclets.internal.toolkit.resources
+com.sun.tools.doclets.internal.toolkit.taglets
+com.sun.tools.doclets.internal.toolkit.util
+com.sun.tools.doclets.internal.toolkit.util.links
+com.sun.tools.doclets.standard
+com.sun.tools.doclint
+com.sun.tools.doclint.resources
+com.sun.tools.example.debug.expr
+com.sun.tools.example.debug.tty
+com.sun.tools.extcheck
+com.sun.tools.hat
+com.sun.tools.hat.internal.model
+com.sun.tools.hat.internal.oql
+com.sun.tools.hat.internal.parser
+com.sun.tools.hat.internal.server
+com.sun.tools.hat.internal.util
+com.sun.tools.internal.jxc
+com.sun.tools.internal.jxc.ap
+com.sun.tools.internal.jxc.api
+com.sun.tools.internal.jxc.api.impl.j2s
+com.sun.tools.internal.jxc.gen.config
+com.sun.tools.internal.jxc.model.nav
+com.sun.tools.internal.ws
+com.sun.tools.internal.ws.api
+com.sun.tools.internal.ws.api.wsdl
+com.sun.tools.internal.ws.processor
+com.sun.tools.internal.ws.processor.generator
+com.sun.tools.internal.ws.processor.model
+com.sun.tools.internal.ws.processor.model.exporter
+com.sun.tools.internal.ws.processor.model.java
+com.sun.tools.internal.ws.processor.model.jaxb
+com.sun.tools.internal.ws.processor.modeler
+com.sun.tools.internal.ws.processor.modeler.annotation
+com.sun.tools.internal.ws.processor.modeler.wsdl
+com.sun.tools.internal.ws.processor.util
+com.sun.tools.internal.ws.resources
+com.sun.tools.internal.ws.spi
+com.sun.tools.internal.ws.util
+com.sun.tools.internal.ws.util.xml
+com.sun.tools.internal.ws.wscompile
+com.sun.tools.internal.ws.wscompile.plugin.at_generated
+com.sun.tools.internal.ws.wsdl.document
+com.sun.tools.internal.ws.wsdl.document.http
+com.sun.tools.internal.ws.wsdl.document.jaxws
+com.sun.tools.internal.ws.wsdl.document.mime
+com.sun.tools.internal.ws.wsdl.document.schema
+com.sun.tools.internal.ws.wsdl.document.soap
+com.sun.tools.internal.ws.wsdl.framework
+com.sun.tools.internal.ws.wsdl.parser
+com.sun.tools.internal.xjc
+com.sun.tools.internal.xjc.addon.accessors
+com.sun.tools.internal.xjc.addon.at_generated
+com.sun.tools.internal.xjc.addon.code_injector
+com.sun.tools.internal.xjc.addon.episode
+com.sun.tools.internal.xjc.addon.locator
+com.sun.tools.internal.xjc.addon.sync
+com.sun.tools.internal.xjc.api
+com.sun.tools.internal.xjc.api.impl.s2j
+com.sun.tools.internal.xjc.api.util
+com.sun.tools.internal.xjc.generator.annotation.spec
+com.sun.tools.internal.xjc.generator.bean
+com.sun.tools.internal.xjc.generator.bean.field
+com.sun.tools.internal.xjc.generator.util
+com.sun.tools.internal.xjc.model
+com.sun.tools.internal.xjc.model.nav
+com.sun.tools.internal.xjc.outline
+com.sun.tools.internal.xjc.reader
+com.sun.tools.internal.xjc.reader.dtd
+com.sun.tools.internal.xjc.reader.dtd.bindinfo
+com.sun.tools.internal.xjc.reader.gbind
+com.sun.tools.internal.xjc.reader.internalizer
+com.sun.tools.internal.xjc.reader.relaxng
+com.sun.tools.internal.xjc.reader.xmlschema
+com.sun.tools.internal.xjc.reader.xmlschema.bindinfo
+com.sun.tools.internal.xjc.reader.xmlschema.ct
+com.sun.tools.internal.xjc.reader.xmlschema.parser
+com.sun.tools.internal.xjc.runtime
+com.sun.tools.internal.xjc.util
+com.sun.tools.internal.xjc.writer
+com.sun.tools.javac
+com.sun.tools.javac.api
+com.sun.tools.javac.code
+com.sun.tools.javac.comp
+com.sun.tools.javac.file
+com.sun.tools.javac.jvm
+com.sun.tools.javac.main
+com.sun.tools.javac.model
+com.sun.tools.javac.nio
+com.sun.tools.javac.parser
+com.sun.tools.javac.processing
+com.sun.tools.javac.resources
+com.sun.tools.javac.sym
+com.sun.tools.javac.tree
+com.sun.tools.javac.util
+com.sun.tools.javadoc
+com.sun.tools.javadoc.api
+com.sun.tools.javadoc.resources
+com.sun.tools.javah
+com.sun.tools.javah.resources
+com.sun.tools.javap
+com.sun.tools.javap.resources
+com.sun.tools.jconsole
+com.sun.tools.jdeps
+com.sun.tools.jdeps.resources
+com.sun.tools.jdi
+com.sun.tools.jdi.resources
+com.sun.tools.script.shell
+com.sun.tracing
+com.sun.tracing.dtrace
+com.sun.webkit
+com.sun.webkit.dom
+com.sun.webkit.event
+com.sun.webkit.graphics
+com.sun.webkit.network
+com.sun.webkit.network.about
+com.sun.webkit.network.data
+com.sun.webkit.perf
+com.sun.webkit.plugin
+com.sun.webkit.text
+com.sun.xml.internal.bind
+com.sun.xml.internal.bind.annotation
+com.sun.xml.internal.bind.api
+com.sun.xml.internal.bind.api.impl
+com.sun.xml.internal.bind.marshaller
+com.sun.xml.internal.bind.unmarshaller
+com.sun.xml.internal.bind.util
+com.sun.xml.internal.bind.v2
+com.sun.xml.internal.bind.v2.bytecode
+com.sun.xml.internal.bind.v2.model.annotation
+com.sun.xml.internal.bind.v2.model.core
+com.sun.xml.internal.bind.v2.model.impl
+com.sun.xml.internal.bind.v2.model.nav
+com.sun.xml.internal.bind.v2.model.runtime
+com.sun.xml.internal.bind.v2.model.util
+com.sun.xml.internal.bind.v2.runtime
+com.sun.xml.internal.bind.v2.runtime.output
+com.sun.xml.internal.bind.v2.runtime.property
+com.sun.xml.internal.bind.v2.runtime.reflect
+com.sun.xml.internal.bind.v2.runtime.reflect.opt
+com.sun.xml.internal.bind.v2.runtime.unmarshaller
+com.sun.xml.internal.bind.v2.schemagen
+com.sun.xml.internal.bind.v2.schemagen.episode
+com.sun.xml.internal.bind.v2.schemagen.xmlschema
+com.sun.xml.internal.bind.v2.util
+com.sun.xml.internal.dtdparser
+com.sun.xml.internal.fastinfoset
+com.sun.xml.internal.fastinfoset.algorithm
+com.sun.xml.internal.fastinfoset.alphabet
+com.sun.xml.internal.fastinfoset.dom
+com.sun.xml.internal.fastinfoset.org.apache.xerces.util
+com.sun.xml.internal.fastinfoset.sax
+com.sun.xml.internal.fastinfoset.stax
+com.sun.xml.internal.fastinfoset.stax.events
+com.sun.xml.internal.fastinfoset.stax.factory
+com.sun.xml.internal.fastinfoset.stax.util
+com.sun.xml.internal.fastinfoset.tools
+com.sun.xml.internal.fastinfoset.util
+com.sun.xml.internal.fastinfoset.vocab
+com.sun.xml.internal.messaging.saaj
+com.sun.xml.internal.messaging.saaj.client.p2p
+com.sun.xml.internal.messaging.saaj.packaging.mime
+com.sun.xml.internal.messaging.saaj.packaging.mime.internet
+com.sun.xml.internal.messaging.saaj.packaging.mime.util
+com.sun.xml.internal.messaging.saaj.soap
+com.sun.xml.internal.messaging.saaj.soap.dynamic
+com.sun.xml.internal.messaging.saaj.soap.impl
+com.sun.xml.internal.messaging.saaj.soap.name
+com.sun.xml.internal.messaging.saaj.soap.ver1_1
+com.sun.xml.internal.messaging.saaj.soap.ver1_2
+com.sun.xml.internal.messaging.saaj.util
+com.sun.xml.internal.messaging.saaj.util.transform
+com.sun.xml.internal.org.jvnet.fastinfoset
+com.sun.xml.internal.org.jvnet.fastinfoset.sax
+com.sun.xml.internal.org.jvnet.fastinfoset.sax.helpers
+com.sun.xml.internal.org.jvnet.fastinfoset.stax
+com.sun.xml.internal.org.jvnet.mimepull
+com.sun.xml.internal.org.jvnet.staxex
+com.sun.xml.internal.rngom.ast.builder
+com.sun.xml.internal.rngom.ast.om
+com.sun.xml.internal.rngom.ast.util
+com.sun.xml.internal.rngom.binary
+com.sun.xml.internal.rngom.binary.visitor
+com.sun.xml.internal.rngom.digested
+com.sun.xml.internal.rngom.dt
+com.sun.xml.internal.rngom.dt.builtin
+com.sun.xml.internal.rngom.nc
+com.sun.xml.internal.rngom.parse
+com.sun.xml.internal.rngom.parse.compact
+com.sun.xml.internal.rngom.parse.host
+com.sun.xml.internal.rngom.parse.xml
+com.sun.xml.internal.rngom.util
+com.sun.xml.internal.rngom.xml.sax
+com.sun.xml.internal.rngom.xml.util
+com.sun.xml.internal.stream
+com.sun.xml.internal.stream.buffer
+com.sun.xml.internal.stream.buffer.sax
+com.sun.xml.internal.stream.buffer.stax
+com.sun.xml.internal.stream.dtd
+com.sun.xml.internal.stream.dtd.nonvalidating
+com.sun.xml.internal.stream.events
+com.sun.xml.internal.stream.util
+com.sun.xml.internal.stream.writers
+com.sun.xml.internal.txw2
+com.sun.xml.internal.txw2.annotation
+com.sun.xml.internal.txw2.output
+com.sun.xml.internal.ws
+com.sun.xml.internal.ws.addressing
+com.sun.xml.internal.ws.addressing.model
+com.sun.xml.internal.ws.addressing.policy
+com.sun.xml.internal.ws.addressing.v200408
+com.sun.xml.internal.ws.api
+com.sun.xml.internal.ws.api.addressing
+com.sun.xml.internal.ws.api.client
+com.sun.xml.internal.ws.api.config.management
+com.sun.xml.internal.ws.api.config.management.policy
+com.sun.xml.internal.ws.api.databinding
+com.sun.xml.internal.ws.api.fastinfoset
+com.sun.xml.internal.ws.api.ha
+com.sun.xml.internal.ws.api.handler
+com.sun.xml.internal.ws.api.message
+com.sun.xml.internal.ws.api.message.saaj
+com.sun.xml.internal.ws.api.message.stream
+com.sun.xml.internal.ws.api.model
+com.sun.xml.internal.ws.api.model.soap
+com.sun.xml.internal.ws.api.model.wsdl
+com.sun.xml.internal.ws.api.model.wsdl.editable
+com.sun.xml.internal.ws.api.pipe
+com.sun.xml.internal.ws.api.pipe.helper
+com.sun.xml.internal.ws.api.policy
+com.sun.xml.internal.ws.api.policy.subject
+com.sun.xml.internal.ws.api.server
+com.sun.xml.internal.ws.api.streaming
+com.sun.xml.internal.ws.api.wsdl.parser
+com.sun.xml.internal.ws.api.wsdl.writer
+com.sun.xml.internal.ws.assembler
+com.sun.xml.internal.ws.assembler.dev
+com.sun.xml.internal.ws.assembler.jaxws
+com.sun.xml.internal.ws.binding
+com.sun.xml.internal.ws.client
+com.sun.xml.internal.ws.client.dispatch
+com.sun.xml.internal.ws.client.sei
+com.sun.xml.internal.ws.commons.xmlutil
+com.sun.xml.internal.ws.config.management.policy
+com.sun.xml.internal.ws.config.metro.dev
+com.sun.xml.internal.ws.config.metro.util
+com.sun.xml.internal.ws.db
+com.sun.xml.internal.ws.db.glassfish
+com.sun.xml.internal.ws.developer
+com.sun.xml.internal.ws.dump
+com.sun.xml.internal.ws.encoding
+com.sun.xml.internal.ws.encoding.fastinfoset
+com.sun.xml.internal.ws.encoding.policy
+com.sun.xml.internal.ws.encoding.soap
+com.sun.xml.internal.ws.encoding.soap.streaming
+com.sun.xml.internal.ws.encoding.xml
+com.sun.xml.internal.ws.fault
+com.sun.xml.internal.ws.handler
+com.sun.xml.internal.ws.message
+com.sun.xml.internal.ws.message.jaxb
+com.sun.xml.internal.ws.message.saaj
+com.sun.xml.internal.ws.message.source
+com.sun.xml.internal.ws.message.stream
+com.sun.xml.internal.ws.model
+com.sun.xml.internal.ws.model.soap
+com.sun.xml.internal.ws.model.wsdl
+com.sun.xml.internal.ws.org.objectweb.asm
+com.sun.xml.internal.ws.policy
+com.sun.xml.internal.ws.policy.jaxws
+com.sun.xml.internal.ws.policy.jaxws.spi
+com.sun.xml.internal.ws.policy.privateutil
+com.sun.xml.internal.ws.policy.sourcemodel
+com.sun.xml.internal.ws.policy.sourcemodel.attach
+com.sun.xml.internal.ws.policy.sourcemodel.wspolicy
+com.sun.xml.internal.ws.policy.spi
+com.sun.xml.internal.ws.policy.subject
+com.sun.xml.internal.ws.protocol.soap
+com.sun.xml.internal.ws.protocol.xml
+com.sun.xml.internal.ws.resources
+com.sun.xml.internal.ws.runtime.config
+com.sun.xml.internal.ws.server
+com.sun.xml.internal.ws.server.provider
+com.sun.xml.internal.ws.server.sei
+com.sun.xml.internal.ws.spi
+com.sun.xml.internal.ws.spi.db
+com.sun.xml.internal.ws.streaming
+com.sun.xml.internal.ws.transport
+com.sun.xml.internal.ws.transport.http
+com.sun.xml.internal.ws.transport.http.client
+com.sun.xml.internal.ws.transport.http.server
+com.sun.xml.internal.ws.util
+com.sun.xml.internal.ws.util.exception
+com.sun.xml.internal.ws.util.pipe
+com.sun.xml.internal.ws.util.xml
+com.sun.xml.internal.ws.wsdl
+com.sun.xml.internal.ws.wsdl.parser
+com.sun.xml.internal.ws.wsdl.writer
+com.sun.xml.internal.ws.wsdl.writer.document
+com.sun.xml.internal.ws.wsdl.writer.document.http
+com.sun.xml.internal.ws.wsdl.writer.document.soap
+com.sun.xml.internal.ws.wsdl.writer.document.soap12
+com.sun.xml.internal.ws.wsdl.writer.document.xsd
+com.sun.xml.internal.xsom
+com.sun.xml.internal.xsom.impl
+com.sun.xml.internal.xsom.impl.parser
+com.sun.xml.internal.xsom.impl.parser.state
+com.sun.xml.internal.xsom.impl.scd
+com.sun.xml.internal.xsom.impl.util
+com.sun.xml.internal.xsom.parser
+com.sun.xml.internal.xsom.util
+com.sun.xml.internal.xsom.visitor
+java.applet
+java.awt
+java.awt.color
+java.awt.datatransfer
+java.awt.dnd
+java.awt.dnd.peer
+java.awt.event
+java.awt.font
+java.awt.geom
+java.awt.im
+java.awt.im.spi
+java.awt.image
+java.awt.image.renderable
+java.awt.peer
+java.awt.print
+java.beans
+java.beans.beancontext
+java.io
+java.lang
+java.lang.annotation
+java.lang.instrument
+java.lang.invoke
+java.lang.management
+java.lang.ref
+java.lang.reflect
+java.math
+java.net
+java.nio
+java.nio.channels
+java.nio.channels.spi
+java.nio.charset
+java.nio.charset.spi
+java.nio.file
+java.nio.file.attribute
+java.nio.file.spi
+java.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+java.sql
+java.text
+java.text.spi
+java.time
+java.time.chrono
+java.time.format
+java.time.temporal
+java.time.zone
+java.util
+java.util.concurrent
+java.util.concurrent.atomic
+java.util.concurrent.locks
+java.util.function
+java.util.jar
+java.util.logging
+java.util.prefs
+java.util.regex
+java.util.spi
+java.util.stream
+java.util.zip
+javafx.animation
+javafx.application
+javafx.beans
+javafx.beans.binding
+javafx.beans.property
+javafx.beans.property.adapter
+javafx.beans.value
+javafx.collections
+javafx.collections.transformation
+javafx.concurrent
+javafx.css
+javafx.embed.swing
+javafx.embed.swt
+javafx.event
+javafx.fxml
+javafx.geometry
+javafx.print
+javafx.scene
+javafx.scene.canvas
+javafx.scene.chart
+javafx.scene.control
+javafx.scene.control.cell
+javafx.scene.effect
+javafx.scene.image
+javafx.scene.input
+javafx.scene.layout
+javafx.scene.media
+javafx.scene.paint
+javafx.scene.shape
+javafx.scene.text
+javafx.scene.transform
+javafx.scene.web
+javafx.stage
+javafx.util
+javafx.util.converter
+javax.accessibility
+javax.activation
+javax.activity
+javax.annotation
+javax.annotation.processing
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+javax.imageio
+javax.imageio.event
+javax.imageio.metadata
+javax.imageio.plugins.bmp
+javax.imageio.plugins.jpeg
+javax.imageio.spi
+javax.imageio.stream
+javax.jws
+javax.jws.soap
+javax.lang.model
+javax.lang.model.element
+javax.lang.model.type
+javax.lang.model.util
+javax.management
+javax.management.loading
+javax.management.modelmbean
+javax.management.monitor
+javax.management.openmbean
+javax.management.relation
+javax.management.remote
+javax.management.remote.rmi
+javax.management.timer
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+javax.net
+javax.net.ssl
+javax.print
+javax.print.attribute
+javax.print.attribute.standard
+javax.print.event
+javax.rmi
+javax.rmi.CORBA
+javax.rmi.ssl
+javax.script
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.kerberos
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.cert
+javax.security.sasl
+javax.smartcardio
+javax.sound.midi
+javax.sound.midi.spi
+javax.sound.sampled
+javax.sound.sampled.spi
+javax.sql
+javax.sql.rowset
+javax.sql.rowset.serial
+javax.sql.rowset.spi
+javax.swing
+javax.swing.border
+javax.swing.colorchooser
+javax.swing.event
+javax.swing.filechooser
+javax.swing.plaf
+javax.swing.plaf.basic
+javax.swing.plaf.metal
+javax.swing.plaf.multi
+javax.swing.plaf.nimbus
+javax.swing.plaf.synth
+javax.swing.table
+javax.swing.text
+javax.swing.text.html
+javax.swing.text.html.parser
+javax.swing.text.rtf
+javax.swing.tree
+javax.swing.undo
+javax.tools
+javax.transaction
+javax.transaction.xa
+javax.xml
+javax.xml.bind
+javax.xml.bind.annotation
+javax.xml.bind.annotation.adapters
+javax.xml.bind.attachment
+javax.xml.bind.helpers
+javax.xml.bind.util
+javax.xml.crypto
+javax.xml.crypto.dom
+javax.xml.crypto.dsig
+javax.xml.crypto.dsig.dom
+javax.xml.crypto.dsig.keyinfo
+javax.xml.crypto.dsig.spec
+javax.xml.datatype
+javax.xml.namespace
+javax.xml.parsers
+javax.xml.soap
+javax.xml.stream
+javax.xml.stream.events
+javax.xml.stream.util
+javax.xml.transform
+javax.xml.transform.dom
+javax.xml.transform.sax
+javax.xml.transform.stax
+javax.xml.transform.stream
+javax.xml.validation
+javax.xml.ws
+javax.xml.ws.handler
+javax.xml.ws.handler.soap
+javax.xml.ws.http
+javax.xml.ws.soap
+javax.xml.ws.spi
+javax.xml.ws.spi.http
+javax.xml.ws.wsaddressing
+javax.xml.xpath
+jdk
+jdk.internal.cmm
+jdk.internal.dynalink
+jdk.internal.dynalink.beans
+jdk.internal.dynalink.linker
+jdk.internal.dynalink.support
+jdk.internal.instrumentation
+jdk.internal.org.objectweb.asm
+jdk.internal.org.objectweb.asm.commons
+jdk.internal.org.objectweb.asm.signature
+jdk.internal.org.objectweb.asm.tree
+jdk.internal.org.objectweb.asm.tree.analysis
+jdk.internal.org.objectweb.asm.util
+jdk.internal.org.xml.sax
+jdk.internal.org.xml.sax.helpers
+jdk.internal.util.xml
+jdk.internal.util.xml.impl
+jdk.jfr.events
+jdk.management.cmm
+jdk.management.resource
+jdk.management.resource.internal
+jdk.management.resource.internal.inst
+jdk.nashorn.api.scripting
+jdk.nashorn.internal
+jdk.nashorn.internal.codegen
+jdk.nashorn.internal.codegen.types
+jdk.nashorn.internal.ir
+jdk.nashorn.internal.ir.annotations
+jdk.nashorn.internal.ir.debug
+jdk.nashorn.internal.ir.visitor
+jdk.nashorn.internal.lookup
+jdk.nashorn.internal.objects
+jdk.nashorn.internal.objects.annotations
+jdk.nashorn.internal.parser
+jdk.nashorn.internal.runtime
+jdk.nashorn.internal.runtime.arrays
+jdk.nashorn.internal.runtime.events
+jdk.nashorn.internal.runtime.linker
+jdk.nashorn.internal.runtime.logging
+jdk.nashorn.internal.runtime.options
+jdk.nashorn.internal.runtime.regexp
+jdk.nashorn.internal.runtime.regexp.joni
+jdk.nashorn.internal.runtime.regexp.joni.ast
+jdk.nashorn.internal.runtime.regexp.joni.constants
+jdk.nashorn.internal.runtime.regexp.joni.encoding
+jdk.nashorn.internal.runtime.regexp.joni.exception
+jdk.nashorn.internal.scripts
+jdk.nashorn.tools
+jdk.net
+netscape.javascript
+oracle.jrockit.jfr
+oracle.jrockit.jfr.events
+oracle.jrockit.jfr.jdkevents
+oracle.jrockit.jfr.jdkevents.throwabletransform
+oracle.jrockit.jfr.openmbean
+oracle.jrockit.jfr.parser
+oracle.jrockit.jfr.settings
+oracle.jrockit.jfr.tools
+org.ietf.jgss
+org.jcp.xml.dsig.internal
+org.jcp.xml.dsig.internal.dom
+org.omg.CORBA
+org.omg.CORBA.DynAnyPackage
+org.omg.CORBA.ORBPackage
+org.omg.CORBA.TypeCodePackage
+org.omg.CORBA.portable
+org.omg.CORBA_2_3
+org.omg.CORBA_2_3.portable
+org.omg.CosNaming
+org.omg.CosNaming.NamingContextExtPackage
+org.omg.CosNaming.NamingContextPackage
+org.omg.Dynamic
+org.omg.DynamicAny
+org.omg.DynamicAny.DynAnyFactoryPackage
+org.omg.DynamicAny.DynAnyPackage
+org.omg.IOP
+org.omg.IOP.CodecFactoryPackage
+org.omg.IOP.CodecPackage
+org.omg.Messaging
+org.omg.PortableInterceptor
+org.omg.PortableInterceptor.ORBInitInfoPackage
+org.omg.PortableServer
+org.omg.PortableServer.CurrentPackage
+org.omg.PortableServer.POAManagerPackage
+org.omg.PortableServer.POAPackage
+org.omg.PortableServer.ServantLocatorPackage
+org.omg.PortableServer.portable
+org.omg.SendingContext
+org.omg.stub.java.rmi
+org.omg.stub.javax.management.remote.rmi
+org.relaxng.datatype
+org.relaxng.datatype.helpers
+org.w3c.dom
+org.w3c.dom.bootstrap
+org.w3c.dom.css
+org.w3c.dom.events
+org.w3c.dom.html
+org.w3c.dom.ls
+org.w3c.dom.ranges
+org.w3c.dom.stylesheets
+org.w3c.dom.traversal
+org.w3c.dom.views
+org.w3c.dom.xpath
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers
+sun.applet
+sun.applet.resources
+sun.audio
+sun.awt
+sun.awt.X11
+sun.awt.datatransfer
+sun.awt.dnd
+sun.awt.event
+sun.awt.geom
+sun.awt.im
+sun.awt.image
+sun.awt.image.codec
+sun.awt.motif
+sun.awt.resources
+sun.awt.shell
+sun.awt.util
+sun.awt.windows
+sun.corba
+sun.dc
+sun.dc.path
+sun.dc.pr
+sun.font
+sun.instrument
+sun.invoke
+sun.invoke.empty
+sun.invoke.util
+sun.io
+sun.java2d
+sun.java2d.cmm
+sun.java2d.cmm.kcms
+sun.java2d.cmm.lcms
+sun.java2d.d3d
+sun.java2d.jules
+sun.java2d.loops
+sun.java2d.opengl
+sun.java2d.pipe
+sun.java2d.pipe.hw
+sun.java2d.pisces
+sun.java2d.windows
+sun.java2d.x11
+sun.java2d.xr
+sun.jvmstat.monitor
+sun.jvmstat.monitor.event
+sun.jvmstat.monitor.remote
+sun.jvmstat.perfdata.monitor
+sun.jvmstat.perfdata.monitor.protocol.file
+sun.jvmstat.perfdata.monitor.protocol.local
+sun.jvmstat.perfdata.monitor.protocol.rmi
+sun.jvmstat.perfdata.monitor.v1_0
+sun.jvmstat.perfdata.monitor.v2_0
+sun.launcher
+sun.launcher.resources
+sun.lwawt
+sun.lwawt.macosx
+sun.management
+sun.management.counter
+sun.management.counter.perf
+sun.management.jdp
+sun.management.jmxremote
+sun.management.resources
+sun.management.snmp
+sun.management.snmp.jvminstr
+sun.management.snmp.jvmmib
+sun.management.snmp.util
+sun.misc
+sun.misc.resources
+sun.net
+sun.net.dns
+sun.net.ftp
+sun.net.ftp.impl
+sun.net.httpserver
+sun.net.idn
+sun.net.sdp
+sun.net.smtp
+sun.net.spi
+sun.net.spi.nameservice
+sun.net.spi.nameservice.dns
+sun.net.util
+sun.net.www
+sun.net.www.content.audio
+sun.net.www.content.image
+sun.net.www.content.text
+sun.net.www.http
+sun.net.www.protocol.file
+sun.net.www.protocol.ftp
+sun.net.www.protocol.http
+sun.net.www.protocol.http.logging
+sun.net.www.protocol.http.ntlm
+sun.net.www.protocol.http.spnego
+sun.net.www.protocol.https
+sun.net.www.protocol.jar
+sun.net.www.protocol.mailto
+sun.net.www.protocol.netdoc
+sun.nio
+sun.nio.ch
+sun.nio.ch.sctp
+sun.nio.cs
+sun.nio.cs.ext
+sun.nio.fs
+sun.print
+sun.print.resources
+sun.reflect
+sun.reflect.annotation
+sun.reflect.generics.factory
+sun.reflect.generics.parser
+sun.reflect.generics.reflectiveObjects
+sun.reflect.generics.repository
+sun.reflect.generics.scope
+sun.reflect.generics.tree
+sun.reflect.generics.visitor
+sun.reflect.misc
+sun.rmi.log
+sun.rmi.registry
+sun.rmi.rmic
+sun.rmi.rmic.iiop
+sun.rmi.rmic.newrmic
+sun.rmi.rmic.newrmic.jrmp
+sun.rmi.runtime
+sun.rmi.server
+sun.rmi.transport
+sun.rmi.transport.proxy
+sun.rmi.transport.tcp
+sun.security.acl
+sun.security.action
+sun.security.ec
+sun.security.internal.interfaces
+sun.security.internal.spec
+sun.security.jca
+sun.security.jgss
+sun.security.jgss.krb5
+sun.security.jgss.spi
+sun.security.jgss.spnego
+sun.security.jgss.wrapper
+sun.security.krb5
+sun.security.krb5.internal
+sun.security.krb5.internal.ccache
+sun.security.krb5.internal.crypto
+sun.security.krb5.internal.crypto.dk
+sun.security.krb5.internal.ktab
+sun.security.krb5.internal.rcache
+sun.security.krb5.internal.tools
+sun.security.krb5.internal.util
+sun.security.mscapi
+sun.security.pkcs
+sun.security.pkcs10
+sun.security.pkcs11
+sun.security.pkcs11.wrapper
+sun.security.pkcs12
+sun.security.provider
+sun.security.provider.certpath
+sun.security.provider.certpath.ldap
+sun.security.provider.certpath.ssl
+sun.security.rsa
+sun.security.smartcardio
+sun.security.ssl
+sun.security.ssl.krb5
+sun.security.timestamp
+sun.security.tools
+sun.security.tools.jarsigner
+sun.security.tools.keytool
+sun.security.tools.policytool
+sun.security.util
+sun.security.validator
+sun.security.x509
+sun.swing
+sun.swing.icon
+sun.swing.plaf
+sun.swing.plaf.synth
+sun.swing.plaf.windows
+sun.swing.table
+sun.swing.text
+sun.swing.text.html
+sun.text
+sun.text.bidi
+sun.text.normalizer
+sun.text.resources
+sun.text.resources.en
+sun.tools.asm
+sun.tools.attach
+sun.tools.jar
+sun.tools.jar.resources
+sun.tools.java
+sun.tools.javac
+sun.tools.jcmd
+sun.tools.jconsole
+sun.tools.jconsole.inspector
+sun.tools.jinfo
+sun.tools.jmap
+sun.tools.jps
+sun.tools.jstack
+sun.tools.jstat
+sun.tools.jstatd
+sun.tools.native2ascii
+sun.tools.native2ascii.resources
+sun.tools.serialver
+sun.tools.tree
+sun.tools.util
+sun.tracing
+sun.tracing.dtrace
+sun.usagetracker
+sun.util
+sun.util.calendar
+sun.util.cldr
+sun.util.locale
+sun.util.locale.provider
+sun.util.logging
+sun.util.logging.resources
+sun.util.resources
+sun.util.resources.en
+sun.util.spi
+sun.util.xml
--- a/jdk/src/java.base/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,51 @@
/**
* Defines the foundational APIs of the Java SE Platform.
*
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Providers:</dt>
+ * <dd> The JDK implementation of this module provides an implementation of
+ * the {@index jrt jrt} {@linkplain java.nio.file.spi.FileSystemProvider
+ * file system provider} to enumerate and read the class and resource
+ * files in a run-time image.
+ * The jrt file system can be created by calling
+ * {@link java.nio.file.FileSystems#newFileSystem
+ * FileSystems.newFileSystem(URI.create("jrt:/"))}.
+ * <p></dd>
+ * <dt class="simpleTagLabel">Tool Guides:</dt>
+ * <dd> {@extLink java_tool_reference java launcher},
+ * {@extLink keytool_tool_reference keytool}</dd>
+ * </dl>
+ *
+ * @provides java.nio.file.spi.FileSystemProvider
+ *
+ * @uses java.lang.System.LoggerFinder
+ * @uses java.net.ContentHandlerFactory
+ * @uses java.net.spi.URLStreamHandlerProvider
+ * @uses java.nio.channels.spi.AsynchronousChannelProvider
+ * @uses java.nio.channels.spi.SelectorProvider
+ * @uses java.nio.charset.spi.CharsetProvider
+ * @uses java.nio.file.spi.FileSystemProvider
+ * @uses java.nio.file.spi.FileTypeDetector
+ * @uses java.security.Provider
+ * @uses java.text.spi.BreakIteratorProvider
+ * @uses java.text.spi.CollatorProvider
+ * @uses java.text.spi.DateFormatProvider
+ * @uses java.text.spi.DateFormatSymbolsProvider
+ * @uses java.text.spi.DecimalFormatSymbolsProvider
+ * @uses java.text.spi.NumberFormatProvider
+ * @uses java.time.chrono.AbstractChronology
+ * @uses java.time.chrono.Chronology
+ * @uses java.time.zone.ZoneRulesProvider
+ * @uses java.util.spi.CalendarDataProvider
+ * @uses java.util.spi.CalendarNameProvider
+ * @uses java.util.spi.CurrencyNameProvider
+ * @uses java.util.spi.LocaleNameProvider
+ * @uses java.util.spi.ResourceBundleControlProvider
+ * @uses java.util.spi.ResourceBundleProvider
+ * @uses java.util.spi.TimeZoneNameProvider
+ * @uses java.util.spi.ToolProvider
+ * @uses javax.security.auth.spi.LoginModule
+ *
* @moduleGraph
* @since 9
*/
@@ -84,37 +129,6 @@
exports javax.security.cert;
- // the service types defined by the APIs in this module
-
- uses java.lang.System.LoggerFinder;
- uses java.net.ContentHandlerFactory;
- uses java.net.spi.URLStreamHandlerProvider;
- uses java.nio.channels.spi.AsynchronousChannelProvider;
- uses java.nio.channels.spi.SelectorProvider;
- uses java.nio.charset.spi.CharsetProvider;
- uses java.nio.file.spi.FileSystemProvider;
- uses java.nio.file.spi.FileTypeDetector;
- uses java.security.Provider;
- uses java.text.spi.BreakIteratorProvider;
- uses java.text.spi.CollatorProvider;
- uses java.text.spi.DateFormatProvider;
- uses java.text.spi.DateFormatSymbolsProvider;
- uses java.text.spi.DecimalFormatSymbolsProvider;
- uses java.text.spi.NumberFormatProvider;
- uses java.time.chrono.AbstractChronology;
- uses java.time.chrono.Chronology;
- uses java.time.zone.ZoneRulesProvider;
- uses java.util.spi.CalendarDataProvider;
- uses java.util.spi.CalendarNameProvider;
- uses java.util.spi.CurrencyNameProvider;
- uses java.util.spi.LocaleNameProvider;
- uses java.util.spi.ResourceBundleControlProvider;
- uses java.util.spi.ResourceBundleProvider;
- uses java.util.spi.TimeZoneNameProvider;
- uses java.util.spi.ToolProvider;
- uses javax.security.auth.spi.LoginModule;
-
-
// additional qualified exports may be inserted at build time
// see make/gensrc/GenModuleInfo.gmk
@@ -147,11 +161,6 @@
jdk.scripting.nashorn;
exports jdk.internal.math to
java.desktop;
- exports jdk.internal.module to
- java.instrument,
- java.management.rmi,
- jdk.jartool,
- jdk.jlink;
exports jdk.internal.misc to
java.desktop,
java.logging,
@@ -173,6 +182,11 @@
jdk.scripting.nashorn.shell,
jdk.unsupported,
jdk.internal.vm.ci;
+ exports jdk.internal.module to
+ java.instrument,
+ java.management.rmi,
+ jdk.jartool,
+ jdk.jlink;
exports jdk.internal.perf to
java.desktop,
java.management,
@@ -188,6 +202,9 @@
jdk.dynalink,
jdk.scripting.nashorn,
jdk.unsupported;
+ exports jdk.internal.vm to
+ jdk.management.agent,
+ jdk.internal.jvmstat;
exports jdk.internal.vm.annotation to
jdk.unsupported,
jdk.internal.vm.ci,
@@ -196,9 +213,6 @@
jdk.jartool,
jdk.jdeps,
jdk.jlink;
- exports jdk.internal.vm to
- jdk.management.agent,
- jdk.internal.jvmstat;
exports sun.net to
jdk.incubator.httpclient;
exports sun.net.ext to
@@ -208,7 +222,8 @@
jdk.naming.dns;
exports sun.net.util to
java.desktop,
- jdk.jconsole;
+ jdk.jconsole,
+ jdk.incubator.httpclient;
exports sun.net.www to
java.desktop,
jdk.incubator.httpclient,
@@ -304,7 +319,39 @@
exports sun.util.resources to
jdk.localedata;
+
+ // the service types defined by the APIs in this module
+
+ uses java.lang.System.LoggerFinder;
+ uses java.net.ContentHandlerFactory;
+ uses java.net.spi.URLStreamHandlerProvider;
+ uses java.nio.channels.spi.AsynchronousChannelProvider;
+ uses java.nio.channels.spi.SelectorProvider;
+ uses java.nio.charset.spi.CharsetProvider;
+ uses java.nio.file.spi.FileSystemProvider;
+ uses java.nio.file.spi.FileTypeDetector;
+ uses java.security.Provider;
+ uses java.text.spi.BreakIteratorProvider;
+ uses java.text.spi.CollatorProvider;
+ uses java.text.spi.DateFormatProvider;
+ uses java.text.spi.DateFormatSymbolsProvider;
+ uses java.text.spi.DecimalFormatSymbolsProvider;
+ uses java.text.spi.NumberFormatProvider;
+ uses java.time.chrono.AbstractChronology;
+ uses java.time.chrono.Chronology;
+ uses java.time.zone.ZoneRulesProvider;
+ uses java.util.spi.CalendarDataProvider;
+ uses java.util.spi.CalendarNameProvider;
+ uses java.util.spi.CurrencyNameProvider;
+ uses java.util.spi.LocaleNameProvider;
+ uses java.util.spi.ResourceBundleControlProvider;
+ uses java.util.spi.ResourceBundleProvider;
+ uses java.util.spi.TimeZoneNameProvider;
+ uses java.util.spi.ToolProvider;
+ uses javax.security.auth.spi.LoginModule;
+
// JDK-internal service types
+
uses jdk.internal.logger.DefaultLoggerFinder;
uses sun.security.ssl.ClientKeyExchangeService;
uses sun.text.spi.JavaTimeDateTimePatternProvider;
@@ -313,7 +360,6 @@
uses sun.util.resources.LocaleData.CommonResourceBundleProvider;
uses sun.util.resources.LocaleData.SupplementaryResourceBundleProvider;
-
// Built-in service providers that are located via ServiceLoader
provides java.nio.file.spi.FileSystemProvider with
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Thu Aug 24 16:24:44 2017 +0200
@@ -92,7 +92,6 @@
import jdk.internal.module.ModuleBootstrap;
import jdk.internal.module.Modules;
-
public final class LauncherHelper {
// No instantiation
@@ -488,16 +487,16 @@
if (s.length == 2) {
String mn = s[0];
String pn = s[1];
-
- ModuleLayer.boot().findModule(mn).ifPresent(m -> {
- if (m.getDescriptor().packages().contains(pn)) {
+ ModuleLayer.boot()
+ .findModule(mn)
+ .filter(m -> m.getDescriptor().packages().contains(pn))
+ .ifPresent(m -> {
if (open) {
Modules.addOpensToAllUnnamed(m, pn);
} else {
Modules.addExportsToAllUnnamed(m, pn);
}
- }
- });
+ });
}
}
}
@@ -614,7 +613,7 @@
}
} catch (LinkageError le) {
abort(null, "java.launcher.module.error3", mainClass, m.getName(),
- le.getClass().getName() + ": " + le.getLocalizedMessage());
+ le.getClass().getName() + ": " + le.getLocalizedMessage());
}
if (c == null) {
abort(null, "java.launcher.module.error2", mainClass, mainModule);
@@ -715,7 +714,7 @@
mainClass.getName(), mainClass.getModule(),
e.getClass().getName(), e.getLocalizedMessage());
} else {
- abort(e,"java.launcher.cls.error7", mainClass.getName(),
+ abort(e, "java.launcher.cls.error7", mainClass.getName(),
e.getClass().getName(), e.getLocalizedMessage());
}
}
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Thu Aug 24 16:24:44 2017 +0200
@@ -58,7 +58,7 @@
\ ALL-MODULE-PATH.\n\
\ --list-modules\n\
\ list observable modules and exit\n\
-\ --d <module name>\n\
+\ -d <module name>\n\
\ --describe-module <module name>\n\
\ describe a module and exit\n\
\ --dry-run create VM and load main class but do not execute main method.\n\
@@ -165,10 +165,11 @@
\ --add-opens <module>/<package>=<target-module>(,<target-module>)*\n\
\ updates <module> to open <package> to\n\
\ <target-module>, regardless of module declaration.\n\
-\ --permit-illegal-access\n\
-\ permit illegal access to members of types in named modules\n\
-\ by code in unnamed modules. This compatibility option will\n\
-\ be removed in the next release.\n\
+\ --illegal-access=<value>\n\
+\ permit or deny access to members of types in named modules\n\
+\ by code in unnamed modules.\n\
+\ <value> is one of "deny", "permit", "warn", or "debug"\n\
+\ This option will be removed in a future release.\n\
\ --limit-modules <module name>[,<module name>...]\n\
\ limit the universe of observable modules\n\
\ --patch-module <module>=<file>({0}<file>)*\n\
--- a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Thu Aug 24 16:24:44 2017 +0200
@@ -2408,9 +2408,9 @@
{ 0x3081000201033081L, 0x0006092A864886F7L, 0x0D010701A0810004L },
{ 0x3082000002010330L, 0x810006092A864886L, 0xF70D010701A08100L },
{ 0x3083000000020103L, 0x3082000006092A86L, 0x4886F70D010701A0L },
- { 0x3083000000020103L, 0x308200000006092AL, 0x864886F70D010701L },
- { 0x3084000000000201L, 0x0330820000000609L, 0x2A864886F70D0107L },
- { 0x3084000000000201L, 0x0330820000000006L, 0x092A864886F70D01L }
+ { 0x3083000000020103L, 0x308300000006092AL, 0x864886F70D010701L },
+ { 0x3084000000000201L, 0x0330830000000609L, 0x2A864886F70D0107L },
+ { 0x3084000000000201L, 0x0330840000000006L, 0x092A864886F70D01L }
};
private static final long[][] PKCS12_HEADER_MASKS = {
--- a/jdk/src/java.base/share/lib/security/default.policy Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/lib/security/default.policy Thu Aug 24 16:24:44 2017 +0200
@@ -20,9 +20,6 @@
permission java.security.AllPermission;
};
-grant codeBase "jrt:/jdk.incubator.httpclient" {
-};
-
grant codeBase "jrt:/java.scripting" {
permission java.security.AllPermission;
};
@@ -69,17 +66,7 @@
};
grant codeBase "jrt:/java.xml.bind" {
- permission java.lang.RuntimePermission
- "accessClassInPackage.sun.misc";
- permission java.lang.RuntimePermission
- "accessClassInPackage.com.sun.xml.internal.*";
- permission java.lang.RuntimePermission
- "accessClassInPackage.com.sun.istack.internal";
- permission java.lang.RuntimePermission
- "accessClassInPackage.com.sun.istack.internal.*";
- permission java.lang.RuntimePermission "accessDeclaredMembers";
- permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
- permission java.util.PropertyPermission "*", "read";
+ permission java.security.AllPermission;
};
grant codeBase "jrt:/java.xml.crypto" {
@@ -104,19 +91,11 @@
};
grant codeBase "jrt:/java.xml.ws" {
- permission java.net.NetPermission
- "getProxySelector";
- permission java.lang.RuntimePermission
- "accessClassInPackage.sun.misc";
- permission java.lang.RuntimePermission
- "accessClassInPackage.com.sun.xml.internal.*";
- permission java.lang.RuntimePermission
- "accessClassInPackage.com.sun.istack.internal";
- permission java.lang.RuntimePermission
- "accessClassInPackage.com.sun.istack.internal.*";
- permission java.lang.RuntimePermission "accessDeclaredMembers";
- permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
- permission java.util.PropertyPermission "*", "read";
+ permission java.security.AllPermission;
+};
+
+grant codeBase "jrt:/jdk.accessibility" {
+ permission java.lang.RuntimePermission "accessClassInPackage.sun.awt";
};
grant codeBase "jrt:/jdk.charsets" {
@@ -155,6 +134,10 @@
permission java.io.FilePermission "<<ALL FILES>>", "read";
};
+grant codeBase "jrt:/jdk.desktop" {
+ permission java.lang.RuntimePermission "accessClassInPackage.com.sun.awt";
+};
+
grant codeBase "jrt:/jdk.dynalink" {
permission java.security.AllPermission;
};
@@ -163,6 +146,10 @@
permission java.security.AllPermission;
};
+grant codeBase "jrt:/jdk.internal.vm.compiler" {
+ permission java.security.AllPermission;
+};
+
grant codeBase "jrt:/jdk.jsobject" {
permission java.security.AllPermission;
};
@@ -198,14 +185,6 @@
permission java.util.PropertyPermission "os.name", "read";
};
-grant codeBase "jrt:/jdk.accessibility" {
- permission java.lang.RuntimePermission "accessClassInPackage.sun.awt";
-};
-
-grant codeBase "jrt:/jdk.desktop" {
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.awt";
-};
-
// permissions needed by applications using java.desktop module
grant {
permission java.lang.RuntimePermission "accessClassInPackage.com.sun.beans";
@@ -213,7 +192,3 @@
permission java.lang.RuntimePermission "accessClassInPackage.com.sun.java.swing.plaf.*";
permission java.lang.RuntimePermission "accessClassInPackage.com.apple.*";
};
-
-grant codeBase "jrt:/jdk.internal.vm.compiler" {
- permission java.security.AllPermission;
-};
--- a/jdk/src/java.base/share/native/include/jvm.h Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/native/include/jvm.h Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -456,14 +456,6 @@
JVM_AddReadsModule(JNIEnv *env, jobject from_module, jobject source_module);
/*
- * Add a package to a module.
- * module: module that will contain the package
- * package: package to add to the module
- */
-JNIEXPORT void JNICALL
-JVM_AddModulePackage(JNIEnv* env, jobject module, const char* package);
-
-/*
* Reflection support functions
*/
--- a/jdk/src/java.base/share/native/libjava/Module.c Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/native/libjava/Module.c Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -176,23 +176,3 @@
}
}
}
-
-JNIEXPORT void JNICALL
-Java_java_lang_Module_addPackage0(JNIEnv *env, jclass cls, jobject m, jstring pkg)
-{
- char buf[128];
- char* pkg_name;
-
- if (pkg == NULL) {
- JNU_ThrowNullPointerException(env, "package is null");
- return;
- }
-
- pkg_name = GetInternalPackageName(env, pkg, buf, (jsize)sizeof(buf));
- if (pkg_name != NULL) {
- JVM_AddModulePackage(env, m, pkg_name);
- if (pkg_name != buf) {
- free(pkg_name);
- }
- }
-}
--- a/jdk/src/java.base/share/native/libjava/jni_util.c Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c Thu Aug 24 16:24:44 2017 +0200
@@ -29,6 +29,7 @@
#include "jvm.h"
#include "jni.h"
#include "jni_util.h"
+#include "java_lang_String.h"
/* Due to a bug in the win32 C runtime library strings
* such as "z:" need to be appended with a "." so we
@@ -442,16 +443,18 @@
return obj;
}
-/* Optimized for char set ISO_8559_1 */
+/* Optimized for charset ISO_8559_1 */
static jstring
-newString8859_1(JNIEnv *env, const char *str)
+newSizedString8859_1(JNIEnv *env, const char *str, const int len)
{
- int len = (int)strlen(str);
jchar buf[512];
jchar *str1;
jstring result;
int i;
+ if ((*env)->EnsureLocalCapacity(env, 1) < 0)
+ return NULL;
+
if (len > 512) {
str1 = (jchar *)malloc(len * sizeof(jchar));
if (str1 == 0) {
@@ -469,6 +472,13 @@
return result;
}
+static jstring
+newString8859_1(JNIEnv *env, const char *str)
+{
+ int len = (int)strlen(str);
+ return newSizedString8859_1(env, str, len);
+}
+
static const char*
getString8859_1Chars(JNIEnv *env, jstring jstr)
{
@@ -501,7 +511,7 @@
}
-/* Optimized for char set ISO646-US (us-ascii) */
+/* Optimized for charset ISO646-US (us-ascii) */
static jstring
newString646_US(JNIEnv *env, const char *str)
{
@@ -573,7 +583,7 @@
0x02Dc,0x2122,0x0161,0x203A,0x0153,0xFFFD,0x017E,0x0178
};
-/* Optimized for char set Cp1252 */
+/* Optimized for charset Cp1252 */
static jstring
newStringCp1252(JNIEnv *env, const char *str)
{
@@ -582,6 +592,10 @@
jchar *str1;
jstring result;
int i;
+
+ if ((*env)->EnsureLocalCapacity(env, 1) < 0)
+ return NULL;
+
if (len > 512) {
str1 = (jchar *)malloc(len * sizeof(jchar));
if (str1 == 0) {
@@ -625,9 +639,13 @@
for (i=0; i<len; i++) {
jchar c = str[i];
- if (c < 256)
- result[i] = (char)c;
- else switch(c) {
+ if (c < 256) {
+ if ((c >= 0x80) && (c <= 0x9f)) {
+ result[i] = '?';
+ } else {
+ result[i] = (char)c;
+ }
+ } else switch(c) {
case 0x20AC: result[i] = (char)0x80; break;
case 0x201A: result[i] = (char)0x82; break;
case 0x0192: result[i] = (char)0x83; break;
@@ -671,8 +689,89 @@
static jmethodID String_init_ID; /* String(byte[], enc) */
static jmethodID String_getBytes_ID; /* String.getBytes(enc) */
-int getFastEncoding() {
- return fastEncoding;
+/* Cached field IDs */
+static jfieldID String_coder_ID; /* String.coder */
+static jfieldID String_value_ID; /* String.value */
+
+static jboolean isJNUEncodingSupported = JNI_FALSE;
+static jboolean jnuEncodingSupported(JNIEnv *env) {
+ jboolean exe;
+ if (isJNUEncodingSupported == JNI_TRUE) {
+ return JNI_TRUE;
+ }
+ isJNUEncodingSupported = (jboolean) JNU_CallStaticMethodByName (
+ env, &exe,
+ "java/nio/charset/Charset",
+ "isSupported",
+ "(Ljava/lang/String;)Z",
+ jnuEncoding).z;
+ return isJNUEncodingSupported;
+}
+
+/* Create a new string by converting str to a heap-allocated byte array and
+ * calling the appropriate String constructor.
+ */
+static jstring
+newSizedStringJava(JNIEnv *env, const char *str, const int len)
+{
+ jstring result = NULL;
+ jbyteArray bytes = 0;
+
+ if ((*env)->EnsureLocalCapacity(env, 2) < 0)
+ return NULL;
+
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes != NULL) {
+ jclass strClazz = JNU_ClassString(env);
+ CHECK_NULL_RETURN(strClazz, 0);
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte *)str);
+ if (jnuEncodingSupported(env)) {
+ result = (*env)->NewObject(env, strClazz,
+ String_init_ID, bytes, jnuEncoding);
+ } else {
+ /*If the encoding specified in sun.jnu.encoding is not endorsed
+ by "Charset.isSupported" we have to fall back to use String(byte[])
+ explicitly here without specifying the encoding name, in which the
+ StringCoding class will pickup the iso-8859-1 as the fallback
+ converter for us.
+ */
+ jmethodID mid = (*env)->GetMethodID(env, strClazz,
+ "<init>", "([B)V");
+ if (mid != NULL) {
+ result = (*env)->NewObject(env, strClazz, mid, bytes);
+ }
+ }
+ (*env)->DeleteLocalRef(env, bytes);
+ return result;
+ }
+ return NULL;
+}
+
+static jstring
+newStringJava(JNIEnv *env, const char *str)
+{
+ int len = (int)strlen(str);
+ return newSizedStringJava(env, str, len);
+}
+
+/* Optimized for charset UTF-8 */
+static jstring
+newStringUTF8(JNIEnv *env, const char *str)
+{
+ int len;
+ const unsigned char *p;
+ unsigned char asciiCheck;
+ for (asciiCheck = 0, p = (const unsigned char*)str; *p != '\0'; p++) {
+ asciiCheck |= *p;
+ }
+ len = (int)((const char*)p - str);
+
+ if (asciiCheck < 0x80) {
+ // ascii fast-path
+ return newSizedString8859_1(env, str, len);
+ }
+
+ return newSizedStringJava(env, str, len);
}
/* Initialize the fast encoding. If the "sun.jnu.encoding" property
@@ -718,17 +817,20 @@
if ((strcmp(encname, "8859_1") == 0) ||
(strcmp(encname, "ISO8859-1") == 0) ||
(strcmp(encname, "ISO8859_1") == 0) ||
- (strcmp(encname, "ISO-8859-1") == 0))
+ (strcmp(encname, "ISO-8859-1") == 0)) {
fastEncoding = FAST_8859_1;
- else if (strcmp(encname, "ISO646-US") == 0)
+ } else if (strcmp(encname, "UTF-8") == 0) {
+ fastEncoding = FAST_UTF_8;
+ jnuEncoding = (jstring)(*env)->NewGlobalRef(env, enc);
+ } else if (strcmp(encname, "ISO646-US") == 0) {
fastEncoding = FAST_646_US;
- else if (strcmp(encname, "Cp1252") == 0 ||
+ } else if (strcmp(encname, "Cp1252") == 0 ||
/* This is a temporary fix until we move */
/* to wide character versions of all Windows */
/* calls. */
- strcmp(encname, "utf-16le") == 0)
+ strcmp(encname, "utf-16le") == 0) {
fastEncoding = FAST_CP1252;
- else {
+ } else {
fastEncoding = NO_FAST_ENCODING;
jnuEncoding = (jstring)(*env)->NewGlobalRef(env, enc);
}
@@ -750,24 +852,10 @@
CHECK_NULL(String_getBytes_ID);
String_init_ID = (*env)->GetMethodID(env, strClazz,
"<init>", "([BLjava/lang/String;)V");
+ String_coder_ID = (*env)->GetFieldID(env, strClazz, "coder", "B");
+ String_value_ID = (*env)->GetFieldID(env, strClazz, "value", "[B");
}
-static jboolean isJNUEncodingSupported = JNI_FALSE;
-static jboolean jnuEncodingSupported(JNIEnv *env) {
- jboolean exe;
- if (isJNUEncodingSupported == JNI_TRUE) {
- return JNI_TRUE;
- }
- isJNUEncodingSupported = (jboolean) JNU_CallStaticMethodByName (
- env, &exe,
- "java/nio/charset/Charset",
- "isSupported",
- "(Ljava/lang/String;)Z",
- jnuEncoding).z;
- return isJNUEncodingSupported;
-}
-
-
JNIEXPORT jstring
NewStringPlatform(JNIEnv *env, const char *str)
{
@@ -777,10 +865,6 @@
JNIEXPORT jstring JNICALL
JNU_NewStringPlatform(JNIEnv *env, const char *str)
{
- jstring result = NULL;
- jbyteArray hab = 0;
- int len;
-
if (fastEncoding == NO_ENCODING_YET) {
initializeEncoding(env);
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
@@ -792,36 +876,9 @@
return newString646_US(env, str);
if (fastEncoding == FAST_CP1252)
return newStringCp1252(env, str);
-
- if ((*env)->EnsureLocalCapacity(env, 2) < 0)
- return NULL;
-
- len = (int)strlen(str);
- hab = (*env)->NewByteArray(env, len);
- if (hab != 0) {
- jclass strClazz = JNU_ClassString(env);
- CHECK_NULL_RETURN(strClazz, 0);
- (*env)->SetByteArrayRegion(env, hab, 0, len, (jbyte *)str);
- if (jnuEncodingSupported(env)) {
- result = (*env)->NewObject(env, strClazz,
- String_init_ID, hab, jnuEncoding);
- } else {
- /*If the encoding specified in sun.jnu.encoding is not endorsed
- by "Charset.isSupported" we have to fall back to use String(byte[])
- explicitly here without specifying the encoding name, in which the
- StringCoding class will pickup the iso-8859-1 as the fallback
- converter for us.
- */
- jmethodID mid = (*env)->GetMethodID(env, strClazz,
- "<init>", "([B)V");
- if (mid != NULL) {
- result = (*env)->NewObject(env, strClazz, mid, hab);
- }
- }
- (*env)->DeleteLocalRef(env, hab);
- return result;
- }
- return NULL;
+ if (fastEncoding == FAST_UTF_8)
+ return newStringUTF8(env, str);
+ return newStringJava(env, str);
}
JNIEXPORT const char *
@@ -830,27 +887,10 @@
return JNU_GetStringPlatformChars(env, jstr, isCopy);
}
-JNIEXPORT const char * JNICALL
-JNU_GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy)
-{
+static const char* getStringBytes(JNIEnv *env, jstring jstr) {
char *result = NULL;
jbyteArray hab = 0;
- if (isCopy)
- *isCopy = JNI_TRUE;
-
- if (fastEncoding == NO_ENCODING_YET) {
- initializeEncoding(env);
- JNU_CHECK_EXCEPTION_RETURN(env, 0);
- }
-
- if ((fastEncoding == FAST_8859_1) || (fastEncoding == NO_ENCODING_YET))
- return getString8859_1Chars(env, jstr);
- if (fastEncoding == FAST_646_US)
- return getString646_USChars(env, jstr);
- if (fastEncoding == FAST_CP1252)
- return getStringCp1252Chars(env, jstr);
-
if ((*env)->EnsureLocalCapacity(env, 2) < 0)
return 0;
@@ -883,6 +923,85 @@
return result;
}
+static const char*
+getStringUTF8(JNIEnv *env, jstring jstr)
+{
+ int i;
+ char *result;
+ jbyteArray value;
+ jint len;
+ jbyte *str;
+ jint rlen;
+ int ri;
+ jbyte coder = (*env)->GetByteField(env, jstr, String_coder_ID);
+ if (coder != java_lang_String_LATIN1) {
+ return getStringBytes(env, jstr);
+ }
+ if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
+ return NULL;
+ }
+ value = (*env)->GetObjectField(env, jstr, String_value_ID);
+ if (value == NULL)
+ return NULL;
+ len = (*env)->GetArrayLength(env, value);
+ str = (*env)->GetPrimitiveArrayCritical(env, value, NULL);
+ if (str == NULL) {
+ return NULL;
+ }
+
+ rlen = len;
+ // we need two bytes for each latin-1 char above 127 (negative jbytes)
+ for (i = 0; i < len; i++) {
+ if (str[i] < 0) {
+ rlen++;
+ }
+ }
+
+ result = MALLOC_MIN4(rlen);
+ if (result == NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, value, str, 0);
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return NULL;
+ }
+
+ for (ri = 0, i = 0; i < len; i++) {
+ jbyte c = str[i];
+ if (c < 0) {
+ result[ri++] = (char)(0xc0 | ((c & 0xff) >> 6));
+ result[ri++] = (char)(0x80 | (c & 0x3f));
+ } else {
+ result[ri++] = c;
+ }
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, value, str, 0);
+ result[rlen] = '\0';
+ return result;
+}
+
+JNIEXPORT const char * JNICALL
+JNU_GetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy)
+{
+
+ if (isCopy)
+ *isCopy = JNI_TRUE;
+
+ if (fastEncoding == NO_ENCODING_YET) {
+ initializeEncoding(env);
+ JNU_CHECK_EXCEPTION_RETURN(env, 0);
+ }
+
+ if ((fastEncoding == FAST_8859_1) || (fastEncoding == NO_ENCODING_YET))
+ return getString8859_1Chars(env, jstr);
+ if (fastEncoding == FAST_646_US)
+ return getString646_USChars(env, jstr);
+ if (fastEncoding == FAST_CP1252)
+ return getStringCp1252Chars(env, jstr);
+ if (fastEncoding == FAST_UTF_8)
+ return getStringUTF8(env, jstr);
+ else
+ return getStringBytes(env, jstr);
+}
+
JNIEXPORT void JNICALL
JNU_ReleaseStringPlatformChars(JNIEnv *env, jstring jstr, const char *str)
{
--- a/jdk/src/java.base/share/native/libjava/jni_util.h Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/share/native/libjava/jni_util.h Thu Aug 24 16:24:44 2017 +0200
@@ -382,7 +382,8 @@
NO_FAST_ENCODING, /* Platform encoding is not fast */
FAST_8859_1, /* ISO-8859-1 */
FAST_CP1252, /* MS-DOS Cp1252 */
- FAST_646_US /* US-ASCII : ISO646-US */
+ FAST_646_US, /* US-ASCII : ISO646-US */
+ FAST_UTF_8
};
int getFastEncoding();
--- a/jdk/src/java.base/share/specs/serialization/class.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](input.html) | [NEXT](version.html)'
-include-after: '[CONTENTS](index.html) | [PREV](input.html) | [NEXT](version.html)'
-
-title: 'Java Object Serialization Specification: 4 - Class Descriptors'
----
-
-- [The ObjectStreamClass Class](#the-objectstreamclass-class)
-- [Dynamic Proxy Class Descriptors](#dynamic-proxy-class-descriptors)
-- [Serialized Form](#serialized-form)
-- [The ObjectStreamField Class](#the-objectstreamfield-class)
-- [Inspecting Serializable Classes](#inspecting-serializable-classes)
-- [Stream Unique Identifiers](#stream-unique-identifiers)
-
--------------------------------------------------------------------------------
-
-## 4.1 The ObjectStreamClass Class
-
-The `ObjectStreamClass` provides information about classes that are saved in a
-Serialization stream. The descriptor provides the fully-qualified name of the
-class and its serialization version UID. A `SerialVersionUID` identifies the
-unique original class version for which this class is capable of writing
-streams and from which it can read.
-
-```
-package java.io;
-
-public class ObjectStreamClass
-{
- public static ObjectStreamClass lookup(Class cl);
-
- public static ObjectStreamClass lookupAny(Class cl);
-
- public String getName();
-
- public Class forClass();
-
- public ObjectStreamField[] getFields();
-
- public long getSerialVersionUID();
-
- public String toString();
-}
-```
-
-The `lookup` method returns the `ObjectStreamClass` descriptor for the
-specified class in the virtual machine. If the class has defined
-`serialVersionUID` it is retrieved from the class. If the `serialVersionUID` is
-not defined by the class, it is computed from the definition of the class in
-the virtual machine. *I*f the specified class is not serializable or
-externalizable, *null* is returned.
-
-The `lookupAny` method behaves like the `lookup` method, except that it returns
-the descriptor for any class, regardless of whether it implements
-`Serializable`. The `serialVersionUID` of a class that does not implement
-`Serializable` is *0L.*
-
-The `getName` method returns the name of the class, in the same format that is
-used by the `Class.getName` method.
-
-The `forClass` method returns the `Class` in the local virtual machine if one
-was found by `ObjectInputStream.resolveClass` method. Otherwise, it returns
-*null*.
-
-The `getFields` method returns an array of `ObjectStreamField` objects that
-represent the serializable fields of this class.
-
-The `getSerialVersionUID` method returns the `serialVersionUID` of this class.
-Refer to [Section 4.6, "Stream Unique
-Identifiers"](#stream-unique-identifiers). If not specified by the class, the
-value returned is a hash computed from the class's name, interfaces, methods,
-and fields using the Secure Hash Algorithm (SHA) as defined by the National
-Institute of Standards.
-
-The `toString` method returns a printable representation of the class
-descriptor including the name of the class and the `serialVersionUID`.
-
-## 4.2 Dynamic Proxy Class Descriptors
-
-ObjectStreamClass descriptors are also used to provide information about
-dynamic proxy classes (e.g., classes obtained via calls to the getProxyClass
-method of java.lang.reflect.Proxy) saved in a serialization stream. A dynamic
-proxy class itself has no serializable fields and a serialVersionUID of 0L. In
-other words, when the Class object for a dynamic proxy class is passed to the
-static lookup method of ObjectStreamClass, the returned ObjectStreamClass
-instance will have the following properties:
-
-- Invoking its getSerialVersionUID method will return 0L.
-- Invoking its getFields method will return an array of length zero.
-- Invoking its getField method with any String argument will return null.
-
-## 4.3 Serialized Form
-
-The serialized form of an ObjectStreamClass instance depends on whether or not
-the Class object it represents is serializable, externalizable, or a dynamic
-proxy class.
-
-When an `ObjectStreamClass` instance that does not represent a dynamic proxy
-class is written to the stream, it writes the class name and
-`serialVersionUID`, flags, and the number of fields. Depending on the class,
-additional information may be written:
-
-- For non-serializable classes, the number of fields is always zero. Neither
- the `SC_SERIALIZABLE` nor the `SC_EXTERNALIZABLE` flag bits are set.
-
-- For serializable classes, the `SC_SERIALIZABLE` flag is set, the number of
- fields counts the number of serializable fields and is followed by a
- descriptor for each serializable field. The descriptors are written in
- canonical order. The descriptors for primitive typed fields are written
- first sorted by field name followed by descriptors for the object typed
- fields sorted by field name. The names are sorted using `String.compareTo`.
- For details of the format, refer to [Section 6.4, "Grammar for the Stream
- Format"](protocol.html#grammar-for-the-stream-format).
-
-- For externalizable classes, flags includes the `SC_EXTERNALIZABLE` flag,
- and the number of fields is always zero.
-
-- For enum types, flags includes the `SC_ENUM` flag, and the number of fields
- is always zero.
-
-When an ObjectOutputStream serializes the ObjectStreamClass descriptor for a
-dynamic proxy class, as determined by passing its Class object to the
-isProxyClass method of java.lang.reflect.Proxy, it writes the number of
-interfaces that the dynamic proxy class implements, followed by the interface
-names. Interfaces are listed in the order that they are returned by invoking
-the getInterfaces method on the Class object of the dynamic proxy class.
-
-The serialized representations of ObjectStreamClass descriptors for dynamic
-proxy classes and non-dynamic proxy classes are differentiated through the use
-of different typecodes (`TC_PROXYCLASSDESC` and `TC_CLASSDESC`, respectively);
-for a more detailed specification of the grammar, see [Section 6.4, "Grammar
-for the Stream Format"](protocol.html#grammar-for-the-stream-format).
-
-## 4.4 The ObjectStreamField Class
-
-An `ObjectStreamField` represents a serializable field of a serializable class.
-The serializable fields of a class can be retrieved from the
-`ObjectStreamClass`.
-
-The special static serializable field, `serialPersistentFields`, is an array of
-`ObjectStreamField` components that is used to override the default
-serializable fields.
-
-```
-package java.io;
-
-public class ObjectStreamField implements Comparable {
-
- public ObjectStreamField(String fieldName,
- Class fieldType);
-
- public ObjectStreamField(String fieldName,
- Class fieldType,
- boolean unshared);
-
- public String getName();
-
- public Class getType();
-
- public String getTypeString();
-
- public char getTypeCode();
-
- public boolean isPrimitive();
-
- public boolean isUnshared();
-
- public int getOffset();
-
- protected void setOffset(int offset);
-
- public int compareTo(Object obj);
-
- public String toString();
-}
-```
-
-`ObjectStreamField` objects are used to specify the serializable fields of a
-class or to describe the fields present in a stream. Its constructors accept
-arguments describing the field to represent: a string specifying the name of
-the field, a `Class` object specifying the type of the field, and a `boolean`
-flag (implicitly `false` for the two-argument constructor) indicating whether
-or not values of the represented field should be read and written as "unshared"
-objects if default serialization/deserialization is in use (see the
-descriptions of the `ObjectInputStream.readUnshared` and
-`ObjectOutputStream.writeUnshared` methods in [Section 3.1, "The
-ObjectInputStream Class"](input.html#the-objectinputstream-class) and [Section
-2.1, "The ObjectOutputStream Class"](output.html#the-objectoutputstream-class),
-respectively).
-
-The `getName` method returns the name of the serializable field.
-
-The `getType` method returns the type of the field.
-
-The `getTypeString` method returns the type signature of the field.
-
-The `getTypeCode` method returns a character encoding of the field type ('`B`'
-for `byte`, '`C`' for `char`, '`D`' for `double`, '`F`' for `float`, '`I`' for
-`int`, '`J`' for `long`, '`L`' for non-array object types, '`S`' for `short`,
-'`Z`' for `boolean`, and '`[`' for arrays).
-
-The `isPrimitive` method returns `true` if the field is of primitive type, or
-`false` otherwise.
-
-The `isUnshared` method returns `true` if values of the field should be written
-as "unshared" objects, or `false` otherwise.
-
-The `getOffset` method returns the offset of the field's value within instance
-data of the class defining the field.
-
-The `setOffset` method allows `ObjectStreamField` subclasses to modify the
-offset value returned by the `getOffset` method.
-
-The `compareTo` method compares `ObjectStreamFields` for use in sorting.
-Primitive fields are ranked as "smaller" than non-primitive fields; fields
-otherwise equal are ranked alphabetically.
-
-The `toString` method returns a printable representation with name and type.
-
-## 4.5 Inspecting Serializable Classes
-
-The program *serialver* can be used to find out if a class is serializable and
-to get its `serialVersionUID`.
-
-When invoked on the command line with one or more class names, serialver prints
-the `serialVersionUID` for each class in a form suitable for copying into an
-evolving class. When invoked with no arguments, it prints a usage line.
-
-## 4.6 Stream Unique Identifiers
-
-Each versioned class must identify the original class version for which it is
-capable of writing streams and from which it can read. For example, a versioned
-class must declare:
-
-```
-private static final long serialVersionUID = 3487495895819393L;
-```
-
-The stream-unique identifier is a 64-bit hash of the class name, interface
-class names, methods, and fields. The value must be declared in all versions of
-a class except the first. It may be declared in the original class but is not
-required. The value is fixed for all compatible classes. If the SUID is not
-declared for a class, the value defaults to the hash for that class. The
-`serialVersionUID` for dynamic proxy classes and enum types always have the
-value *0L*. Array classes cannot declare an explicit `serialVersionUID`, so
-they always have the default computed value, but the requirement for matching
-`serialVersionUID` values is waived for array classes.
-
-**Note:** It is strongly recommended that all serializable classes explicitly
-declare `serialVersionUID` values, since the default `serialVersionUID`
-computation is highly sensitive to class details that may vary depending on
-compiler implementations, and can thus result in unexpected `serialVersionUID`
-conflicts during deserialization, causing deserialization to fail.
-
-The initial version of an `Externalizable` class must output a stream data
-format that is extensible in the future. The initial version of the method
-`readExternal` has to be able to read the output format of all future versions
-of the method `writeExternal`.
-
-The `serialVersionUID` is computed using the signature of a stream of bytes
-that reflect the class definition. The National Institute of Standards and
-Technology (NIST) Secure Hash Algorithm (SHA-1) is used to compute a signature
-for the stream. The first two 32-bit quantities are used to form a 64-bit hash.
-A `java.lang.DataOutputStream` is used to convert primitive data types to a
-sequence of bytes. The values input to the stream are defined by the Java
-Virtual Machine (VM) specification for classes. Class modifiers may include the
-`ACC_PUBLIC`, `ACC_FINAL`, `ACC_INTERFACE`, and `ACC_ABSTRACT` flags; other
-flags are ignored and do not affect `serialVersionUID` computation. Similarly,
-for field modifiers, only the `ACC_PUBLIC`, `ACC_PRIVATE`, `ACC_PROTECTED`,
-`ACC_STATIC`, `ACC_FINAL`, `ACC_VOLATILE`, and `ACC_TRANSIENT` flags are used
-when computing `serialVersionUID` values. For constructor and method modifiers,
-only the `ACC_PUBLIC`, `ACC_PRIVATE`, `ACC_PROTECTED`, `ACC_STATIC`,
-`ACC_FINAL`, `ACC_SYNCHRONIZED`, `ACC_NATIVE`, `ACC_ABSTRACT` and `ACC_STRICT`
-flags are used. Names and descriptors are written in the format used by the
-`java.io.DataOutputStream.writeUTF` method.
-
-The sequence of items in the stream is as follows:
-
-1. The class name.
-
-2. The class modifiers written as a 32-bit integer.
-
-3. The name of each interface sorted by name.
-
-4. For each field of the class sorted by field name (except `private static`
- and `private transient` fields:
-
- a. The name of the field.
-
- b. The modifiers of the field written as a 32-bit integer.
-
- c. The descriptor of the field.
-
-5. If a class initializer exists, write out the following:
-
- a. The name of the method, `<clinit>`.
-
- b. The modifier of the method, `java.lang.reflect.Modifier.STATIC`,
- written as a 32-bit integer.
-
- c. The descriptor of the method, `()V`.
-
-6. For each non-`private` constructor sorted by method name and signature:
-
- a. The name of the method, `<init>`.
-
- b. The modifiers of the method written as a 32-bit integer.
-
- c. The descriptor of the method.
-
-7. For each non-`private` method sorted by method name and signature:
-
- a. The name of the method.
-
- b. The modifiers of the method written as a 32-bit integer.
-
- c. The descriptor of the method.
-
-8. The SHA-1 algorithm is executed on the stream of bytes produced by
- `DataOutputStream` and produces five 32-bit values `sha[0..4]`.
-
-9. The hash value is assembled from the first and second 32-bit values of the
- SHA-1 message digest. If the result of the message digest, the five 32-bit
- words `H0 H1 H2 H3 H4`, is in an array of five `int` values named `sha`,
- the hash value would be computed as follows:
-
-```
- long hash = ((sha[0] >>> 24) & 0xFF) |
- ((sha[0] >>> 16) & 0xFF) << 8 |
- ((sha[0] >>> 8) & 0xFF) << 16 |
- ((sha[0] >>> 0) & 0xFF) << 24 |
- ((sha[1] >>> 24) & 0xFF) << 32 |
- ((sha[1] >>> 16) & 0xFF) << 40 |
- ((sha[1] >>> 8) & 0xFF) << 48 |
- ((sha[1] >>> 0) & 0xFF) << 56;
-```
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/examples.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](exceptions.html) | NEXT'
-include-after: '[CONTENTS](index.html) | [PREV](exceptions.html) | NEXT'
-
-title: 'Java Object Serialization Specification: C - Example of Serializable Fields'
----
-
-- [Example Alternate Implementation of
- java.io.File](#c.1-example-alternate-implementation-of-java.io.file)
-
--------------------------------------------------------------------------------
-
-## C.1 Example Alternate Implementation of java.io.File
-
-This appendix provides a brief example of how an existing class could be
-specified and implemented to interoperate with the existing implementation but
-without requiring the same assumptions about the representation of the file
-name as a *String*.
-
-The system class `java.io.File` represents a filename and has methods for
-parsing, manipulating files and directories by name. It has a single private
-field that contains the current file name. The semantics of the methods that
-parse paths depend on the current path separator which is held in a static
-field. This path separator is part of the serialized state of a file so that
-file name can be adjusted when read.
-
-The serialized state of a `File` object is defined as the serializable fields
-and the sequence of data values for the file. In this case, there is one of
-each.
-
-```
-Serializable Fields:
- String path; // path name with embedded separators
-Serializable Data:
- char // path name separator for path name
-```
-
-An alternate implementation might be defined as follows:
-
-```
-class File implements java.io.Serializable {
- ...
- private String[] pathcomponents;
- // Define serializable fields with the ObjectStreamClass
-
- /**
- * @serialField path String
- * Path components separated by separator.
- */
-
- private static final ObjectStreamField[] serialPersistentFields
- = { new ObjectStreamField("path", String.class) };
- ...
- /**
- * @serialData Default fields followed by separator character.
- */
-
- private void writeObject(ObjectOutputStream s)
- throws IOException
- {
- ObjectOutputStream.PutField fields = s.putFields();
- StringBuffer str = new StringBuffer();
- for(int i = 0; i < pathcomponents; i++) {
- str.append(separator);
- str.append(pathcomponents[i]);
- }
- fields.put("path", str.toString());
- s.writeFields();
- s.writeChar(separatorChar); // Add the separator character
- }
- ...
-
- private void readObject(ObjectInputStream s)
- throws IOException
- {
- ObjectInputStream.GetField fields = s.readFields();
- String path = (String)fields.get("path", null);
- ...
- char sep = s.readChar(); // read the previous separator char
-
- // parse path into components using the separator
- // and store into pathcomponents array.
- }
-}
-```
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/exceptions.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](security.html) | [NEXT](examples.html)'
-include-after: '[CONTENTS](index.html) | [PREV](security.html) | [NEXT](examples.html)'
-
-title: 'Java Object Serialization Specification: B - Exceptions In Object Serialization'
----
-
--------------------------------------------------------------------------------
-
-All exceptions thrown by serialization classes are subclasses of
-`ObjectStreamException` which is a subclass of `IOException`.
-
-### `ObjectStreamException`
-
-Superclass of all serialization exceptions.
-
-### `InvalidClassException`
-
-Thrown when a class cannot be used to restore objects for any of these reasons:
-
-- The class does not match the serial version of the class in the stream.
-- The class contains fields with invalid primitive data types.
-- The `Externalizable` class does not have a public no-arg constructor.
-- The `Serializable` class can not access the no-arg constructor of its
- closest non-Serializable superclass.
-
-### `NotSerializableException`
-
-Thrown by a `readObject` or `writeObject` method to terminate serialization or
-deserialization.
-
-### `StreamCorruptedException`
-
-Thrown:
-
-- If the stream header is invalid.
-- If control information not found.
-- If control information is invalid.
-- JDK 1.1.5 or less attempts to call `readExternal` on a `PROTOCOL_VERSION_2`
- stream.
-
-### `NotActiveException`
-
-Thrown if `writeObject` state is invalid within the following
-`ObjectOutputStream` methods:
-
-- `defaultWriteObject`
-- `putFields`
-- `writeFields`
-
-Thrown if `readObject` state is invalid within the following
-`ObjectInputStream` methods:
-
-- `defaultReadObject`
-- `readFields`
-- `registerValidation`
-
-### `InvalidObjectException`
-
-Thrown when a restored object cannot be made valid.
-
-### `OptionalDataException`
-
-Thrown by `readObject` when there is primitive data in the stream and an object
-is expected. The length field of the exception indicates the number of bytes
-that are available in the current block.
-
-### `WriteAbortedException`
-
-Thrown when reading a stream terminated by an exception that occurred while the
-stream was being written.
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
Binary file jdk/src/java.base/share/specs/serialization/images/version.gif has changed
--- a/jdk/src/java.base/share/specs/serialization/index.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: 'CONTENTS | PREV | [NEXT](serial-arch.html)'
-include-after: 'CONTENTS | PREV | [NEXT](serial-arch.html)'
-
-title: 'Java Object Serialization Specification: Contents'
----
-
--------------------------------------------------------------------------------
-
-## Table of Contents
-
-### 1 [System Architecture](serial-arch.html)
-
-- 1.1 [Overview](serial-arch.html#overview)
-- 1.2 [Writing to an Object
- Stream](serial-arch.html#writing-to-an-object-stream)
-- 1.3 [Reading from an Object
- Stream](serial-arch.html#reading-from-an-object-stream)
-- 1.4 [Object Streams as
- Containers](serial-arch.html#object-streams-as-containers)
-- 1.5 [Defining Serializable Fields for a
- Class](serial-arch.html#defining-serializable-fields-for-a-class)
-- 1.6 [Documenting Serializable Fields and Data for a
- Class](serial-arch.html#documenting-serializable-fields-and-data-for-a-class)
-- 1.7 [Accessing Serializable Fields of a
- Class](serial-arch.html#accessing-serializable-fields-of-a-class)
-- 1.8 [The ObjectOutput
- Interface](serial-arch.html#the-objectoutput-interface)
-- 1.9 [The ObjectInput Interface](serial-arch.html#the-objectinput-interface)
-- 1.10 [The Serializable
- Interface](serial-arch.html#the-serializable-interface)
-- 1.11 [The Externalizable
- Interface](serial-arch.html#the-externalizable-interface)
-- 1.12 [Serialization of Enum
- Constants](serial-arch.html#serialization-of-enum-constants)
-- 1.13 [Protecting Sensitive
- Information](serial-arch.html#protecting-sensitive-information)
-
-### 2 [Object Output Classes](output.html)
-
-- 2.1 [The ObjectOutputStream
- Class](output.html#the-objectoutputstream-class)
-- 2.2 [The ObjectOutputStream.PutField
- Class](output.html#the-objectoutputstream.putfield-class)
-- 2.3 [The writeObject Method](output.html#the-writeobject-method)
-- 2.4 [The writeExternal Method](output.html#the-writeexternal-method)
-- 2.5 [The writeReplace Method](output.html#the-writereplace-method)
-- 2.6 [The useProtocolVersion
- Method](output.html#the-useprotocolversion-method)
-
-### 3 [Object Input Classes](input.html)
-
-- 3.1 [The ObjectInputStream Class](input.html#the-objectinputstream-class)
-- 3.2 [The ObjectInputStream.GetField
- Class](input.html#the-objectinputstream.getfield-class)
-- 3.3 [The ObjectInputValidation
- Interface](input.html#the-objectinputvalidation-interface)
-- 3.4 [The readObject Method](input.html#the-readobject-method)
-- 3.5 [The readObjectNoData Method](input.html#the-readobjectnodata-method)
-- 3.6 [The readExternal Method](input.html#the-readexternal-method)
-- 3.7 [The readResolve Method](input.html#the-readresolve-method)
-
-### 4 [Class Descriptors](class.html)
-
-- 4.1 [The ObjectStreamClass Class](class.html#the-objectstreamclass-class)
-- 4.2 [Dynamic Proxy Class
- Descriptors](class.html#dynamic-proxy-class-descriptors)
-- 4.3 [Serialized Form](class.html#serialized-form)
-- 4.4 [The ObjectStreamField Class](class.html#the-objectstreamfield-class)
-- 4.5 [Inspecting Serializable
- Classes](class.html#inspecting-serializable-classes)
-- 4.6 [Stream Unique Identifiers](class.html#stream-unique-identifiers)
-
-### 5 [Versioning of Serializable Objects](version.html)
-
-- 5.1 [Overview](version.html#overview)
-- 5.2 [Goals](version.html#goals)
-- 5.3 [Assumptions](version.html#assumptions)
-- 5.4 [Who's Responsible for Versioning of
- Streams](version.html#whos-responsible-for-versioning-of-streams)
-- 5.5 [Compatible Java Type
- Evolution](version.html#compatible-java-type-evolution)
-- 5.6 [Type Changes Affecting
- Serialization](version.html#type-changes-affecting-serialization)
- - 5.6.1 [Incompatible Changes](version.html#incompatible-changes)
- - 5.6.2 [Compatible Changes](version.html#compatible-changes)
-
-### 6 [Object Serialization Stream Protocol](protocol.html)
-
-- 6.1 [Overview](protocol.html#overview)
-- 6.2 [Stream Elements](protocol.html#stream-elements)
-- 6.3 [Stream Protocol Versions](protocol.html#stream-protocol-versions)
-- 6.4 [Grammar for the Stream
- Format](protocol.html#grammar-for-the-stream-format)
- - 6.4.1 [Rules of the Grammar](protocol.html#rules-of-the-grammar)
- - 6.4.2 [Terminal Symbols and
- Constants](protocol.html#terminal-symbols-and-constants)
-
-### A [Security in Object Serialization](security.html)
-
-### B [Exceptions In Object Serialization](exceptions.html)
-
-### C [Example of Serializable Fields](examples.html)
-
-- [C.1 Example Alternate Implementation of
- `java.io.File`](examples.html#c.1-example-alternate-implementation-of-java.io.file)
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/input.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,672 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](output.html) | [NEXT](class.html)'
-include-after: '[CONTENTS](index.html) | [PREV](output.html) | [NEXT](class.html)'
-
-title: 'Java Object Serialization Specification: 3 - Object Input Classes'
----
-
-- [The ObjectInputStream Class](#the-objectinputstream-class)
-- [The ObjectInputStream.GetField
- Class](#the-objectinputstream.getfield-class)
-- [The ObjectInputValidation Interface](#the-objectinputvalidation-interface)
-- [The readObject Method](#the-readobject-method)
-- [The readExternal Method](#the-readexternal-method)
-- [The readResolve Method](#the-readresolve-method)
-
--------------------------------------------------------------------------------
-
-## 3.1 The ObjectInputStream Class
-
-Class `ObjectInputStream` implements object deserialization. It maintains the
-state of the stream including the set of objects already deserialized. Its
-methods allow primitive types and objects to be read from a stream written by
-`ObjectOutputStream`. It manages restoration of the object and the objects that
-it refers to from the stream.
-
-```
-package java.io;
-
-public class ObjectInputStream
- extends InputStream
- implements ObjectInput, ObjectStreamConstants
-{
- public ObjectInputStream(InputStream in)
- throws StreamCorruptedException, IOException;
-
- public final Object readObject()
- throws OptionalDataException, ClassNotFoundException,
- IOException;
-
- public Object readUnshared()
- throws OptionalDataException, ClassNotFoundException,
- IOException;
-
- public void defaultReadObject()
- throws IOException, ClassNotFoundException,
- NotActiveException;
-
- public GetField readFields()
- throws IOException;
-
- public synchronized void registerValidation(
- ObjectInputValidation obj, int prio)
- throws NotActiveException, InvalidObjectException;
-
- protected ObjectStreamClass readClassDescriptor()
- throws IOException, ClassNotFoundException;
-
- protected Class resolveClass(ObjectStreamClass v)
- throws IOException, ClassNotFoundException;
-
- protected Object resolveObject(Object obj)
- throws IOException;
-
- protected boolean enableResolveObject(boolean enable)
- throws SecurityException;
-
- protected void readStreamHeader()
- throws IOException, StreamCorruptedException;
-
- public int read() throws IOException;
-
- public int read(byte[] data, int offset, int length)
- throws IOException
-
- public int available() throws IOException;
-
- public void close() throws IOException;
-
- public boolean readBoolean() throws IOException;
-
- public byte readByte() throws IOException;
-
- public int readUnsignedByte() throws IOException;
-
- public short readShort() throws IOException;
-
- public int readUnsignedShort() throws IOException;
-
- public char readChar() throws IOException;
-
- public int readInt() throws IOException;
-
- public long readLong() throws IOException;
-
- public float readFloat() throws IOException;
-
- public double readDouble() throws IOException;
-
- public void readFully(byte[] data) throws IOException;
-
- public void readFully(byte[] data, int offset, int size)
- throws IOException;
-
- public int skipBytes(int len) throws IOException;
-
- public String readLine() throws IOException;
-
- public String readUTF() throws IOException;
-
- // Class to provide access to serializable fields.
- static abstract public class GetField
- {
- public ObjectStreamClass getObjectStreamClass();
-
- public boolean defaulted(String name)
- throws IOException, IllegalArgumentException;
-
- public char get(String name, char default)
- throws IOException, IllegalArgumentException;
-
- public boolean get(String name, boolean default)
- throws IOException, IllegalArgumentException;
-
- public byte get(String name, byte default)
- throws IOException, IllegalArgumentException;
-
- public short get(String name, short default)
- throws IOException, IllegalArgumentException;
-
- public int get(String name, int default)
- throws IOException, IllegalArgumentException;
-
- public long get(String name, long default)
- throws IOException, IllegalArgumentException;
-
- public float get(String name, float default)
- throws IOException, IllegalArgumentException;
-
- public double get(String name, double default)
- throws IOException, IllegalArgumentException;
-
- public Object get(String name, Object default)
- throws IOException, IllegalArgumentException;
- }
-
- protected ObjectInputStream()
- throws StreamCorruptedException, IOException;
-
- protected readObjectOverride()
- throws OptionalDataException, ClassNotFoundException,
- IOException;
-}
-```
-
-The single-argument `ObjectInputStream` constructor requires an `InputStream`.
-The constructor calls `readStreamHeader` to read and verifies the header and
-version written by the corresponding `ObjectOutputStream.writeStreamHeader`
-method. If a security manager is installed, this constructor checks for the
-`"enableSubclassImplementation"` `SerializablePermission` when invoked directly
-or indirectly by the constructor of a subclass which overrides the `readFields`
-and/or `readUnshared` methods.
-
-**Note:** The `ObjectInputStream` constructor blocks until it completes reading
-the serialization stream header. Code which waits for an `ObjectInputStream` to
-be constructed before creating the corresponding `ObjectOutputStream` for that
-stream will deadlock, since the `ObjectInputStream` constructor will block
-until a header is written to the stream, and the header will not be written to
-the stream until the `ObjectOutputStream` constructor executes. This problem
-can be resolved by creating the `ObjectOutputStream` before the
-`ObjectInputStream`, or otherwise removing the timing dependency between
-completion of `ObjectInputStream` construction and the creation of the
-`ObjectOutputStream`.
-
-The `readObject` method is used to deserialize an object from the stream. It
-reads from the stream to reconstruct an object.
-
-1. If the `ObjectInputStream` subclass is overriding the implementation, call
- the `readObjectOverride` method and return. Reimplementation is described
- at the end of this section.
-
-2. If a block data record occurs in the stream, throw a `BlockDataException`
- with the number of available bytes.
-
-3. If the object in the stream is null, return null.
-
-4. If the object in the stream is a handle to a previous object, return the
- object.
-
-5. If the object in the stream is a `Class`, read its `ObjectStreamClass`
- descriptor, add it and its handle to the set of known objects, and return
- the corresponding `Class` object.
-
-6. If the object in the stream is an `ObjectStreamClass`, read in its data
- according to the formats described in [Section 4.3, "Serialized
- Form"](class.html#serialized-form). Add it and its handle to the set of
- known objects. In versions 1.3 and later of the Java 2 SDK, Standard
- Edition, the `readClassDescriptor` method is called to read in the
- `ObjectStreamClass` if it represents a class that is not a dynamic proxy
- class, as indicated in the stream data. If the class descriptor represents
- a dynamic proxy class, call the `resolveProxyClass` method on the stream to
- get the local class for the descriptor; otherwise, call the `resolveClass`
- method on the stream to get the local class. If the class cannot be
- resolved, throw a ClassNotFoundException. Return the resulting
- `ObjectStreamClass` object.
-
-7. If the object in the stream is a `String`, read its length information
- followed by the contents of the string encoded in modified UTF-8. For
- details, refer to [Section 6.2, "Stream
- Elements"](protocol.html#stream-elements). Add the `String` and its handle
- to the set of known objects, and proceed to Step 12.
-
-8. If the object in the stream is an array, read its `ObjectStreamClass` and
- the length of the array. Allocate the array, and add it and its handle in
- the set of known objects. Read each element using the appropriate method
- for its type and assign it to the array. Proceed to Step 12.
-
-9. If the object in the stream is an enum constant, read its
- `ObjectStreamClass` and the enum constant name. If the `ObjectStreamClass`
- represents a class that is not an enum type, an `InvalidClassException` is
- thrown. Obtain a reference to the enum constant by calling the
- `java.lang.Enum.valueOf` method, passing the enum type bound to the
- received `ObjectStreamClass` along with the received name as arguments. If
- the `valueOf` method throws an `IllegalArgumentException`, an
- `InvalidObjectException` is thrown with the `IllegalArgumentException` as
- its cause. Add the enum constant and its handle in the set of known
- objects, and proceed to Step 12.
-
-10. For all other objects, the `ObjectStreamClass` of the object is read from
- the stream. The local class for that `ObjectStreamClass` is retrieved. The
- class must be serializable or externalizable, and must not be an enum type.
- If the class does not satisfy these criteria, an `InvalidClassException` is
- thrown.
-
-11. An instance of the class is allocated. The instance and its handle are
- added to the set of known objects. The contents restored appropriately:
-
- a. For serializable objects, the no-arg constructor for the first
- non-serializable supertype is run. For serializable classes, the fields
- are initialized to the default value appropriate for its type. Then the
- fields of each class are restored by calling class-specific
- `readObject` methods, or if these are not defined, by calling the
- `defaultReadObject` method. Note that field initializers and
- constructors are not executed for serializable classes during
- deserialization. In the normal case, the version of the class that
- wrote the stream will be the same as the class reading the stream. In
- this case, all of the supertypes of the object in the stream will match
- the supertypes in the currently-loaded class. If the version of the
- class that wrote the stream had different supertypes than the loaded
- class, the `ObjectInputStream` must be more careful about restoring or
- initializing the state of the differing classes. It must step through
- the classes, matching the available data in the stream with the classes
- of the object being restored. Data for classes that occur in the
- stream, but do not occur in the object, is discarded. For classes that
- occur in the object, but not in the stream, the class fields are set to
- default values by default serialization.
-
- b. For externalizable objects, the no-arg constructor for the class is run
- and then the `readExternal` method is called to restore the contents of
- the object.
-
-12. Process potential substitutions by the class of the object and/or by a
- subclass of `ObjectInputStream`:
-
- a. If the class of the object is not an enum type and defines the
- appropriate `readResolve` method, the method is called to allow the
- object to replace itself.
-
- b. Then if previously enabled by `enableResolveObject,` the
- `resolveObject` method is called to allow subclasses of the stream to
- examine and replace the object. If the previous step did replace the
- original object, the `resolveObject` method is called with the
- replacement object. If a replacement took place, the table of known
- objects is updated so the replacement object is associated with the
- handle. The replacement object is then returned from `readObject`.
-
-All of the methods for reading primitives types only consume bytes from the
-block data records in the stream. If a read for primitive data occurs when the
-next item in the stream is an object, the read methods return *-1* or the
-`EOFException` as appropriate. The value of a primitive type is read by a
-`DataInputStream` from the block data record.
-
-The exceptions thrown reflect errors during the traversal or exceptions that
-occur on the underlying stream. If any exception is thrown, the underlying
-stream is left in an unknown and unusable state.
-
-When the reset token occurs in the stream, all of the state of the stream is
-discarded. The set of known objects is cleared.
-
-When the exception token occurs in the stream, the exception is read and a new
-`WriteAbortedException` is thrown with the terminating exception as an
-argument. The stream context is reset as described earlier.
-
-The `readUnshared` method is used to read "unshared" objects from the stream.
-This method is identical to `readObject`, except that it prevents subsequent
-calls to `readObject` and `readUnshared` from returning additional references
-to the deserialized instance returned by the original call to `readUnshared`.
-Specifically:
-
-- If `readUnshared` is called to deserialize a back-reference (the stream
- representation of an object which has been written previously to the
- stream), an `ObjectStreamException` will be thrown.
-
-- If `readUnshared` returns successfully, then any subsequent attempts to
- deserialize back-references to the stream handle deserialized by
- `readUnshared` will cause an `ObjectStreamException` to be thrown.
-
-Deserializing an object via `readUnshared` invalidates the stream handle
-associated with the returned object. Note that this in itself does not always
-guarantee that the reference returned by `readUnshared` is unique; the
-deserialized object may define a `readResolve` method which returns an object
-visible to other parties, or `readUnshared` may return a `Class` object or enum
-constant obtainable elsewhere in the stream or through external means. If the
-deserialized object defines a `readResolve` method and the invocation of that
-method returns an array, then `readUnshared` returns a shallow clone of that
-array; this guarantees that the returned array object is unique and cannot be
-obtained a second time from an invocation of `readObject` or `readUnshared` on
-the `ObjectInputStream`, even if the underlying data stream has been
-manipulated.
-
-The `defaultReadObject` method is used to read the fields and object from the
-stream. It uses the class descriptor in the stream to read the fields in the
-canonical order by name and type from the stream. The values are assigned to
-the matching fields by name in the current class. Details of the versioning
-mechanism can be found in [Section 5.5, "Compatible Java Type
-Evolution"](version.html#compatible-java-type-evolution). Any field of the
-object that does not appear in the stream is set to its default value. Values
-that appear in the stream, but not in the object, are discarded. This occurs
-primarily when a later version of a class has written additional fields that do
-not occur in the earlier version. This method may only be called from the
-`readObject` method while restoring the fields of a class. When called at any
-other time, the `NotActiveException` is thrown.
-
-The `readFields` method reads the values of the serializable fields from the
-stream and makes them available via the `GetField` class. The `readFields`
-method is only callable from within the `readObject` method of a serializable
-class. It cannot be called more than once or if `defaultReadObject` has been
-called. The `GetFields` object uses the current object's `ObjectStreamClass` to
-verify the fields that can be retrieved for this class. The `GetFields` object
-returned by `readFields` is only valid during this call to the classes
-`readObject` method. The fields may be retrieved in any order. Additional data
-may only be read directly from stream after `readFields` has been called.
-
-The `registerValidation` method can be called to request a callback when the
-entire graph has been restored but before the object is returned to the
-original caller of `readObject`. The order of validate callbacks can be
-controlled using the priority. Callbacks registered with higher values are
-called before those with lower values. The object to be validated must support
-the `ObjectInputValidation` interface and implement the `validateObject`
-method. It is only correct to register validations during a call to a class's
-`readObject` method. Otherwise, a `NotActiveException` is thrown. If the
-callback object supplied to `registerValidation` is null, an
-`InvalidObjectException` is thrown.
-
-Starting with the Java SDK, Standard Edition, v1.3, the `readClassDescriptor`
-method is used to read in all `ObjectStreamClass` objects.
-`readClassDescriptor` is called when the `ObjectInputStream` expects a class
-descriptor as the next item in the serialization stream. Subclasses of
-`ObjectInputStream` may override this method to read in class descriptors that
-have been written in non-standard formats (by subclasses of
-`ObjectOutputStream` which have overridden the `writeClassDescriptor` method).
-By default, this method reads class descriptors according to the format
-described in [Section 6.4, "Grammar for the Stream
-Format"](protocol.html#grammar-for-the-stream-format).
-
-The `resolveClass` method is called while a class is being deserialized, and
-after the class descriptor has been read. Subclasses may extend this method to
-read other information about the class written by the corresponding subclass of
-`ObjectOutputStream`. The method must find and return the class with the given
-name and `serialVersionUID`. The default implementation locates the class by
-calling the class loader of the closest caller of `readObject` that has a class
-loader. If the class cannot be found `ClassNotFoundException` should be thrown.
-Prior to JDK 1.1.6, the `resolveClass` method was required to return the same
-fully qualified class name as the class name in the stream. In order to
-accommodate package renaming across releases, `method` `resolveClass` only
-needs to return a class with the same base class name and `SerialVersionUID` in
-JDK 1.1.6 and later versions.
-
-The `resolveObject` method is used by trusted subclasses to monitor or
-substitute one object for another during deserialization. Resolving objects
-must be enabled explicitly by calling `enableResolveObject` before calling
-`readObject` for the first object to be resolved. Once enabled, `resolveObject`
-is called once for each serializable object just prior to the first time it is
-being returned from `readObject`. Note that the `resolveObject` method is not
-called for objects of the specially handled classes, `Class`,
-`ObjectStreamClass`, `String`, and arrays. A subclass's implementation of
-`resolveObject` may return a substitute object that will be assigned or
-returned instead of the original. The object returned must be of a type that is
-consistent and assignable to every reference of the original object or else a
-`ClassCastException` will be thrown. All assignments are type-checked. All
-references in the stream to the original object will be replaced by references
-to the substitute object.
-
-The `enableResolveObject` method is called by trusted subclasses of
-`ObjectOutputStream` to enable the monitoring or substitution of one object for
-another during deserialization. Replacing objects is disabled until
-`enableResolveObject` is called with a `true` value. It may thereafter be
-disabled by setting it to `false`. The previous setting is returned. The
-`enableResolveObject` method checks if the stream has permission to request
-substitution during serialization. To ensure that the private state of objects
-is not unintentionally exposed, only trusted streams may use `resolveObject`.
-Trusted classes are those classes with a class loader equal to null or belong
-to a security protection domain that provides permission to enable
-substitution.
-
-If the subclass of `ObjectInputStream` is not considered part of the system
-domain, a line has to be added to the security policy file to provide to a
-subclass of `ObjectInputStream` permission to call `enableResolveObject`. The
-`SerializablePermission` to add is `"enableSubstitution"`.
-`AccessControlException` is thrown if the protection domain of the subclass of
-`ObjectStreamClass` does not have permission to `"enableSubstitution"` by
-calling `enableResolveObject`. See the document Java Security Architecture (JDK
-1.2) for additional information about the security model.
-
-The `readStreamHeader` method reads and verifies the magic number and version
-of the stream. If they do not match, the `StreamCorruptedMismatch` is thrown.
-
-To override the implementation of deserialization, a subclass of
-`ObjectInputStream` should call the protected no-arg `ObjectInputStream`,
-constructor. There is a security check within the no-arg constructor for
-`SerializablePermission "enableSubclassImplementation"` to ensure that only
-trusted classes are allowed to override the default implementation. This
-constructor does not allocate any private data for `ObjectInputStream` and sets
-a flag that indicates that the final `readObject` method should invoke the
-`readObjectOverride` method and return. All other `ObjectInputStream` methods
-are not final and can be directly overridden by the subclass.
-
-## 3.2 The ObjectInputStream.GetField Class
-
-The class `ObjectInputStream.GetField` provides the API for getting the values
-of serializable fields. The protocol of the stream is the same as used by
-`defaultReadObject.` Using `readFields` to access the serializable fields does
-not change the format of the stream. It only provides an alternate API to
-access the values which does not require the class to have the corresponding
-non-transient and non-static fields for each named serializable field. The
-serializable fields are those declared using `serialPersistentFields` or if it
-is not declared the non-transient and non-static fields of the object. When the
-stream is read the available serializable fields are those written to the
-stream when the object was serialized. If the class that wrote the stream is a
-different version not all fields will correspond to the serializable fields of
-the current class. The available fields can be retrieved from the
-`ObjectStreamClass` of the `GetField` object.
-
-The `getObjectStreamClass` method returns an `ObjectStreamClass` object
-representing the class in the stream. It contains the list of serializable
-fields.
-
-The `defaulted` method returns *true* if the field is not present in the
-stream. An `IllegalArgumentException` is thrown if the requested field is not a
-serializable field of the current class.
-
-Each `get` method returns the specified serializable field from the stream. I/O
-exceptions will be thrown if the underlying stream throws an exception. An
-`IllegalArgumentException` is thrown if the name or type does not match the
-name and type of an field serializable field of the current class. The default
-value is returned if the stream does not contain an explicit value for the
-field.
-
-## 3.3 The ObjectInputValidation Interface
-
-This interface allows an object to be called when a complete graph of objects
-has been deserialized. If the object cannot be made valid, it should throw the
-`ObjectInvalidException`. Any exception that occurs during a call to
-`validateObject` will terminate the validation process, and the
-`InvalidObjectException` will be thrown.
-
-```
-package java.io;
-
-public interface ObjectInputValidation
-{
- public void validateObject()
- throws InvalidObjectException;
-}
-```
-
-## 3.4 The readObject Method
-
-For serializable objects, the `readObject` method allows a class to control the
-deserialization of its own fields. Here is its signature:
-
-```
-private void readObject(ObjectInputStream stream)
- throws IOException, ClassNotFoundException;
-```
-
-Each subclass of a serializable object may define its own `readObject` method.
-If a class does not implement the method, the default serialization provided by
-`defaultReadObject` will be used. When implemented, the class is only
-responsible for restoring its own fields, not those of its supertypes or
-subtypes.
-
-The `readObject` method of the class, if implemented, is responsible for
-restoring the state of the class. The values of every field of the object
-whether transient or not, static or not are set to the default value for the
-fields type. Either `ObjectInputStream`'s `defaultReadObject` or `readFields`
-method must be called once (and only once) before reading any optional data
-written by the corresponding `writeObject` method; even if no optional data is
-read, `defaultReadObject` or `readFields` must still be invoked once. If the
-`readObject` method of the class attempts to read more data than is present in
-the optional part of the stream for this class, the stream will return `-1` for
-bytewise reads, throw an `EOFException` for primitive data reads (e.g.,
-`readInt`, `readFloat`), or throw an `OptionalDataException` with the `eof`
-field set to `true` for object reads.
-
-The responsibility for the format, structure, and versioning of the optional
-data lies completely with the class. The `@serialData` javadoc tag within the
-javadoc comment for the `readObject` method should be used to document the
-format and structure of the optional data.
-
-If the class being restored is not present in the stream being read, then its
-`readObjectNoData` method, if defined, is invoked (instead of `readObject`);
-otherwise, its fields are initialized to the appropriate default values. For
-further detail, see [Section 3.5, "The readObjectNoData
-Method"](#the-readobjectnodata-method).
-
-Reading an object from the `ObjectInputStream` is analogous to creating a new
-object. Just as a new object's constructors are invoked in the order from the
-superclass to the subclass, an object being read from a stream is deserialized
-from superclass to subclass. The `readObject` or `readObjectNoData` method is
-called instead of the constructor for each `Serializable` subclass during
-deserialization.
-
-One last similarity between a constructor and a `readObject` method is that
-both provide the opportunity to invoke a method on an object that is not fully
-constructed. Any overridable (neither private, static nor final) method called
-while an object is being constructed can potentially be overridden by a
-subclass. Methods called during the construction phase of an object are
-resolved by the actual type of the object, not the type currently being
-initialized by either its constructor or `readObject`/`readObjectNoData`
-method. Therefore, calling an overridable method from within a `readObject` or
-`readObjectNoData` method may result in the unintentional invocation of a
-subclass method before the superclass has been fully initialized.
-
-## 3.5 The readObjectNoData Method
-
-For serializable objects, the `readObjectNoData` method allows a class to
-control the initialization of its own fields in the event that a subclass
-instance is deserialized and the serialization stream does not list the class
-in question as a superclass of the deserialized object. This may occur in cases
-where the receiving party uses a different version of the deserialized
-instance's class than the sending party, and the receiver's version extends
-classes that are not extended by the sender's version. This may also occur if
-the serialization stream has been tampered; hence, `readObjectNoData` is useful
-for initializing deserialized objects properly despite a "hostile" or
-incomplete source stream.
-
-```
-private void readObjectNoData() throws ObjectStreamException;
-```
-
-Each serializable class may define its own `readObjectNoData` method. If a
-serializable class does not define a `readObjectNoData` method, then in the
-circumstances listed above the fields of the class will be initialized to their
-default values (as listed in The Java Language Specification); this behavior is
-consistent with that of `ObjectInputStream` prior to version 1.4 of the Java 2
-SDK, Standard Edition, when support for `readObjectNoData` methods was
-introduced. If a serializable class does define a `readObjectNoData` method and
-the aforementioned conditions arise, then `readObjectNoData` will be invoked at
-the point during deserialization when a class-defined `readObject` method would
-otherwise be called had the class in question been listed by the stream as a
-superclass of the instance being deserialized.
-
-## 3.6 The readExternal Method
-
-Objects implementing `java.io.Externalizable` must implement the `readExternal`
-method to restore the entire state of the object. It must coordinate with its
-superclasses to restore their state. All of the methods of `ObjectInput` are
-available to restore the object's primitive typed fields and object fields.
-
-```
-public void readExternal(ObjectInput stream)
- throws IOException;
-```
-
-**Note:** The `readExternal` method is public, and it raises the risk of a
-client being able to overwrite an existing object from a stream. The class may
-add its own checks to insure that this is only called when appropriate.
-
-A new stream protocol version has been introduced in JDK 1.2 to correct a
-problem with `Externalizable` objects. The old definition of `Externalizable`
-objects required the local virtual machine to find a `readExternal` method to
-be able to properly read an `Externalizable` object from the stream. The new
-format adds enough information to the stream protocol so serialization can skip
-an `Externalizable` object when the local `readExternal` method is not
-available. Due to class evolution rules, serialization must be able to skip an
-`Externalizable` object in the input stream if there is not a mapping for the
-object using the local classes.
-
-An additional benefit of the new `Externalizable` stream format is that
-`ObjectInputStream` can detect attempts to read more External data than is
-available, and can also skip by any data that is left unconsumed by a
-`readExternal` method. The behavior of `ObjectInputStream` in response to a
-read past the end of External data is the same as the behavior when a
-class-defined `readObject` method attempts to read past the end of its optional
-data: bytewise reads will return `-1`, primitive reads will throw
-`EOFException`s, and object reads will throw `OptionalDataException`s with the
-`eof` field set to `true`.
-
-Due to the format change, JDK 1.1.6 and earlier releases are not able to read
-the new format. `StreamCorruptedException` is thrown when JDK 1.1.6 or earlier
-attempts to read an `Externalizable` object from a stream written in
-`PROTOCOL_VERSION_2`. Compatibility issues are discussed in more detail in
-[Section 6.3, "Stream Protocol
-Versions"](protocol.html#stream-protocol-versions).
-
-## 3.7 The readResolve Method
-
-For Serializable and Externalizable classes, the `readResolve` method allows a
-class to replace/resolve the object read from the stream before it is returned
-to the caller. By implementing the `readResolve` method, a class can directly
-control the types and instances of its own instances being deserialized. The
-method is defined as follows:
-
-```
-ANY-ACCESS-MODIFIER Object readResolve()
- throws ObjectStreamException;
-```
-
-The `readResolve` method is called when `ObjectInputStream` has read an object
-from the stream and is preparing to return it to the caller.
-`ObjectInputStream` checks whether the class of the object defines the
-`readResolve` method. If the method is defined, the `readResolve` method is
-called to allow the object in the stream to designate the object to be
-returned. The object returned should be of a type that is compatible with all
-uses. If it is not compatible, a `ClassCastException` will be thrown when the
-type mismatch is discovered.
-
-For example, a `Symbol` class could be created for which only a single instance
-of each symbol binding existed within a virtual machine. The `readResolve`
-method would be implemented to determine if that symbol was already defined and
-substitute the preexisting equivalent `Symbol` object to maintain the identity
-constraint. In this way the uniqueness of `Symbol` objects can be maintained
-across serialization.
-
-**Note:** The `readResolve` method is not invoked on the object until the
-object is fully constructed, so any references to this object in its object
-graph will not be updated to the new object nominated by `readResolve`.
-However, during the serialization of an object with the `writeReplace` method,
-all references to the original object in the replacement object's object graph
-are replaced with references to the replacement object. Therefore in cases
-where an object being serialized nominates a replacement object whose object
-graph has a reference to the original object, deserialization will result in an
-incorrect graph of objects. Furthermore, if the reference types of the object
-being read (nominated by `writeReplace`) and the original object are not
-compatible, the construction of the object graph will raise a
-`ClassCastException`.
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/output.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,514 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](serial-arch.html) | [NEXT](input.html)'
-include-after: '[CONTENTS](index.html) | [PREV](serial-arch.html) | [NEXT](input.html)'
-
-title: 'Java Object Serialization Specification: 2 - Object Output Classes'
----
-
-- [The ObjectOutputStream Class](#the-objectoutputstream-class)
-- [The ObjectOutputStream.PutField
- Class](#the-objectoutputstream.putfield-class)
-- [The writeObject Method](#the-writeobject-method)
-- [The writeExternal Method](#the-writeexternal-method)
-- [The writeReplace Method](#the-writereplace-method)
-- [The useProtocolVersion Method](#the-useprotocolversion-method)
-
--------------------------------------------------------------------------------
-
-## 2.1 The ObjectOutputStream Class
-
-Class `ObjectOutputStream` implements object serialization. It maintains the
-state of the stream including the set of objects already serialized. Its
-methods control the traversal of objects to be serialized to save the specified
-objects and the objects to which they refer.
-
-```
-package java.io;
-
-public class ObjectOutputStream
- extends OutputStream
- implements ObjectOutput, ObjectStreamConstants
-{
- public ObjectOutputStream(OutputStream out)
- throws IOException;
-
- public final void writeObject(Object obj)
- throws IOException;
-
- public void writeUnshared(Object obj)
- throws IOException;
-
- public void defaultWriteObject()
- throws IOException, NotActiveException;
-
- public PutField putFields()
- throws IOException;
-
- public writeFields()
- throws IOException;
-
- public void reset() throws IOException;
-
- protected void annotateClass(Class cl) throws IOException;
-
- protected void writeClassDescriptor(ObjectStreamClass desc)
- throws IOException;
-
- protected Object replaceObject(Object obj) throws IOException;
-
- protected boolean enableReplaceObject(boolean enable)
- throws SecurityException;
-
- protected void writeStreamHeader() throws IOException;
-
- public void write(int data) throws IOException;
-
- public void write(byte b[]) throws IOException;
-
- public void write(byte b[], int off, int len) throws IOException;
-
- public void flush() throws IOException;
-
- protected void drain() throws IOException;
-
- public void close() throws IOException;
-
- public void writeBoolean(boolean data) throws IOException;
-
- public void writeByte(int data) throws IOException;
-
- public void writeShort(int data) throws IOException;
-
- public void writeChar(int data) throws IOException;
-
- public void writeInt(int data) throws IOException;
-
- public void writeLong(long data) throws IOException;
-
- public void writeFloat(float data) throws IOException;
-
- public void writeDouble(double data) throws IOException;
-
- public void writeBytes(String data) throws IOException;
-
- public void writeChars(String data) throws IOException;
-
- public void writeUTF(String data) throws IOException;
-
- // Inner class to provide access to serializable fields.
- abstract static public class PutField
- {
- public void put(String name, boolean value)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, char data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, byte data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, short data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, int data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, long data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, float data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, double data)
- throws IOException, IllegalArgumentException;
-
- public void put(String name, Object data)
- throws IOException, IllegalArgumentException;
- }
-
- public void useProtocolVersion(int version) throws IOException;
-
- protected ObjectOutputStream()
- throws IOException;
-
- protected writeObjectOverride()
- throws NotActiveException, IOException;
-}
-```
-
-The single-argument `ObjectOutputStream` constructor creates an
-`ObjectOutputStream` that serializes objects to the given `OutputStream`. The
-constructor calls `writeStreamHeader` to write a magic number and version to
-the stream that will be read and verified by a corresponding call to
-`readStreamHeader` in the single-argument `ObjectInputStream` constructor. If a
-security manager is installed, this constructor checks for the
-`"enableSubclassImplementation"` `SerializablePermission` when invoked directly
-or indirectly by the constructor of a subclass which overrides the `putFields`
-and/or `writeUnshared` methods.
-
-The `writeObject` method is used to serialize an object to the stream. An
-object is serialized as follows:
-
-1. If a subclass is overriding the implementation, call the
- `writeObjectOverride` method and return. Overriding the implementation is
- described at the end of this section.
-
-2. If there is data in the block-data buffer, the data is written to the
- stream and the buffer is reset.
-
-3. If the object is null, null is put in the stream and `writeObject` returns.
-
-4. If the object has been previously replaced, as described in Step 8, write
- the handle of the replacement to the stream and `writeObject` returns.
-
-5. If the object has already been written to the stream, its handle is written
- to the stream and `writeObject` returns.
-
-6. If the object is a `Class`, the corresponding `ObjectStreamClass` is
- written to the stream, a handle is assigned for the class, and
- `writeObject` returns.
-
-7. If the object is an `ObjectStreamClass`, a handle is assigned to the
- object, after which it is written to the stream using one of the class
- descriptor formats described in [Section 4.3, "Serialized
- Form"](class.html#serialized-form). In versions 1.3 and later of the Java 2
- SDK, Standard Edition, the `writeClassDescriptor` method is called to
- output the `ObjectStreamClass` if it represents a class that is not a
- dynamic proxy class, as determined by passing the associated `Class` object
- to the `isProxyClass` method of `java.lang.reflect.Proxy`. Afterwards, an
- annotation for the represented class is written: if the class is a dynamic
- proxy class, then the `annotateProxyClass` method is called; otherwise, the
- `annotateClass` method is called. The `writeObject` method then returns.
-
-8. Process potential substitutions by the class of the object and/or by a
- subclass of `ObjectInputStream`.
-
- a. If the class of an object is not an enum type and defines the
- appropriate `writeReplace` method, the method is called. Optionally, it
- can return a substitute object to be serialized.
-
- b. Then, if enabled by calling the `enableReplaceObject` method, the
- `replaceObject` method is called to allow subclasses of
- `ObjectOutputStream` to substitute for the object being serialized. If
- the original object was replaced in the previous step, the
- `replaceObject` method is called with the replacement object.
-
- If the original object was replaced by either one or both steps above, the
- mapping from the original object to the replacement is recorded for later
- use in Step 4. Then, Steps 3 through 7 are repeated on the new object.
-
- If the replacement object is not one of the types covered by Steps 3
- through 7, processing resumes using the replacement object at Step 10.
-
-9. <a id="java-lang-string-encoding"></a>
- If the object is a `java.lang.String,` the string is written as length
- information followed by the contents of the string encoded in modified
- UTF-8. For details, refer to [Section 6.2, "Stream
- Elements"](protocol.html#stream-elements). A handle is assigned to the
- string, and `writeObject` returns.
-
-10. If the object is an array, `writeObject` is called recursively to write the
- `ObjectStreamClass` of the array. The handle for the array is assigned. It
- is followed by the length of the array. Each element of the array is then
- written to the stream, after which `writeObject` returns.
-
-11. If the object is an enum constant, the `ObjectStreamClass` for the enum
- type of the constant is written by recursively calling `writeObject`. It
- will appear in the stream only the first time it is referenced. A handle is
- assigned for the enum constant. Next, the value returned by the `name`
- method of the enum constant is written as a `String` object, as described
- in step 9. Note that if the same name string has appeared previously in the
- stream, a back reference to it will be written. The `writeObject` method
- then returns.
-
-12. For regular objects, the `ObjectStreamClass` for the class of the object is
- written by recursively calling `writeObject`. It will appear in the stream
- only the first time it is referenced. A handle is assigned for the object.
-
-13. The contents of the object are written to the stream.
-
- a. If the object is serializable, the highest serializable class is
- located. For that class, and each derived class, that class's fields
- are written. If the class does not have a `writeObject` method, the
- `defaultWriteObject` method is called to write the serializable fields
- to the stream. If the class does have a `writeObject` method, it is
- called. It may call `defaultWriteObject` or `putFields` and
- `writeFields` to save the state of the object, and then it can write
- other information to the stream.
-
- b. If the object is externalizable, the `writeExternal` method of the
- object is called.
-
- c. If the object is neither serializable or externalizable, the
- `NotSerializableException` is thrown.
-
-Exceptions may occur during the traversal or may occur in the underlying
-stream. For any subclass of `IOException`, the exception is written to the
-stream using the exception protocol and the stream state is discarded. If a
-second `IOException` is thrown while attempting to write the first exception
-into the stream, the stream is left in an unknown state and
-`StreamCorruptedException` is thrown from `writeObject`. For other exceptions,
-the stream is aborted and left in an unknown and unusable state.
-
-The `writeUnshared` method writes an "unshared" object to the
-`ObjectOutputStream`. This method is identical to `writeObject`, except that it
-always writes the given object as a new, unique object in the stream (as
-opposed to a back-reference pointing to a previously serialized instance).
-Specifically:
-
-- An object written via `writeUnshared` is always serialized in the same
- manner as a newly appearing object (an object that has not been written to
- the stream yet), regardless of whether or not the object has been written
- previously.
-
-- If `writeObject` is used to write an object that has been previously
- written with `writeUnshared`, the previous `writeUnshared` operation is
- treated as if it were a write of a separate object. In other words,
- `ObjectOutputStream` will never generate back-references to object data
- written by calls to `writeUnshared`.
-
-While writing an object via `writeUnshared` does not in itself guarantee a
-unique reference to the object when it is deserialized, it allows a single
-object to be defined multiple times in a stream, so that multiple calls to the
-`ObjectInputStream.readUnshared` method (see [Section 3.1, "The
-ObjectInputStream Class"](input.html#the-objectinputstream-class)) by the
-receiver will not conflict. Note that the rules described above only apply to
-the base-level object written with `writeUnshared`, and not to any transitively
-referenced sub-objects in the object graph to be serialized.
-
-The `defaultWriteObject` method implements the default serialization mechanism
-for the current class. This method may be called only from a class's
-`writeObject` method. The method writes all of the serializable fields of the
-current class to the stream. If called from outside the `writeObject` method,
-the `NotActiveException` is thrown.
-
-The `putFields` method returns a `PutField` object the caller uses to set the
-values of the serializable fields in the stream. The fields may be set in any
-order. After all of the fields have been set, `writeFields` must be called to
-write the field values in the canonical order to the stream. If a field is not
-set, the default value appropriate for its type will be written to the stream.
-This method may only be called from within the `writeObject` method of a
-serializable class. It may not be called more than once or if
-`defaultWriteObject` has been called. Only after `writeFields` has been called
-can other data be written to the stream.
-
-The `reset` method resets the stream state to be the same as if it had just
-been constructed. `Reset` will discard the state of any objects already written
-to the stream. The current point in the stream is marked as reset, so the
-corresponding `ObjectInputStream` will reset at the same point. Objects
-previously written to the stream will not be remembered as already having been
-written to the stream. They will be written to the stream again. This is useful
-when the contents of an object or objects must be sent again. `Reset` may not
-be called while objects are being serialized. If called inappropriately, an
-`IOException` is thrown.
-
-Starting with the Java 2 SDK, Standard Edition, v1.3, the
-`writeClassDescriptor` method is called when an `ObjectStreamClass` needs to be
-serialized. `writeClassDescriptor` is responsible for writing a representation
-of the `ObjectStreamClass` to the serialization stream. Subclasses may override
-this method to customize the way in which class descriptors are written to the
-serialization stream. If this method is overridden, then the corresponding
-`readClassDescriptor` method in `ObjectInputStream` should also be overridden
-to reconstitute the class descriptor from its custom stream representation. By
-default, `writeClassDescriptor` writes class descriptors according to the
-format specified in [Section 6.4, "Grammar for the Stream
-Format"](protocol.html#grammar-for-the-stream-format). Note that this method
-will only be called if the `ObjectOutputStream` is not using the old
-serialization stream format (see [Section 6.3, "Stream Protocol
-Versions"](protocol.html#stream-protocol-versions)). If the serialization
-stream is using the old format (`ObjectStreamConstants.PROTOCOL_VERSION_1`),
-the class descriptor will be written internally in a manner that cannot be
-overridden or customized.
-
-The `annotateClass` method is called while a `Class` is being serialized, and
-after the class descriptor has been written to the stream. Subclasses may
-extend this method and write other information to the stream about the class.
-This information must be read by the `resolveClass` method in a corresponding
-`ObjectInputStream` subclass.
-
-An `ObjectOutputStream` subclass can implement the `replaceObject` method to
-monitor or replace objects during serialization. Replacing objects must be
-enabled explicitly by calling `enableReplaceObject` before calling
-`writeObject` with the first object to be replaced. Once enabled,
-`replaceObject` is called for each object just prior to serializing the object
-for the first time. Note that the `replaceObject` method is not called for
-objects of the specially handled classes, `Class` and `ObjectStreamClass`. An
-implementation of a subclass may return a substitute object that will be
-serialized instead of the original. The substitute object must be serializable.
-All references in the stream to the original object will be replaced by the
-substitute object.
-
-When objects are being replaced, the subclass must ensure that the substituted
-object is compatible with every field where the reference will be stored, or
-that a complementary substitution will be made during deserialization. Objects,
-whose type is not a subclass of the type of the field or array element, will
-later abort the deserialization by raising a `ClassCastException` and the
-reference will not be stored.
-
-The `enableReplaceObject` method can be called by trusted subclasses of
-`ObjectOutputStream` to enable the substitution of one object for another
-during serialization. Replacing objects is disabled until `enableReplaceObject`
-is called with a `true` value. It may thereafter be disabled by setting it to
-`false`. The previous setting is returned. The `enableReplaceObject` method
-checks that the stream requesting the replacement can be trusted. To ensure
-that the private state of objects is not unintentionally exposed, only trusted
-stream subclasses may use `replaceObject`. Trusted classes are those classes
-that belong to a security protection domain with permission to enable
-Serializable substitution.
-
-If the subclass of `ObjectOutputStream` is not considered part of the system
-domain, `SerializablePermission "enableSubstitution"` must be added to the
-security policy file. `AccessControlException` is thrown if the protection
-domain of the subclass of `ObjectInputStream` does not have permission to
-`"enableSubstitution"` by calling `enableReplaceObject`. See the document Java
-Security Architecture (JDK1.2) for additional information about the security
-model.
-
-The `writeStreamHeader` method writes the magic number and version to the
-stream. This information must be read by the `readStreamHeader` method of
-`ObjectInputStream`. Subclasses may need to implement this method to identify
-the stream's unique format.
-
-The `flush` method is used to empty any buffers being held by the stream and to
-forward the flush to the underlying stream. The `drain` method may be used by
-subclassers to empty only the `ObjectOutputStream`'s buffers without forcing
-the underlying stream to be flushed.
-
-All of the write methods for primitive types encode their values using a
-`DataOutputStream` to put them in the standard stream format. The bytes are
-buffered into block data records so they can be distinguished from the encoding
-of objects. This buffering allows primitive data to be skipped if necessary for
-class versioning. It also allows the stream to be parsed without invoking
-class-specific methods.
-
-To override the implementation of serialization, the subclass of
-`ObjectOutputStream` should call the protected no-arg `ObjectOutputStream`,
-constructor. There is a security check within the no-arg constructor for
-`SerializablePermission "enableSubclassImplementation"` to ensure that only
-trusted classes are allowed to override the default implementation. This
-constructor does not allocate any private data for `ObjectOutputStream` and
-sets a flag that indicates that the final `writeObject` method should invoke
-the `writeObjectOverride` method and return. All other `ObjectOutputStream`
-methods are not final and can be directly overridden by the subclass.
-
-## 2.2 The ObjectOutputStream.PutField Class
-
-Class `PutField` provides the API for setting values of the serializable fields
-for a class when the class does not use default serialization. Each method puts
-the specified named value into the stream. An `IllegalArgumentException` is
-thrown if `name` does not match the name of a serializable field for the class
-whose fields are being written, or if the type of the named field does not
-match the second parameter type of the specific `put` method invoked.
-
-## 2.3 The writeObject Method
-
-For serializable objects, the `writeObject` method allows a class to control
-the serialization of its own fields. Here is its signature:
-
-```
-private void writeObject(ObjectOutputStream stream)
- throws IOException;
-```
-
-Each subclass of a serializable object may define its own `writeObject` method.
-If a class does not implement the method, the default serialization provided by
-`defaultWriteObject` will be used. When implemented, the class is only
-responsible for writing its own fields, not those of its supertypes or
-subtypes.
-
-The class's `writeObject` method, if implemented, is responsible for saving the
-state of the class. Either `ObjectOutputStream`'s `defaultWriteObject` or
-`writeFields` method must be called once (and only once) before writing any
-optional data that will be needed by the corresponding `readObject` method to
-restore the state of the object; even if no optional data is written,
-`defaultWriteObject` or `writeFields` must still be invoked once. If
-`defaultWriteObject` or `writeFields` is not invoked once prior to the writing
-of optional data (if any), then the behavior of instance deserialization is
-undefined in cases where the `ObjectInputStream` cannot resolve the class which
-defined the `writeObject` method in question.
-
-The responsibility for the format, structure, and versioning of the optional
-data lies completely with the class.
-
-## 2.4 The writeExternal Method
-
-Objects implementing `java.io.Externalizable` must implement the
-`writeExternal` method to save the entire state of the object. It must
-coordinate with its superclasses to save their state. All of the methods of
-`ObjectOutput` are available to save the object's primitive typed fields and
-object fields.
-
-```
-public void writeExternal(ObjectOutput stream)
- throws IOException;
-```
-
-A new default format for writing Externalizable data has been introduced in JDK
-1.2. The new format specifies that primitive data will be written in block data
-mode by `writeExternal` methods. Additionally, a tag denoting the end of the
-External object is appended to the stream after the `writeExternal` method
-returns. The benefits of this format change are discussed in [Section 3.6, "The
-readExternal Method"](input.html#the-readexternal-method). Compatibility issues
-caused by this change are discussed in [Section 2.6, "The useProtocolVersion
-Method"](#the-useprotocolversion-method).
-
-## 2.5 The writeReplace Method
-
-For Serializable and Externalizable classes, the `writeReplace` method allows a
-class of an object to nominate its own replacement in the stream before the
-object is written. By implementing the `writeReplace` method, a class can
-directly control the types and instances of its own instances being serialized.
-
-The method is defined as follows:
-
-```
-ANY-ACCESS-MODIFIER Object writeReplace()
- throws ObjectStreamException;
-```
-
-The `writeReplace` method is called when `ObjectOutputStream` is preparing to
-write the object to the stream. The `ObjectOutputStream` checks whether the
-class defines the `writeReplace` method. If the method is defined, the
-`writeReplace` method is called to allow the object to designate its
-replacement in the stream. The object returned should be either of the same
-type as the object passed in or an object that when read and resolved will
-result in an object of a type that is compatible with all references to the
-object. If it is not, a `ClassCastException` will occur when the type mismatch
-is discovered.
-
-## 2.6 The useProtocolVersion Method
-
-Due to a stream protocol change that was not backwards compatible, a mechanism
-has been added to enable the current Virtual Machine to write a serialization
-stream that is readable by a previous release. Of course, the problems that are
-corrected by the new stream format will exist when using the backwards
-compatible protocol.
-
-Stream protocol versions are discussed in [Section 6.3, "Stream Protocol
-Versions"](protocol.html#stream-protocol-versions).
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/protocol.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,504 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](version.html) | [NEXT](security.html)'
-include-after: '[CONTENTS](index.html) | [PREV](version.html) | [NEXT](security.html)'
-
-title: 'Java Object Serialization Specification: 6 - Object Serialization Stream Protocol'
----
-
-- [Overview](#overview)
-- [Stream Elements](#stream-elements)
-- [Stream Protocol Versions](#stream-protocol-versions)
-- [Grammar for the Stream Format](#grammar-for-the-stream-format)
-- [Example](#example)
-
--------------------------------------------------------------------------------
-
-## 6.1 Overview
-
-The stream format satisfies the following design goals:
-
-- Is compact and is structured for efficient reading.
-- Allows skipping through the stream using only the knowledge of the
- structure and format of the stream. Does not require invoking any per class
- code.
-- Requires only stream access to the data.
-
-## 6.2 Stream Elements
-
-A basic structure is needed to represent objects in a stream. Each attribute of
-the object needs to be represented: its classes, its fields, and data written
-and later read by class-specific methods. The representation of objects in the
-stream can be described with a grammar. There are special representations for
-null objects, new objects, classes, arrays, strings, and back references to any
-object already in the stream. Each object written to the stream is assigned a
-handle that is used to refer back to the object. Handles are assigned
-sequentially starting from 0x7E0000. The handles restart at 0x7E0000 when the
-stream is reset.
-
-A class object is represented by the following:
-
-- Its `ObjectStreamClass` object.
-
-An `ObjectStreamClass` object for a Class that is not a dynamic proxy class is
-represented by the following:
-
-- The Stream Unique Identifier (SUID) of compatible classes.
-
-- A set of flags indicating various properties of the class, such as whether
- the class defines a `writeObject` method, and whether the class is
- serializable, externalizable, or an enum type
-
-- The number of serializable fields
-
-- The array of fields of the class that are serialized by the default
- mechanismFor arrays and object fields, the type of the field is included as
- a string which must be in "field descriptor" format (e.g.,
- "`Ljava/lang/Object;`") as specified in The Java Virtual Machine
- Specification.
-
-- Optional block-data records or objects written by the `annotateClass`
- method
-
-- The `ObjectStreamClass` of its supertype (null if the superclass is not
- serializable)
-
-An `ObjectStreamClass` object for a dynamic proxy class is represented by the
-following:
-
-- The number of interfaces that the dynamic proxy class implements
-
-- The names of all of the interfaces implemented by the dynamic proxy class,
- listed in the order that they are returned by invoking the `getInterfaces`
- method on the Class object.
-
-- Optional block-data records or objects written by the `annotateProxyClass`
- method.
-
-- The ObjectStreamClass of its supertype, `java.lang.reflect.Proxy`.
-
-The representation of `String` objects consists of length information followed
-by the contents of the string encoded in modified UTF-8. The modified UTF-8
-encoding is the same as used in the Java Virtual Machine and in the
-`java.io.DataInput` and `DataOutput` interfaces; it differs from standard UTF-8
-in the representation of supplementary characters and of the null character.
-The form of the length information depends on the length of the string in
-modified UTF-8 encoding. If the modified UTF-8 encoding of the given `String`
-is less than 65536 bytes in length, the length is written as 2 bytes
-representing an unsigned 16-bit integer. Starting with the Java 2 platform,
-Standard Edition, v1.3, if the length of the string in modified UTF-8 encoding
-is 65536 bytes or more, the length is written in 8 bytes representing a signed
-64-bit integer. The typecode preceding the `String` in the serialization stream
-indicates which format was used to write the `String`.
-
-Arrays are represented by the following:
-
-- Their `ObjectStreamClass` object.
-
-- The number of elements.
-
-- The sequence of values. The type of the values is implicit in the type of
- the array. for example the values of a byte array are of type byte.
-
-Enum constants are represented by the following:
-
-- The `ObjectStreamClass` object of the constant's base enum type.
-
-- The constant's name string.
-
-New objects in the stream are represented by the following:
-
-- The most derived class of the object.
-
-- Data for each serializable class of the object, with the highest superclass
- first. For each class the stream contains the following:
-
- - The serializable fields.See [Section 1.5, "Defining Serializable Fields
- for a
- Class"](serial-arch.html#defining-serializable-fields-for-a-class).
-
- - If the class has `writeObject`/`readObject` methods, there may be
- optional objects and/or block-data records of primitive types written
- by the `writeObject` method followed by an `endBlockData` code.
-
-All primitive data written by classes is buffered and wrapped in block-data
-records, regardless if the data is written to the stream within a `writeObject`
-method or written directly to the stream from outside a `writeObject` method.
-This data can only be read by the corresponding `readObject` methods or be read
-directly from the stream. Objects written by the `writeObject` method terminate
-any previous block-data record and are written either as regular objects or
-null or back references, as appropriate. The block-data records allow error
-recovery to discard any optional data. When called from within a class, the
-stream can discard any data or objects until the `endBlockData`.
-
-## 6.3 Stream Protocol Versions
-
-It was necessary to make a change to the serialization stream format in JDK 1.2
-that is not backwards compatible to all minor releases of JDK 1.1. To provide
-for cases where backwards compatibility is required, a capability has been
-added to indicate what `PROTOCOL_VERSION` to use when writing a serialization
-stream. The method `ObjectOutputStream.useProtocolVersion` takes as a parameter
-the protocol version to use to write the serialization stream.
-
-The Stream Protocol Versions are as follows:
-
-- `ObjectStreamConstants.PROTOCOL_VERSION_1`: Indicates the initial stream
- format.
-
-- `ObjectStreamConstants.PROTOCOL_VERSION_2`: Indicates the new external data
- format. Primitive data is written in block data mode and is terminated with
- `TC_ENDBLOCKDATA`.
-
- Block data boundaries have been standardized. Primitive data written in
- block data mode is normalized to not exceed 1024 byte chunks. The benefit
- of this change was to tighten the specification of serialized data format
- within the stream. This change is fully backward and forward compatible.
-
-JDK 1.2 defaults to writing `PROTOCOL_VERSION_2`.
-
-JDK 1.1 defaults to writing `PROTOCOL_VERSION_1`.
-
-JDK 1.1.7 and greater can read both versions.
-
-Releases prior to JDK 1.1.7 can only read `PROTOCOL_VERSION_1`.
-
-## 6.4 Grammar for the Stream Format
-
-The table below contains the grammar for the stream format. Nonterminal symbols
-are shown in italics. Terminal symbols in a *fixed width font*. Definitions of
-nonterminals are followed by a ":". The definition is followed by one or more
-alternatives, each on a separate line. The following table describes the
-notation:
-
- ------------- --------------------------------------------------------------
- **Notation** **Meaning**
- ------------- --------------------------------------------------------------
- (*datatype*) This token has the data type specified, such as byte.
-
- *token*\[n\] A predefined number of occurrences of the token, that is an
- array.
-
- *x0001* A literal value expressed in hexadecimal. The number of hex
- digits reflects the size of the value.
-
- <*xxx*> A value read from the stream used to indicate the length of an
- array.
- ------------- --------------------------------------------------------------
-
-Note that the symbol (utf) is used to designate a string written using 2-byte
-length information, and (long-utf) is used to designate a string written using
-8-byte length information. For details, refer to [Section 6.2, "Stream
-Elements"](#stream-elements).
-
-### 6.4.1 Rules of the Grammar
-
-A Serialized stream is represented by any stream satisfying the *stream* rule.
-
-```
-stream:
- magic version contents
-
-contents:
- content
- contents content
-
-content:
- object
- blockdata
-
-object:
- newObject
- newClass
- newArray
- newString
- newEnum
- newClassDesc
- prevObject
- nullReference
- exception
- TC_RESET
-
-newClass:
- TC_CLASS classDesc newHandle
-
-classDesc:
- newClassDesc
- nullReference
- (ClassDesc)prevObject // an object required to be of type ClassDesc
-
-superClassDesc:
- classDesc
-
-newClassDesc:
- TC_CLASSDESC className serialVersionUID newHandle classDescInfo
- TC_PROXYCLASSDESC newHandle proxyClassDescInfo
-
-classDescInfo:
- classDescFlags fields classAnnotation superClassDesc
-
-className:
- (utf)
-
-serialVersionUID:
- (long)
-
-classDescFlags:
- (byte) // Defined in Terminal Symbols and Constants
-
-proxyClassDescInfo:
- (int)<count> proxyInterfaceName[count] classAnnotation
- superClassDesc
-
-proxyInterfaceName:
- (utf)
-
-fields:
- (short)<count> fieldDesc[count]
-
-fieldDesc:
- primitiveDesc
- objectDesc
-
-primitiveDesc:
- prim_typecode fieldName
-
-objectDesc:
- obj_typecode fieldName className1
-
-fieldName:
- (utf)
-
-className1:
- (String)object // String containing the field's type,
- // in field descriptor format
-
-classAnnotation:
- endBlockData
- contents endBlockData // contents written by annotateClass
-
-prim_typecode:
- 'B' // byte
- 'C' // char
- 'D' // double
- 'F' // float
- 'I' // integer
- 'J' // long
- 'S' // short
- 'Z' // boolean
-
-obj_typecode:
- '[' // array
- 'L' // object
-
-newArray:
- TC_ARRAY classDesc newHandle (int)<size> values[size]
-
-newObject:
- TC_OBJECT classDesc newHandle classdata[] // data for each class
-
-classdata:
- nowrclass // SC_SERIALIZABLE & classDescFlag &&
- // !(SC_WRITE_METHOD & classDescFlags)
- wrclass objectAnnotation // SC_SERIALIZABLE & classDescFlag &&
- // SC_WRITE_METHOD & classDescFlags
- externalContents // SC_EXTERNALIZABLE & classDescFlag &&
- // !(SC_BLOCKDATA & classDescFlags
- objectAnnotation // SC_EXTERNALIZABLE & classDescFlag&&
- // SC_BLOCKDATA & classDescFlags
-
-nowrclass:
- values // fields in order of class descriptor
-
-wrclass:
- nowrclass
-
-objectAnnotation:
- endBlockData
- contents endBlockData // contents written by writeObject
- // or writeExternal PROTOCOL_VERSION_2.
-
-blockdata:
- blockdatashort
- blockdatalong
-
-blockdatashort:
- TC_BLOCKDATA (unsigned byte)<size> (byte)[size]
-
-blockdatalong:
- TC_BLOCKDATALONG (int)<size> (byte)[size]
-
-endBlockData:
- TC_ENDBLOCKDATA
-
-externalContent: // Only parseable by readExternal
- (bytes) // primitive data
- object
-
-externalContents: // externalContent written by
- externalContent // writeExternal in PROTOCOL_VERSION_1.
- externalContents externalContent
-
-newString:
- TC_STRING newHandle (utf)
- TC_LONGSTRING newHandle (long-utf)
-
-newEnum:
- TC_ENUM classDesc newHandle enumConstantName
-
-enumConstantName:
- (String)object
-
-prevObject:
- TC_REFERENCE (int)handle
-
-nullReference:
- TC_NULL
-
-exception:
- TC_EXCEPTION reset (Throwable)object reset
-
-magic:
- STREAM_MAGIC
-
-version:
- STREAM_VERSION
-
-values: // The size and types are described by the
- // classDesc for the current object
-
-newHandle: // The next number in sequence is assigned
- // to the object being serialized or deserialized
-
-reset: // The set of known objects is discarded
- // so the objects of the exception do not
- // overlap with the previously sent objects
- // or with objects that may be sent after
- // the exception
-```
-
-### 6.4.2 Terminal Symbols and Constants
-
-The following symbols in `java.io.ObjectStreamConstants` define the terminal
-and constant values expected in a stream.
-
-```
-final static short STREAM_MAGIC = (short)0xaced;
-final static short STREAM_VERSION = 5;
-final static byte TC_NULL = (byte)0x70;
-final static byte TC_REFERENCE = (byte)0x71;
-final static byte TC_CLASSDESC = (byte)0x72;
-final static byte TC_OBJECT = (byte)0x73;
-final static byte TC_STRING = (byte)0x74;
-final static byte TC_ARRAY = (byte)0x75;
-final static byte TC_CLASS = (byte)0x76;
-final static byte TC_BLOCKDATA = (byte)0x77;
-final static byte TC_ENDBLOCKDATA = (byte)0x78;
-final static byte TC_RESET = (byte)0x79;
-final static byte TC_BLOCKDATALONG = (byte)0x7A;
-final static byte TC_EXCEPTION = (byte)0x7B;
-final static byte TC_LONGSTRING = (byte) 0x7C;
-final static byte TC_PROXYCLASSDESC = (byte) 0x7D;
-final static byte TC_ENUM = (byte) 0x7E;
-final static int baseWireHandle = 0x7E0000;
-```
-
-The flag byte *classDescFlags* may include values of
-
-```
-final static byte SC_WRITE_METHOD = 0x01; //if SC_SERIALIZABLE
-final static byte SC_BLOCK_DATA = 0x08; //if SC_EXTERNALIZABLE
-final static byte SC_SERIALIZABLE = 0x02;
-final static byte SC_EXTERNALIZABLE = 0x04;
-final static byte SC_ENUM = 0x10;
-```
-
-The flag `SC_WRITE_METHOD` is set if the Serializable class writing the stream
-had a `writeObject` method that may have written additional data to the stream.
-In this case a `TC_ENDBLOCKDATA` marker is always expected to terminate the
-data for that class.
-
-The flag `SC_BLOCKDATA` is set if the `Externalizable` class is written into
-the stream using `STREAM_PROTOCOL_2`. By default, this is the protocol used to
-write `Externalizable` objects into the stream in JDK 1.2. JDK 1.1 writes
-`STREAM_PROTOCOL_1`.
-
-The flag `SC_SERIALIZABLE` is set if the class that wrote the stream extended
-`java.io.Serializable` but not `java.io.Externalizable`, the class reading the
-stream must also extend `java.io.Serializable` and the default serialization
-mechanism is to be used.
-
-The flag `SC_EXTERNALIZABLE` is set if the class that wrote the stream extended
-`java.io.Externalizable`, the class reading the data must also extend
-`Externalizable` and the data will be read using its `writeExternal` and
-`readExternal` methods.
-
-The flag `SC_ENUM` is set if the class that wrote the stream was an enum type.
-The receiver's corresponding class must also be an enum type. Data for
-constants of the enum type will be written and read as described in [Section
-1.12, "Serialization of Enum
-Constants"](serial-arch.html#serialization-of-enum-constants).
-
-#### Example
-
-Consider the case of an original class and two instances in a linked list:
-
-```
-class List implements java.io.Serializable {
- int value;
- List next;
- public static void main(String[] args) {
- try {
- List list1 = new List();
- List list2 = new List();
- list1.value = 17;
- list1.next = list2;
- list2.value = 19;
- list2.next = null;
-
- ByteArrayOutputStream o = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(o);
- out.writeObject(list1);
- out.writeObject(list2);
- out.flush();
- ...
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-}
-```
-
-The resulting stream contains:
-
-```
- 00: ac ed 00 05 73 72 00 04 4c 69 73 74 69 c8 8a 15 >....sr..Listi...<
- 10: 40 16 ae 68 02 00 02 49 00 05 76 61 6c 75 65 4c >Z......I..valueL<
- 20: 00 04 6e 65 78 74 74 00 06 4c 4c 69 73 74 3b 78 >..nextt..LList;x<
- 30: 70 00 00 00 11 73 71 00 7e 00 00 00 00 00 13 70 >p....sq.~......p<
- 40: 71 00 7e 00 03 >q.~..<
-```
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/security.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](protocol.html) | [NEXT](exceptions.html)'
-include-after: '[CONTENTS](index.html) | [PREV](protocol.html) | [NEXT](exceptions.html)'
-
-title: 'Java Object Serialization Specification: A - Security in Object Serialization'
----
-
--------------------------------------------------------------------------------
-
-Refer to the [Secure Coding Guidelines for the Java Programming
-Language](http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=secure_coding_guidelines_javase)
-for information about security in object serialization.
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/serial-arch.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,575 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](index.html) | [NEXT](output.html)'
-include-after: '[CONTENTS](index.html) | [PREV](index.html) | [NEXT](output.html)'
-
-title: 'Java Object Serialization Specification: 1 - System Architecture'
----
-
-- [Overview](#overview)
-- [Writing to an Object Stream](#writing-to-an-object-stream)
-- [Reading from an Object Stream](#reading-from-an-object-stream)
-- [Object Streams as Containers](#object-streams-as-containers)
-- [Defining Serializable Fields for a
- Class](#defining-serializable-fields-for-a-class)
-- [Documenting Serializable Fields and Data for a
- Class](#documenting-serializable-fields-and-data-for-a-class)
-- [Accessing Serializable Fields of a
- Class](#accessing-serializable-fields-of-a-class)
-- [The ObjectOutput Interface](#the-objectoutput-interface)
-- [The ObjectInput Interface](#the-objectinput-interface)
-- [The Serializable Interface](#the-serializable-interface)
-- [The Externalizable Interface](#the-externalizable-interface)
-- [Serialization of Enum Constants](#serialization-of-enum-constants)
-- [Protecting Sensitive Information](#protecting-sensitive-information)
-
--------------------------------------------------------------------------------
-
-## 1.1 Overview
-
-The ability to store and retrieve Java^TM^ objects is essential to building all
-but the most transient applications. The key to storing and retrieving objects
-in a serialized form is representing the state of objects sufficient to
-reconstruct the object(s). Objects to be saved in the stream may support either
-the `Serializable` or the `Externalizable` interface. For Java^TM^ objects, the
-serialized form must be able to identify and verify the Java^TM^ class from
-which the contents of the object were saved and to restore the contents to a
-new instance. For serializable objects, the stream includes sufficient
-information to restore the fields in the stream to a compatible version of the
-class. For Externalizable objects, the class is solely responsible for the
-external format of its contents.
-
-Objects to be stored and retrieved frequently refer to other objects. Those
-other objects must be stored and retrieved at the same time to maintain the
-relationships between the objects. When an object is stored, all of the objects
-that are reachable from that object are stored as well.
-
-The goals for serializing Java^TM^ objects are to:
-
-- Have a simple yet extensible mechanism.
-- Maintain the Java^TM^ object type and safety properties in the serialized
- form.
-- Be extensible to support marshaling and unmarshaling as needed for remote
- objects.
-- Be extensible to support simple persistence of Java^TM^ objects.
-- Require per class implementation only for customization.
-- Allow the object to define its external format.
-
-## 1.2 Writing to an Object Stream
-
-Writing objects and primitives to a stream is a straightforward process. For
-example:
-
-```
-// Serialize today's date to a file.
- FileOutputStream f = new FileOutputStream("tmp");
- ObjectOutput s = new ObjectOutputStream(f);
- s.writeObject("Today");
- s.writeObject(new Date());
- s.flush();
-```
-
-First an `OutputStream`, in this case a `FileOutputStream`, is needed to
-receive the bytes. Then an `ObjectOutputStream` is created that writes to the
-`FileOutputStream`. Next, the string "Today" and a Date object are written to
-the stream. More generally, objects are written with the `writeObject` method
-and primitives are written to the stream with the methods of `DataOutput`.
-
-The `writeObject` method (see [Section 2.3, "The writeObject
-Method"](output.html#the-writeobject-method)) serializes the specified object
-and traverses its references to other objects in the object graph recursively
-to create a complete serialized representation of the graph. Within a stream,
-the first reference to any object results in the object being serialized or
-externalized and the assignment of a handle for that object. Subsequent
-references to that object are encoded as the handle. Using object handles
-preserves sharing and circular references that occur naturally in object
-graphs. Subsequent references to an object use only the handle allowing a very
-compact representation.
-
-Special handling is required for arrays, enum constants, and objects of type
-`Class`, `ObjectStreamClass`, and `String`. Other objects must implement either
-the `Serializable` or the `Externalizable` interface to be saved in or restored
-from a stream.
-
-Primitive data types are written to the stream with the methods in the
-`DataOutput` interface, such as `writeInt`, `writeFloat`, or `writeUTF`.
-Individual bytes and arrays of bytes are written with the methods of
-`OutputStream`. Except for serializable fields, primitive data is written to
-the stream in block-data records, with each record prefixed by a marker and an
-indication of the number of bytes in the record.
-
-`ObjectOutputStream` can be extended to customize the information about classes
-in the stream or to replace objects to be serialized. Refer to the
-`annotateClass` and `replaceObject` method descriptions for details.
-
-## 1.3 Reading from an Object Stream
-
-Reading an object from a stream, like writing, is straightforward:
-
-```
-// Deserialize a string and date from a file.
- FileInputStream in = new FileInputStream("tmp");
- ObjectInputStream s = new ObjectInputStream(in);
- String today = (String)s.readObject();
- Date date = (Date)s.readObject();
-```
-
-First an `InputStream`, in this case a `FileInputStream`, is needed as the
-source stream. Then an `ObjectInputStream` is created that reads from the
-`InputStream`. Next, the string "Today" and a Date object are read from the
-stream. Generally, objects are read with the `readObject` method and primitives
-are read from the stream with the methods of `DataInput`.
-
-The `readObject` method deserializes the next object in the stream and
-traverses its references to other objects recursively to create the complete
-graph of objects serialized.
-
-Primitive data types are read from the stream with the methods in the
-`DataInput` interface, such as `readInt`, `readFloat`, or `readUTF`. Individual
-bytes and arrays of bytes are read with the methods of `InputStream`. Except
-for serializable fields, primitive data is read from block-data records.
-
-`ObjectInputStream` can be extended to utilize customized information in the
-stream about classes or to replace objects that have been deserialized. Refer
-to the `resolveClass` and `resolveObject` method descriptions for details.
-
-## 1.4 Object Streams as Containers
-
-Object Serialization produces and consumes a stream of bytes that contain one
-or more primitives and objects. The objects written to the stream, in turn,
-refer to other objects, which are also represented in the stream. Object
-Serialization produces just one stream format that encodes and stores the
-contained objects.
-
-Each object that acts as a container implements an interface which allows
-primitives and objects to be stored in or retrieved from it. These interfaces
-are the `ObjectOutput` and `ObjectInput` interfaces which:
-
-- Provide a stream to write to and to read from
-- Handle requests to write primitive types and objects to the stream
-- Handle requests to read primitive types and objects from the stream
-
-Each object which is to be stored in a stream must explicitly allow itself to
-be stored and must implement the protocols needed to save and restore its
-state. Object Serialization defines two such protocols. The protocols allow the
-container to ask the object to write and read its state.
-
-To be stored in an Object Stream, each object must implement either the
-`Serializable` or the `Externalizable` interface:
-
-- For a `Serializable` class, Object Serialization can automatically save and
- restore fields of each class of an object and automatically handle classes
- that evolve by adding fields or supertypes. A serializable class can
- declare which of its fields are saved or restored, and write and read
- optional values and objects.
-
-- For an `Externalizable` class, Object Serialization delegates to the class
- complete control over its external format and how the state of the
- supertype(s) is saved and restored.
-
-## 1.5 Defining Serializable Fields for a Class
-
-The serializable fields of a class can be defined two different ways. Default
-serializable fields of a class are defined to be the non-transient and
-non-static fields. This default computation can be overridden by declaring a
-special field in the `Serializable` class, `serialPersistentFields`. This field
-must be initialized with an array of `ObjectStreamField` objects that list the
-names and types of the serializable fields. The modifiers for the field are
-required to be private, static, and final. If the field's value is null or is
-otherwise not an instance of `ObjectStreamField[]`, or if the field does not
-have the required modifiers, then the behavior is as if the field were not
-declared at all.
-
-For example, the following declaration duplicates the default behavior.
-
-```
-class List implements Serializable {
- List next;
-
- private static final ObjectStreamField[] serialPersistentFields
- = {new ObjectStreamField("next", List.class)};
-
-}
-```
-
-By using `serialPersistentFields` to define the Serializable fields for a
-class, there no longer is a limitation that a serializable field must be a
-field within the current definition of the `Serializable` class. The
-`writeObject` and `readObject` methods of the `Serializable` class can map the
-current implementation of the class to the serializable fields of the class
-using the interface that is described in [Section 1.7, "Accessing Serializable
-Fields of a Class"](#accessing-serializable-fields-of-a-class). Therefore, the
-fields for a `Serializable` class can change in a later release, as long as it
-maintains the mapping back to its Serializable fields that must remain
-compatible across release boundaries.
-
-**Note:** There is, however, a limitation to the use of this mechanism to
-specify serializable fields for inner classes. Inner classes can only contain
-final static fields that are initialized to constants or expressions built up
-from constants. Consequently, it is not possible to set
-`serialPersistentFields` for an inner class (though it is possible to set it
-for static member classes). For other restrictions pertaining to serialization
-of inner class instances, see section [Section 1.10, "The Serializable
-Interface"](#the-serializable-interface).
-
-## 1.6 Documenting Serializable Fields and Data for a Class
-
-It is important to document the serializable state of a class to enable
-interoperability with alternative implementations of a Serializable class and
-to document class evolution. Documenting a serializable field gives one a final
-opportunity to review whether or not the field should be serializable. The
-serialization javadoc tags, `@serial`, `@serialField`, and `@serialData`,
-provide a way to document the serialized form for a Serializable class within
-the source code.
-
-- The `@serial` tag should be placed in the javadoc comment for a default
- serializable field. The syntax is as follows: `@serial` *field-description*
- The optional *field-description* describes the meaning of the field and its
- acceptable values. The *field-description* can span multiple lines. When a
- field is added after the initial release, a *@since* tag indicates the
- version the field was added. The *field-description* for `@serial` provides
- serialization-specific documentation and is appended to the javadoc comment
- for the field within the serialized form documentation.
-
-- The `@serialField` tag is used to document an `ObjectStreamField` component
- of a `serialPersistentFields` array. One of these tags should be used for
- each `ObjectStreamField` component. The syntax is as follows:
- `@serialField` *field-name field-type field-description*
-
-- The `@serialData` tag describes the sequences and types of data written or
- read. The tag describes the sequence and type of optional data written by
- `writeObject` or all data written by the `Externalizable.writeExternal`
- method. The syntax is as follows: `@serialData` *data-description*
-
-The javadoc application recognizes the serialization javadoc tags and generates
-a specification for each Serializable and Externalizable class. See [Section
-C.1, "Example Alternate Implementation of
-java.io.File"](examples.html#c.1-example-alternate-implementation-of-java.io.file)
-for an example that uses these tags.
-
-When a class is declared Serializable, the serializable state of the object is
-defined by serializable fields (by name and type) plus optional data. Optional
-data can only be written explicitly by the `writeObject` method of a
-`Serializable` class. Optional data can be read by the `Serializable` class'
-`readObject` method or serialization will skip unread optional data.
-
-When a class is declared Externalizable, the data that is written to the stream
-by the class itself defines the serialized state. The class must specify the
-order, types, and meaning of each datum that is written to the stream. The
-class must handle its own evolution, so that it can continue to read data
-written by and write data that can be read by previous versions. The class must
-coordinate with the superclass when saving and restoring data. The location of
-the superclasses data in the stream must be specified.
-
-The designer of a Serializable class must ensure that the information saved for
-the class is appropriate for persistence and follows the
-serialization-specified rules for interoperability and evolution. Class
-evolution is explained in greater detail in [Chapter
-5](version.html#versioning-of-serializable-objects), "Versioning of
-Serializable Objects".
-
-## 1.7 Accessing Serializable Fields of a Class
-
-Serialization provides two mechanisms for accessing the serializable fields in
-a stream:
-
-- The default mechanism requires no customization
-- The Serializable Fields API allows a class to explicitly access/set the
- serializable fields by name and type
-
-The default mechanism is used automatically when reading or writing objects
-that implement the `Serializable` interface and do no further customization.
-The serializable fields are mapped to the corresponding fields of the class and
-values are either written to the stream from those fields or are read in and
-assigned respectively. If the class provides `writeObject` and `readObject`
-methods, the default mechanism can be invoked by calling `defaultWriteObject`
-and `defaultReadObject`. When the `writeObject` and `readObject` methods are
-implemented, the class has an opportunity to modify the serializable field
-values before they are written or after they are read.
-
-When the default mechanism cannot be used, the serializable class can use the
-`putFields` method of `ObjectOutputStream` to put the values for the
-serializable fields into the stream. The `writeFields` method of
-`ObjectOutputStream` puts the values in the correct order, then writes them to
-the stream using the existing protocol for serialization. Correspondingly, the
-`readFields` method of `ObjectInputStream` reads the values from the stream and
-makes them available to the class by name in any order. See [Section 2.2, "The
-ObjectOutputStream.PutField
-Class"](output.html#the-objectoutputstream.putfield-class) and [Section 3.2,
-"The ObjectInputStream.GetField
-Class"](input.html#the-objectinputstream.getfield-class) for a detailed
-description of the Serializable Fields API.
-
-## 1.8 The ObjectOutput Interface
-
-The `ObjectOutput` interface provides an abstract, stream-based interface to
-object storage. It extends the DataOutput interface so those methods can be
-used for writing primitive data types. Objects that implement this interface
-can be used to store primitives and objects.
-
-```
-package java.io;
-
-public interface ObjectOutput extends DataOutput
-{
- public void writeObject(Object obj) throws IOException;
- public void write(int b) throws IOException;
- public void write(byte b[]) throws IOException;
- public void write(byte b[], int off, int len) throws IOException;
- public void flush() throws IOException;
- public void close() throws IOException;
-}
-```
-
-`The` `writeObject` method is used to write an object. The exceptions thrown
-reflect errors while accessing the object or its fields, or exceptions that
-occur in writing to storage. If any exception is thrown, the underlying storage
-may be corrupted. If this occurs, refer to the object that is implementing this
-interface for more information.
-
-## 1.9 The ObjectInput Interface
-
-The `ObjectInput` interface provides an abstract stream based interface to
-object retrieval. It extends the `DataInput` interface so those methods for
-reading primitive data types are accessible in this interface.
-
-```
-package java.io;
-
-public interface ObjectInput extends DataInput
-{
- public Object readObject()
- throws ClassNotFoundException, IOException;
- public int read() throws IOException;
- public int read(byte b[]) throws IOException;
- public int read(byte b[], int off, int len) throws IOException;
- public long skip(long n) throws IOException;
- public int available() throws IOException;
- public void close() throws IOException;
-}
-```
-
-The `readObject` method is used to read and return an object. The exceptions
-thrown reflect errors while accessing the objects or its fields or exceptions
-that occur in reading from the storage. If any exception is thrown, the
-underlying storage may be corrupted. If this occurs, refer to the object
-implementing this interface for additional information.
-
-## 1.10 The Serializable Interface
-
-Object Serialization produces a stream with information about the Java^TM^
-classes for the objects which are being saved. For serializable objects,
-sufficient information is kept to restore those objects even if a different
-(but compatible) version of the implementation of the class is present. The
-`Serializable` interface is defined to identify classes which implement the
-serializable protocol:
-
-```
-package java.io;
-
-public interface Serializable {};
-```
-
-A Serializable class must do the following:
-
-- Implement the `java.io.Serializable` interface
-
-- Identify the fields that should be serializable
-
- (Use the `serialPersistentFields` member to explicitly declare them
- serializable or use the transient keyword to denote nonserializable
- fields.)
-
-- Have access to the no-arg constructor of its first nonserializable
- superclass
-
-The class can optionally define the following methods:
-
-- A `writeObject` method to control what information is saved or to append
- additional information to the stream
-
-- A `readObject` method either to read the information written by the
- corresponding `writeObject` method or to update the state of the object
- after it has been restored
-
-- A `writeReplace` method to allow a class to nominate a replacement object
- to be written to the stream
-
- (See [Section 2.5, "The writeReplace
- Method"](output.html#the-writereplace-method) for additional information.)
-
-- A `readResolve` method to allow a class to designate a replacement object
- for the object just read from the stream
-
- (See [Section 3.7, "The readResolve
- Method](input.html#the-readresolve-method) for additional information.)
-
-`ObjectOutputStream` and `ObjectInputStream` allow the serializable classes on
-which they operate to evolve (allow changes to the classes that are compatible
-with the earlier versions of the classes). See [Section 5.5, "Compatible Java
-Type Evolution"](version.html#compatible-java-type-evolution) for information
-about the mechanism which is used to allow compatible changes.
-
-**Note:** Serialization of inner classes (i.e., nested classes that are not
-static member classes), including local and anonymous classes, is strongly
-discouraged for several reasons. Because inner classes declared in non-static
-contexts contain implicit non-transient references to enclosing class
-instances, serializing such an inner class instance will result in
-serialization of its associated outer class instance as well. Synthetic fields
-generated by `javac` (or other Java^TM^ compilers) to implement inner classes
-are implementation dependent and may vary between compilers; differences in
-such fields can disrupt compatibility as well as result in conflicting default
-`serialVersionUID` values. The names assigned to local and anonymous inner
-classes are also implementation dependent and may differ between compilers.
-Since inner classes cannot declare static members other than compile-time
-constant fields, they cannot use the `serialPersistentFields` mechanism to
-designate serializable fields. Finally, because inner classes associated with
-outer instances do not have zero-argument constructors (constructors of such
-inner classes implicitly accept the enclosing instance as a prepended
-parameter), they cannot implement `Externalizable`. None of the issues listed
-above, however, apply to static member classes.
-
-## 1.11 The Externalizable Interface
-
-For Externalizable objects, only the identity of the class of the object is
-saved by the container; the class must save and restore the contents. The
-`Externalizable` interface is defined as follows:
-
-```
-package java.io;
-
-public interface Externalizable extends Serializable
-{
- public void writeExternal(ObjectOutput out)
- throws IOException;
-
- public void readExternal(ObjectInput in)
- throws IOException, java.lang.ClassNotFoundException;
-}
-```
-
-The class of an Externalizable object must do the following:
-
-- Implement the `java.io.Externalizable` interface
-
-- Implement a `writeExternal` method to save the state of the object
-
- (It must explicitly coordinate with its supertype to save its state.)
-
-- Implement a `readExternal` method to read the data written by the
- `writeExternal` method from the stream and restore the state of the object
-
- (It must explicitly coordinate with the supertype to save its state.)
-
-- Have the `writeExternal` and `readExternal` methods be solely responsible
- for the format, if an externally defined format is written
-
- **Note:** The `writeExternal` and `readExternal` methods are public and
- raise the risk that a client may be able to write or read information in
- the object other than by using its methods and fields. These methods must
- be used only when the information held by the object is not sensitive or
- when exposing it does not present a security risk.
-
-- Have a public no-arg constructor
-
- **Note:** Inner classes associated with enclosing instances cannot have
- no-arg constructors, since constructors of such classes implicitly accept
- the enclosing instance as a prepended parameter. Consequently the
- `Externalizable` interface mechanism cannot be used for inner classes and
- they should implement the `Serializable` interface, if they must be
- serialized. Several limitations exist for serializable inner classes as
- well, however; see [Section 1.10, "The Serializable
- Interface"](#the-serializable-interface), for a full enumeration.
-
-An Externalizable class can optionally define the following methods:
-
-- A `writeReplace` method to allow a class to nominate a replacement object
- to be written to the stream
-
- (See [Section 2.5, "The writeReplace
- Method"](output.html#the-writereplace-method) for additional information.)
-
-- A `readResolve` method to allow a class to designate a replacement object
- for the object just read from the stream
-
- (See [Section 3.7, "The readResolve
- Method"](input.html#the-readresolve-method) for additional information.)
-
-## 1.12 Serialization of Enum Constants
-
-Enum constants are serialized differently than ordinary serializable or
-externalizable objects. The serialized form of an enum constant consists solely
-of its name; field values of the constant are not present in the form. To
-serialize an enum constant, `ObjectOutputStream` writes the value returned by
-the enum constant's `name` method. To deserialize an enum constant,
-`ObjectInputStream` reads the constant name from the stream; the deserialized
-constant is then obtained by calling the `java.lang.Enum.valueOf` method,
-passing the constant's enum type along with the received constant name as
-arguments. Like other serializable or externalizable objects, enum constants
-can function as the targets of back references appearing subsequently in the
-serialization stream.
-
-The process by which enum constants are serialized cannot be customized: any
-class-specific `writeObject`, `readObject`, `readObjectNoData`, `writeReplace`,
-and `readResolve` methods defined by enum types are ignored during
-serialization and deserialization. Similarly, any `serialPersistentFields` or
-`serialVersionUID` field declarations are also ignored--all enum types have a
-fixed `serialVersionUID` of `0L`. Documenting serializable fields and data for
-enum types is unnecessary, since there is no variation in the type of data
-sent.
-
-## 1.13 Protecting Sensitive Information
-
-When developing a class that provides controlled access to resources, care must
-be taken to protect sensitive information and functions. During
-deserialization, the private state of the object is restored. For example, a
-file descriptor contains a handle that provides access to an operating system
-resource. Being able to forge a file descriptor would allow some forms of
-illegal access, since restoring state is done from a stream. Therefore, the
-serializing runtime must take the conservative approach and not trust the
-stream to contain only valid representations of objects. To avoid compromising
-a class, the sensitive state of an object must not be restored from the stream,
-or it must be reverified by the class. Several techniques are available to
-protect sensitive data in classes.
-
-The easiest technique is to mark fields that contain sensitive data as *private
-transient*. Transient fields are not persistent and will not be saved by any
-persistence mechanism. Marking the field will prevent the state from appearing
-in the stream and from being restored during deserialization. Since writing and
-reading (of private fields) cannot be superseded outside of the class, the
-transient fields of the class are safe.
-
-Particularly sensitive classes should not be serialized at all. To accomplish
-this, the object should not implement either the `Serializable` or the
-`Externalizable` interface.
-
-Some classes may find it beneficial to allow writing and reading but
-specifically handle and revalidate the state as it is deserialized. The class
-should implement `writeObject` and `readObject` methods to save and restore
-only the appropriate state. If access should be denied, throwing a
-`NotSerializableException` will prevent further access.
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/share/specs/serialization/version.md Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
----
-# Copyright (c) 2005, 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.
-
-include-before: '[CONTENTS](index.html) | [PREV](class.html) | [NEXT](protocol.html)'
-include-after: '[CONTENTS](index.html) | [PREV](class.html) | [NEXT](protocol.html)'
-
-title: 'Java Object Serialization Specification: 5 - Versioning of Serializable Objects'
----
-
-- [Overview](#overview)
-- [Goals](#goals)
-- [Assumptions](#assumptions)
-- [Who's Responsible for Versioning of
- Streams](#whos-responsible-for-versioning-of-streams)
-- [Compatible Java Type Evolution](#compatible-java-type-evolution)
-- [Type Changes Affecting
- Serialization](#type-changes-affecting-serialization)
-
--------------------------------------------------------------------------------
-
-## 5.1 Overview
-
-When Java objects use serialization to save state in files, or as blobs in
-databases, the potential arises that the version of a class reading the data is
-different than the version that wrote the data.
-
-Versioning raises some fundamental questions about the identity of a class,
-including what constitutes a compatible change. A ***compatible change*** is a
-change that does not affect the contract between the class and its callers.
-
-This section describes the goals, assumptions, and a solution that attempts to
-address this problem by restricting the kinds of changes allowed and by
-carefully choosing the mechanisms.
-
-The proposed solution provides a mechanism for "automatic" handling of classes
-that evolve by adding fields and adding classes. Serialization will handle
-versioning without class-specific methods to be implemented for each version.
-The stream format can be traversed without invoking class-specific methods.
-
-## 5.2 Goals
-
-The goals are to:
-
-- Support bidirectional communication between different versions of a class
- operating in different virtual machines by:
-
- - Defining a mechanism that allows Java classes to read streams written
- by older versions of the same class.
-
- - Defining a mechanism that allows Java classes to write streams intended
- to be read by older versions of the same class.
-
-- Provide default serialization for persistence and for RMI.
-
-- Perform well and produce compact streams in simple cases, so that RMI can
- use serialization.
-
-- Be able to identify and load classes that match the exact class used to
- write the stream.
-
-- Keep the overhead low for nonversioned classes.
-
-- Use a stream format that allows the traversal of the stream without having
- to invoke methods specific to the objects saved in the stream.
-
-## 5.3 Assumptions
-
-The assumptions are that:
-
-- Versioning will only apply to serializable classes since it must control
- the stream format to achieve it goals. Externalizable classes will be
- responsible for their own versioning which is tied to the external format.
-
-- All data and objects must be read from, or skipped in, the stream in the
- same order as they were written.
-
-- Classes evolve individually as well as in concert with supertypes and
- subtypes.
-
-- Classes are identified by name. Two classes with the same name may be
- different versions or completely different classes that can be
- distinguished only by comparing their interfaces or by comparing hashes of
- the interfaces.
-
-- Default serialization will not perform any type conversions.
-
-- The stream format only needs to support a linear sequence of type changes,
- not arbitrary branching of a type.
-
-## 5.4 Who's Responsible for Versioning of Streams
-
-In the evolution of classes, it is the responsibility of the evolved (later
-version) class to maintain the contract established by the nonevolved class.
-This takes two forms. First, the evolved class must not break the existing
-assumptions about the interface provided by the original version, so that the
-evolved class can be used in place of the original. Secondly, when
-communicating with the original (or previous) versions, the evolved class must
-provide sufficient and equivalent information to allow the earlier version to
-continue to satisfy the nonevolved contract.
-
-> ![*Private serialization protocol and contract with supertype relationships
- between evolved and nonevolved classes and their
- instances*](images/version.gif)
-
-For the purposes of the discussion here, each class implements and extends the
-interface or contract defined by its supertype. New versions of a class, for
-example `foo'`, must continue to satisfy the contract for `foo` and may extend
-the interface or modify its implementation.
-
-Communication between objects via serialization is not part of the contract
-defined by these interfaces. Serialization is a private protocol between the
-implementations. It is the responsibility of the implementations to communicate
-sufficiently to allow each implementation to continue to satisfy the contract
-expected by its clients.
-
-## 5.5 Compatible Java Type Evolution
-
-The Java Language Specification discusses binary compatibility of Java classes
-as those classes evolve. Most of the flexibility of binary compatibility comes
-from the use of late binding of symbolic references for the names of classes,
-interfaces, fields, methods, and so on.
-
-The following are the principle aspects of the design for versioning of
-serialized object streams.
-
-- The default serialization mechanism will use a symbolic model for binding
- the fields in the stream to the fields in the corresponding class in the
- virtual machine.
-
-- Each class referenced in the stream will uniquely identify itself, its
- supertype, and the types and names of each serializable field written to
- the stream. The fields are ordered with the primitive types first sorted by
- field name, followed by the object fields sorted by field name.
-
-- Two types of data may occur in the stream for each class: required data
- (corresponding directly to the serializable fields of the object); and
- optional data (consisting of an arbitrary sequence of primitives and
- objects). The stream format defines how the required and optional data
- occur in the stream so that the whole class, the required, or the optional
- parts can be skipped if necessary.
-
- - The required data consists of the fields of the object in the order
- defined by the class descriptor.
-
- - The optional data is written to the stream and does not correspond
- directly to fields of the class. The class itself is responsible for
- the length, types, and versioning of this optional information.
-
-- If defined for a class, the `writeObject`/`readObject` methods supersede
- the default mechanism to write/read the state of the class. These methods
- write and read the optional data for a class. The required data is written
- by calling `defaultWriteObject` and read by calling `defaultReadObject`.
-
-- The stream format of each class is identified by the use of a Stream Unique
- Identifier (SUID). By default, this is the hash of the class. All later
- versions of the class must declare the Stream Unique Identifier (SUID) that
- they are compatible with. This guards against classes with the same name
- that might inadvertently be identified as being versions of a single class.
-
-- Subtypes of `ObjectOutputStream` and `ObjectInputStream` may include their
- own information identifying the class using the `annotateClass` method; for
- example, `MarshalOutputStream` embeds the URL of the class.
-
-## 5.6 Type Changes Affecting Serialization
-
-With these concepts, we can now describe how the design will cope with the
-different cases of an evolving class. The cases are described in terms of a
-stream written by some version of a class. When the stream is read back by the
-same version of the class, there is no loss of information or functionality.
-The stream is the only source of information about the original class. Its
-class descriptions, while a subset of the original class description, are
-sufficient to match up the data in the stream with the version of the class
-being reconstituted.
-
-The descriptions are from the perspective of the stream being read in order to
-reconstitute either an earlier or later version of the class. In the parlance
-of RPC systems, this is a "receiver makes right" system. The writer writes its
-data in the most suitable form and the receiver must interpret that information
-to extract the parts it needs and to fill in the parts that are not available.
-
-### 5.6.1 Incompatible Changes
-
-Incompatible changes to classes are those changes for which the guarantee of
-interoperability cannot be maintained. The incompatible changes that may occur
-while evolving a class are:
-
-- Deleting fields - If a field is deleted in a class, the stream written will
- not contain its value. When the stream is read by an earlier class, the
- value of the field will be set to the default value because no value is
- available in the stream. However, this default value may adversely impair
- the ability of the earlier version to fulfill its contract.
-
-- Moving classes up or down the hierarchy - This cannot be allowed since the
- data in the stream appears in the wrong sequence.
-
-- Changing a nonstatic field to static or a nontransient field to transient -
- When relying on default serialization, this change is equivalent to
- deleting a field from the class. This version of the class will not write
- that data to the stream, so it will not be available to be read by earlier
- versions of the class. As when deleting a field, the field of the earlier
- version will be initialized to the default value, which can cause the class
- to fail in unexpected ways.
-
-- Changing the declared type of a primitive field - Each version of the class
- writes the data with its declared type. Earlier versions of the class
- attempting to read the field will fail because the type of the data in the
- stream does not match the type of the field.
-
-- Changing the `writeObject` or `readObject` method so that it no longer
- writes or reads the default field data or changing it so that it attempts
- to write it or read it when the previous version did not. The default field
- data must consistently either appear or not appear in the stream.
-
-- Changing a class from `Serializable` to `Externalizable` or vice versa is
- an incompatible change since the stream will contain data that is
- incompatible with the implementation of the available class.
-
-- Changing a class from a non-enum type to an enum type or vice versa since
- the stream will contain data that is incompatible with the implementation
- of the available class.
-
-- Removing either `Serializable` or `Externalizable` is an incompatible
- change since when written it will no longer supply the fields needed by
- older versions of the class.
-
-- Adding the `writeReplace` or `readResolve` method to a class is
- incompatible if the behavior would produce an object that is incompatible
- with any older version of the class.
-
-### 5.6.2 Compatible Changes
-
-The compatible changes to a class are handled as follows:
-
-- Adding fields - When the class being reconstituted has a field that does
- not occur in the stream, that field in the object will be initialized to
- the default value for its type. If class-specific initialization is needed,
- the class may provide a readObject method that can initialize the field to
- nondefault values.
-
-- Adding classes - The stream will contain the type hierarchy of each object
- in the stream. Comparing this hierarchy in the stream with the current
- class can detect additional classes. Since there is no information in the
- stream from which to initialize the object, the class's fields will be
- initialized to the default values.
-
-- Removing classes - Comparing the class hierarchy in the stream with that of
- the current class can detect that a class has been deleted. In this case,
- the fields and objects corresponding to that class are read from the
- stream. Primitive fields are discarded, but the objects referenced by the
- deleted class are created, since they may be referred to later in the
- stream. They will be garbage-collected when the stream is garbage-collected
- or reset.
-
-- Adding `writeObject`/`readObject` methods - If the version reading the
- stream has these methods then `readObject` is expected, as usual, to read
- the required data written to the stream by the default serialization. It
- should call `defaultReadObject` first before reading any optional data. The
- `writeObject` method is expected as usual to call `defaultWriteObject` to
- write the required data and then may write optional data.
-
-- Removing `writeObject`/`readObject` methods - If the class reading the
- stream does not have these methods, the required data will be read by
- default serialization, and the optional data will be discarded.
-
-- Adding `java.io.Serializable` - This is equivalent to adding types. There
- will be no values in the stream for this class so its fields will be
- initialized to default values. The support for subclassing nonserializable
- classes requires that the class's supertype have a no-arg constructor and
- the class itself will be initialized to default values. If the no-arg
- constructor is not available, the `InvalidClassException` is thrown.
-
-- Changing the access to a field - The access modifiers public, package,
- protected, and private have no effect on the ability of serialization to
- assign values to the fields.
-
-- Changing a field from static to nonstatic or transient to nontransient -
- When relying on default serialization to compute the serializable fields,
- this change is equivalent to adding a field to the class. The new field
- will be written to the stream but earlier classes will ignore the value
- since serialization will not assign values to static or transient fields.
-
--------------------------------------------------------------------------------
-
-*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle
-and/or its affiliates. All rights reserved.*
--- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c Thu Aug 24 16:24:44 2017 +0200
@@ -1244,7 +1244,7 @@
(JNIEnv *env, const char *ifname, const struct in_addr *addr,
unsigned char *buf)
{
- static struct ifreq ifr;
+ struct ifreq ifr;
int i, sock;
if ((sock = openSocketWithFallback(env, ifname)) < 0) {
--- a/jdk/src/java.base/windows/classes/java/io/WinNTFileSystem.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.base/windows/classes/java/io/WinNTFileSystem.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,6 +27,7 @@
import java.io.File;
import java.nio.file.Path;
+import java.util.BitSet;
import java.util.Locale;
import java.util.Properties;
import sun.security.action.GetPropertyAction;
@@ -586,24 +587,12 @@
@Override
public File[] listRoots() {
- int ds = listRoots0();
- int n = 0;
- for (int i = 0; i < 26; i++) {
- if (((ds >> i) & 1) != 0) {
- if (!access((char)('A' + i) + ":" + slash))
- ds &= ~(1 << i);
- else
- n++;
- }
- }
- File[] fs = new File[n];
- int j = 0;
- char slash = this.slash;
- for (int i = 0; i < 26; i++) {
- if (((ds >> i) & 1) != 0)
- fs[j++] = new File((char)('A' + i) + ":" + slash);
- }
- return fs;
+ return BitSet
+ .valueOf(new long[] {listRoots0()})
+ .stream()
+ .mapToObj(i -> new File((char)('A' + i) + ":" + slash))
+ .filter(f -> access(f.getPath()) && f.exists())
+ .toArray(File[]::new);
}
private static native int listRoots0();
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Clipboard.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Clipboard.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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,29 +25,26 @@
package java.awt.datatransfer;
-import sun.datatransfer.DataFlavorUtil;
-
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
-import java.util.HashSet;
-import java.util.Arrays;
-import java.io.IOException;
+import sun.datatransfer.DataFlavorUtil;
/**
- * A class that implements a mechanism to transfer data using
- * cut/copy/paste operations.
+ * A class that implements a mechanism to transfer data using cut/copy/paste
+ * operations.
* <p>
- * {@link FlavorListener}s may be registered on an instance of the
- * Clipboard class to be notified about changes to the set of
- * {@link DataFlavor}s available on this clipboard (see
- * {@link #addFlavorListener}).
+ * {@link FlavorListener}s may be registered on an instance of the Clipboard
+ * class to be notified about changes to the set of {@link DataFlavor}s
+ * available on this clipboard (see {@link #addFlavorListener}).
*
+ * @author Amy Fowler
+ * @author Alexander Gerasimov
* @see java.awt.Toolkit#getSystemClipboard
* @see java.awt.Toolkit#getSystemSelection
- *
- * @author Amy Fowler
- * @author Alexander Gerasimov
* @since 1.1
*/
public class Clipboard {
@@ -58,6 +55,7 @@
* The owner of the clipboard.
*/
protected ClipboardOwner owner;
+
/**
* Contents of the clipboard.
*/
@@ -71,9 +69,9 @@
private Set<FlavorListener> flavorListeners;
/**
- * A set of <code>DataFlavor</code>s that is available on
- * this local clipboard. It is used for tracking changes
- * of <code>DataFlavor</code>s available on this clipboard.
+ * A set of {@code DataFlavor}s that is available on this local clipboard.
+ * It is used for tracking changes of {@code DataFlavor}s available on this
+ * clipboard.
*
* @since 1.5
*/
@@ -81,7 +79,8 @@
/**
* Creates a clipboard object.
- * @param name for the clipboard
+ *
+ * @param name for the clipboard
* @see java.awt.Toolkit#getSystemClipboard
*/
public Clipboard(String name) {
@@ -90,8 +89,8 @@
/**
* Returns the name of this clipboard object.
+ *
* @return the name of this clipboard object
- *
* @see java.awt.Toolkit#getSystemClipboard
*/
public String getName() {
@@ -99,27 +98,25 @@
}
/**
- * Sets the current contents of the clipboard to the specified
- * transferable object and registers the specified clipboard owner
- * as the owner of the new contents.
+ * Sets the current contents of the clipboard to the specified transferable
+ * object and registers the specified clipboard owner as the owner of the
+ * new contents.
* <p>
- * If there is an existing owner different from the argument
- * <code>owner</code>, that owner is notified that it no longer
- * holds ownership of the clipboard contents via an invocation
- * of <code>ClipboardOwner.lostOwnership()</code> on that owner.
- * An implementation of <code>setContents()</code> is free not
- * to invoke <code>lostOwnership()</code> directly from this method.
- * For example, <code>lostOwnership()</code> may be invoked later on
- * a different thread. The same applies to <code>FlavorListener</code>s
- * registered on this clipboard.
+ * If there is an existing owner different from the argument {@code owner},
+ * that owner is notified that it no longer holds ownership of the clipboard
+ * contents via an invocation of {@code ClipboardOwner.lostOwnership()} on
+ * that owner. An implementation of {@code setContents()} is free not to
+ * invoke {@code lostOwnership()} directly from this method. For example,
+ * {@code lostOwnership()} may be invoked later on a different thread. The
+ * same applies to {@code FlavorListener}s registered on this clipboard.
* <p>
- * The method throws <code>IllegalStateException</code> if the clipboard
- * is currently unavailable. For example, on some platforms, the system
+ * The method throws {@code IllegalStateException} if the clipboard is
+ * currently unavailable. For example, on some platforms, the system
* clipboard is unavailable while it is accessed by another application.
*
- * @param contents the transferable object representing the
- * clipboard content
- * @param owner the object which owns the clipboard content
+ * @param contents the transferable object representing the clipboard
+ * content
+ * @param owner the object which owns the clipboard content
* @throws IllegalStateException if the clipboard is currently unavailable
* @see java.awt.Toolkit#getSystemClipboard
*/
@@ -138,15 +135,14 @@
}
/**
- * Returns a transferable object representing the current contents
- * of the clipboard. If the clipboard currently has no contents,
- * it returns <code>null</code>. The parameter Object requestor is
- * not currently used. The method throws
- * <code>IllegalStateException</code> if the clipboard is currently
- * unavailable. For example, on some platforms, the system clipboard is
+ * Returns a transferable object representing the current contents of the
+ * clipboard. If the clipboard currently has no contents, it returns
+ * {@code null}. The parameter Object requestor is not currently used. The
+ * method throws {@code IllegalStateException} if the clipboard is currently
+ * unavailable. For example, on some platforms, the system clipboard is
* unavailable while it is accessed by another application.
*
- * @param requestor the object requesting the clip data (not used)
+ * @param requestor the object requesting the clip data (not used)
* @return the current transferable object on the clipboard
* @throws IllegalStateException if the clipboard is currently unavailable
* @see java.awt.Toolkit#getSystemClipboard
@@ -155,18 +151,14 @@
return contents;
}
-
/**
- * Returns an array of <code>DataFlavor</code>s in which the current
- * contents of this clipboard can be provided. If there are no
- * <code>DataFlavor</code>s available, this method returns a zero-length
- * array.
+ * Returns an array of {@code DataFlavor}s in which the current contents of
+ * this clipboard can be provided. If there are no {@code DataFlavor}s
+ * available, this method returns a zero-length array.
*
- * @return an array of <code>DataFlavor</code>s in which the current
- * contents of this clipboard can be provided
- *
+ * @return an array of {@code DataFlavor}s in which the current contents of
+ * this clipboard can be provided
* @throws IllegalStateException if this clipboard is currently unavailable
- *
* @since 1.5
*/
public DataFlavor[] getAvailableDataFlavors() {
@@ -179,17 +171,14 @@
/**
* Returns whether or not the current contents of this clipboard can be
- * provided in the specified <code>DataFlavor</code>.
- *
- * @param flavor the requested <code>DataFlavor</code> for the contents
+ * provided in the specified {@code DataFlavor}.
*
- * @return <code>true</code> if the current contents of this clipboard
- * can be provided in the specified <code>DataFlavor</code>;
- * <code>false</code> otherwise
- *
- * @throws NullPointerException if <code>flavor</code> is <code>null</code>
+ * @param flavor the requested {@code DataFlavor} for the contents
+ * @return {@code true} if the current contents of this clipboard can be
+ * provided in the specified {@code DataFlavor}; {@code false}
+ * otherwise
+ * @throws NullPointerException if {@code flavor} is {@code null}
* @throws IllegalStateException if this clipboard is currently unavailable
- *
* @since 1.5
*/
public boolean isDataFlavorAvailable(DataFlavor flavor) {
@@ -205,25 +194,20 @@
}
/**
- * Returns an object representing the current contents of this clipboard
- * in the specified <code>DataFlavor</code>.
- * The class of the object returned is defined by the representation
- * class of <code>flavor</code>.
- *
- * @param flavor the requested <code>DataFlavor</code> for the contents
- *
- * @return an object representing the current contents of this clipboard
- * in the specified <code>DataFlavor</code>
+ * Returns an object representing the current contents of this clipboard in
+ * the specified {@code DataFlavor}. The class of the object returned is
+ * defined by the representation class of {@code flavor}.
*
- * @throws NullPointerException if <code>flavor</code> is <code>null</code>
+ * @param flavor the requested {@code DataFlavor} for the contents
+ * @return an object representing the current contents of this clipboard in
+ * the specified {@code DataFlavor}
+ * @throws NullPointerException if {@code flavor} is {@code null}
* @throws IllegalStateException if this clipboard is currently unavailable
- * @throws UnsupportedFlavorException if the requested <code>DataFlavor</code>
- * is not available
- * @throws IOException if the data in the requested <code>DataFlavor</code>
- * can not be retrieved
- *
+ * @throws UnsupportedFlavorException if the requested {@code DataFlavor} is
+ * not available
+ * @throws IOException if the data in the requested {@code DataFlavor} can
+ * not be retrieved
* @see DataFlavor#getRepresentationClass
- *
* @since 1.5
*/
public Object getData(DataFlavor flavor)
@@ -239,15 +223,12 @@
return cntnts.getTransferData(flavor);
}
-
/**
- * Registers the specified <code>FlavorListener</code> to receive
- * <code>FlavorEvent</code>s from this clipboard.
- * If <code>listener</code> is <code>null</code>, no exception
- * is thrown and no action is performed.
+ * Registers the specified {@code FlavorListener} to receive
+ * {@code FlavorEvent}s from this clipboard. If {@code listener} is
+ * {@code null}, no exception is thrown and no action is performed.
*
- * @param listener the listener to be added
- *
+ * @param listener the listener to be added
* @see #removeFlavorListener
* @see #getFlavorListeners
* @see FlavorListener
@@ -268,16 +249,14 @@
}
/**
- * Removes the specified <code>FlavorListener</code> so that it no longer
- * receives <code>FlavorEvent</code>s from this <code>Clipboard</code>.
- * This method performs no function, nor does it throw an exception, if
- * the listener specified by the argument was not previously added to this
- * <code>Clipboard</code>.
- * If <code>listener</code> is <code>null</code>, no exception
- * is thrown and no action is performed.
+ * Removes the specified {@code FlavorListener} so that it no longer
+ * receives {@code FlavorEvent}s from this {@code Clipboard}. This method
+ * performs no function, nor does it throw an exception, if the listener
+ * specified by the argument was not previously added to this
+ * {@code Clipboard}. If {@code listener} is {@code null}, no exception is
+ * thrown and no action is performed.
*
- * @param listener the listener to be removed
- *
+ * @param listener the listener to be removed
* @see #addFlavorListener
* @see #getFlavorListeners
* @see FlavorListener
@@ -292,11 +271,11 @@
}
/**
- * Returns an array of all the <code>FlavorListener</code>s currently
- * registered on this <code>Clipboard</code>.
+ * Returns an array of all the {@code FlavorListener}s currently registered
+ * on this {@code Clipboard}.
*
- * @return all of this clipboard's <code>FlavorListener</code>s or an empty
- * array if no listeners are currently registered
+ * @return all of this clipboard's {@code FlavorListener}s or an empty array
+ * if no listeners are currently registered
* @see #addFlavorListener
* @see #removeFlavorListener
* @see FlavorListener
@@ -309,9 +288,9 @@
}
/**
- * Checks change of the <code>DataFlavor</code>s and, if necessary,
- * notifies all listeners that have registered interest for notification
- * on <code>FlavorEvent</code>s.
+ * Checks change of the {@code DataFlavor}s and, if necessary, notifies all
+ * listeners that have registered interest for notification on
+ * {@code FlavorEvent}s.
*
* @since 1.5
*/
@@ -331,12 +310,11 @@
}
/**
- * Returns a set of <code>DataFlavor</code>s currently available
- * on this clipboard.
+ * Returns a set of {@code DataFlavor}s currently available on this
+ * clipboard.
*
- * @return a set of <code>DataFlavor</code>s currently available
- * on this clipboard
- *
+ * @return a set of {@code DataFlavor}s currently available on this
+ * clipboard
* @since 1.5
*/
private Set<DataFlavor> getAvailableDataFlavorSet() {
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/ClipboardOwner.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/ClipboardOwner.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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,32 +26,28 @@
package java.awt.datatransfer;
/**
- * Defines the interface for classes that will provide data to
- * a clipboard. An instance of this interface becomes the owner
- * of the contents of a clipboard (clipboard owner) if it is
- * passed as an argument to
- * {@link java.awt.datatransfer.Clipboard#setContents} method of
- * the clipboard and this method returns successfully.
- * The instance remains the clipboard owner until another application
- * or another object within this application asserts ownership
- * of this clipboard.
+ * Defines the interface for classes that will provide data to a clipboard. An
+ * instance of this interface becomes the owner of the contents of a clipboard
+ * (clipboard owner) if it is passed as an argument to
+ * {@link Clipboard#setContents} method of the clipboard and this method returns
+ * successfully. The instance remains the clipboard owner until another
+ * application or another object within this application asserts ownership of
+ * this clipboard.
*
- * @see java.awt.datatransfer.Clipboard
- *
- * @author Amy Fowler
+ * @author Amy Fowler
+ * @see Clipboard
* @since 1.1
*/
-
public interface ClipboardOwner {
/**
- * Notifies this object that it is no longer the clipboard owner.
- * This method will be called when another application or another
- * object within this application asserts ownership of the clipboard.
+ * Notifies this object that it is no longer the clipboard owner. This
+ * method will be called when another application or another object within
+ * this application asserts ownership of the clipboard.
*
- * @param clipboard the clipboard that is no longer owned
- * @param contents the contents which this owner had placed on the clipboard
+ * @param clipboard the clipboard that is no longer owned
+ * @param contents the contents which this owner had placed on the
+ * {@code clipboard}
*/
public void lostOwnership(Clipboard clipboard, Transferable contents);
-
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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,6 @@
package java.awt.datatransfer;
-import sun.datatransfer.DataFlavorUtil;
-import sun.reflect.misc.ReflectUtil;
-
import java.io.ByteArrayInputStream;
import java.io.CharArrayReader;
import java.io.Externalizable;
@@ -46,54 +43,52 @@
import java.util.Collections;
import java.util.Objects;
+import sun.datatransfer.DataFlavorUtil;
+import sun.reflect.misc.ReflectUtil;
+
/**
* A {@code DataFlavor} provides meta information about data. {@code DataFlavor}
- * is typically used to access data on the clipboard, or during
- * a drag and drop operation.
+ * is typically used to access data on the clipboard, or during a drag and drop
+ * operation.
* <p>
- * An instance of {@code DataFlavor} encapsulates a content type as
- * defined in <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
- * and <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>.
- * A content type is typically referred to as a MIME type.
+ * An instance of {@code DataFlavor} encapsulates a content type as defined in
+ * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> and
+ * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>. A content type is
+ * typically referred to as a MIME type.
* <p>
- * A content type consists of a media type (referred
- * to as the primary type), a subtype, and optional parameters. See
- * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
- * for details on the syntax of a MIME type.
+ * A content type consists of a media type (referred to as the primary type), a
+ * subtype, and optional parameters. See
+ * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> for details on the
+ * syntax of a MIME type.
* <p>
- * The JRE data transfer implementation interprets the parameter "class"
- * of a MIME type as <B>a representation class</b>.
- * The representation class reflects the class of the object being
- * transferred. In other words, the representation class is the type of
- * object returned by {@link Transferable#getTransferData}.
- * For example, the MIME type of {@link #imageFlavor} is
- * {@code "image/x-java-image;class=java.awt.Image"},
- * the primary type is {@code image}, the subtype is
- * {@code x-java-image}, and the representation class is
- * {@code java.awt.Image}. When {@code getTransferData} is invoked
- * with a {@code DataFlavor} of {@code imageFlavor}, an instance of
- * {@code java.awt.Image} is returned.
- * It's important to note that {@code DataFlavor} does no error checking
- * against the representation class. It is up to consumers of
- * {@code DataFlavor}, such as {@code Transferable}, to honor the representation
- * class.
+ * The JRE data transfer implementation interprets the parameter
+ * "class" of a MIME type as <B>a representation class</b>. The
+ * representation class reflects the class of the object being transferred. In
+ * other words, the representation class is the type of object returned by
+ * {@link Transferable#getTransferData}. For example, the MIME type of
+ * {@link #imageFlavor} is {@code "image/x-java-image;class=java.awt.Image"},
+ * the primary type is {@code image}, the subtype is {@code x-java-image}, and
+ * the representation class is {@code java.awt.Image}. When
+ * {@code getTransferData} is invoked with a {@code DataFlavor} of
+ * {@code imageFlavor}, an instance of {@code java.awt.Image} is returned. It's
+ * important to note that {@code DataFlavor} does no error checking against the
+ * representation class. It is up to consumers of {@code DataFlavor}, such as
+ * {@code Transferable}, to honor the representation class.
* <br>
- * Note, if you do not specify a representation class when
- * creating a {@code DataFlavor}, the default
- * representation class is used. See appropriate documentation for
- * {@code DataFlavor}'s constructors.
+ * Note, if you do not specify a representation class when creating a
+ * {@code DataFlavor}, the default representation class is used. See appropriate
+ * documentation for {@code DataFlavor}'s constructors.
* <p>
- * Also, {@code DataFlavor} instances with the "text" primary
- * MIME type may have a "charset" parameter. Refer to
+ * Also, {@code DataFlavor} instances with the "text" primary MIME
+ * type may have a "charset" parameter. Refer to
* <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a> and
- * {@link #selectBestTextFlavor} for details on "text" MIME types
- * and the "charset" parameter.
+ * {@link #selectBestTextFlavor} for details on "text" MIME types and
+ * the "charset" parameter.
* <p>
- * Equality of {@code DataFlavors} is determined by the primary type,
- * subtype, and representation class. Refer to {@link #equals(DataFlavor)} for
- * details. When determining equality, any optional parameters are ignored.
- * For example, the following produces two {@code DataFlavors} that
- * are considered identical:
+ * Equality of {@code DataFlavors} is determined by the primary type, subtype,
+ * and representation class. Refer to {@link #equals(DataFlavor)} for details.
+ * When determining equality, any optional parameters are ignored. For example,
+ * the following produces two {@code DataFlavors} that are considered identical:
* <pre>
* DataFlavor flavor1 = new DataFlavor(Object.class, "X-test/test; class=<java.lang.Object>; foo=bar");
* DataFlavor flavor2 = new DataFlavor(Object.class, "X-test/test; class=<java.lang.Object>; x=y");
@@ -104,14 +99,14 @@
* As such, asking a {@code Transferable} for either {@code DataFlavor} returns
* the same results.
* <p>
- * For more information on using data transfer with Swing see
- * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
- * How to Use Drag and Drop and Data Transfer</a>,
- * section in <em>Java Tutorial</em>.
+ * For more information on using data transfer with Swing see the
+ * <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">How
+ * to Use Drag and Drop and Data Transfer</a>, section in
+ * <em>The Java Tutorial</em>.
*
- * @author Blake Sullivan
- * @author Laurence P. G. Cable
- * @author Jeff Dunn
+ * @author Blake Sullivan
+ * @author Laurence P. G. Cable
+ * @author Jeff Dunn
* @since 1.1
*/
public class DataFlavor implements Externalizable, Cloneable {
@@ -120,13 +115,13 @@
private static final Class<InputStream> ioInputStreamClass = InputStream.class;
/**
- * Tries to load a class from: the bootstrap loader, the system loader,
- * the context loader (if one is present) and finally the loader specified.
+ * Tries to load a class from: the bootstrap loader, the system loader, the
+ * context loader (if one is present) and finally the loader specified.
*
- * @param className the name of the class to be loaded
- * @param fallback the fallback loader
+ * @param className the name of the class to be loaded
+ * @param fallback the fallback loader
* @return the class loaded
- * @exception ClassNotFoundException if class is not found
+ * @throws ClassNotFoundException if class is not found
*/
protected static final Class<?> tryToLoadClass(String className,
ClassLoader fallback)
@@ -196,18 +191,16 @@
}
/**
- * The <code>DataFlavor</code> representing a Java Unicode String class,
- * where:
+ * The {@code DataFlavor} representing a Java Unicode String class, where:
* <pre>
* representationClass = java.lang.String
- * mimeType = "application/x-java-serialized-object"
+ * mimeType = "application/x-java-serialized-object"
* </pre>
*/
public static final DataFlavor stringFlavor = createConstant(java.lang.String.class, "Unicode String");
/**
- * The <code>DataFlavor</code> representing a Java Image class,
- * where:
+ * The {@code DataFlavor} representing a Java Image class, where:
* <pre>
* representationClass = java.awt.Image
* mimeType = "image/x-java-image"
@@ -219,79 +212,78 @@
public static final DataFlavor imageFlavor = createConstant("image/x-java-image; class=java.awt.Image", "Image");
/**
- * The <code>DataFlavor</code> representing plain text with Unicode
- * encoding, where:
+ * The {@code DataFlavor} representing plain text with Unicode encoding,
+ * where:
* <pre>
* representationClass = InputStream
* mimeType = "text/plain; charset=unicode"
* </pre>
- * This <code>DataFlavor</code> has been <b>deprecated</b> because
- * (1) Its representation is an InputStream, an 8-bit based representation,
- * while Unicode is a 16-bit character set; and (2) The charset "unicode"
- * is not well-defined. "unicode" implies a particular platform's
- * implementation of Unicode, not a cross-platform implementation.
+ * This {@code DataFlavor} has been <b>deprecated</b> because:
+ * <ul>
+ * <li>Its representation is an InputStream, an 8-bit based representation,
+ * while Unicode is a 16-bit character set</li>
+ * <li>The charset "unicode" is not well-defined. "unicode" implies a
+ * particular platform's implementation of Unicode, not a cross-platform
+ * implementation</li>
+ * </ul>
*
- * @deprecated as of 1.3. Use <code>DataFlavor.getReaderForText(Transferable)</code>
- * instead of <code>Transferable.getTransferData(DataFlavor.plainTextFlavor)</code>.
+ * @deprecated as of 1.3. Use {@link #getReaderForText} instead of
+ * {@code Transferable.getTransferData(DataFlavor.plainTextFlavor)}.
*/
@Deprecated
public static final DataFlavor plainTextFlavor = createConstant("text/plain; charset=unicode; class=java.io.InputStream", "Plain Text");
/**
- * A MIME Content-Type of application/x-java-serialized-object represents
- * a graph of Java object(s) that have been made persistent.
- *
- * The representation class associated with this <code>DataFlavor</code>
- * identifies the Java type of an object returned as a reference
- * from an invocation <code>java.awt.datatransfer.getTransferData</code>.
+ * A MIME Content-Type of application/x-java-serialized-object represents a
+ * graph of Java object(s) that have been made persistent.
+ * <p>
+ * The representation class associated with this {@code DataFlavor}
+ * identifies the Java type of an object returned as a reference from an
+ * invocation {@code java.awt.datatransfer.getTransferData}.
*/
public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object";
/**
- * To transfer a list of files to/from Java (and the underlying
- * platform) a <code>DataFlavor</code> of this type/subtype and
- * representation class of <code>java.util.List</code> is used.
- * Each element of the list is required/guaranteed to be of type
- * <code>java.io.File</code>.
+ * To transfer a list of files to/from Java (and the underlying platform) a
+ * {@code DataFlavor} of this type/subtype and representation class of
+ * {@code java.util.List} is used. Each element of the list is
+ * required/guaranteed to be of type {@code java.io.File}.
*/
public static final DataFlavor javaFileListFlavor = createConstant("application/x-java-file-list;class=java.util.List", null);
/**
- * To transfer a reference to an arbitrary Java object reference that
- * has no associated MIME Content-type, across a <code>Transferable</code>
- * interface WITHIN THE SAME JVM, a <code>DataFlavor</code>
- * with this type/subtype is used, with a <code>representationClass</code>
- * equal to the type of the class/interface being passed across the
- * <code>Transferable</code>.
+ * To transfer a reference to an arbitrary Java object reference that has no
+ * associated MIME Content-type, across a {@code Transferable} interface
+ * WITHIN THE SAME JVM, a {@code DataFlavor} with this type/subtype is used,
+ * with a {@code representationClass} equal to the type of the
+ * class/interface being passed across the {@code Transferable}.
* <p>
- * The object reference returned from
- * <code>Transferable.getTransferData</code> for a <code>DataFlavor</code>
- * with this MIME Content-Type is required to be
- * an instance of the representation Class of the <code>DataFlavor</code>.
+ * The object reference returned from {@code Transferable.getTransferData}
+ * for a {@code DataFlavor} with this MIME Content-Type is required to be an
+ * instance of the representation Class of the {@code DataFlavor}.
*/
public static final String javaJVMLocalObjectMimeType = "application/x-java-jvm-local-objectref";
/**
* In order to pass a live link to a Remote object via a Drag and Drop
- * <code>ACTION_LINK</code> operation a Mime Content Type of
- * application/x-java-remote-object should be used,
- * where the representation class of the <code>DataFlavor</code>
- * represents the type of the <code>Remote</code> interface to be
- * transferred.
+ * {@code ACTION_LINK} operation a Mime Content Type of
+ * application/x-java-remote-object should be used, where the representation
+ * class of the {@code DataFlavor} represents the type of the {@code Remote}
+ * interface to be transferred.
*/
public static final String javaRemoteObjectMimeType = "application/x-java-remote-object";
/**
* Represents a piece of an HTML markup. The markup consists of the part
* selected on the source side. Therefore some tags in the markup may be
- * unpaired. If the flavor is used to represent the data in
- * a {@link Transferable} instance, no additional changes will be made.
- * This DataFlavor instance represents the same HTML markup as DataFlavor
+ * unpaired. If the flavor is used to represent the data in a
+ * {@link Transferable} instance, no additional changes will be made. This
+ * DataFlavor instance represents the same HTML markup as DataFlavor
* instances which content MIME type does not contain document parameter
* and representation class is the String class.
* <pre>
* representationClass = String
- * mimeType = "text/html"
+ * mimeType = "text/html"
* </pre>
*
* @since 1.8
@@ -300,12 +292,12 @@
/**
* Represents a piece of an HTML markup. If possible, the markup received
- * from a native system is supplemented with pair tags to be
- * a well-formed HTML markup. If the flavor is used to represent the data in
- * a {@link Transferable} instance, no additional changes will be made.
+ * from a native system is supplemented with pair tags to be a well-formed
+ * HTML markup. If the flavor is used to represent the data in a
+ * {@link Transferable} instance, no additional changes will be made.
* <pre>
* representationClass = String
- * mimeType = "text/html"
+ * mimeType = "text/html"
* </pre>
*
* @since 1.8
@@ -313,25 +305,23 @@
public static DataFlavor fragmentHtmlFlavor = initHtmlDataFlavor("fragment");
/**
- * Represents a piece of an HTML markup. If possible, the markup
- * received from a native system is supplemented with additional
- * tags to make up a well-formed HTML document. If the flavor is used to
- * represent the data in a {@link Transferable} instance,
- * no additional changes will be made.
+ * Represents a piece of an HTML markup. If possible, the markup received
+ * from a native system is supplemented with additional tags to make up a
+ * well-formed HTML document. If the flavor is used to represent the data in
+ * a {@link Transferable} instance, no additional changes will be made.
* <pre>
* representationClass = String
- * mimeType = "text/html"
+ * mimeType = "text/html"
* </pre>
*
* @since 1.8
*/
- public static DataFlavor allHtmlFlavor = initHtmlDataFlavor("all");
+ public static DataFlavor allHtmlFlavor = initHtmlDataFlavor("all");
/**
- * Constructs a new <code>DataFlavor</code>. This constructor is
- * provided only for the purpose of supporting the
- * <code>Externalizable</code> interface. It is not
- * intended for public (client) use.
+ * Constructs a new {@code DataFlavor}. This constructor is provided only
+ * for the purpose of supporting the {@code Externalizable} interface. It is
+ * not intended for public (client) use.
*
* @since 1.2
*/
@@ -340,10 +330,10 @@
}
/**
- * Constructs a fully specified <code>DataFlavor</code>.
+ * Constructs a fully specified {@code DataFlavor}.
*
- * @exception NullPointerException if either <code>primaryType</code>,
- * <code>subType</code> or <code>representationClass</code> is null
+ * @throws NullPointerException if either {@code primaryType},
+ * {@code subType} or {@code representationClass} is {@code null}
*/
private DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class<?> representationClass, String humanPresentableName) {
super();
@@ -381,19 +371,21 @@
}
/**
- * Constructs a <code>DataFlavor</code> that represents a Java class.
+ * Constructs a {@code DataFlavor} that represents a Java class.
* <p>
- * The returned <code>DataFlavor</code> will have the following
- * characteristics:
+ * The returned {@code DataFlavor} will have the following characteristics:
* <pre>
* representationClass = representationClass
* mimeType = application/x-java-serialized-object
* </pre>
- * @param representationClass the class used to transfer data in this flavor
- * @param humanPresentableName the human-readable string used to identify
- * this flavor; if this parameter is <code>null</code>
- * then the value of the MIME Content Type is used
- * @exception NullPointerException if <code>representationClass</code> is null
+ *
+ * @param representationClass the class used to transfer data in this
+ * flavor
+ * @param humanPresentableName the human-readable string used to identify
+ * this flavor; if this parameter is {@code null} then the value of
+ * the MIME Content Type is used
+ * @throws NullPointerException if {@code representationClass} is
+ * {@code null}
*/
public DataFlavor(Class<?> representationClass, String humanPresentableName) {
this("application", "x-java-serialized-object", null, representationClass, humanPresentableName);
@@ -403,33 +395,31 @@
}
/**
- * Constructs a <code>DataFlavor</code> that represents a
- * <code>MimeType</code>.
+ * Constructs a {@code DataFlavor} that represents a {@code MimeType}.
* <p>
- * The returned <code>DataFlavor</code> will have the following
- * characteristics:
+ * The returned {@code DataFlavor} will have the following characteristics:
* <p>
- * If the <code>mimeType</code> is
+ * If the {@code mimeType} is
* "application/x-java-serialized-object; class=<representation class>",
* the result is the same as calling
- * <code>new DataFlavor(Class.forName(<representation class>)</code>.
+ * {@code new DataFlavor(Class.forName(<representation class>)}.
* <p>
* Otherwise:
* <pre>
* representationClass = InputStream
* mimeType = mimeType
* </pre>
- * @param mimeType the string used to identify the MIME type for this flavor;
- * if the <code>mimeType</code> does not specify a
- * "class=" parameter, or if the class is not successfully
- * loaded, then an <code>IllegalArgumentException</code>
- * is thrown
- * @param humanPresentableName the human-readable string used to identify
- * this flavor; if this parameter is <code>null</code>
- * then the value of the MIME Content Type is used
- * @exception IllegalArgumentException if <code>mimeType</code> is
- * invalid or if the class is not successfully loaded
- * @exception NullPointerException if <code>mimeType</code> is null
+ *
+ * @param mimeType the string used to identify the MIME type for this
+ * flavor; if the {@code mimeType} does not specify a "class="
+ * parameter, or if the class is not successfully loaded, then an
+ * {@code IllegalArgumentException} is thrown
+ * @param humanPresentableName the human-readable string used to identify
+ * this flavor; if this parameter is {@code null} then the value of
+ * the MIME Content Type is used
+ * @throws IllegalArgumentException if {@code mimeType} is invalid or if the
+ * class is not successfully loaded
+ * @throws NullPointerException if {@code mimeType} is {@code null}
*/
public DataFlavor(String mimeType, String humanPresentableName) {
super();
@@ -446,30 +436,29 @@
}
/**
- * Constructs a <code>DataFlavor</code> that represents a
- * <code>MimeType</code>.
+ * Constructs a {@code DataFlavor} that represents a {@code MimeType}.
* <p>
- * The returned <code>DataFlavor</code> will have the following
- * characteristics:
+ * The returned {@code DataFlavor} will have the following characteristics:
* <p>
* If the mimeType is
* "application/x-java-serialized-object; class=<representation class>",
* the result is the same as calling
- * <code>new DataFlavor(Class.forName(<representation class>)</code>.
+ * {@code new DataFlavor(Class.forName(<representation class>)}.
* <p>
* Otherwise:
* <pre>
* representationClass = InputStream
* mimeType = mimeType
* </pre>
- * @param mimeType the string used to identify the MIME type for this flavor
- * @param humanPresentableName the human-readable string used to
- * identify this flavor
- * @param classLoader the class loader to use
- * @exception ClassNotFoundException if the class is not loaded
- * @exception IllegalArgumentException if <code>mimeType</code> is
- * invalid
- * @exception NullPointerException if <code>mimeType</code> is null
+ *
+ * @param mimeType the string used to identify the MIME type for this
+ * flavor
+ * @param humanPresentableName the human-readable string used to identify
+ * this flavor
+ * @param classLoader the class loader to use
+ * @throws ClassNotFoundException if the class is not loaded
+ * @throws IllegalArgumentException if {@code mimeType} is invalid
+ * @throws NullPointerException if {@code mimeType} is {@code null}
*/
public DataFlavor(String mimeType, String humanPresentableName, ClassLoader classLoader) throws ClassNotFoundException {
super();
@@ -484,20 +473,19 @@
}
/**
- * Constructs a <code>DataFlavor</code> from a <code>mimeType</code> string.
- * The string can specify a "class=<fully specified Java class name>"
- * parameter to create a <code>DataFlavor</code> with the desired
- * representation class. If the string does not contain "class=" parameter,
- * <code>java.io.InputStream</code> is used as default.
+ * Constructs a {@code DataFlavor} from a {@code mimeType} string. The
+ * string can specify a "class=<fully specified Java class name>"
+ * parameter to create a {@code DataFlavor} with the desired representation
+ * class. If the string does not contain "class=" parameter,
+ * {@code java.io.InputStream} is used as default.
*
- * @param mimeType the string used to identify the MIME type for this flavor;
- * if the class specified by "class=" parameter is not
- * successfully loaded, then an
- * <code>ClassNotFoundException</code> is thrown
- * @exception ClassNotFoundException if the class is not loaded
- * @exception IllegalArgumentException if <code>mimeType</code> is
- * invalid
- * @exception NullPointerException if <code>mimeType</code> is null
+ * @param mimeType the string used to identify the MIME type for this
+ * flavor; if the class specified by "class=" parameter is not
+ * successfully loaded, then a {@code ClassNotFoundException} is
+ * thrown
+ * @throws ClassNotFoundException if the class is not loaded
+ * @throws IllegalArgumentException if {@code mimeType} is invalid
+ * @throws NullPointerException if {@code mimeType} is {@code null}
*/
public DataFlavor(String mimeType) throws ClassNotFoundException {
super();
@@ -511,20 +499,17 @@
}
}
- /**
- * Common initialization code called from various constructors.
- *
- * @param mimeType the MIME Content Type (must have a class= param)
- * @param humanPresentableName the human Presentable Name or
- * <code>null</code>
- * @param classLoader the fallback class loader to resolve against
- *
- * @throws MimeTypeParseException
- * @throws ClassNotFoundException
- * @throws NullPointerException if <code>mimeType</code> is null
- *
- * @see #tryToLoadClass
- */
+ /**
+ * Common initialization code called from various constructors.
+ *
+ * @param mimeType the MIME Content Type (must have a class= param)
+ * @param humanPresentableName the human Presentable Name or {@code null}
+ * @param classLoader the fallback class loader to resolve against
+ * @throws MimeTypeParseException
+ * @throws ClassNotFoundException
+ * @throws NullPointerException if {@code mimeType} is {@code null}
+ * @see #tryToLoadClass
+ */
private void initialize(String mimeType, String humanPresentableName, ClassLoader classLoader) throws MimeTypeParseException, ClassNotFoundException {
if (mimeType == null) {
throw new NullPointerException("mimeType");
@@ -558,15 +543,15 @@
}
/**
- * String representation of this <code>DataFlavor</code> and its
- * parameters. The resulting <code>String</code> contains the name of
- * the <code>DataFlavor</code> class, this flavor's MIME type, and its
- * representation class. If this flavor has a primary MIME type of "text",
- * supports the charset parameter, and has an encoded representation, the
- * flavor's charset is also included. See <code>selectBestTextFlavor</code>
- * for a list of text flavors which support the charset parameter.
+ * String representation of this {@code DataFlavor} and its parameters. The
+ * resulting {@code String} contains the name of the {@code DataFlavor}
+ * class, this flavor's MIME type, and its representation class. If this
+ * flavor has a primary MIME type of "text", supports the charset parameter,
+ * and has an encoded representation, the flavor's charset is also included.
+ * See {@code selectBestTextFlavor} for a list of text flavors which support
+ * the charset parameter.
*
- * @return string representation of this <code>DataFlavor</code>
+ * @return string representation of this {@code DataFlavor}
* @see #selectBestTextFlavor
*/
public String toString() {
@@ -600,19 +585,19 @@
}
/**
- * Returns a <code>DataFlavor</code> representing plain text with Unicode
+ * Returns a {@code DataFlavor} representing plain text with Unicode
* encoding, where:
* <pre>
* representationClass = java.io.InputStream
* mimeType = "text/plain;
* charset=<platform default Unicode encoding>"
* </pre>
- * Sun's implementation for Microsoft Windows uses the encoding <code>utf-16le</code>.
- * Sun's implementation for Solaris and Linux uses the encoding
- * <code>iso-10646-ucs-2</code>.
+ * @implNote Oracle's implementation for Microsoft Windows and macOS uses
+ * the encoding {@code utf-16le}. Oracle's implementation for Solaris and
+ * Linux uses the encoding {@code iso-10646-ucs-2}.
*
- * @return a <code>DataFlavor</code> representing plain text
- * with Unicode encoding
+ * @return a {@code DataFlavor} representing plain text with Unicode
+ * encoding
* @since 1.3
*/
public static final DataFlavor getTextPlainUnicodeFlavor() {
@@ -622,10 +607,10 @@
}
/**
- * Selects the best text <code>DataFlavor</code> from an array of <code>
- * DataFlavor</code>s. Only <code>DataFlavor.stringFlavor</code>, and
- * equivalent flavors, and flavors that have a primary MIME type of "text",
- * are considered for selection.
+ * Selects the best text {@code DataFlavor} from an array of
+ * {@code DataFlavor}s. Only {@code DataFlavor.stringFlavor}, and equivalent
+ * flavors, and flavors that have a primary MIME type of "text", are
+ * considered for selection.
* <p>
* Flavors are first sorted by their MIME types in the following order:
* <ul>
@@ -647,9 +632,10 @@
* <li>"text/plain"
* <li>"text/<other>"
* </ul>
- * <p>For example, "text/sgml" will be selected over
- * "text/html", and <code>DataFlavor.stringFlavor</code> will be chosen
- * over <code>DataFlavor.plainTextFlavor</code>.
+ * <p>
+ * For example, "text/sgml" will be selected over "text/html", and
+ * {@code DataFlavor.stringFlavor} will be chosen over
+ * {@code DataFlavor.plainTextFlavor}.
* <p>
* If two or more flavors share the best MIME type in the array, then that
* MIME type will be checked to see if it supports the charset parameter.
@@ -669,8 +655,8 @@
* <li>"application/x-java-serialized-object"
* <li>"text/plain"
* </ul>
- * The following MIME types do not support, or are treated as though they
- * do not support, the charset parameter:
+ * The following MIME types do not support, or are treated as though they do
+ * not support, the charset parameter:
* <ul>
* <li>"text/rtf"
* <li>"text/tab-separated-values"
@@ -680,25 +666,24 @@
* </ul>
* For "text/<other>" MIME types, the first time the JRE needs to
* determine whether the MIME type supports the charset parameter, it will
- * check whether the parameter is explicitly listed in an arbitrarily
- * chosen <code>DataFlavor</code> which uses that MIME type. If so, the JRE
- * will assume from that point on that the MIME type supports the charset
- * parameter and will not check again. If the parameter is not explicitly
- * listed, the JRE will assume from that point on that the MIME type does
- * not support the charset parameter and will not check again. Because
- * this check is performed on an arbitrarily chosen
- * <code>DataFlavor</code>, developers must ensure that all
- * <code>DataFlavor</code>s with a "text/<other>" MIME type specify
- * the charset parameter if it is supported by that MIME type. Developers
- * should never rely on the JRE to substitute the platform's default
- * charset for a "text/<other>" DataFlavor. Failure to adhere to this
- * restriction will lead to undefined behavior.
+ * check whether the parameter is explicitly listed in an arbitrarily chosen
+ * {@code DataFlavor} which uses that MIME type. If so, the JRE will assume
+ * from that point on that the MIME type supports the charset parameter and
+ * will not check again. If the parameter is not explicitly listed, the JRE
+ * will assume from that point on that the MIME type does not support the
+ * charset parameter and will not check again. Because this check is
+ * performed on an arbitrarily chosen {@code DataFlavor}, developers must
+ * ensure that all {@code DataFlavor}s with a "text/<other>" MIME type
+ * specify the charset parameter if it is supported by that MIME type.
+ * Developers should never rely on the JRE to substitute the platform's
+ * default charset for a "text/<other>" DataFlavor. Failure to adhere
+ * to this restriction will lead to undefined behavior.
* <p>
* If the best MIME type in the array does not support the charset
* parameter, the flavors which share that MIME type will then be sorted by
* their representation classes in the following order:
- * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
- * <code>[B</code>, <all others>.
+ * {@code java.io.InputStream}, {@code java.nio.ByteBuffer}, {@code [B},
+ * <all others>.
* <p>
* If two or more flavors share the best representation class, or if no
* flavor has one of the three specified representations, then one of those
@@ -706,9 +691,9 @@
* <p>
* If the best MIME type in the array does support the charset parameter,
* the flavors which share that MIME type will then be sorted by their
- * representation classes in the following order:
- * <code>java.io.Reader</code>, <code>java.lang.String</code>,
- * <code>java.nio.CharBuffer</code>, <code>[C</code>, <all others>.
+ * representation classes in the following order: {@code java.io.Reader},
+ * {@code java.lang.String}, {@code java.nio.CharBuffer}, {@code [C},
+ * <all others>.
* <p>
* If two or more flavors share the best representation class, and that
* representation is one of the four explicitly listed, then one of those
@@ -718,23 +703,22 @@
* "UTF-16BE", "UTF-16LE", and their aliases, are considered best. After
* them, the platform default charset and its aliases are selected.
* "US-ASCII" and its aliases are worst. All other charsets are chosen in
- * alphabetical order, but only charsets supported by this implementation
- * of the Java platform will be considered.
+ * alphabetical order, but only charsets supported by this implementation of
+ * the Java platform will be considered.
* <p>
* If two or more flavors share the best charset, the flavors will then
* again be sorted by their representation classes in the following order:
- * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
- * <code>[B</code>, <all others>.
+ * {@code java.io.InputStream}, {@code java.nio.ByteBuffer}, {@code [B},
+ * <all others>.
* <p>
* If two or more flavors share the best representation class, or if no
* flavor has one of the three specified representations, then one of those
* flavors will be chosen non-deterministically.
*
- * @param availableFlavors an array of available <code>DataFlavor</code>s
+ * @param availableFlavors an array of available {@code DataFlavor}s
* @return the best (highest fidelity) flavor according to the rules
- * specified above, or <code>null</code>,
- * if <code>availableFlavors</code> is <code>null</code>,
- * has zero length, or contains no text flavors
+ * specified above, or {@code null}, if {@code availableFlavors} is
+ * {@code null}, has zero length, or contains no text flavors
* @since 1.3
*/
public static final DataFlavor selectBestTextFlavor(
@@ -756,40 +740,33 @@
/**
* Gets a Reader for a text flavor, decoded, if necessary, for the expected
* charset (encoding). The supported representation classes are
- * <code>java.io.Reader</code>, <code>java.lang.String</code>,
- * <code>java.nio.CharBuffer</code>, <code>[C</code>,
- * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>,
- * and <code>[B</code>.
+ * {@code java.io.Reader}, {@code java.lang.String},
+ * {@code java.nio.CharBuffer}, {@code [C}, {@code java.io.InputStream},
+ * {@code java.nio.ByteBuffer}, and {@code [B}.
* <p>
* Because text flavors which do not support the charset parameter are
* encoded in a non-standard format, this method should not be called for
- * such flavors. However, in order to maintain backward-compatibility,
- * if this method is called for such a flavor, this method will treat the
- * flavor as though it supports the charset parameter and attempt to
- * decode it accordingly. See <code>selectBestTextFlavor</code> for a list
- * of text flavors which do not support the charset parameter.
- *
- * @param transferable the <code>Transferable</code> whose data will be
- * requested in this flavor
- *
- * @return a <code>Reader</code> to read the <code>Transferable</code>'s
- * data
+ * such flavors. However, in order to maintain backward-compatibility, if
+ * this method is called for such a flavor, this method will treat the
+ * flavor as though it supports the charset parameter and attempt to decode
+ * it accordingly. See {@code selectBestTextFlavor} for a list of text
+ * flavors which do not support the charset parameter.
*
- * @exception IllegalArgumentException if the representation class
- * is not one of the seven listed above
- * @exception IllegalArgumentException if the <code>Transferable</code>
- * has <code>null</code> data
- * @exception NullPointerException if the <code>Transferable</code> is
- * <code>null</code>
- * @exception UnsupportedEncodingException if this flavor's representation
- * is <code>java.io.InputStream</code>,
- * <code>java.nio.ByteBuffer</code>, or <code>[B</code> and
- * this flavor's encoding is not supported by this
- * implementation of the Java platform
- * @exception UnsupportedFlavorException if the <code>Transferable</code>
- * does not support this flavor
- * @exception IOException if the data cannot be read because of an
- * I/O error
+ * @param transferable the {@code Transferable} whose data will be
+ * requested in this flavor
+ * @return a {@code Reader} to read the {@code Transferable}'s data
+ * @throws IllegalArgumentException if the representation class is not one
+ * of the seven listed above
+ * @throws IllegalArgumentException if the {@code Transferable} has
+ * {@code null} data
+ * @throws NullPointerException if the {@code Transferable} is {@code null}
+ * @throws UnsupportedEncodingException if this flavor's representation is
+ * {@code java.io.InputStream}, {@code java.nio.ByteBuffer}, or
+ * {@code [B} and this flavor's encoding is not supported by this
+ * implementation of the Java platform
+ * @throws UnsupportedFlavorException if the {@code Transferable} does not
+ * support this flavor
+ * @throws IOException if the data cannot be read because of an I/O error
* @see #selectBestTextFlavor
* @since 1.3
*/
@@ -841,7 +818,8 @@
}
/**
- * Returns the MIME type string for this <code>DataFlavor</code>.
+ * Returns the MIME type string for this {@code DataFlavor}.
+ *
* @return the MIME type string for this flavor
*/
public String getMimeType() {
@@ -849,12 +827,12 @@
}
/**
- * Returns the <code>Class</code> which objects supporting this
- * <code>DataFlavor</code> will return when this <code>DataFlavor</code>
- * is requested.
- * @return the <code>Class</code> which objects supporting this
- * <code>DataFlavor</code> will return when this <code>DataFlavor</code>
- * is requested
+ * Returns the {@code Class} which objects supporting this
+ * {@code DataFlavor} will return when this {@code DataFlavor} is requested.
+ *
+ * @return the {@code Class} which objects supporting this
+ * {@code DataFlavor} will return when this {@code DataFlavor} is
+ * requested
*/
public Class<?> getRepresentationClass() {
return representationClass;
@@ -862,39 +840,42 @@
/**
* Returns the human presentable name for the data format that this
- * <code>DataFlavor</code> represents. This name would be localized
- * for different countries.
+ * {@code DataFlavor} represents. This name would be localized for different
+ * countries.
+ *
* @return the human presentable name for the data format that this
- * <code>DataFlavor</code> represents
+ * {@code DataFlavor} represents
*/
public String getHumanPresentableName() {
return humanPresentableName;
}
/**
- * Returns the primary MIME type for this <code>DataFlavor</code>.
- * @return the primary MIME type of this <code>DataFlavor</code>
+ * Returns the primary MIME type for this {@code DataFlavor}.
+ *
+ * @return the primary MIME type of this {@code DataFlavor}
*/
public String getPrimaryType() {
return (mimeType != null) ? mimeType.getPrimaryType() : null;
}
/**
- * Returns the sub MIME type of this <code>DataFlavor</code>.
- * @return the Sub MIME type of this <code>DataFlavor</code>
+ * Returns the sub MIME type of this {@code DataFlavor}.
+ *
+ * @return the Sub MIME type of this {@code DataFlavor}
*/
public String getSubType() {
return (mimeType != null) ? mimeType.getSubType() : null;
}
/**
- * Returns the human presentable name for this <code>DataFlavor</code>
- * if <code>paramName</code> equals "humanPresentableName". Otherwise
- * returns the MIME type value associated with <code>paramName</code>.
+ * Returns the human presentable name for this {@code DataFlavor} if
+ * {@code paramName} equals "humanPresentableName". Otherwise returns the
+ * MIME type value associated with {@code paramName}.
*
- * @param paramName the parameter name requested
- * @return the value of the name parameter, or <code>null</code>
- * if there is no associated value
+ * @param paramName the parameter name requested
+ * @return the value of the name parameter, or {@code null} if there is no
+ * associated value
*/
public String getParameter(String paramName) {
if (paramName.equals("humanPresentableName")) {
@@ -907,9 +888,10 @@
/**
* Sets the human presentable name for the data format that this
- * <code>DataFlavor</code> represents. This name would be localized
- * for different countries.
- * @param humanPresentableName the new human presentable name
+ * {@code DataFlavor} represents. This name would be localized for different
+ * countries.
+ *
+ * @param humanPresentableName the new human presentable name
*/
public void setHumanPresentableName(String humanPresentableName) {
this.humanPresentableName = humanPresentableName;
@@ -918,22 +900,21 @@
/**
* {@inheritDoc}
* <p>
- * The equals comparison for the {@code DataFlavor} class is implemented
- * as follows: Two <code>DataFlavor</code>s are considered equal if and
- * only if their MIME primary type and subtype and representation class are
- * equal. Additionally, if the primary type is "text", the subtype denotes
- * a text flavor which supports the charset parameter, and the
- * representation class is not <code>java.io.Reader</code>,
- * <code>java.lang.String</code>, <code>java.nio.CharBuffer</code>, or
- * <code>[C</code>, the <code>charset</code> parameter must also be equal.
- * If a charset is not explicitly specified for one or both
- * <code>DataFlavor</code>s, the platform default encoding is assumed. See
- * <code>selectBestTextFlavor</code> for a list of text flavors which
- * support the charset parameter.
+ * The equals comparison for the {@code DataFlavor} class is implemented as
+ * follows: Two {@code DataFlavor}s are considered equal if and only if
+ * their MIME primary type and subtype and representation class are equal.
+ * Additionally, if the primary type is "text", the subtype denotes a text
+ * flavor which supports the charset parameter, and the representation class
+ * is not {@code java.io.Reader}, {@code java.lang.String},
+ * {@code java.nio.CharBuffer}, or {@code [C}, the {@code charset} parameter
+ * must also be equal. If a charset is not explicitly specified for one or
+ * both {@code DataFlavor}s, the platform default encoding is assumed. See
+ * {@code selectBestTextFlavor} for a list of text flavors which support the
+ * charset parameter.
*
- * @param o the <code>Object</code> to compare with <code>this</code>
- * @return <code>true</code> if <code>that</code> is equivalent to this
- * <code>DataFlavor</code>; <code>false</code> otherwise
+ * @param o the {@code Object} to compare with {@code this}
+ * @return {@code true} if {@code that} is equivalent to this
+ * {@code DataFlavor}; {@code false} otherwise
* @see #selectBestTextFlavor
*/
public boolean equals(Object o) {
@@ -941,14 +922,13 @@
}
/**
- * This method has the same behavior as {@link #equals(Object)}.
- * The only difference being that it takes a {@code DataFlavor} instance
- * as a parameter.
+ * This method has the same behavior as {@link #equals(Object)}. The only
+ * difference being that it takes a {@code DataFlavor} instance as a
+ * parameter.
*
- * @param that the <code>DataFlavor</code> to compare with
- * <code>this</code>
- * @return <code>true</code> if <code>that</code> is equivalent to this
- * <code>DataFlavor</code>; <code>false</code> otherwise
+ * @param that the {@code DataFlavor} to compare with {@code this}
+ * @return {@code true} if {@code that} is equivalent to this
+ * {@code DataFlavor}; {@code false} otherwise
* @see #selectBestTextFlavor
*/
public boolean equals(DataFlavor that) {
@@ -999,17 +979,16 @@
}
/**
- * Compares only the <code>mimeType</code> against the passed in
- * <code>String</code> and <code>representationClass</code> is
- * not considered in the comparison.
+ * Compares only the {@code mimeType} against the passed in {@code String}
+ * and {@code representationClass} is not considered in the comparison. If
+ * {@code representationClass} needs to be compared, then
+ * {@code equals(new DataFlavor(s))} may be used.
*
- * If <code>representationClass</code> needs to be compared, then
- * <code>equals(new DataFlavor(s))</code> may be used.
- * @deprecated As inconsistent with <code>hashCode()</code> contract,
- * use <code>isMimeTypeEqual(String)</code> instead.
- * @param s the {@code mimeType} to compare.
- * @return true if the String (MimeType) is equal; false otherwise or if
- * {@code s} is {@code null}
+ * @param s the {@code mimeType} to compare
+ * @return {@code true} if the String (MimeType) is equal; {@code false}
+ * otherwise or if {@code s} is {@code null}
+ * @deprecated As inconsistent with {@code hashCode()} contract, use
+ * {@link #isMimeTypeEqual(String)} instead.
*/
@Deprecated
public boolean equals(String s) {
@@ -1019,14 +998,13 @@
}
/**
- * Returns hash code for this <code>DataFlavor</code>.
- * For two equal <code>DataFlavor</code>s, hash codes are equal.
- * For the <code>String</code>
- * that matches <code>DataFlavor.equals(String)</code>, it is not
- * guaranteed that <code>DataFlavor</code>'s hash code is equal
- * to the hash code of the <code>String</code>.
+ * Returns hash code for this {@code DataFlavor}. For two equal
+ * {@code DataFlavor}s, hash codes are equal. For the {@code String} that
+ * matches {@code DataFlavor.equals(String)}, it is not guaranteed that
+ * {@code DataFlavor}'s hash code is equal to the hash code of the
+ * {@code String}.
*
- * @return a hash code for this <code>DataFlavor</code>
+ * @return a hash code for this {@code DataFlavor}
*/
public int hashCode() {
int total = 0;
@@ -1070,10 +1048,9 @@
/**
* Identical to {@link #equals(DataFlavor)}.
*
- * @param that the <code>DataFlavor</code> to compare with
- * <code>this</code>
- * @return <code>true</code> if <code>that</code> is equivalent to this
- * <code>DataFlavor</code>; <code>false</code> otherwise
+ * @param that the {@code DataFlavor} to compare with {@code this}
+ * @return {@code true} if {@code that} is equivalent to this
+ * {@code DataFlavor}; {@code false} otherwise
* @see #selectBestTextFlavor
* @since 1.3
*/
@@ -1082,15 +1059,15 @@
}
/**
- * Returns whether the string representation of the MIME type passed in
- * is equivalent to the MIME type of this <code>DataFlavor</code>.
- * Parameters are not included in the comparison.
+ * Returns whether the string representation of the MIME type passed in is
+ * equivalent to the MIME type of this {@code DataFlavor}. Parameters are
+ * not included in the comparison.
*
- * @param mimeType the string representation of the MIME type
- * @return true if the string representation of the MIME type passed in is
- * equivalent to the MIME type of this <code>DataFlavor</code>;
- * false otherwise
- * @throws NullPointerException if mimeType is <code>null</code>
+ * @param mimeType the string representation of the MIME type
+ * @return {@code true} if the string representation of the MIME type passed
+ * in is equivalent to the MIME type of this {@code DataFlavor};
+ * {@code false} otherwise
+ * @throws NullPointerException if mimeType is {@code null}
*/
public boolean isMimeTypeEqual(String mimeType) {
// JCK Test DataFlavor0117: if 'mimeType' is null, throw NPE
@@ -1108,26 +1085,24 @@
}
/**
- * Compares the <code>mimeType</code> of two <code>DataFlavor</code>
- * objects. No parameters are considered.
+ * Compares the {@code mimeType} of two {@code DataFlavor} objects. No
+ * parameters are considered.
*
- * @param dataFlavor the <code>DataFlavor</code> to be compared
- * @return true if the <code>MimeType</code>s are equal,
- * otherwise false
+ * @param dataFlavor the {@code DataFlavor} to be compared
+ * @return {@code true} if the {@code MimeType}s are equal, otherwise
+ * {@code false}
*/
-
public final boolean isMimeTypeEqual(DataFlavor dataFlavor) {
return isMimeTypeEqual(dataFlavor.mimeType);
}
/**
- * Compares the <code>mimeType</code> of two <code>DataFlavor</code>
- * objects. No parameters are considered.
+ * Compares the {@code mimeType} of two {@code DataFlavor} objects. No
+ * parameters are considered.
*
- * @return true if the <code>MimeType</code>s are equal,
- * otherwise false
+ * @return {@code true} if the {@code MimeType}s are equal, otherwise
+ * {@code false}
*/
-
private boolean isMimeTypeEqual(MimeType mtype) {
if (this.mimeType == null) {
return (mtype == null);
@@ -1139,8 +1114,8 @@
* Checks if the representation class is one of the standard text
* representation classes.
*
- * @return true if the representation class is one of the standard text
- * representation classes, otherwise false
+ * @return {@code true} if the representation class is one of the standard
+ * text representation classes, otherwise {@code false}
*/
private boolean isStandardTextRepresentationClass() {
return isRepresentationClassReader()
@@ -1149,16 +1124,18 @@
|| char[].class.equals(representationClass);
}
- /**
- * Does the <code>DataFlavor</code> represent a serialized object?
- * @return whether or not a serialized object is represented
- */
+ /**
+ * Does the {@code DataFlavor} represent a serialized object?
+ *
+ * @return whether or not a serialized object is represented
+ */
public boolean isMimeTypeSerializedObject() {
return isMimeTypeEqual(javaSerializedObjectMimeType);
}
/**
* Returns the default representation class.
+ *
* @return the default representation class
*/
public final Class<?> getDefaultRepresentationClass() {
@@ -1167,30 +1144,30 @@
/**
* Returns the name of the default representation class.
+ *
* @return the name of the default representation class
*/
public final String getDefaultRepresentationClassAsString() {
return getDefaultRepresentationClass().getName();
}
- /**
- * Does the <code>DataFlavor</code> represent a
- * <code>java.io.InputStream</code>?
- * @return whether or not this {@code DataFlavor} represent a
- * {@code java.io.InputStream}
- */
+ /**
+ * Does the {@code DataFlavor} represent a {@code java.io.InputStream}?
+ *
+ * @return whether or not this {@code DataFlavor} represent a
+ * {@code java.io.InputStream}
+ */
public boolean isRepresentationClassInputStream() {
return ioInputStreamClass.isAssignableFrom(representationClass);
}
/**
- * Returns whether the representation class for this
- * <code>DataFlavor</code> is <code>java.io.Reader</code> or a subclass
- * thereof.
+ * Returns whether the representation class for this {@code DataFlavor} is
+ * {@code java.io.Reader} or a subclass thereof.
+ *
* @return whether or not the representation class for this
- * {@code DataFlavor} is {@code java.io.Reader} or a subclass
- * thereof
- *
+ * {@code DataFlavor} is {@code java.io.Reader} or a subclass
+ * thereof
* @since 1.4
*/
public boolean isRepresentationClassReader() {
@@ -1198,13 +1175,12 @@
}
/**
- * Returns whether the representation class for this
- * <code>DataFlavor</code> is <code>java.nio.CharBuffer</code> or a
- * subclass thereof.
+ * Returns whether the representation class for this {@code DataFlavor} is
+ * {@code java.nio.CharBuffer} or a subclass thereof.
+ *
* @return whether or not the representation class for this
- * {@code DataFlavor} is {@code java.nio.CharBuffer} or a subclass
- * thereof
- *
+ * {@code DataFlavor} is {@code java.nio.CharBuffer} or a subclass
+ * thereof
* @since 1.4
*/
public boolean isRepresentationClassCharBuffer() {
@@ -1212,103 +1188,100 @@
}
/**
- * Returns whether the representation class for this
- * <code>DataFlavor</code> is <code>java.nio.ByteBuffer</code> or a
- * subclass thereof.
+ * Returns whether the representation class for this {@code DataFlavor} is
+ * {@code java.nio.ByteBuffer} or a subclass thereof.
+ *
* @return whether or not the representation class for this
- * {@code DataFlavor} is {@code java.nio.ByteBuffer} or a subclass
- * thereof
- *
+ * {@code DataFlavor} is {@code java.nio.ByteBuffer} or a subclass
+ * thereof
* @since 1.4
*/
public boolean isRepresentationClassByteBuffer() {
return java.nio.ByteBuffer.class.isAssignableFrom(representationClass);
}
- /**
- * Returns true if the representation class can be serialized.
- * @return true if the representation class can be serialized
- */
-
+ /**
+ * Returns {@code true} if the representation class can be serialized.
+ *
+ * @return {@code true} if the representation class can be serialized
+ */
public boolean isRepresentationClassSerializable() {
return java.io.Serializable.class.isAssignableFrom(representationClass);
}
- /**
- * Returns true if the representation class is <code>Remote</code>.
- * @return true if the representation class is <code>Remote</code>
- */
+ /**
+ * Returns {@code true} if the representation class is {@code Remote}.
+ *
+ * @return {@code true} if the representation class is {@code Remote}
+ */
public boolean isRepresentationClassRemote() {
return DataFlavorUtil.RMI.isRemote(representationClass);
}
- /**
- * Returns true if the <code>DataFlavor</code> specified represents
- * a serialized object.
- * @return true if the <code>DataFlavor</code> specified represents
- * a Serialized Object
- */
-
+ /**
+ * Returns {@code true} if the {@code DataFlavor} specified represents a
+ * serialized object.
+ *
+ * @return {@code true} if the {@code DataFlavor} specified represents a
+ * Serialized Object
+ */
public boolean isFlavorSerializedObjectType() {
return isRepresentationClassSerializable() && isMimeTypeEqual(javaSerializedObjectMimeType);
}
/**
- * Returns true if the <code>DataFlavor</code> specified represents
- * a remote object.
- * @return true if the <code>DataFlavor</code> specified represents
- * a Remote Object
+ * Returns {@code true} if the {@code DataFlavor} specified represents a
+ * remote object.
+ *
+ * @return {@code true} if the {@code DataFlavor} specified represents a
+ * Remote Object
*/
-
public boolean isFlavorRemoteObjectType() {
return isRepresentationClassRemote()
&& isRepresentationClassSerializable()
&& isMimeTypeEqual(javaRemoteObjectMimeType);
}
-
- /**
- * Returns true if the <code>DataFlavor</code> specified represents
- * a list of file objects.
- * @return true if the <code>DataFlavor</code> specified represents
- * a List of File objects
- */
-
- public boolean isFlavorJavaFileListType() {
+ /**
+ * Returns {@code true} if the {@code DataFlavor} specified represents a
+ * list of file objects.
+ *
+ * @return {@code true} if the {@code DataFlavor} specified represents a
+ * {@code java.util.List} of {@code java.io.File} objects
+ */
+ public boolean isFlavorJavaFileListType() {
if (mimeType == null || representationClass == null)
return false;
return java.util.List.class.isAssignableFrom(representationClass) &&
mimeType.match(javaFileListFlavor.mimeType);
- }
+ }
/**
- * Returns whether this <code>DataFlavor</code> is a valid text flavor for
- * this implementation of the Java platform. Only flavors equivalent to
- * <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
- * a primary MIME type of "text" can be valid text flavors.
+ * Returns whether this {@code DataFlavor} is a valid text flavor for this
+ * implementation of the Java platform. Only flavors equivalent to
+ * {@code DataFlavor.stringFlavor} and {@code DataFlavor}s with a primary
+ * MIME type of "text" can be valid text flavors.
* <p>
* If this flavor supports the charset parameter, it must be equivalent to
- * <code>DataFlavor.stringFlavor</code>, or its representation must be
- * <code>java.io.Reader</code>, <code>java.lang.String</code>,
- * <code>java.nio.CharBuffer</code>, <code>[C</code>,
- * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
- * <code>[B</code>. If the representation is
- * <code>java.io.InputStream</code>, <code>java.nio.ByteBuffer</code>, or
- * <code>[B</code>, then this flavor's <code>charset</code> parameter must
- * be supported by this implementation of the Java platform. If a charset
- * is not specified, then the platform default charset, which is always
- * supported, is assumed.
+ * {@code DataFlavor.stringFlavor}, or its representation must be
+ * {@code java.io.Reader}, {@code java.lang.String},
+ * {@code java.nio.CharBuffer}, {@code [C}, {@code java.io.InputStream},
+ * {@code java.nio.ByteBuffer}, or {@code [B}. If the representation is
+ * {@code java.io.InputStream}, {@code java.nio.ByteBuffer}, or {@code [B},
+ * then this flavor's {@code charset} parameter must be supported by this
+ * implementation of the Java platform. If a charset is not specified, then
+ * the platform default charset, which is always supported, is assumed.
* <p>
- * If this flavor does not support the charset parameter, its
- * representation must be <code>java.io.InputStream</code>,
- * <code>java.nio.ByteBuffer</code>, or <code>[B</code>.
+ * If this flavor does not support the charset parameter, its representation
+ * must be {@code java.io.InputStream}, {@code java.nio.ByteBuffer}, or
+ * {@code [B}.
* <p>
- * See <code>selectBestTextFlavor</code> for a list of text flavors which
- * support the charset parameter.
+ * See {@code selectBestTextFlavor} for a list of text flavors which support
+ * the charset parameter.
*
- * @return <code>true</code> if this <code>DataFlavor</code> is a valid
- * text flavor as described above; <code>false</code> otherwise
+ * @return {@code true} if this {@code DataFlavor} is a valid text flavor as
+ * described above; {@code false} otherwise
* @see #selectBestTextFlavor
* @since 1.4
*/
@@ -1317,10 +1290,9 @@
DataFlavorUtil.isFlavorNoncharsetTextType(this));
}
- /**
- * Serializes this <code>DataFlavor</code>.
- */
-
+ /**
+ * Serializes this {@code DataFlavor}.
+ */
public synchronized void writeExternal(ObjectOutput os) throws IOException {
if (mimeType != null) {
mimeType.setParameter("humanPresentableName", humanPresentableName);
@@ -1333,12 +1305,11 @@
os.writeObject(representationClass);
}
- /**
- * Restores this <code>DataFlavor</code> from a Serialized state.
- */
-
- public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException {
- String rcn = null;
+ /**
+ * Restores this {@code DataFlavor} from a Serialized state.
+ */
+ public synchronized void readExternal(ObjectInput is) throws IOException , ClassNotFoundException {
+ String rcn = null;
mimeType = (MimeType)is.readObject();
if (mimeType != null) {
@@ -1365,13 +1336,13 @@
DataFlavor.tryToLoadClass(rcn, getClass().getClassLoader());
}
}
- }
+ }
- /**
- * Returns a clone of this <code>DataFlavor</code>.
- * @return a clone of this <code>DataFlavor</code>
- */
-
+ /**
+ * Returns a clone of this {@code DataFlavor}.
+ *
+ * @return a clone of this {@code DataFlavor}
+ */
public Object clone() throws CloneNotSupportedException {
Object newObj = super.clone();
if (mimeType != null) {
@@ -1380,41 +1351,37 @@
return newObj;
} // clone()
- /**
- * Called on <code>DataFlavor</code> for every MIME Type parameter
- * to allow <code>DataFlavor</code> subclasses to handle special
- * parameters like the text/plain <code>charset</code>
- * parameters, whose values are case insensitive. (MIME type parameter
- * values are supposed to be case sensitive.
- * <p>
- * This method is called for each parameter name/value pair and should
- * return the normalized representation of the <code>parameterValue</code>.
- *
- * This method is never invoked by this implementation from 1.1 onwards.
- *
- * @param parameterName the parameter name
- * @param parameterValue the parameter value
- * @return the parameter value
- * @deprecated
- */
+ /**
+ * Called on {@code DataFlavor} for every MIME Type parameter to allow
+ * {@code DataFlavor} subclasses to handle special parameters like the
+ * text/plain {@code charset} parameters, whose values are case insensitive.
+ * (MIME type parameter values are supposed to be case sensitive.
+ * <p>
+ * This method is called for each parameter name/value pair and should
+ * return the normalized representation of the {@code parameterValue}.
+ *
+ * @param parameterName the parameter name
+ * @param parameterValue the parameter value
+ * @return the parameter value
+ * @deprecated This method is never invoked by this implementation from 1.1
+ * onwards
+ */
@Deprecated
protected String normalizeMimeTypeParameter(String parameterName, String parameterValue) {
return parameterValue;
}
- /**
- * Called for each MIME type string to give <code>DataFlavor</code> subtypes
- * the opportunity to change how the normalization of MIME types is
- * accomplished. One possible use would be to add default
- * parameter/value pairs in cases where none are present in the MIME
- * type string passed in.
- *
- * This method is never invoked by this implementation from 1.1 onwards.
- *
- * @param mimeType the mime type
- * @return the mime type
- * @deprecated
- */
+ /**
+ * Called for each MIME type string to give {@code DataFlavor} subtypes the
+ * opportunity to change how the normalization of MIME types is
+ * accomplished. One possible use would be to add default parameter/value
+ * pairs in cases where none are present in the MIME type string passed in.
+ *
+ * @param mimeType the mime type
+ * @return the mime type
+ * @deprecated This method is never invoked by this implementation from 1.1
+ * onwards
+ */
@Deprecated
protected String normalizeMimeType(String mimeType) {
return mimeType;
@@ -1434,8 +1401,9 @@
private String humanPresentableName;
- /** Java class of objects this DataFlavor represents **/
-
+ /**
+ * Java class of objects this DataFlavor represents.
+ **/
private Class<?> representationClass;
} // class DataFlavor
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, 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
@@ -22,29 +22,27 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package java.awt.datatransfer;
import java.util.EventObject;
-
/**
- * <code>FlavorEvent</code> is used to notify interested parties
- * that available {@link DataFlavor}s have changed in the
- * {@link Clipboard} (the event source).
- *
- * @see FlavorListener
+ * {@code FlavorEvent} is used to notify interested parties that available
+ * {@link DataFlavor}s have changed in the {@link Clipboard} (the event source).
*
* @author Alexander Gerasimov
+ * @see FlavorListener
* @since 1.5
*/
public class FlavorEvent extends EventObject {
+
private static final long serialVersionUID = -5842664112252414548L;
/**
- * Constructs a <code>FlavorEvent</code> object.
+ * Constructs a {@code FlavorEvent} object.
*
- * @param source the <code>Clipboard</code> that is the source of the event
- *
+ * @param source the {@code Clipboard} that is the source of the event
* @throws IllegalArgumentException if the {@code source} is {@code null}
*/
public FlavorEvent(Clipboard source) {
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorListener.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorListener.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 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
@@ -22,11 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package java.awt.datatransfer;
import java.util.EventListener;
-
/**
* Defines an object which listens for {@link FlavorEvent}s.
*
@@ -34,22 +34,21 @@
* @since 1.5
*/
public interface FlavorListener extends EventListener {
+
/**
- * Invoked when the target {@link Clipboard} of the listener
- * has changed its available {@link DataFlavor}s.
+ * Invoked when the target {@link Clipboard} of the listener has changed its
+ * available {@link DataFlavor}s.
* <p>
- * Some notifications may be redundant — they are not
- * caused by a change of the set of DataFlavors available
- * on the clipboard.
- * For example, if the clipboard subsystem supposes that
- * the system clipboard's contents has been changed but it
- * can't ascertain whether its DataFlavors have been changed
- * because of some exceptional condition when accessing the
- * clipboard, the notification is sent to ensure from omitting
- * a significant notification. Ordinarily, those redundant
- * notifications should be occasional.
+ * Some notifications may be redundant — they are not caused by a
+ * change of the set of DataFlavors available on the clipboard. For example,
+ * if the clipboard subsystem supposes that the system clipboard's contents
+ * has been changed but it can't ascertain whether its DataFlavors have been
+ * changed because of some exceptional condition when accessing the
+ * clipboard, the notification is sent to ensure from omitting a significant
+ * notification. Ordinarily, those redundant notifications should be
+ * occasional.
*
- * @param e a <code>FlavorEvent</code> object
+ * @param e a {@code FlavorEvent} object
*/
void flavorsChanged(FlavorEvent e);
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorMap.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorMap.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,49 +27,45 @@
import java.util.Map;
-
/**
- * A two-way Map between "natives" (Strings), which correspond to platform-
- * specific data formats, and "flavors" (DataFlavors), which correspond to
- * platform-independent MIME types. FlavorMaps need not be symmetric, but
+ * A two-way Map between "natives" (Strings), which correspond to
+ * platform-specific data formats, and "flavors" (DataFlavors), which correspond
+ * to platform-independent MIME types. FlavorMaps need not be symmetric, but
* typically are.
*
- *
* @since 1.2
*/
public interface FlavorMap {
/**
- * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
- * their corresponding <code>String</code> native. The returned
- * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
- * internal data. Client code is free to modify the <code>Map</code>
- * without affecting this object.
+ * Returns a {@code Map} of the specified {@code DataFlavor}s to their
+ * corresponding {@code String} native. The returned {@code Map} is a
+ * modifiable copy of this {@code FlavorMap}'s internal data. Client code is
+ * free to modify the {@code Map} without affecting this object.
*
- * @param flavors an array of <code>DataFlavor</code>s which will be the
- * key set of the returned <code>Map</code>. If <code>null</code> is
- * specified, a mapping of all <code>DataFlavor</code>s currently
- * known to this <code>FlavorMap</code> to their corresponding
- * <code>String</code> natives will be returned.
- * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
- * <code>String</code> natives
+ * @param flavors an array of {@code DataFlavor}s which will be the key set
+ * of the returned {@code Map}. If {@code null} is specified, a
+ * mapping of all {@code DataFlavor}s currently known to this
+ * {@code FlavorMap} to their corresponding {@code String} natives
+ * will be returned.
+ * @return a {@code java.util.Map} of {@code DataFlavor}s to {@code String}
+ * natives
*/
- Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors);
+ Map<DataFlavor, String> getNativesForFlavors(DataFlavor[] flavors);
/**
- * Returns a <code>Map</code> of the specified <code>String</code> natives
- * to their corresponding <code>DataFlavor</code>. The returned
- * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
- * internal data. Client code is free to modify the <code>Map</code>
- * without affecting this object.
+ * Returns a {@code Map} of the specified {@code String} natives to their
+ * corresponding {@code DataFlavor}. The returned {@code Map} is a
+ * modifiable copy of this {@code FlavorMap}'s internal data. Client code is
+ * free to modify the {@code Map} without affecting this object.
*
- * @param natives an array of <code>String</code>s which will be the
- * key set of the returned <code>Map</code>. If <code>null</code> is
- * specified, a mapping of all <code>String</code> natives currently
- * known to this <code>FlavorMap</code> to their corresponding
- * <code>DataFlavor</code>s will be returned.
- * @return a <code>java.util.Map</code> of <code>String</code> natives to
- * <code>DataFlavor</code>s
+ * @param natives an array of {@code String}s which will be the key set of
+ * the returned {@code Map}. If {@code null} is specified, a mapping
+ * of all {@code String} natives currently known to this
+ * {@code FlavorMap} to their corresponding {@code DataFlavor}s will
+ * be returned.
+ * @return a {@code java.util.Map} of {@code String} natives to
+ * {@code DataFlavor}s
*/
- Map<String,DataFlavor> getFlavorsForNatives(String[] natives);
+ Map<String, DataFlavor> getFlavorsForNatives(String[] natives);
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorTable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorTable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,56 +27,52 @@
import java.util.List;
-
/**
* A FlavorMap which relaxes the traditional 1-to-1 restriction of a Map. A
- * flavor is permitted to map to any number of natives, and likewise a native
- * is permitted to map to any number of flavors. FlavorTables need not be
+ * flavor is permitted to map to any number of natives, and likewise a native is
+ * permitted to map to any number of flavors. FlavorTables need not be
* symmetric, but typically are.
*
* @author David Mendenhall
- *
* @since 1.4
*/
public interface FlavorTable extends FlavorMap {
/**
- * Returns a <code>List</code> of <code>String</code> natives to which the
- * specified <code>DataFlavor</code> corresponds. The <code>List</code>
- * will be sorted from best native to worst. That is, the first native will
- * best reflect data in the specified flavor to the underlying native
- * platform. The returned <code>List</code> is a modifiable copy of this
- * <code>FlavorTable</code>'s internal data. Client code is free to modify
- * the <code>List</code> without affecting this object.
+ * Returns a {@code List} of {@code String} natives to which the specified
+ * {@code DataFlavor} corresponds. The {@code List} will be sorted from best
+ * native to worst. That is, the first native will best reflect data in the
+ * specified flavor to the underlying native platform. The returned
+ * {@code List} is a modifiable copy of this {@code FlavorTable}'s internal
+ * data. Client code is free to modify the {@code List} without affecting
+ * this object.
*
- * @param flav the <code>DataFlavor</code> whose corresponding natives
- * should be returned. If <code>null</code> is specified, all
- * natives currently known to this <code>FlavorTable</code> are
- * returned in a non-deterministic order.
- * @return a <code>java.util.List</code> of <code>java.lang.String</code>
- * objects which are platform-specific representations of platform-
- * specific data formats
+ * @param flav the {@code DataFlavor} whose corresponding natives should be
+ * returned. If {@code null} is specified, all natives currently
+ * known to this {@code FlavorTable} are returned in a
+ * non-deterministic order.
+ * @return a {@code java.util.List} of {@code java.lang.String} objects
+ * which are platform-specific representations of platform-specific
+ * data formats
*/
List<String> getNativesForFlavor(DataFlavor flav);
/**
- * Returns a <code>List</code> of <code>DataFlavor</code>s to which the
- * specified <code>String</code> corresponds. The <code>List</code> will be
- * sorted from best <code>DataFlavor</code> to worst. That is, the first
- * <code>DataFlavor</code> will best reflect data in the specified
- * native to a Java application. The returned <code>List</code> is a
- * modifiable copy of this <code>FlavorTable</code>'s internal data.
- * Client code is free to modify the <code>List</code> without affecting
- * this object.
+ * Returns a {@code List} of {@code DataFlavor}s to which the specified
+ * {@code String} corresponds. The {@code List} will be sorted from best
+ * {@code DataFlavor} to worst. That is, the first {@code DataFlavor} will
+ * best reflect data in the specified native to a Java application. The
+ * returned {@code List} is a modifiable copy of this {@code FlavorTable}'s
+ * internal data. Client code is free to modify the {@code List} without
+ * affecting this object.
*
- * @param nat the native whose corresponding <code>DataFlavor</code>s
- * should be returned. If <code>null</code> is specified, all
- * <code>DataFlavor</code>s currently known to this
- * <code>FlavorTable</code> are returned in a non-deterministic
- * order.
- * @return a <code>java.util.List</code> of <code>DataFlavor</code>
- * objects into which platform-specific data in the specified,
- * platform-specific native can be translated
+ * @param nat the native whose corresponding {@code DataFlavor}s should be
+ * returned. If {@code null} is specified, all {@code DataFlavor}s
+ * currently known to this {@code FlavorTable} are returned in a
+ * non-deterministic order.
+ * @return a {@code java.util.List} of {@code DataFlavor} objects into which
+ * platform-specific data in the specified, platform-specific native
+ * can be translated
*/
List<DataFlavor> getFlavorsForNative(String nat);
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,20 +26,18 @@
package java.awt.datatransfer;
import java.io.Externalizable;
-import java.io.ObjectOutput;
+import java.io.IOException;
import java.io.ObjectInput;
-import java.io.IOException;
-import java.util.Enumeration;
+import java.io.ObjectOutput;
import java.util.Locale;
-
/**
- * A Multipurpose Internet Mail Extension (MIME) type, as defined
- * in RFC 2045 and 2046.
- *
- * THIS IS *NOT* - REPEAT *NOT* - A PUBLIC CLASS! DataFlavor IS
- * THE PUBLIC INTERFACE, AND THIS IS PROVIDED AS A ***PRIVATE***
- * (THAT IS AS IN *NOT* PUBLIC) HELPER CLASS!
+ * A Multipurpose Internet Mail Extension (MIME) type, as defined in RFC 2045
+ * and 2046.
+ * <p>
+ * THIS IS *NOT* - REPEAT *NOT* - A PUBLIC CLASS! DataFlavor IS THE PUBLIC
+ * INTERFACE, AND THIS IS PROVIDED AS A ***PRIVATE*** (THAT IS AS IN *NOT*
+ * PUBLIC) HELPER CLASS!
*/
class MimeType implements Externalizable, Cloneable {
@@ -50,45 +48,45 @@
static final long serialVersionUID = -6568722458793895906L;
/**
- * Constructor for externalization; this constructor should not be
- * called directly by an application, since the result will be an
- * uninitialized, immutable <code>MimeType</code> object.
+ * Constructor for externalization; this constructor should not be called
+ * directly by an application, since the result will be an uninitialized,
+ * immutable {@code MimeType} object.
*/
public MimeType() {
}
/**
- * Builds a <code>MimeType</code> from a <code>String</code>.
+ * Builds a {@code MimeType} from a {@code String}.
*
- * @param rawdata text used to initialize the <code>MimeType</code>
- * @throws NullPointerException if <code>rawdata</code> is null
+ * @param rawdata text used to initialize the {@code MimeType}
+ * @throws NullPointerException if {@code rawdata} is {@code null}
*/
public MimeType(String rawdata) throws MimeTypeParseException {
parse(rawdata);
}
/**
- * Builds a <code>MimeType</code> with the given primary and sub
- * type but has an empty parameter list.
+ * Builds a {@code MimeType} with the given primary and sub type but has an
+ * empty parameter list.
*
- * @param primary the primary type of this <code>MimeType</code>
- * @param sub the subtype of this <code>MimeType</code>
- * @throws NullPointerException if either <code>primary</code> or
- * <code>sub</code> is null
+ * @param primary the primary type of this {@code MimeType}
+ * @param sub the subtype of this {@code MimeType}
+ * @throws NullPointerException if either {@code primary} or {@code sub} is
+ * {@code null}
*/
public MimeType(String primary, String sub) throws MimeTypeParseException {
this(primary, sub, new MimeTypeParameterList());
}
/**
- * Builds a <code>MimeType</code> with a pre-defined
- * and valid (or empty) parameter list.
+ * Builds a {@code MimeType} with a pre-defined and valid (or empty)
+ * parameter list.
*
- * @param primary the primary type of this <code>MimeType</code>
- * @param sub the subtype of this <code>MimeType</code>
- * @param mtpl the requested parameter list
- * @throws NullPointerException if either <code>primary</code>,
- * <code>sub</code> or <code>mtpl</code> is null
+ * @param primary the primary type of this {@code MimeType}
+ * @param sub the subtype of this {@code MimeType}
+ * @param mtpl the requested parameter list
+ * @throws NullPointerException if either {@code primary}, {@code sub} or
+ * {@code mtpl} is {@code null}
*/
public MimeType(String primary, String sub, MimeTypeParameterList mtpl) throws
MimeTypeParseException {
@@ -121,13 +119,12 @@
} // hashCode()
/**
- * <code>MimeType</code>s are equal if their primary types,
- * subtypes, and parameters are all equal. No default values
- * are taken into account.
- * @param thatObject the object to be evaluated as a
- * <code>MimeType</code>
- * @return <code>true</code> if <code>thatObject</code> is
- * a <code>MimeType</code>; otherwise returns <code>false</code>
+ * {@code MimeType}s are equal if their primary types, subtypes, and
+ * parameters are all equal. No default values are taken into account.
+ *
+ * @param thatObject the object to be evaluated as a {@code MimeType}
+ * @return {@code true} if {@code thatObject} is a {@code MimeType};
+ * otherwise returns {@code false}
*/
public boolean equals(Object thatObject) {
if (!(thatObject instanceof MimeType)) {
@@ -144,7 +141,7 @@
/**
* A routine for parsing the MIME type out of a String.
*
- * @throws NullPointerException if <code>rawdata</code> is null
+ * @throws NullPointerException if {@code rawdata} is {@code null}
*/
private void parse(String rawdata) throws MimeTypeParseException {
int slashIndex = rawdata.indexOf('/');
@@ -213,8 +210,8 @@
}
/**
- * Retrieve the value associated with the given name, or null if there
- * is no current association.
+ * Retrieve the value associated with the given name, or {@code null} if
+ * there is no current association.
*/
public String getParameter(String name) {
return parameters.get(name);
@@ -247,23 +244,21 @@
}
/**
- * Return a String representation of this object
- * without the parameter list.
+ * Return a String representation of this object without the parameter list.
*/
public String getBaseType() {
return primaryType + "/" + subType;
}
/**
- * Returns <code>true</code> if the primary type and the
- * subtype of this object are the same as the specified
- * <code>type</code>; otherwise returns <code>false</code>.
+ * Returns {@code true} if the primary type and the subtype of this object
+ * are the same as the specified {@code type}; otherwise returns
+ * {@code false}.
*
- * @param type the type to compare to <code>this</code>'s type
- * @return <code>true</code> if the primary type and the
- * subtype of this object are the same as the
- * specified <code>type</code>; otherwise returns
- * <code>false</code>
+ * @param type the type to compare to {@code this}'s type
+ * @return {@code true} if the primary type and the subtype of this object
+ * are the same as the specified {@code type}; otherwise returns
+ * {@code false}
*/
public boolean match(MimeType type) {
if (type == null)
@@ -275,17 +270,15 @@
}
/**
- * Returns <code>true</code> if the primary type and the
- * subtype of this object are the same as the content type
- * described in <code>rawdata</code>; otherwise returns
- * <code>false</code>.
+ * Returns {@code true} if the primary type and the subtype of this object
+ * are the same as the content type described in {@code rawdata}; otherwise
+ * returns {@code false}.
*
- * @param rawdata the raw data to be examined
- * @return <code>true</code> if the primary type and the
- * subtype of this object are the same as the content type
- * described in <code>rawdata</code>; otherwise returns
- * <code>false</code>; if <code>rawdata</code> is
- * <code>null</code>, returns <code>false</code>
+ * @param rawdata the raw data to be examined
+ * @return {@code true} if the primary type and the subtype of this object
+ * are the same as the content type described in {@code rawdata};
+ * otherwise returns {@code false}; if {@code rawdata} is
+ * {@code null}, returns {@code false}
*/
public boolean match(String rawdata) throws MimeTypeParseException {
if (rawdata == null)
@@ -294,11 +287,11 @@
}
/**
- * The object implements the writeExternal method to save its contents
- * by calling the methods of DataOutput for its primitive values or
- * calling the writeObject method of ObjectOutput for objects, strings
- * and arrays.
- * @exception IOException Includes any I/O exceptions that may occur
+ * The object implements the writeExternal method to save its contents by
+ * calling the methods of DataOutput for its primitive values or calling the
+ * writeObject method of ObjectOutput for objects, strings and arrays.
+ *
+ * @throws IOException Includes any I/O exceptions that may occur
*/
public void writeExternal(ObjectOutput out) throws IOException {
String s = toString(); // contains ASCII chars only
@@ -314,13 +307,14 @@
}
/**
- * The object implements the readExternal method to restore its
- * contents by calling the methods of DataInput for primitive
- * types and readObject for objects, strings and arrays. The
- * readExternal method must read the values in the same sequence
- * and with the same types as were written by writeExternal.
- * @exception ClassNotFoundException If the class for an object being
- * restored cannot be found.
+ * The object implements the readExternal method to restore its contents by
+ * calling the methods of DataInput for primitive types and readObject for
+ * objects, strings and arrays. The readExternal method must read the values
+ * in the same sequence and with the same types as were written by
+ * writeExternal.
+ *
+ * @throws ClassNotFoundException If the class for an object being restored
+ * cannot be found
*/
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
@@ -339,9 +333,9 @@
/**
* Returns a clone of this object.
+ *
* @return a clone of this object
*/
-
public Object clone() {
MimeType newObj = null;
try {
@@ -368,7 +362,7 @@
/**
* Determines whether or not a given string is a legal token.
*
- * @throws NullPointerException if <code>s</code> is null
+ * @throws NullPointerException if {@code s} is {@code null}
*/
private boolean isValidToken(String s) {
int len = s.length();
@@ -388,7 +382,5 @@
/**
* A string that holds all the special chars.
*/
-
private static final String TSPECIALS = "()<>@,;:\\\"/[]?=";
-
} // class MimeType
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParameterList.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParameterList.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,10 +31,9 @@
import java.util.Map;
import java.util.Set;
-
/**
- * An object that encapsulates the parameter list of a MimeType
- * as defined in RFC 2045 and 2046.
+ * An object that encapsulates the parameter list of a MimeType as defined in
+ * RFC 2045 and 2046.
*
* @author jeff.dunn@eng.sun.com
*/
@@ -71,9 +70,9 @@
} // hashCode()
/**
- * Two parameter lists are considered equal if they have exactly
- * the same set of parameter names and associated values. The
- * order of the parameters is not considered.
+ * Two parameter lists are considered equal if they have exactly the same
+ * set of parameter names and associated values. The order of the parameters
+ * is not considered.
*/
public boolean equals(Object thatObject) {
//System.out.println("MimeTypeParameterList.equals("+this+","+thatObject+")");
@@ -246,16 +245,16 @@
}
/**
- * Retrieve the value associated with the given name, or null if there
- * is no current association.
+ * Retrieve the value associated with the given name, or {@code null} if
+ * there is no current association.
*/
public String get(String name) {
return parameters.get(name.trim().toLowerCase());
}
/**
- * Set the value to be associated with the given name, replacing
- * any previous association.
+ * Set the value to be associated with the given name, replacing any
+ * previous association.
*/
public void set(String name, String value) {
parameters.put(name.trim().toLowerCase(), value);
@@ -294,18 +293,20 @@
}
/**
+ * Returns a clone of this object.
+ *
* @return a clone of this object
*/
@SuppressWarnings("unchecked") // Cast from clone
- public Object clone() {
- MimeTypeParameterList newObj = null;
- try {
- newObj = (MimeTypeParameterList)super.clone();
- } catch (CloneNotSupportedException cannotHappen) {
- }
- newObj.parameters = (Hashtable<String, String>)parameters.clone();
- return newObj;
- }
+ public Object clone() {
+ MimeTypeParameterList newObj = null;
+ try {
+ newObj = (MimeTypeParameterList)super.clone();
+ } catch (CloneNotSupportedException cannotHappen) {
+ }
+ newObj.parameters = (Hashtable<String, String>)parameters.clone();
+ return newObj;
+ }
private Hashtable<String, String> parameters;
@@ -319,8 +320,8 @@
}
/**
- * return the index of the first non white space character in
- * rawdata at or after index i.
+ * Returns the index of the first non white space character in
+ * {@code rawdata} at or after index {@code i}.
*/
private static int skipWhiteSpace(String rawdata, int i) {
int length = rawdata.length();
@@ -374,7 +375,8 @@
}
/**
- * A routine that knows how to strip the quotes and escape sequences from the given value.
+ * A routine that knows how to strip the quotes and escape sequences from
+ * the given value.
*/
private static String unquote(String value) {
int valueLength = value.length();
@@ -400,5 +402,4 @@
* A string that holds all the special chars.
*/
private static final String TSPECIALS = "()<>@,;:\\\"/[]?=";
-
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParseException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParseException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,12 +25,11 @@
package java.awt.datatransfer;
-
/**
- * A class to encapsulate MimeType parsing related exceptions
+ * A class to encapsulate MimeType parsing related exceptions.
*
+ * @since 1.3
* @serial exclude
- * @since 1.3
*/
public class MimeTypeParseException extends Exception {
@@ -47,7 +46,7 @@
/**
* Constructs a MimeTypeParseException with the specified detail message.
*
- * @param s the detail message.
+ * @param s the detail message
*/
public MimeTypeParseException(String s) {
super(s);
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/StringSelection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/StringSelection.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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,23 +25,21 @@
package java.awt.datatransfer;
-import java.io.*;
-
+import java.io.IOException;
+import java.io.StringReader;
/**
- * A <code>Transferable</code> which implements the capability required
- * to transfer a <code>String</code>.
+ * A {@code Transferable} which implements the capability required to transfer a
+ * {@code String}.
+ * <p>
+ * This {@code Transferable} properly supports {@code DataFlavor.stringFlavor}
+ * and all equivalent flavors. Support for {@code DataFlavor.plainTextFlavor}
+ * and all equivalent flavors is <b>deprecated</b>. No other {@code DataFlavor}s
+ * are supported.
*
- * This <code>Transferable</code> properly supports
- * <code>DataFlavor.stringFlavor</code>
- * and all equivalent flavors. Support for
- * <code>DataFlavor.plainTextFlavor</code>
- * and all equivalent flavors is <b>deprecated</b>. No other
- * <code>DataFlavor</code>s are supported.
- *
+ * @see DataFlavor#stringFlavor
+ * @see DataFlavor#plainTextFlavor
* @since 1.1
- * @see java.awt.datatransfer.DataFlavor#stringFlavor
- * @see java.awt.datatransfer.DataFlavor#plainTextFlavor
*/
public class StringSelection implements Transferable, ClipboardOwner {
@@ -57,23 +55,23 @@
private String data;
/**
- * Creates a <code>Transferable</code> capable of transferring
- * the specified <code>String</code>.
- * @param data the string to be transferred
+ * Creates a {@code Transferable} capable of transferring the specified
+ * {@code String}.
+ *
+ * @param data the string to be transferred
*/
public StringSelection(String data) {
this.data = data;
}
/**
- * Returns an array of flavors in which this <code>Transferable</code>
- * can provide the data. <code>DataFlavor.stringFlavor</code>
- * is properly supported.
- * Support for <code>DataFlavor.plainTextFlavor</code> is
- * <b>deprecated</b>.
+ * Returns an array of flavors in which this {@code Transferable} can
+ * provide the data. {@code DataFlavor.stringFlavor} is properly supported.
+ * Support for {@code DataFlavor.plainTextFlavor} is <b>deprecated</b>.
*
- * @return an array of length two, whose elements are <code>DataFlavor.
- * stringFlavor</code> and <code>DataFlavor.plainTextFlavor</code>
+ * @return an array of length two, whose elements are
+ * {@code DataFlavor.stringFlavor} and
+ * {@code DataFlavor.plainTextFlavor}
*/
public DataFlavor[] getTransferDataFlavors() {
// returning flavors itself would allow client code to modify
@@ -83,14 +81,14 @@
/**
* Returns whether the requested flavor is supported by this
- * <code>Transferable</code>.
+ * {@code Transferable}.
*
- * @param flavor the requested flavor for the data
- * @return true if <code>flavor</code> is equal to
- * <code>DataFlavor.stringFlavor</code> or
- * <code>DataFlavor.plainTextFlavor</code>; false if <code>flavor</code>
- * is not one of the above flavors
- * @throws NullPointerException if flavor is <code>null</code>
+ * @param flavor the requested flavor for the data
+ * @return {@code true} if {@code flavor} is equal to
+ * {@code DataFlavor.stringFlavor} or
+ * {@code DataFlavor.plainTextFlavor}; {@code false} if
+ * {@code flavor} is not one of the above flavors
+ * @throws NullPointerException if {@code flavor} is {@code null}
*/
public boolean isDataFlavorSupported(DataFlavor flavor) {
// JCK Test StringSelection0003: if 'flavor' is null, throw NPE
@@ -103,27 +101,27 @@
}
/**
- * Returns the <code>Transferable</code>'s data in the requested
- * <code>DataFlavor</code> if possible. If the desired flavor is
- * <code>DataFlavor.stringFlavor</code>, or an equivalent flavor,
- * the <code>String</code> representing the selection is
- * returned. If the desired flavor is
- * <code>DataFlavor.plainTextFlavor</code>,
- * or an equivalent flavor, a <code>Reader</code> is returned.
+ * Returns the {@code Transferable}'s data in the requested
+ * {@code DataFlavor} if possible. If the desired flavor is
+ * {@code DataFlavor.stringFlavor}, or an equivalent flavor, the
+ * {@code String} representing the selection is returned. If the desired
+ * flavor is {@code DataFlavor.plainTextFlavor}, or an equivalent flavor, a
+ * {@code Reader} is returned.
+ * <br>
* <b>Note:</b> The behavior of this method for
- * <code>DataFlavor.plainTextFlavor</code>
- * and equivalent <code>DataFlavor</code>s is inconsistent with the
- * definition of <code>DataFlavor.plainTextFlavor</code>.
+ * {@code DataFlavor.plainTextFlavor}
+ * and equivalent {@code DataFlavor}s is inconsistent with the definition of
+ * {@code DataFlavor.plainTextFlavor}.
*
- * @param flavor the requested flavor for the data
+ * @param flavor the requested flavor for the data
* @return the data in the requested flavor, as outlined above
- * @throws UnsupportedFlavorException if the requested data flavor is
- * not equivalent to either <code>DataFlavor.stringFlavor</code>
- * or <code>DataFlavor.plainTextFlavor</code>
+ * @throws UnsupportedFlavorException if the requested data flavor is not
+ * equivalent to either {@code DataFlavor.stringFlavor} or
+ * {@code DataFlavor.plainTextFlavor}
* @throws IOException if an IOException occurs while retrieving the data.
* By default, StringSelection never throws this exception, but a
* subclass may.
- * @throws NullPointerException if flavor is <code>null</code>
+ * @throws NullPointerException if {@code flavor} is {@code null}
* @see java.io.Reader
*/
public Object getTransferData(DataFlavor flavor)
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,6 @@
package java.awt.datatransfer;
-import sun.datatransfer.DataFlavorUtil;
-import sun.datatransfer.DesktopDatatransferService;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -45,11 +42,14 @@
import java.util.Objects;
import java.util.Set;
+import sun.datatransfer.DataFlavorUtil;
+import sun.datatransfer.DesktopDatatransferService;
+
/**
* The SystemFlavorMap is a configurable map between "natives" (Strings), which
* correspond to platform-specific data formats, and "flavors" (DataFlavors),
- * which correspond to platform-independent MIME types. This mapping is used
- * by the data transfer subsystem to transfer data between Java and native
+ * which correspond to platform-independent MIME types. This mapping is used by
+ * the data transfer subsystem to transfer data between Java and native
* applications, and between Java applications in separate VMs.
*
* @since 1.2
@@ -57,8 +57,7 @@
public final class SystemFlavorMap implements FlavorMap, FlavorTable {
/**
- * Constant prefix used to tag Java types converted to native platform
- * type.
+ * Constant prefix used to tag Java types converted to native platform type.
*/
private static String JavaMIME = "JAVA_DATAFLAVOR:";
@@ -93,14 +92,15 @@
/**
* Maps native Strings to Lists of DataFlavors (or base type Strings for
* text DataFlavors).
- * Do not use the field directly, use getNativeToFlavor() instead.
+ * <p>
+ * Do not use the field directly, use {@link #getNativeToFlavor} instead.
*/
private final Map<String, LinkedHashSet<DataFlavor>> nativeToFlavor = new HashMap<>();
/**
- * Accessor to nativeToFlavor map. Since we use lazy initialization we must
+ * Accessor to nativeToFlavor map. Since we use lazy initialization we must
* use this accessor instead of direct access to the field which may not be
- * initialized yet. This method will initialize the field if needed.
+ * initialized yet. This method will initialize the field if needed.
*
* @return nativeToFlavor
*/
@@ -114,14 +114,15 @@
/**
* Maps DataFlavors (or base type Strings for text DataFlavors) to Lists of
* native Strings.
- * Do not use the field directly, use getFlavorToNative() instead.
+ * <p>
+ * Do not use the field directly, use {@link #getFlavorToNative} instead.
*/
private final Map<DataFlavor, LinkedHashSet<String>> flavorToNative = new HashMap<>();
/**
- * Accessor to flavorToNative map. Since we use lazy initialization we must
+ * Accessor to flavorToNative map. Since we use lazy initialization we must
* use this accessor instead of direct access to the field which may not be
- * initialized yet. This method will initialize the field if needed.
+ * initialized yet. This method will initialize the field if needed.
*
* @return flavorToNative
*/
@@ -133,9 +134,10 @@
}
/**
- * Maps a text DataFlavor primary mime-type to the native. Used only to store
- * standard mappings registered in the flavormap.properties
- * Do not use this field directly, use getTextTypeToNative() instead.
+ * Maps a text DataFlavor primary mime-type to the native. Used only to
+ * store standard mappings registered in the {@code flavormap.properties}.
+ * <p>
+ * Do not use this field directly, use {@link #getTextTypeToNative} instead.
*/
private Map<String, LinkedHashSet<String>> textTypeToNative = new HashMap<>();
@@ -145,9 +147,9 @@
private boolean isMapInitialized = false;
/**
- * An accessor to textTypeToNative map. Since we use lazy initialization we
- * must use this accessor instead of direct access to the field which may not
- * be initialized yet. This method will initialize the field if needed.
+ * An accessor to textTypeToNative map. Since we use lazy initialization we
+ * must use this accessor instead of direct access to the field which may
+ * not be initialized yet. This method will initialize the field if needed.
*
* @return textTypeToNative
*/
@@ -175,8 +177,8 @@
/**
* Dynamic mapping generation used for text mappings should not be applied
* to the DataFlavors and String natives for which the mappings have been
- * explicitly specified with setFlavorsForNative() or
- * setNativesForFlavor(). This keeps all such keys.
+ * explicitly specified with {@link #setFlavorsForNative} or
+ * {@link #setNativesForFlavor}. This keeps all such keys.
*/
private Set<Object> disabledMappingGenerationKeys = new HashSet<>();
@@ -193,8 +195,8 @@
}
/**
- * Initializes a SystemFlavorMap by reading flavormap.properties
- * For thread-safety must be called under lock on this.
+ * Initializes a SystemFlavorMap by reading {@code flavormap.properties}.
+ * For thread-safety must be called under lock on {@code this}.
*/
private void initSystemFlavorMap() {
if (isMapInitialized) {
@@ -366,10 +368,10 @@
}
/**
- * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method
- * handles the case where 'nat' is not found in 'nativeToFlavor'. In that
- * case, a new DataFlavor is synthesized, stored, and returned, if and
- * only if the specified native is encoded as a Java MIME type.
+ * Semantically equivalent to 'nativeToFlavor.get(nat)'. This method handles
+ * the case where 'nat' is not found in 'nativeToFlavor'. In that case, a
+ * new DataFlavor is synthesized, stored, and returned, if and only if the
+ * specified native is encoded as a Java MIME type.
*/
private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
@@ -480,27 +482,25 @@
}
/**
- * Returns a <code>List</code> of <code>String</code> natives to which the
- * specified <code>DataFlavor</code> can be translated by the data transfer
- * subsystem. The <code>List</code> will be sorted from best native to
- * worst. That is, the first native will best reflect data in the specified
- * flavor to the underlying native platform.
+ * Returns a {@code List} of {@code String} natives to which the specified
+ * {@code DataFlavor} can be translated by the data transfer subsystem. The
+ * {@code List} will be sorted from best native to worst. That is, the first
+ * native will best reflect data in the specified flavor to the underlying
+ * native platform.
* <p>
- * If the specified <code>DataFlavor</code> is previously unknown to the
- * data transfer subsystem and the data transfer subsystem is unable to
- * translate this <code>DataFlavor</code> to any existing native, then
- * invoking this method will establish a
- * mapping in both directions between the specified <code>DataFlavor</code>
- * and an encoded version of its MIME type as its native.
+ * If the specified {@code DataFlavor} is previously unknown to the data
+ * transfer subsystem and the data transfer subsystem is unable to translate
+ * this {@code DataFlavor} to any existing native, then invoking this method
+ * will establish a mapping in both directions between the specified
+ * {@code DataFlavor} and an encoded version of its MIME type as its native.
*
- * @param flav the <code>DataFlavor</code> whose corresponding natives
- * should be returned. If <code>null</code> is specified, all
- * natives currently known to the data transfer subsystem are
- * returned in a non-deterministic order.
- * @return a <code>java.util.List</code> of <code>java.lang.String</code>
- * objects which are platform-specific representations of platform-
- * specific data formats
- *
+ * @param flav the {@code DataFlavor} whose corresponding natives should be
+ * returned. If {@code null} is specified, all natives currently
+ * known to the data transfer subsystem are returned in a
+ * non-deterministic order.
+ * @return a {@code java.util.List} of {@code java.lang.String} objects
+ * which are platform-specific representations of platform-specific
+ * data formats
* @see #encodeDataFlavor
* @since 1.4
*/
@@ -566,33 +566,30 @@
}
/**
- * Returns a <code>List</code> of <code>DataFlavor</code>s to which the
- * specified <code>String</code> native can be translated by the data
- * transfer subsystem. The <code>List</code> will be sorted from best
- * <code>DataFlavor</code> to worst. That is, the first
- * <code>DataFlavor</code> will best reflect data in the specified
- * native to a Java application.
+ * Returns a {@code List} of {@code DataFlavor}s to which the specified
+ * {@code String} native can be translated by the data transfer subsystem.
+ * The {@code List} will be sorted from best {@code DataFlavor} to worst.
+ * That is, the first {@code DataFlavor} will best reflect data in the
+ * specified native to a Java application.
* <p>
* If the specified native is previously unknown to the data transfer
* subsystem, and that native has been properly encoded, then invoking this
* method will establish a mapping in both directions between the specified
- * native and a <code>DataFlavor</code> whose MIME type is a decoded
- * version of the native.
+ * native and a {@code DataFlavor} whose MIME type is a decoded version of
+ * the native.
* <p>
- * If the specified native is not a properly encoded native and the
- * mappings for this native have not been altered with
- * <code>setFlavorsForNative</code>, then the contents of the
- * <code>List</code> is platform dependent, but <code>null</code>
- * cannot be returned.
+ * If the specified native is not a properly encoded native and the mappings
+ * for this native have not been altered with {@code setFlavorsForNative},
+ * then the contents of the {@code List} is platform dependent, but
+ * {@code null} cannot be returned.
*
- * @param nat the native whose corresponding <code>DataFlavor</code>s
- * should be returned. If <code>null</code> is specified, all
- * <code>DataFlavor</code>s currently known to the data transfer
- * subsystem are returned in a non-deterministic order.
- * @return a <code>java.util.List</code> of <code>DataFlavor</code>
- * objects into which platform-specific data in the specified,
- * platform-specific native can be translated
- *
+ * @param nat the native whose corresponding {@code DataFlavor}s should be
+ * returned. If {@code null} is specified, all {@code DataFlavor}s
+ * currently known to the data transfer subsystem are returned in a
+ * non-deterministic order.
+ * @return a {@code java.util.List} of {@code DataFlavor} objects into which
+ * platform-specific data in the specified, platform-specific native
+ * can be translated
* @see #encodeJavaMIMEType
* @since 1.4
*/
@@ -741,24 +738,23 @@
}
/**
- * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
- * their most preferred <code>String</code> native. Each native value will
- * be the same as the first native in the List returned by
- * <code>getNativesForFlavor</code> for the specified flavor.
+ * Returns a {@code Map} of the specified {@code DataFlavor}s to their most
+ * preferred {@code String} native. Each native value will be the same as
+ * the first native in the List returned by {@code getNativesForFlavor} for
+ * the specified flavor.
* <p>
- * If a specified <code>DataFlavor</code> is previously unknown to the
- * data transfer subsystem, then invoking this method will establish a
- * mapping in both directions between the specified <code>DataFlavor</code>
- * and an encoded version of its MIME type as its native.
+ * If a specified {@code DataFlavor} is previously unknown to the data
+ * transfer subsystem, then invoking this method will establish a mapping in
+ * both directions between the specified {@code DataFlavor} and an encoded
+ * version of its MIME type as its native.
*
- * @param flavors an array of <code>DataFlavor</code>s which will be the
- * key set of the returned <code>Map</code>. If <code>null</code> is
- * specified, a mapping of all <code>DataFlavor</code>s known to the
- * data transfer subsystem to their most preferred
- * <code>String</code> natives will be returned.
- * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
- * <code>String</code> natives
- *
+ * @param flavors an array of {@code DataFlavor}s which will be the key set
+ * of the returned {@code Map}. If {@code null} is specified, a
+ * mapping of all {@code DataFlavor}s known to the data transfer
+ * subsystem to their most preferred {@code String} natives will be
+ * returned.
+ * @return a {@code java.util.Map} of {@code DataFlavor}s to {@code String}
+ * natives
* @see #getNativesForFlavor
* @see #encodeDataFlavor
*/
@@ -785,26 +781,23 @@
}
/**
- * Returns a <code>Map</code> of the specified <code>String</code> natives
- * to their most preferred <code>DataFlavor</code>. Each
- * <code>DataFlavor</code> value will be the same as the first
- * <code>DataFlavor</code> in the List returned by
- * <code>getFlavorsForNative</code> for the specified native.
+ * Returns a {@code Map} of the specified {@code String} natives to their
+ * most preferred {@code DataFlavor}. Each {@code DataFlavor} value will be
+ * the same as the first {@code DataFlavor} in the List returned by
+ * {@code getFlavorsForNative} for the specified native.
* <p>
* If a specified native is previously unknown to the data transfer
* subsystem, and that native has been properly encoded, then invoking this
* method will establish a mapping in both directions between the specified
- * native and a <code>DataFlavor</code> whose MIME type is a decoded
- * version of the native.
+ * native and a {@code DataFlavor} whose MIME type is a decoded version of
+ * the native.
*
- * @param natives an array of <code>String</code>s which will be the
- * key set of the returned <code>Map</code>. If <code>null</code> is
- * specified, a mapping of all supported <code>String</code> natives
- * to their most preferred <code>DataFlavor</code>s will be
- * returned.
- * @return a <code>java.util.Map</code> of <code>String</code> natives to
- * <code>DataFlavor</code>s
- *
+ * @param natives an array of {@code String}s which will be the key set of
+ * the returned {@code Map}. If {@code null} is specified, a mapping
+ * of all supported {@code String} natives to their most preferred
+ * {@code DataFlavor}s will be returned.
+ * @return a {@code java.util.Map} of {@code String} natives to
+ * {@code DataFlavor}s
* @see #getFlavorsForNative
* @see #encodeJavaMIMEType
*/
@@ -828,22 +821,19 @@
}
/**
- * Adds a mapping from the specified <code>DataFlavor</code> (and all
- * <code>DataFlavor</code>s equal to the specified <code>DataFlavor</code>)
- * to the specified <code>String</code> native.
- * Unlike <code>getNativesForFlavor</code>, the mapping will only be
- * established in one direction, and the native will not be encoded. To
- * establish a two-way mapping, call
- * <code>addFlavorForUnencodedNative</code> as well. The new mapping will
- * be of lower priority than any existing mapping.
- * This method has no effect if a mapping from the specified or equal
- * <code>DataFlavor</code> to the specified <code>String</code> native
- * already exists.
+ * Adds a mapping from the specified {@code DataFlavor} (and all
+ * {@code DataFlavor}s equal to the specified {@code DataFlavor}) to the
+ * specified {@code String} native. Unlike {@code getNativesForFlavor}, the
+ * mapping will only be established in one direction, and the native will
+ * not be encoded. To establish a two-way mapping, call
+ * {@code addFlavorForUnencodedNative} as well. The new mapping will be of
+ * lower priority than any existing mapping. This method has no effect if a
+ * mapping from the specified or equal {@code DataFlavor} to the specified
+ * {@code String} native already exists.
*
- * @param flav the <code>DataFlavor</code> key for the mapping
- * @param nat the <code>String</code> native value for the mapping
- * @throws NullPointerException if flav or nat is <code>null</code>
- *
+ * @param flav the {@code DataFlavor} key for the mapping
+ * @param nat the {@code String} native value for the mapping
+ * @throws NullPointerException if flav or nat is {@code null}
* @see #addFlavorForUnencodedNative
* @since 1.4
*/
@@ -862,30 +852,27 @@
}
/**
- * Discards the current mappings for the specified <code>DataFlavor</code>
- * and all <code>DataFlavor</code>s equal to the specified
- * <code>DataFlavor</code>, and creates new mappings to the
- * specified <code>String</code> natives.
- * Unlike <code>getNativesForFlavor</code>, the mappings will only be
- * established in one direction, and the natives will not be encoded. To
- * establish two-way mappings, call <code>setFlavorsForNative</code>
- * as well. The first native in the array will represent the highest
- * priority mapping. Subsequent natives will represent mappings of
- * decreasing priority.
+ * Discards the current mappings for the specified {@code DataFlavor} and
+ * all {@code DataFlavor}s equal to the specified {@code DataFlavor}, and
+ * creates new mappings to the specified {@code String} natives. Unlike
+ * {@code getNativesForFlavor}, the mappings will only be established in one
+ * direction, and the natives will not be encoded. To establish two-way
+ * mappings, call {@code setFlavorsForNative} as well. The first native in
+ * the array will represent the highest priority mapping. Subsequent natives
+ * will represent mappings of decreasing priority.
* <p>
* If the array contains several elements that reference equal
- * <code>String</code> natives, this method will establish new mappings
- * for the first of those elements and ignore the rest of them.
+ * {@code String} natives, this method will establish new mappings for the
+ * first of those elements and ignore the rest of them.
* <p>
* It is recommended that client code not reset mappings established by the
* data transfer subsystem. This method should only be used for
* application-level mappings.
*
- * @param flav the <code>DataFlavor</code> key for the mappings
- * @param natives the <code>String</code> native values for the mappings
- * @throws NullPointerException if flav or natives is <code>null</code>
- * or if natives contains <code>null</code> elements
- *
+ * @param flav the {@code DataFlavor} key for the mappings
+ * @param natives the {@code String} native values for the mappings
+ * @throws NullPointerException if flav or natives is {@code null} or if
+ * natives contains {@code null} elements
* @see #setFlavorsForNative
* @since 1.4
*/
@@ -903,20 +890,19 @@
}
/**
- * Adds a mapping from a single <code>String</code> native to a single
- * <code>DataFlavor</code>. Unlike <code>getFlavorsForNative</code>, the
- * mapping will only be established in one direction, and the native will
- * not be encoded. To establish a two-way mapping, call
- * <code>addUnencodedNativeForFlavor</code> as well. The new mapping will
- * be of lower priority than any existing mapping.
- * This method has no effect if a mapping from the specified
- * <code>String</code> native to the specified or equal
- * <code>DataFlavor</code> already exists.
+ * Adds a mapping from a single {@code String} native to a single
+ * {@code DataFlavor}. Unlike {@code getFlavorsForNative}, the mapping will
+ * only be established in one direction, and the native will not be encoded.
+ * To establish a two-way mapping, call {@code addUnencodedNativeForFlavor}
+ * as well. The new mapping will be of lower priority than any existing
+ * mapping. This method has no effect if a mapping from the specified
+ * {@code String} native to the specified or equal {@code DataFlavor}
+ * already exists.
*
- * @param nat the <code>String</code> native key for the mapping
- * @param flav the <code>DataFlavor</code> value for the mapping
- * @throws NullPointerException if nat or flav is <code>null</code>
- *
+ * @param nat the {@code String} native key for the mapping
+ * @param flav the {@code DataFlavor} value for the mapping
+ * @throws NullPointerException if {@code nat} or {@code flav} is
+ * {@code null}
* @see #addUnencodedNativeForFlavor
* @since 1.4
*/
@@ -935,29 +921,27 @@
}
/**
- * Discards the current mappings for the specified <code>String</code>
- * native, and creates new mappings to the specified
- * <code>DataFlavor</code>s. Unlike <code>getFlavorsForNative</code>, the
- * mappings will only be established in one direction, and the natives need
- * not be encoded. To establish two-way mappings, call
- * <code>setNativesForFlavor</code> as well. The first
- * <code>DataFlavor</code> in the array will represent the highest priority
- * mapping. Subsequent <code>DataFlavor</code>s will represent mappings of
+ * Discards the current mappings for the specified {@code String} native,
+ * and creates new mappings to the specified {@code DataFlavor}s. Unlike
+ * {@code getFlavorsForNative}, the mappings will only be established in one
+ * direction, and the natives need not be encoded. To establish two-way
+ * mappings, call {@code setNativesForFlavor} as well. The first
+ * {@code DataFlavor} in the array will represent the highest priority
+ * mapping. Subsequent {@code DataFlavor}s will represent mappings of
* decreasing priority.
* <p>
* If the array contains several elements that reference equal
- * <code>DataFlavor</code>s, this method will establish new mappings
- * for the first of those elements and ignore the rest of them.
+ * {@code DataFlavor}s, this method will establish new mappings for the
+ * first of those elements and ignore the rest of them.
* <p>
* It is recommended that client code not reset mappings established by the
* data transfer subsystem. This method should only be used for
* application-level mappings.
*
- * @param nat the <code>String</code> native key for the mappings
- * @param flavors the <code>DataFlavor</code> values for the mappings
- * @throws NullPointerException if nat or flavors is <code>null</code>
- * or if flavors contains <code>null</code> elements
- *
+ * @param nat the {@code String} native key for the mappings
+ * @param flavors the {@code DataFlavor} values for the mappings
+ * @throws NullPointerException if {@code nat} or {@code flavors} is
+ * {@code null} or if {@code flavors} contains {@code null} elements
* @see #setNativesForFlavor
* @since 1.4
*/
@@ -975,23 +959,22 @@
}
/**
- * Encodes a MIME type for use as a <code>String</code> native. The format
- * of an encoded representation of a MIME type is implementation-dependent.
- * The only restrictions are:
+ * Encodes a MIME type for use as a {@code String} native. The format of an
+ * encoded representation of a MIME type is implementation-dependent. The
+ * only restrictions are:
* <ul>
- * <li>The encoded representation is <code>null</code> if and only if the
- * MIME type <code>String</code> is <code>null</code>.</li>
- * <li>The encoded representations for two non-<code>null</code> MIME type
- * <code>String</code>s are equal if and only if these <code>String</code>s
- * are equal according to <code>String.equals(Object)</code>.</li>
+ * <li>The encoded representation is {@code null} if and only if the MIME
+ * type {@code String} is {@code null}</li>
+ * <li>The encoded representations for two non-{@code null} MIME type
+ * {@code String}s are equal if and only if these {@code String}s are
+ * equal according to {@code String.equals(Object)}</li>
* </ul>
- * <p>
* The reference implementation of this method returns the specified MIME
- * type <code>String</code> prefixed with <code>JAVA_DATAFLAVOR:</code>.
+ * type {@code String} prefixed with {@code JAVA_DATAFLAVOR:}.
*
- * @param mimeType the MIME type to encode
- * @return the encoded <code>String</code>, or <code>null</code> if
- * mimeType is <code>null</code>
+ * @param mimeType the MIME type to encode
+ * @return the encoded {@code String}, or {@code null} if {@code mimeType}
+ * is {@code null}
*/
public static String encodeJavaMIMEType(String mimeType) {
return (mimeType != null)
@@ -1000,27 +983,26 @@
}
/**
- * Encodes a <code>DataFlavor</code> for use as a <code>String</code>
- * native. The format of an encoded <code>DataFlavor</code> is
- * implementation-dependent. The only restrictions are:
+ * Encodes a {@code DataFlavor} for use as a {@code String} native. The
+ * format of an encoded {@code DataFlavor} is implementation-dependent. The
+ * only restrictions are:
* <ul>
- * <li>The encoded representation is <code>null</code> if and only if the
- * specified <code>DataFlavor</code> is <code>null</code> or its MIME type
- * <code>String</code> is <code>null</code>.</li>
- * <li>The encoded representations for two non-<code>null</code>
- * <code>DataFlavor</code>s with non-<code>null</code> MIME type
- * <code>String</code>s are equal if and only if the MIME type
- * <code>String</code>s of these <code>DataFlavor</code>s are equal
- * according to <code>String.equals(Object)</code>.</li>
+ * <li>The encoded representation is {@code null} if and only if the
+ * specified {@code DataFlavor} is {@code null} or its MIME type
+ * {@code String} is {@code null}</li>
+ * <li>The encoded representations for two non-{@code null}
+ * {@code DataFlavor}s with non-{@code null} MIME type {@code String}s
+ * are equal if and only if the MIME type {@code String}s of these
+ * {@code DataFlavor}s are equal according to
+ * {@code String.equals(Object)}</li>
* </ul>
- * <p>
* The reference implementation of this method returns the MIME type
- * <code>String</code> of the specified <code>DataFlavor</code> prefixed
- * with <code>JAVA_DATAFLAVOR:</code>.
+ * {@code String} of the specified {@code DataFlavor} prefixed with
+ * {@code JAVA_DATAFLAVOR:}.
*
- * @param flav the <code>DataFlavor</code> to encode
- * @return the encoded <code>String</code>, or <code>null</code> if
- * flav is <code>null</code> or has a <code>null</code> MIME type
+ * @param flav the {@code DataFlavor} to encode
+ * @return the encoded {@code String}, or {@code null} if {@code flav} is
+ * {@code null} or has a {@code null} MIME type
*/
public static String encodeDataFlavor(DataFlavor flav) {
return (flav != null)
@@ -1029,23 +1011,23 @@
}
/**
- * Returns whether the specified <code>String</code> is an encoded Java
- * MIME type.
+ * Returns whether the specified {@code String} is an encoded Java MIME
+ * type.
*
- * @param str the <code>String</code> to test
- * @return <code>true</code> if the <code>String</code> is encoded;
- * <code>false</code> otherwise
+ * @param str the {@code String} to test
+ * @return {@code true} if the {@code String} is encoded; {@code false}
+ * otherwise
*/
public static boolean isJavaMIMEType(String str) {
return (str != null && str.startsWith(JavaMIME, 0));
}
/**
- * Decodes a <code>String</code> native for use as a Java MIME type.
+ * Decodes a {@code String} native for use as a Java MIME type.
*
- * @param nat the <code>String</code> to decode
- * @return the decoded Java MIME type, or <code>null</code> if nat is not
- * an encoded <code>String</code> native
+ * @param nat the {@code String} to decode
+ * @return the decoded Java MIME type, or {@code null} if {@code nat} is not
+ * an encoded {@code String} native
*/
public static String decodeJavaMIMEType(String nat) {
return (isJavaMIMEType(nat))
@@ -1054,14 +1036,13 @@
}
/**
- * Decodes a <code>String</code> native for use as a
- * <code>DataFlavor</code>.
+ * Decodes a {@code String} native for use as a {@code DataFlavor}.
*
- * @param nat the <code>String</code> to decode
- * @return the decoded <code>DataFlavor</code>, or <code>null</code> if
- * nat is not an encoded <code>String</code> native
- * @throws ClassNotFoundException if the class of the data flavor
- * is not loaded
+ * @param nat the {@code String} to decode
+ * @return the decoded {@code DataFlavor}, or {@code null} if {@code nat} is
+ * not an encoded {@code String} native
+ * @throws ClassNotFoundException if the class of the data flavor is not
+ * loaded
*/
public static DataFlavor decodeDataFlavor(String nat)
throws ClassNotFoundException
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Transferable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Transferable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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,48 +28,50 @@
import java.io.IOException;
/**
- * Defines the interface for classes that can be used to provide data
- * for a transfer operation.
+ * Defines the interface for classes that can be used to provide data for a
+ * transfer operation.
* <p>
* For information on using data transfer with Swing, see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
- * How to Use Drag and Drop and Data Transfer</a>,
- * a section in <em>The Java Tutorial</em>, for more information.
+ * How to Use Drag and Drop and Data Transfer</a>, a section in
+ * <em>The Java Tutorial</em>, for more information.
*
- * @author Amy Fowler
+ * @author Amy Fowler
* @since 1.1
*/
-
public interface Transferable {
/**
* Returns an array of DataFlavor objects indicating the flavors the data
- * can be provided in. The array should be ordered according to preference
- * for providing the data (from most richly descriptive to least descriptive).
+ * can be provided in. The array should be ordered according to preference
+ * for providing the data (from most richly descriptive to least
+ * descriptive).
+ *
* @return an array of data flavors in which this data can be transferred
*/
public DataFlavor[] getTransferDataFlavors();
/**
- * Returns whether or not the specified data flavor is supported for
- * this object.
- * @param flavor the requested flavor for the data
+ * Returns whether or not the specified data flavor is supported for this
+ * object.
+ *
+ * @param flavor the requested flavor for the data
* @return boolean indicating whether or not the data flavor is supported
*/
public boolean isDataFlavorSupported(DataFlavor flavor);
/**
- * Returns an object which represents the data to be transferred. The class
- * of the object returned is defined by the representation class of the flavor.
+ * Returns an object which represents the data to be transferred. The class
+ * of the object returned is defined by the representation class of the
+ * flavor.
*
- * @param flavor the requested flavor for the data
+ * @param flavor the requested flavor for the data
* @return an object which represents the data to be transferred
+ * @throws IOException if the data is no longer available in the requested
+ * flavor
+ * @throws UnsupportedFlavorException if the requested data flavor is not
+ * supported
* @see DataFlavor#getRepresentationClass
- * @exception IOException if the data is no longer available
- * in the requested flavor.
- * @exception UnsupportedFlavorException if the requested data flavor is
- * not supported.
*/
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;
-
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/UnsupportedFlavorException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/UnsupportedFlavorException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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,9 +27,9 @@
/**
* Signals that the requested data is not supported in this flavor.
+ *
+ * @author Amy Fowler
* @see Transferable#getTransferData
- *
- * @author Amy Fowler
* @since 1.1
*/
public class UnsupportedFlavorException extends Exception {
@@ -42,8 +42,8 @@
/**
* Constructs an UnsupportedFlavorException.
*
- * @param flavor the flavor object which caused the exception. May
- * be <code>null</code>.
+ * @param flavor the flavor object which caused the exception. May be
+ * {@code null}.
*/
public UnsupportedFlavorException(DataFlavor flavor) {
super((flavor != null) ? flavor.getHumanPresentableName() : null);
--- a/jdk/src/java.datatransfer/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,6 +31,8 @@
*/
module java.datatransfer {
exports java.awt.datatransfer;
+
exports sun.datatransfer to java.desktop;
+
uses sun.datatransfer.DesktopDatatransferService;
}
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -51,9 +51,8 @@
import java.util.TreeSet;
import java.util.function.Supplier;
-
/**
- * Utility class with different datatransfer helper functions
+ * Utility class with different datatransfer helper functions.
*
* @since 9
*/
@@ -64,11 +63,11 @@
}
private static Comparator<String> getCharsetComparator() {
- return CharsetComparator.INSTANCE;
+ return CharsetComparator.INSTANCE;
}
public static Comparator<DataFlavor> getDataFlavorComparator() {
- return DataFlavorComparator.INSTANCE;
+ return DataFlavorComparator.INSTANCE;
}
public static Comparator<Long> getIndexOrderComparator(Map<Long, Integer> indexMap) {
@@ -83,7 +82,8 @@
* Tracks whether a particular text/* MIME type supports the charset
* parameter. The Map is initialized with all of the standard MIME types
* listed in the DataFlavor.selectBestTextFlavor method comment. Additional
- * entries may be added during the life of the JRE for text/<other> types.
+ * entries may be added during the life of the JRE for text/<other>
+ * types.
*/
private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
@@ -127,11 +127,11 @@
}
/**
- * Returns a {@code SortedSet} of Strings which are a total order of the standard
- * character sets supported by the JRE. The ordering follows the same principles as
- * {@link java.awt.datatransfer.DataFlavor#selectBestTextFlavor(java.awt.datatransfer.DataFlavor[])}.
- * So as to avoid loading all available character converters, optional, non-standard,
- * character sets are not included.
+ * Returns a {@code SortedSet} of Strings which are a total order of the
+ * standard character sets supported by the JRE. The ordering follows the
+ * same principles as {@link DataFlavor#selectBestTextFlavor(DataFlavor[])}.
+ * So as to avoid loading all available character converters, optional,
+ * non-standard, character sets are not included.
*/
public static Set<String> standardEncodings() {
return StandardEncodingsHolder.standardEncodings;
@@ -154,9 +154,8 @@
}
/**
- * Tests only whether the flavor's MIME type supports the charset
- * parameter. Must only be called for flavors with a primary type of
- * "text".
+ * Tests only whether the flavor's MIME type supports the charset parameter.
+ * Must only be called for flavors with a primary type of "text".
*/
public static boolean doesSubtypeSupportCharset(DataFlavor flavor) {
String subType = flavor.getSubType();
@@ -188,10 +187,9 @@
return ret_val;
}
-
/**
- * Returns whether this flavor is a text type which supports the
- * 'charset' parameter.
+ * Returns whether this flavor is a text type which supports the 'charset'
+ * parameter.
*/
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
// Although stringFlavor doesn't actually support the charset
@@ -247,9 +245,9 @@
/**
* If the specified flavor is a text flavor which supports the "charset"
* parameter, then this method returns that parameter, or the default
- * charset if no such parameter was specified at construction. For non-
- * text DataFlavors, and for non-charset text flavors, this method returns
- * null.
+ * charset if no such parameter was specified at construction. For non-text
+ * DataFlavors, and for non-charset text flavors, this method returns
+ * {@code null}.
*/
public static String getTextCharset(DataFlavor flavor) {
if (!isFlavorCharsetTextType(flavor)) {
@@ -278,16 +276,16 @@
/**
* Helper method to compare two objects by their Integer indices in the
- * given map. If the map doesn't contain an entry for either of the
- * objects, the fallback index will be used for the object instead.
+ * given map. If the map doesn't contain an entry for either of the objects,
+ * the fallback index will be used for the object instead.
*
- * @param indexMap the map which maps objects into Integer indexes.
- * @param obj1 the first object to be compared.
- * @param obj2 the second object to be compared.
- * @param fallbackIndex the Integer to be used as a fallback index.
- * @return a negative integer, zero, or a positive integer as the
- * first object is mapped to a less, equal to, or greater
- * index than the second.
+ * @param indexMap the map which maps objects into Integer indexes
+ * @param obj1 the first object to be compared
+ * @param obj2 the second object to be compared
+ * @param fallbackIndex the Integer to be used as a fallback index
+ * @return a negative integer, zero, or a positive integer as the first
+ * object is mapped to a less, equal to, or greater index than the
+ * second
*/
static <T> int compareIndices(Map<T, Integer> indexMap,
T obj1, T obj2,
@@ -342,21 +340,20 @@
* <p>
* Charsets are ordered according to the following rules:
* <ul>
- * <li>All unsupported charsets are equal.
+ * <li>All unsupported charsets are equal</li>
* <li>Any unsupported charset is worse than any supported charset.
* <li>Unicode charsets, such as "UTF-16", "UTF-8", "UTF-16BE" and
- * "UTF-16LE", are considered best.
- * <li>After them, platform default charset is selected.
- * <li>"US-ASCII" is the worst of supported charsets.
- * <li>For all other supported charsets, the lexicographically less
- * one is considered the better.
+ * "UTF-16LE", are considered best</li>
+ * <li>After them, platform default charset is selected</li>
+ * <li>"US-ASCII" is the worst of supported charsets</li>
+ * <li>For all other supported charsets, the lexicographically less one
+ * is considered the better</li>
* </ul>
*
- * @param charset1 the first charset to be compared
- * @param charset2 the second charset to be compared.
- * @return a negative integer, zero, or a positive integer as the
- * first argument is worse, equal to, or better than the
- * second.
+ * @param charset1 the first charset to be compared
+ * @param charset2 the second charset to be compared
+ * @return a negative integer, zero, or a positive integer as the first
+ * argument is worse, equal to, or better than the second
*/
public int compare(String charset1, String charset2) {
charset1 = getEncoding(charset1);
@@ -372,20 +369,20 @@
}
/**
- * Returns encoding for the specified charset according to the
- * following rules:
+ * Returns encoding for the specified charset according to the following
+ * rules:
* <ul>
- * <li>If the charset is <code>null</code>, then <code>null</code> will
- * be returned.
+ * <li>If the charset is {@code null}, then {@code null} will be
+ * returned</li>
* <li>Iff the charset specifies an encoding unsupported by this JRE,
- * <code>UNSUPPORTED_CHARSET</code> will be returned.
+ * {@code UNSUPPORTED_CHARSET} will be returned</li>
* <li>If the charset specifies an alias name, the corresponding
* canonical name will be returned iff the charset is a known
- * Unicode, ASCII, or default charset.
+ * Unicode, ASCII, or default charset</li>
* </ul>
*
- * @param charset the charset.
- * @return an encoding for this charset.
+ * @param charset the charset
+ * @return an encoding for this charset
*/
static String getEncoding(String charset) {
if (charset == null) {
@@ -408,12 +405,13 @@
/**
* An IndexedComparator which compares two DataFlavors. For text flavors,
* the comparison follows the rules outlined in
- * DataFlavor.selectBestTextFlavor. For non-text flavors, unknown
- * application MIME types are preferred, followed by known
- * application/x-java-* MIME types. Unknown application types are preferred
- * because if the user provides his own data flavor, it will likely be the
- * most descriptive one. For flavors which are otherwise equal, the
- * flavors' string representation are compared in the alphabetical order.
+ * {@link DataFlavor#selectBestTextFlavor selectBestTextFlavor}. For
+ * non-text flavors, unknown application MIME types are preferred, followed
+ * by known application/x-java-* MIME types. Unknown application types are
+ * preferred because if the user provides his own data flavor, it will
+ * likely be the most descriptive one. For flavors which are otherwise
+ * equal, the flavors' string representation are compared in the
+ * alphabetical order.
*/
private static class DataFlavorComparator implements Comparator<DataFlavor> {
@@ -614,7 +612,7 @@
}
}
- /*
+ /**
* Given the Map that maps objects to Integer indices and a boolean value,
* this Comparator imposes a direct or reverse order on set of objects.
* <p>
@@ -623,9 +621,9 @@
* only if the index of A is greater than the index of B. An object that
* doesn't have an associated index is less or equal than any other object.
* <p>
- * If the specified boolean value is SELECT_WORST, the Comparator imposes the
- * reverse index-based order: an object A is greater than an object B if and
- * only if A is less than B with the direct index-based order.
+ * If the specified boolean value is SELECT_WORST, the Comparator imposes
+ * the reverse index-based order: an object A is greater than an object B if
+ * and only if A is less than B with the direct index-based order.
*/
private static class IndexOrderComparator implements Comparator<Long> {
private final Map<Long, Integer> indexMap;
@@ -643,25 +641,24 @@
private static class TextFlavorComparator extends DataFlavorComparator {
static final TextFlavorComparator INSTANCE = new TextFlavorComparator();
+
/**
- * Compares two <code>DataFlavor</code> objects. Returns a negative
- * integer, zero, or a positive integer as the first
- * <code>DataFlavor</code> is worse than, equal to, or better than the
- * second.
+ * Compares two {@code DataFlavor} objects. Returns a negative integer,
+ * zero, or a positive integer as the first {@code DataFlavor} is worse
+ * than, equal to, or better than the second.
* <p>
- * <code>DataFlavor</code>s are ordered according to the rules outlined
- * for <code>selectBestTextFlavor</code>.
+ * {@code DataFlavor}s are ordered according to the rules outlined for
+ * {@link DataFlavor#selectBestTextFlavor selectBestTextFlavor}.
*
- * @param flavor1 the first <code>DataFlavor</code> to be compared
- * @param flavor2 the second <code>DataFlavor</code> to be compared
+ * @param flavor1 the first {@code DataFlavor} to be compared
+ * @param flavor2 the second {@code DataFlavor} to be compared
* @return a negative integer, zero, or a positive integer as the first
* argument is worse, equal to, or better than the second
* @throws ClassCastException if either of the arguments is not an
- * instance of <code>DataFlavor</code>
+ * instance of {@code DataFlavor}
* @throws NullPointerException if either of the arguments is
- * <code>null</code>
- *
- * @see java.awt.datatransfer.DataFlavor#selectBestTextFlavor
+ * {@code null}
+ * @see DataFlavor#selectBestTextFlavor
*/
public int compare(DataFlavor flavor1, DataFlavor flavor2) {
if (flavor1.isFlavorTextType()) {
@@ -679,8 +676,8 @@
}
/**
- * A fallback implementation of {@link sun.datatransfer.DesktopDatatransferService}
- * used if there is no desktop.
+ * A fallback implementation of {@link DesktopDatatransferService} used if
+ * there is no desktop.
*/
private static final class DefaultDesktopDatatransferService implements DesktopDatatransferService {
static final DesktopDatatransferService INSTANCE = getDesktopService();
@@ -697,9 +694,8 @@
}
/**
- * System singleton FlavorTable.
- * Only used if there is no desktop
- * to provide an appropriate FlavorMap.
+ * System singleton FlavorTable. Only used if there is no desktop to
+ * provide an appropriate FlavorMap.
*/
private volatile FlavorMap flavorMap;
@@ -754,8 +750,8 @@
}
/**
- * A class that provides access to java.rmi.Remote and java.rmi.MarshalledObject
- * without creating a static dependency.
+ * A class that provides access to {@code java.rmi.Remote} and
+ * {@code java.rmi.MarshalledObject} without creating a static dependency.
*/
public static class RMI {
private static final Class<?> remoteClass = getClass("java.rmi.Remote");
@@ -788,7 +784,8 @@
}
/**
- * Returns java.rmi.Remote.class if RMI is present; otherwise {@code null}.
+ * Returns {@code java.rmi.Remote.class} if RMI is present; otherwise
+ * {@code null}.
*/
static Class<?> remoteClass() {
return remoteClass;
@@ -802,8 +799,8 @@
}
/**
- * Returns a new MarshalledObject containing the serialized representation
- * of the given object.
+ * Returns a new MarshalledObject containing the serialized
+ * representation of the given object.
*/
public static Object newMarshalledObject(Object obj) throws IOException {
try {
@@ -836,6 +833,5 @@
throw new AssertionError(x);
}
}
-
}
}
--- a/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,8 +31,8 @@
import java.util.function.Supplier;
/**
- * Contains services which desktop provides to the datatransfer system
- * to enrich it's functionality
+ * Contains services which desktop provides to the datatransfer system to enrich
+ * it's functionality.
*
* @author Petr Pchelko
* @since 9
@@ -40,57 +40,55 @@
public interface DesktopDatatransferService {
/**
- * If desktop is present - invokes a {@code Runnable} on
- * the event dispatch thread. Otherwise invokes a {@code run()}
- * method directly.
+ * If desktop is present - invokes a {@code Runnable} on the event dispatch
+ * thread. Otherwise invokes a {@code run()} method directly.
*
- * @param r a {@code Runnable} to invoke
+ * @param r a {@code Runnable} to invoke
*/
void invokeOnEventThread(Runnable r);
/**
- * Get a platform-dependent default unicode encoding to use in
- * datatransfer system.
+ * Get a platform-dependent default unicode encoding to use in datatransfer
+ * system.
*
* @return default unicode encoding
*/
String getDefaultUnicodeEncoding();
/**
- * Takes an appropriate {@code FlavorMap} from the desktop.
- * If no appropriate table is found - uses a provided supplier to
- * instantiate a table. If the desktop is absent - creates and returns
- * a system singleton.
+ * Takes an appropriate {@code FlavorMap} from the desktop. If no
+ * appropriate table is found - uses a provided supplier to instantiate a
+ * table. If the desktop is absent - creates and returns a system singleton.
*
- * @param supplier a constructor that should be used to create a new instance of
- * the {@code FlavorMap}
+ * @param supplier a constructor that should be used to create a new
+ * instance of the {@code FlavorMap}
* @return a {@code FlavorMap}
*/
FlavorMap getFlavorMap(Supplier<FlavorMap> supplier);
/**
- * Checks if desktop is present
+ * Checks if desktop is present.
*
* @return {@code true} is the desktop is present
*/
boolean isDesktopPresent();
/**
- * Returns platform-specific mappings for the specified native format.
- * If there are no platform-specific mappings for this native, the method
- * returns an empty {@code Set}
+ * Returns platform-specific mappings for the specified native format. If
+ * there are no platform-specific mappings for this native, the method
+ * returns an empty {@code Set}.
*
- * @param nat a native format to return flavors for
+ * @param nat a native format to return flavors for
* @return set of platform-specific mappings for a native format
*/
LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat);
/**
- * Returns platform-specific mappings for the specified flavor.
- * If there are no platform-specific mappings for this flavor, the method
- * returns an empty {@code Set}
+ * Returns platform-specific mappings for the specified flavor. If there are
+ * no platform-specific mappings for this flavor, the method returns an
+ * empty {@code Set}.
*
- * @param df {@code DataFlavor} to return mappings for
+ * @param df {@code DataFlavor} to return mappings for
* @return set of platform-specific mappings for a {@code DataFlavor}
*/
LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df);
@@ -98,8 +96,8 @@
/**
* This method is called for text flavor mappings established while parsing
* the default flavor mappings file. It stores the "eoln" and "terminators"
- * parameters which are not officially part of the MIME type. They are
- * MIME parameters specific to the flavormap.properties file format.
+ * parameters which are not officially part of the MIME type. They are MIME
+ * parameters specific to the flavormap.properties file format.
*/
void registerTextFlavorProperties(String nat, String charset,
String eoln, String terminators);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m Thu Aug 24 16:24:44 2017 +0200
@@ -376,7 +376,7 @@
static JNF_MEMBER_CACHE(jm_getMaxPage, sjc_CPrinterJob, "getMaxPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
- static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormat", "(I)Ljava/awt/print/PageFormat;");
+ static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
NSMutableDictionary* printingDictionary = [dst dictionary];
@@ -412,7 +412,7 @@
[printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
[printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
- jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat, (jint)0);
+ jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat);
if (page != NULL) {
javaPageFormatToNSPrintInfo(env, NULL, page, dst);
}
--- a/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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,8 +114,13 @@
* document is to be displayed.
* The target argument is interpreted as follows:
*
- * <center><table border="3" summary="Target arguments and their descriptions">
- * <tr><th>Target Argument</th><th>Description</th></tr>
+ * <table class="striped">
+ * <caption>Target arguments and their descriptions</caption>
+ * <thead>
+ * <tr><th>Target Argument</th>
+ * <th>Description</th></tr>
+ * </thead>
+ * <tbody>
* <tr><td>{@code "_self"} <td>Show in the window and frame that
* contain the applet.</tr>
* <tr><td>{@code "_parent"}<td>Show in the applet's parent frame. If
@@ -130,7 +135,8 @@
* a target named <i>name</i> does not already exist, a
* new top-level window with the specified name is created,
* and the document is shown there.</tr>
- * </table> </center>
+ * </tbody>
+ * </table>
* <p>
* An applet viewer or browser is free to ignore {@code showDocument}.
*
--- a/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -90,8 +90,13 @@
/**
* Constructs an {@code AWTKeyStroke} with default values.
* The default values used are:
- * <table border="1" summary="AWTKeyStroke default values">
+ *
+ * <table class="striped">
+ * <caption>AWTKeyStroke default values</caption>
+ * <thead>
* <tr><th>Property</th><th>Default Value</th></tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>Key Char</td>
* <td>{@code KeyEvent.CHAR_UNDEFINED}</td>
@@ -108,6 +113,7 @@
* <td>On key release?</td>
* <td>{@code false}</td>
* </tr>
+ * </tbody>
* </table>
*
* {@code AWTKeyStroke}s should not be constructed
--- a/jdk/src/java.desktop/share/classes/java/awt/AWTPermission.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/AWTPermission.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,13 +44,17 @@
* permission allows and a discussion of the risks of granting code
* the permission.
*
- * <table border=1 cellpadding=5 summary="AWTPermission target names, descriptions, and associated risks.">
+ * <table class="striped">
+ * <caption>AWTPermission target names, descriptions, and associated risks
+ * </caption>
+ * <thead>
* <tr>
* <th>Permission Target Name</th>
* <th>What the Permission Allows</th>
* <th>Risks of Allowing this Permission</th>
* </tr>
- *
+ * </thead>
+ * <tbody>
* <tr>
* <td>accessClipboard</td>
* <td>Posting and retrieval of information to and from the AWT clipboard</td>
@@ -182,6 +186,7 @@
* so that keyboard is emulated using the mouse, an applet may guess what
* is being typed.</td>
* </tr>
+ * </tbody>
* </table>
*
* @see java.security.BasicPermission
--- a/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java Thu Aug 24 16:24:44 2017 +0200
@@ -73,7 +73,8 @@
* equation in the Porter and Duff paper:
*
* <blockquote>
- * <table summary="layout">
+ * <table class="borderless">
+ * <caption style="display:none">Factors</caption>
* <tr><th style="text-align:left">Factor <th style="text-align:left">Definition
* <tr><td><em>A<sub>s</sub></em><td>the alpha component of the source pixel
* <tr><td><em>C<sub>s</sub></em><td>a color component of the source pixel in premultiplied form
@@ -113,7 +114,8 @@
* the blending equation in the Porter and Duff paper:
*
* <blockquote>
- * <table summary="layout">
+ * <table class="borderless">
+ * <caption style="display:none">Factors</caption>
* <tr><th style="text-align:left">Factor <th style="text-align:left">Definition
* <tr><td><em>C<sub>sr</sub></em> <td>one of the raw color components of the source pixel
* <tr><td><em>C<sub>dr</sub></em> <td>one of the raw color components of the destination pixel
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java Thu Aug 24 16:24:44 2017 +0200
@@ -7237,12 +7237,17 @@
* recommendations for Windows and Unix are listed below. These
* recommendations are used in the Sun AWT implementations.
*
- * <table border=1 summary="Recommended default values for a Component's focus traversal keys">
+ * <table class="striped">
+ * <caption>Recommended default values for a Component's focus traversal
+ * keys</caption>
+ * <thead>
* <tr>
* <th>Identifier</th>
* <th>Meaning</th>
* <th>Default</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS</td>
* <td>Normal forward keyboard traversal</td>
@@ -7258,6 +7263,7 @@
* <td>Go up one focus traversal cycle</td>
* <td>none</td>
* </tr>
+ * </tbody>
* </table>
*
* To disable a traversal key, use an empty Set; Collections.EMPTY_SET is
--- a/jdk/src/java.desktop/share/classes/java/awt/Container.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -3064,12 +3064,17 @@
* recommendations for Windows and Unix are listed below. These
* recommendations are used in the Sun AWT implementations.
*
- * <table border=1 summary="Recommended default values for a Container's focus traversal keys">
+ * <table class="striped">
+ * <caption>Recommended default values for a Container's focus traversal
+ * keys</caption>
+ * <thead>
* <tr>
* <th>Identifier</th>
* <th>Meaning</th>
* <th>Default</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS</td>
* <td>Normal forward keyboard traversal</td>
@@ -3086,10 +3091,11 @@
* <td>none</td>
* </tr>
* <tr>
- * <td>KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS<td>
+ * <td>KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS</td>
* <td>Go down one focus traversal cycle</td>
* <td>none</td>
* </tr>
+ * </tbody>
* </table>
*
* To disable a traversal key, use an empty Set; Collections.EMPTY_SET is
--- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -668,12 +668,16 @@
* dispatched depends upon the type of the event and the
* type of the event's source object:
*
- * <table border=1 summary="Event types, source types, and dispatch methods">
+ * <table class="striped">
+ * <caption>Event types, source types, and dispatch methods</caption>
+ * <thead>
* <tr>
* <th>Event Type</th>
* <th>Source Type</th>
* <th>Dispatched To</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>ActiveEvent</td>
* <td>Any</td>
@@ -694,6 +698,7 @@
* <td>Other</td>
* <td>No action (ignored)</td>
* </tr>
+ * </tbody>
* </table>
*
* @param event an instance of {@code java.awt.AWTEvent},
--- a/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java Thu Aug 24 16:24:44 2017 +0200
@@ -122,13 +122,16 @@
* are not. Baseline relative values are calculated relative to the
* baseline. Valid values are:
*
- * <center><table BORDER=0 style="width:800"
- * SUMMARY="absolute, relative and baseline values as described above">
+ * <table class="striped" style="margin: 0px auto">
+ * <caption>Absolute, relative and baseline values as described above</caption>
+ * <thead>
* <tr>
- * <th><P style="text-align:left">Absolute Values</th>
- * <th><P style="text-align:left">Orientation Relative Values</th>
- * <th><P style="text-align:left">Baseline Relative Values</th>
+ * <th><p style="text-align:center">Absolute Values</th>
+ * <th><p style="text-align:center">Orientation Relative Values</th>
+ * <th><p style="text-align:center">Baseline Relative Values</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>
* <ul style="list-style-type:none">
@@ -169,7 +172,8 @@
* </ul>
* </td>
* </tr>
- * </table></center>
+ * </tbody>
+ * </table>
* <dt>{@link GridBagConstraints#weightx},
* {@link GridBagConstraints#weighty}
* <dd>Used to determine how to distribute space, which is
@@ -197,13 +201,14 @@
* <p>
* The following figure shows a baseline layout and includes a
* component that spans rows:
- * <center><table summary="Baseline Layout">
+ * <table class="borderless" style="margin: 0px auto">
+ * <caption>Baseline Layout</caption>
* <tr style="text-align:center">
* <td>
* <img src="doc-files/GridBagLayout-baseline.png"
* alt="The following text describes this graphic (Figure 1)." style="float:center">
* </td>
- * </table></center>
+ * </table>
* This layout consists of three components:
* <ul><li>A panel that starts in row 0 and ends in row 1. The panel
* has a baseline-resize behavior of {@code CONSTANT_DESCENT} and has
@@ -252,7 +257,8 @@
* left-to-right container and Figure 3 shows the layout for a horizontal,
* right-to-left container.
*
- * <center><table style="width:600" summary="layout">
+ * <table class="borderless" style="margin: 0px auto">
+ * <caption style="width:600;display:none">Figures</caption>
* <tr style="text-align:center">
* <td>
* <img src="doc-files/GridBagLayout-1.gif" alt="The preceding text describes this graphic (Figure 1)." style="float:center; margin: 7px 10px;">
@@ -264,7 +270,7 @@
* <td>Figure 2: Horizontal, Left-to-Right</td>
* <td>Figure 3: Horizontal, Right-to-Left</td>
* </tr>
- * </table></center>
+ * </table>
* <p>
* Each of the ten components has the {@code fill} field
* of its associated {@code GridBagConstraints} object
--- a/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java Thu Aug 24 16:24:44 2017 +0200
@@ -55,7 +55,8 @@
* If the container's {@code ComponentOrientation} property is horizontal
* and right-to-left, the example produces the output shown in Figure 2.
*
- * <table style="float:center;width:600" summary="layout">
+ * <table style="float:center;width:600">
+ * <caption style="display:none">Figures</caption>
* <tr style="text-align:center">
* <td><img SRC="doc-files/GridLayout-1.gif"
* alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 1 then 2.
--- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1039,12 +1039,16 @@
* recommendations for Windows and Unix are listed below. These
* recommendations are used in the Sun AWT implementations.
*
- * <table border=1 summary="Recommended default values for focus traversal keys">
+ * <table class="striped">
+ * <caption>Recommended default values for focus traversal keys</caption>
+ * <thead>
* <tr>
* <th>Identifier</th>
* <th>Meaning</th>
* <th>Default</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>{@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}</td>
* <td>Normal forward keyboard traversal</td>
@@ -1067,6 +1071,7 @@
* <td>Go down one focus traversal cycle</td>
* <td>none</td>
* </tr>
+ * </tbody>
* </table>
*
* To disable a traversal key, use an empty {@code Set};
--- a/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -296,12 +296,16 @@
* The default properties of the scroll bar are listed in
* the following table:
*
- * <table border=1 summary="Scrollbar default properties">
+ * <table class="striped">
+ * <caption>Scrollbar default properties</caption>
+ * <thead>
* <tr>
* <th>Property</th>
* <th>Description</th>
* <th>Default Value</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>orientation</td>
* <td>indicates whether the scroll bar is vertical
@@ -347,6 +351,7 @@
* <br>on either side of the bubble </td>
* <td>10</td>
* </tr>
+ * </tbody>
* </table>
*
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
--- a/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java Thu Aug 24 16:24:44 2017 +0200
@@ -368,11 +368,15 @@
* Adds a {@code PropertyChangeListener} to the list of listeners for the
* specific property. The following properties are currently supported:
*
- * <table border=1 summary="SystemTray properties">
+ * <table class="striped">
+ * <caption>SystemTray properties</caption>
+ * <thead>
* <tr>
* <th>Property</th>
* <th>Description</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>{@code trayIcons}</td>
* <td>The {@code SystemTray}'s array of {@code TrayIcon} objects.
@@ -389,6 +393,7 @@
* when the system tray becomes available or unavailable on the desktop.<br>
* The property is accessed by the {@link #getSystemTray} method.</td>
* </tr>
+ * </tbody>
* </table>
* <p>
* The {@code listener} listens to property changes only in this context.
--- a/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -106,12 +106,16 @@
* multiple decimal digits sets are specified for the same Unicode
* range, one of the sets will take precedence as follows.
*
- * <table border=1 cellspacing=3 cellpadding=0 summary="NumericShaper constants precedence.">
+ * <table class="plain">
+ * <caption>NumericShaper constants precedence</caption>
+ * <thead>
* <tr>
* <th class="TableHeadingColor">Unicode Range</th>
* <th class="TableHeadingColor">{@code NumericShaper} Constants</th>
* <th class="TableHeadingColor">Precedence</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td rowspan="2">Arabic</td>
* <td>{@link NumericShaper#ARABIC NumericShaper.ARABIC}<br>
@@ -123,12 +127,15 @@
* {@link NumericShaper.Range#EASTERN_ARABIC}</td>
* <td>{@link NumericShaper.Range#EASTERN_ARABIC}</td>
* </tr>
+ * </tbody>
+ * <tbody>
* <tr>
* <td>Tai Tham</td>
* <td>{@link NumericShaper.Range#TAI_THAM_HORA}<br>
* {@link NumericShaper.Range#TAI_THAM_THAM}</td>
* <td>{@link NumericShaper.Range#TAI_THAM_THAM}</td>
* </tr>
+ * </tbody>
* </table>
*
* @since 1.4
--- a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java Thu Aug 24 16:24:44 2017 +0200
@@ -96,15 +96,18 @@
* </UL>
*
* <h4>Summary of attributes</h4>
- * <table style="float:center;width:95%" border="0" cellspacing="0" cellpadding="2"
- * summary="Key, value type, principal constants, and default value
- * behavior of all TextAttributes">
- * <tr style="background-color:#ccccff">
+ * <table style="float:center;width:95%" class="striped">
+ * <caption>Key, value type, principal constants, and
+ * default value behavior of all TextAttributes</caption>
+ * <thead>
+ * <tr>
* <th valign="TOP" style="text-align:center">Key</th>
* <th valign="TOP" style="text-align:center">Value Type</th>
* <th valign="TOP" style="text-align:center">Principal Constants</th>
* <th valign="TOP" style="text-align:center">Default Value</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td valign="TOP">{@link #FAMILY}</td>
* <td valign="TOP">String</td>
@@ -114,7 +117,7 @@
* </td>
* <td valign="TOP">"Default" (use platform default)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #WEIGHT}</td>
* <td valign="TOP">Number</td>
* <td valign="TOP">WEIGHT_REGULAR, WEIGHT_BOLD</td>
@@ -126,7 +129,7 @@
* <td valign="TOP">WIDTH_CONDENSED, WIDTH_REGULAR,<br>WIDTH_EXTENDED</td>
* <td valign="TOP">WIDTH_REGULAR</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #POSTURE}</td>
* <td valign="TOP">Number</td>
* <td valign="TOP">POSTURE_REGULAR, POSTURE_OBLIQUE</td>
@@ -138,7 +141,7 @@
* <td valign="TOP">none</td>
* <td valign="TOP">12.0</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #TRANSFORM}</td>
* <td valign="TOP">{@link TransformAttribute}</td>
* <td valign="TOP">See TransformAttribute {@link TransformAttribute#IDENTITY IDENTITY}</td>
@@ -150,7 +153,7 @@
* <td valign="TOP">SUPERSCRIPT_SUPER, SUPERSCRIPT_SUB</td>
* <td valign="TOP">0 (use the standard glyphs and metrics)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #FONT}</td>
* <td valign="TOP">{@link java.awt.Font}</td>
* <td valign="TOP">none</td>
@@ -162,7 +165,7 @@
* <td valign="TOP">none</td>
* <td valign="TOP">null (draw text using font glyphs)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #FOREGROUND}</td>
* <td valign="TOP">{@link java.awt.Paint}</td>
* <td valign="TOP">none</td>
@@ -174,7 +177,7 @@
* <td valign="TOP">none</td>
* <td valign="TOP">null (do not render background)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #UNDERLINE}</td>
* <td valign="TOP">Integer</td>
* <td valign="TOP">UNDERLINE_ON</td>
@@ -186,7 +189,7 @@
* <td valign="TOP">STRIKETHROUGH_ON</td>
* <td valign="TOP">false (do not render strikethrough)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #RUN_DIRECTION}</td>
* <td valign="TOP">Boolean</td>
* <td valign="TOP">RUN_DIRECTION_LTR<br>RUN_DIRECTION_RTL</td>
@@ -198,7 +201,7 @@
* <td valign="TOP">none</td>
* <td valign="TOP">0 (use base line direction)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #JUSTIFICATION}</td>
* <td valign="TOP">Number</td>
* <td valign="TOP">JUSTIFICATION_FULL</td>
@@ -210,7 +213,7 @@
* <td valign="TOP">(see class)</td>
* <td valign="TOP">null (do not apply input highlighting)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #INPUT_METHOD_UNDERLINE}</td>
* <td valign="TOP">Integer</td>
* <td valign="TOP">UNDERLINE_LOW_ONE_PIXEL,<br>UNDERLINE_LOW_TWO_PIXEL</td>
@@ -222,7 +225,7 @@
* <td valign="TOP">SWAP_COLORS_ON</td>
* <td valign="TOP">false (do not swap colors)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #NUMERIC_SHAPING}</td>
* <td valign="TOP">{@link java.awt.font.NumericShaper}</td>
* <td valign="TOP">none</td>
@@ -234,7 +237,7 @@
* <td valign="TOP">KERNING_ON</td>
* <td valign="TOP">0 (do not request kerning)</td>
* </tr>
- * <tr style="background-color:#eeeeff">
+ * <tr>
* <td valign="TOP">{@link #LIGATURES}</td>
* <td valign="TOP">Integer</td>
* <td valign="TOP">LIGATURES_ON</td>
@@ -246,6 +249,7 @@
* <td valign="TOP">TRACKING_LOOSE, TRACKING_TIGHT</td>
* <td valign="TOP">0 (do not add tracking)</td>
* </tr>
+ * </tbody>
* </table>
*
* @see java.awt.Font
--- a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java Thu Aug 24 16:24:44 2017 +0200
@@ -876,13 +876,18 @@
* <p>
* The following byte value constants are used in the serialized form
* of {@code Path2D} objects:
- * <table>
+ *
+ * <table class="striped">
+ * <caption>Constants</caption>
+ * <thead>
* <tr>
* <th>Constant Name</th>
* <th>Byte Value</th>
* <th>Followed by</th>
* <th>Description</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>{@code SERIAL_STORAGE_FLT_ARRAY}</td>
* <td>0x30</td>
@@ -956,6 +961,7 @@
* <td>0x61</td>
* <td></td>
* <td>There are no more path segments following.</td>
+ * </tbody>
* </table>
*
* @since 1.6
@@ -1635,13 +1641,17 @@
* <p>
* The following byte value constants are used in the serialized form
* of {@code Path2D} objects:
- * <table>
+ * <table class="striped">
+ * <caption>Constants</caption>
+ * <thead>
* <tr>
* <th>Constant Name</th>
* <th>Byte Value</th>
* <th>Followed by</th>
* <th>Description</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>{@code SERIAL_STORAGE_FLT_ARRAY}</td>
* <td>0x30</td>
@@ -1715,6 +1725,7 @@
* <td>0x61</td>
* <td></td>
* <td>There are no more path segments following.</td>
+ * </tbody>
* </table>
*
* @since 1.6
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -22,25 +22,26 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package javax.accessibility;
/**
* Service Provider Interface (SPI) for Assistive Technology.
* <p>
- * This service provider class provides mappings from the platform
- * specific accessibility APIs to the Java Accessibility API.
+ * This service provider class provides mappings from the platform specific
+ * accessibility APIs to the Java Accessibility API.
* <p>
* Each service provider implementation is named and can be activated via the
* {@link #activate} method. Service providers can be loaded when the default
* {@link java.awt.Toolkit toolkit} is initialized.
*
* @apiNote There will typically be one provider per platform, such as Windows
- * or Linux, to support accessibility for screen readers and magnifiers. However,
- * more than one service provider can be activated. For example, a test tool
- * which provides visual results obtained by interrogating the Java Accessibility
- * API can be activated along with the activation of the support for screen readers
- * and screen magnifiers.
- *
+ * or Linux, to support accessibility for screen readers and
+ * magnifiers. However, more than one service provider can be
+ * activated. For example, a test tool which provides visual results
+ * obtained by interrogating the Java Accessibility API can be
+ * activated along with the activation of the support for screen
+ * readers and screen magnifiers.
* @see java.awt.Toolkit#getDefaultToolkit
* @see java.util.ServiceLoader
* @since 9
@@ -50,25 +51,34 @@
/**
* Initializes a new accessibility provider.
*
- * @throws SecurityException
- * If a security manager has been installed and it denies
- * {@link RuntimePermission} {@code "accessibilityProvider"}
+ * @throws SecurityException If a security manager has been installed and it
+ * denies {@link RuntimePermission} {@code "accessibilityProvider"}
*/
protected AccessibilityProvider() {
- // Use a permission check when calling a private constructor to check that
- // the proper security permission has been granted before the Object superclass
- // is called. If an exception is thrown before the Object superclass is
- // constructed a finalizer in a subclass of this class will not be run.
- // This protects against a finalizer vulnerability.
+ // Use a permission check when calling a private constructor to check
+ // that the proper security permission has been granted before the
+ // {@code Object} superclass is called. If an exception is thrown before
+ // the {@code Object} superclass is constructed a finalizer in a
+ // subclass of this class will not be run. This protects against a
+ // finalizer vulnerability.
this(checkPermission());
}
+ /**
+ * Allows to check a permission before the {@code Object} is called.
+ *
+ * @param ignore unused stub to call a {@link #checkPermission()}}
+ */
private AccessibilityProvider(Void ignore) { }
/**
* If this code is running with a security manager and if the permission
- * "accessibilityProvider" has not been granted SecurityException will be thrown.
+ * {@code "accessibilityProvider"} has not been granted
+ * {@code SecurityException} will be thrown.
*
+ * @return {@code null} if {@code SecurityException} was not thrown
+ * @throws SecurityException If a security manager has been installed and it
+ * denies {@link RuntimePermission} {@code "accessibilityProvider"}
*/
private static Void checkPermission() {
SecurityManager sm = System.getSecurityManager();
@@ -78,7 +88,7 @@
}
/**
- * Returns the name of this service provider. This name is used to locate a
+ * Returns the name of this service provider. This name is used to locate a
* requested service provider.
*
* @return the name of this service provider
@@ -89,5 +99,4 @@
* Activates the support provided by this service provider.
*/
public abstract void activate();
-
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/Accessible.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/Accessible.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,26 +26,26 @@
package javax.accessibility;
/**
- * Interface Accessible is the main interface for the accessibility package.
- * All components that support
- * the accessibility package must implement this interface.
- * It contains a single method, {@link #getAccessibleContext}, which
- * returns an instance of the class {@link AccessibleContext}.
+ * Interface {@code Accessible} is the main interface for the accessibility
+ * package. All components that support the accessibility package must implement
+ * this interface. It contains a single method, {@link #getAccessibleContext},
+ * which returns an instance of the class {@link AccessibleContext}.
*
- * @author Peter Korn
- * @author Hans Muller
- * @author Willie Walker
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
*/
public interface Accessible {
/**
- * Returns the AccessibleContext associated with this object. In most
- * cases, the return value should not be null if the object implements
- * interface Accessible. If a component developer creates a subclass
- * of an object that implements Accessible, and that subclass
- * is not Accessible, the developer should override the
- * getAccessibleContext method to return null.
- * @return the AccessibleContext associated with this object
+ * Returns the {@code AccessibleContext} associated with this object. In
+ * most cases, the return value should not be {@code null} if the object
+ * implements interface {@code Accessible}. If a component developer creates
+ * a subclass of an object that implements {@code Accessible}, and that
+ * subclass is not {@code Accessible}, the developer should override the
+ * {@code getAccessibleContext} method to return {@code null}.
+ *
+ * @return the {@code AccessibleContext} associated with this object
*/
public AccessibleContext getAccessibleContext();
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleAction.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleAction.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,31 +26,31 @@
package javax.accessibility;
/**
- * The AccessibleAction interface should be supported by any object
- * that can perform one or more actions. This interface
- * provides the standard mechanism for an assistive technology to determine
- * what those actions are as well as tell the object to perform them.
- * Any object that can be manipulated should support this
- * interface. Applications can determine if an object supports the
- * AccessibleAction interface by first obtaining its AccessibleContext (see
- * {@link Accessible}) and then calling the {@link AccessibleContext#getAccessibleAction}
- * method. If the return value is not null, the object supports this interface.
+ * The {@code AccessibleAction} interface should be supported by any object that
+ * can perform one or more actions. This interface provides the standard
+ * mechanism for an assistive technology to determine what those actions are as
+ * well as tell the object to perform them. Any object that can be manipulated
+ * should support this interface. Applications can determine if an object
+ * supports the {@code AccessibleAction} interface by first obtaining its
+ * {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleAction} method. If the return value is
+ * not {@code null}, the object supports this interface.
*
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
+ * @author Lynn Monsanto
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleAction
- *
- * @author Peter Korn
- * @author Hans Muller
- * @author Willie Walker
- * @author Lynn Monsanto
*/
public interface AccessibleAction {
/**
- * An action which causes a tree node to
- * collapse if expanded and expand if collapsed.
+ * An action which causes a tree node to collapse if expanded and expand if
+ * collapsed.
+ *
* @since 1.5
*/
public static final String TOGGLE_EXPAND =
@@ -58,6 +58,7 @@
/**
* An action which increments a value.
+ *
* @since 1.5
*/
public static final String INCREMENT =
@@ -66,6 +67,7 @@
/**
* An action which decrements a value.
+ *
* @since 1.5
*/
public static final String DECREMENT =
@@ -73,6 +75,7 @@
/**
* An action which causes a component to execute its default action.
+ *
* @since 1.6
*/
public static final String CLICK = new String("click");
@@ -80,33 +83,34 @@
/**
* An action which causes a popup to become visible if it is hidden and
* hidden if it is visible.
+ *
* @since 1.6
*/
public static final String TOGGLE_POPUP = new String("toggle popup");
/**
- * Returns the number of accessible actions available in this object
- * If there are more than one, the first one is considered the "default"
- * action of the object.
+ * Returns the number of accessible actions available in this object If
+ * there are more than one, the first one is considered the "default" action
+ * of the object.
*
- * @return the zero-based number of Actions in this object
+ * @return the zero-based number of actions in this object
*/
public int getAccessibleActionCount();
/**
* Returns a description of the specified action of the object.
*
- * @param i zero-based index of the actions
- * @return a String description of the action
+ * @param i zero-based index of the actions
+ * @return a {@code String} description of the action
* @see #getAccessibleActionCount
*/
public String getAccessibleActionDescription(int i);
/**
- * Performs the specified Action on the object
+ * Performs the specified action on the object.
*
- * @param i zero-based index of actions
- * @return true if the action was performed; otherwise false.
+ * @param i zero-based index of actions
+ * @return {@code true} if the action was performed; otherwise {@code false}
* @see #getAccessibleActionCount
*/
public boolean doAccessibleAction(int i);
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleAttributeSequence.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleAttributeSequence.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, 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
@@ -22,51 +22,44 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package javax.accessibility;
import javax.swing.text.AttributeSet;
-
/**
- * <P>The AccessibleAttributeSequence provides information about
- * a contiguous sequence of text attributes
- *
- * @see Accessible
- * @see Accessible#getAccessibleContext
- * @see AccessibleContext
- * @see AccessibleContext#getAccessibleText
- * @see AccessibleTextSequence
+ * This class collects together the span of text that share the same contiguous
+ * set of attributes, along with that set of attributes. It is used by
+ * implementors of the class {@code AccessibleContext} in order to generate
+ * {@code ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED} events.
*
- * @author Lynn Monsanto
- */
-
-/**
- * This class collects together the span of text that share the same
- * contiguous set of attributes, along with that set of attributes. It
- * is used by implementors of the class {@code AccessibleContext} in
- * order to generate {@code ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED} events.
- *
- * @see javax.accessibility.AccessibleContext
- * @see javax.accessibility.AccessibleContext#ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED
+ * @see AccessibleContext
+ * @see AccessibleContext#ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED
*/
public class AccessibleAttributeSequence {
- /** The start index of the text sequence */
+
+ /**
+ * The start index of the text sequence.
+ */
public int startIndex;
- /** The end index of the text sequence */
+ /**
+ * The end index of the text sequence.
+ */
public int endIndex;
- /** The text attributes */
+ /**
+ * The text attributes.
+ */
public AttributeSet attributes;
/**
* Constructs an {@code AccessibleAttributeSequence} with the given
* parameters.
*
- * @param start the beginning index of the span of text
- * @param end the ending index of the span of text
- * @param attr the {@code AttributeSet} shared by this text span
- *
+ * @param start the beginning index of the span of text
+ * @param end the ending index of the span of text
+ * @param attr the {@code AttributeSet} shared by this text span
* @since 1.6
*/
public AccessibleAttributeSequence(int start, int end, AttributeSet attr) {
@@ -74,5 +67,4 @@
endIndex = end;
attributes = attr;
}
-
};
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,30 +27,31 @@
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Vector;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+
import sun.awt.AWTAccessor;
/**
- * <p>Base class used to maintain a strongly typed enumeration. This is
- * the superclass of {@link AccessibleState} and {@link AccessibleRole}.
- * <p>The toDisplayString method allows you to obtain the localized string
- * for a locale independent key from a predefined ResourceBundle for the
- * keys defined in this class. This localized string is intended to be
+ * Base class used to maintain a strongly typed enumeration. This is the
+ * superclass of {@link AccessibleState} and {@link AccessibleRole}.
+ * <p>
+ * The {@link #toDisplayString()} method allows you to obtain the localized
+ * string for a locale independent key from a predefined {@code ResourceBundle}
+ * for the keys defined in this class. This localized string is intended to be
* readable by humans.
*
+ * @author Willie Walker
+ * @author Peter Korn
+ * @author Lynn Monsanto
* @see AccessibleRole
* @see AccessibleState
- *
- * @author Willie Walker
- * @author Peter Korn
- * @author Lynn Monsanto
*/
public abstract class AccessibleBundle {
private static Hashtable<Locale, Hashtable<String, Object>> table = new Hashtable<>();
+
private final String defaultResourceBundleName
= "com.sun.accessibility.internal.resources.accessibility";
@@ -72,23 +73,24 @@
}
/**
- * The locale independent name of the state. This is a programmatic
- * name that is not intended to be read by humans.
+ * The locale independent name of the state. This is a programmatic name
+ * that is not intended to be read by humans.
+ *
* @see #toDisplayString
*/
protected String key = null;
/**
- * Obtains the key as a localized string.
- * If a localized string cannot be found for the key, the
- * locale independent key stored in the role will be returned.
- * This method is intended to be used only by subclasses so that they
- * can specify their own resource bundles which contain localized
+ * Obtains the key as a localized string. If a localized string cannot be
+ * found for the key, the locale independent key stored in the role will be
+ * returned. This method is intended to be used only by subclasses so that
+ * they can specify their own resource bundles which contain localized
* strings for their keys.
- * @param resourceBundleName the name of the resource bundle to use for
- * lookup
- * @param locale the locale for which to obtain a localized string
- * @return a localized String for the key.
+ *
+ * @param resourceBundleName the name of the resource bundle to use for
+ * lookup
+ * @param locale the locale for which to obtain a localized string
+ * @return a localized string for the key
*/
protected String toDisplayString(String resourceBundleName,
Locale locale) {
@@ -108,12 +110,12 @@
}
/**
- * Obtains the key as a localized string.
- * If a localized string cannot be found for the key, the
- * locale independent key stored in the role will be returned.
+ * Obtains the key as a localized string. If a localized string cannot be
+ * found for the key, the locale independent key stored in the role will be
+ * returned.
*
- * @param locale the locale for which to obtain a localized string
- * @return a localized String for the key.
+ * @param locale the locale for which to obtain a localized string
+ * @return a localized string for the key
*/
public String toDisplayString(Locale locale) {
return toDisplayString(defaultResourceBundleName, locale);
@@ -121,7 +123,8 @@
/**
* Gets localized string describing the key using the default locale.
- * @return a localized String describing the key for the default locale
+ *
+ * @return a localized string describing the key using the default locale
*/
public String toDisplayString() {
return toDisplayString(Locale.getDefault());
@@ -129,14 +132,15 @@
/**
* Gets localized string describing the key using the default locale.
- * @return a localized String describing the key using the default locale
+ *
+ * @return a localized string describing the key using the default locale
* @see #toDisplayString
*/
public String toString() {
return toDisplayString();
}
- /*
+ /**
* Loads the Accessibility resource bundle if necessary.
*/
private void loadResourceBundle(String resourceBundleName,
@@ -164,5 +168,4 @@
}
}
}
-
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleComponent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleComponent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,36 +25,40 @@
package javax.accessibility;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.FocusListener;
/**
- * The AccessibleComponent interface should be supported by any object
- * that is rendered on the screen. This interface provides the standard
- * mechanism for an assistive technology to determine and set the
- * graphical representation of an object. Applications can determine
- * if an object supports the AccessibleComponent interface by first
- * obtaining its AccessibleContext
- * and then calling the
- * {@link AccessibleContext#getAccessibleComponent} method.
- * If the return value is not null, the object supports this interface.
+ * The {@code AccessibleComponent} interface should be supported by any object
+ * that is rendered on the screen. This interface provides the standard
+ * mechanism for an assistive technology to determine and set the graphical
+ * representation of an object. Applications can determine if an object supports
+ * the {@code AccessibleComponent} interface by first obtaining its
+ * {@code AccessibleContext} and then calling the
+ * {@link AccessibleContext#getAccessibleComponent} method. If the return value
+ * is not {@code null}, the object supports this interface.
*
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleComponent
- *
- * @author Peter Korn
- * @author Hans Muller
- * @author Willie Walker
*/
public interface AccessibleComponent {
/**
* Gets the background color of this object.
*
- * @return the background color, if supported, of the object;
- * otherwise, null
+ * @return the background color, if supported, of the object; otherwise,
+ * {@code null}
* @see #setBackground
*/
public Color getBackground();
@@ -62,7 +66,7 @@
/**
* Sets the background color of this object.
*
- * @param c the new Color for the background
+ * @param c the new color for the background
* @see #setBackground
*/
public void setBackground(Color c);
@@ -70,8 +74,8 @@
/**
* Gets the foreground color of this object.
*
- * @return the foreground color, if supported, of the object;
- * otherwise, null
+ * @return the foreground color, if supported, of the object; otherwise,
+ * {@code null}
* @see #setForeground
*/
public Color getForeground();
@@ -79,58 +83,59 @@
/**
* Sets the foreground color of this object.
*
- * @param c the new Color for the foreground
+ * @param c the new color for the foreground
* @see #getForeground
*/
public void setForeground(Color c);
/**
- * Gets the Cursor of this object.
+ * Gets the cursor of this object.
*
- * @return the Cursor, if supported, of the object; otherwise, null
+ * @return the cursor, if supported, of the object; otherwise, {@code null}
* @see #setCursor
*/
public Cursor getCursor();
/**
- * Sets the Cursor of this object.
+ * Sets the cursor of this object.
*
- * @param cursor the new Cursor for the object
+ * @param cursor the new cursor for the object
* @see #getCursor
*/
public void setCursor(Cursor cursor);
/**
- * Gets the Font of this object.
+ * Gets the font of this object.
*
- * @return the Font,if supported, for the object; otherwise, null
+ * @return the font, if supported, for the object; otherwise, {@code null}
* @see #setFont
*/
public Font getFont();
/**
- * Sets the Font of this object.
+ * Sets the font of this object.
*
- * @param f the new Font for the object
+ * @param f the new font for the object
* @see #getFont
*/
public void setFont(Font f);
/**
- * Gets the FontMetrics of this object.
+ * Gets the {@code FontMetrics} of this object.
*
- * @param f the Font
- * @return the FontMetrics, if supported, the object; otherwise, null
+ * @param f the font for which font metrics is to be obtained
+ * @return the {@code FontMetrics}, if supported, the object; otherwise,
+ * {@code null}
* @see #getFont
*/
public FontMetrics getFontMetrics(Font f);
/**
- * Determines if the object is enabled. Objects that are enabled
- * will also have the AccessibleState.ENABLED state set in their
- * AccessibleStateSets.
+ * Determines if the object is enabled. Objects that are enabled will also
+ * have the {@code AccessibleState.ENABLED} state set in their
+ * {@code AccessibleStateSets}.
*
- * @return true if object is enabled; otherwise, false
+ * @return {@code true} if object is enabled; otherwise, {@code false}
* @see #setEnabled
* @see AccessibleContext#getAccessibleStateSet
* @see AccessibleState#ENABLED
@@ -141,21 +146,23 @@
/**
* Sets the enabled state of the object.
*
- * @param b if true, enables this object; otherwise, disables it
+ * @param b if {@code true}, enables this object; otherwise, disables it
* @see #isEnabled
*/
public void setEnabled(boolean b);
/**
- * Determines if the object is visible. Note: this means that the
- * object intends to be visible; however, it may not be
- * showing on the screen because one of the objects that this object
- * is contained by is currently not visible. To determine if an object is
- * showing on the screen, use isShowing().
- * <p>Objects that are visible will also have the
- * AccessibleState.VISIBLE state set in their AccessibleStateSets.
+ * Determines if the object is visible. Note: this means that the object
+ * intends to be visible; however, it may not be showing on the screen
+ * because one of the objects that this object is contained by is currently
+ * not visible. To determine if an object is showing on the screen, use
+ * {@link #isShowing()}
+ * <p>
+ * Objects that are visible will also have the
+ * {@code AccessibleState.VISIBLE} state set in their
+ * {@code AccessibleStateSets}.
*
- * @return true if object is visible; otherwise, false
+ * @return {@code true} if object is visible; otherwise, {@code false}
* @see #setVisible
* @see AccessibleContext#getAccessibleStateSet
* @see AccessibleState#VISIBLE
@@ -166,29 +173,28 @@
/**
* Sets the visible state of the object.
*
- * @param b if true, shows this object; otherwise, hides it
+ * @param b if {@code true}, shows this object; otherwise, hides it
* @see #isVisible
*/
public void setVisible(boolean b);
/**
- * Determines if the object is showing. This is determined by checking
- * the visibility of the object and its ancestors.
- * Note: this
- * will return true even if the object is obscured by another (for example,
- * it is underneath a menu that was pulled down).
+ * Determines if the object is showing. This is determined by checking the
+ * visibility of the object and its ancestors. Note: this will return
+ * {@code true} even if the object is obscured by another (for example, it
+ * is underneath a menu that was pulled down).
*
- * @return true if object is showing; otherwise, false
+ * @return {@code true} if object is showing; otherwise, {@code false}
*/
public boolean isShowing();
/**
- * Checks whether the specified point is within this object's bounds,
- * where the point's x and y coordinates are defined to be relative to the
+ * Checks whether the specified point is within this object's bounds, where
+ * the point's x and y coordinates are defined to be relative to the
* coordinate system of the object.
*
- * @param p the Point relative to the coordinate system of the object
- * @return true if object contains Point; otherwise false
+ * @param p the point relative to the coordinate system of the object
+ * @return {@code true} if object contains point; otherwise {@code false}
* @see #getBounds
*/
public boolean contains(Point p);
@@ -196,21 +202,21 @@
/**
* Returns the location of the object on the screen.
*
- * @return the location of the object on screen; null if this object
- * is not on the screen
+ * @return the location of the object on screen; {@code null} if this object
+ * is not on the screen
* @see #getBounds
* @see #getLocation
*/
public Point getLocationOnScreen();
/**
- * Gets the location of the object relative to the parent in the form
- * of a point specifying the object's top-left corner in the screen's
- * coordinate space.
+ * Gets the location of the object relative to the parent in the form of a
+ * point specifying the object's top-left corner in the screen's coordinate
+ * space.
*
- * @return An instance of Point representing the top-left corner of the
- * object's bounds in the coordinate space of the screen; null if
- * this object or its parent are not on the screen
+ * @return An instance of {@code Point} representing the top-left corner of
+ * the object's bounds in the coordinate space of the screen;
+ * {@code null} if this object or its parent are not on the screen
* @see #getBounds
* @see #getLocationOnScreen
*/
@@ -218,40 +224,41 @@
/**
* Sets the location of the object relative to the parent.
- * @param p the new position for the top-left corner
+ *
+ * @param p the new position for the top-left corner
* @see #getLocation
*/
public void setLocation(Point p);
/**
- * Gets the bounds of this object in the form of a Rectangle object.
- * The bounds specify this object's width, height, and location
- * relative to its parent.
+ * Gets the bounds of this object in the form of a {@code Rectangle} object.
+ * The bounds specify this object's width, height, and location relative to
+ * its parent.
*
- * @return A rectangle indicating this component's bounds; null if
- * this object is not on the screen.
+ * @return A rectangle indicating this component's bounds; {@code null} if
+ * this object is not on the screen.
* @see #contains
*/
public Rectangle getBounds();
/**
- * Sets the bounds of this object in the form of a Rectangle object.
- * The bounds specify this object's width, height, and location
- * relative to its parent.
+ * Sets the bounds of this object in the form of a {@code Rectangle} object.
+ * The bounds specify this object's width, height, and location relative to
+ * its parent.
*
- * @param r rectangle indicating this component's bounds
+ * @param r rectangle indicating this component's bounds
* @see #getBounds
*/
public void setBounds(Rectangle r);
/**
- * Returns the size of this object in the form of a Dimension object.
- * The height field of the Dimension object contains this object's
- * height, and the width field of the Dimension object contains this
- * object's width.
+ * Returns the size of this object in the form of a {@code Dimension}
+ * object. The {@code height} field of the {@code Dimension} object contains
+ * this object's height, and the {@code width} field of the
+ * {@code Dimension} object contains this object's width.
*
- * @return A Dimension object that indicates the size of this component;
- * null if this object is not on the screen
+ * @return A {@code Dimension} object that indicates the size of this
+ * component; {@code null} if this object is not on the screen
* @see #setSize
*/
public Dimension getSize();
@@ -259,27 +266,27 @@
/**
* Resizes this object so that it has width and height.
*
- * @param d The dimension specifying the new size of the object.
+ * @param d The dimension specifying the new size of the object
* @see #getSize
*/
public void setSize(Dimension d);
/**
- * Returns the Accessible child, if one exists, contained at the local
- * coordinate Point.
+ * Returns the {@code Accessible} child, if one exists, contained at the
+ * local coordinate {@code Point}.
*
- * @param p The point relative to the coordinate system of this object.
- * @return the Accessible, if it exists, at the specified location;
- * otherwise null
+ * @param p The point relative to the coordinate system of this object
+ * @return the {@code Accessible}, if it exists, at the specified location;
+ * otherwise {@code null}
*/
public Accessible getAccessibleAt(Point p);
/**
- * Returns whether this object can accept focus or not. Objects that
- * can accept focus will also have the AccessibleState.FOCUSABLE state
- * set in their AccessibleStateSets.
+ * Returns whether this object can accept focus or not. Objects that can
+ * accept focus will also have the {@code AccessibleState.FOCUSABLE} state
+ * set in their {@code AccessibleStateSets}.
*
- * @return true if object can accept focus; otherwise false
+ * @return {@code true} if object can accept focus; otherwise {@code false}
* @see AccessibleContext#getAccessibleStateSet
* @see AccessibleState#FOCUSABLE
* @see AccessibleState#FOCUSED
@@ -288,9 +295,9 @@
public boolean isFocusTraversable();
/**
- * Requests focus for this object. If this object cannot accept focus,
- * nothing will happen. Otherwise, the object will attempt to take
- * focus.
+ * Requests focus for this object. If this object cannot accept focus,
+ * nothing will happen. Otherwise, the object will attempt to take focus.
+ *
* @see #isFocusTraversable
*/
public void requestFocus();
@@ -299,7 +306,7 @@
* Adds the specified focus listener to receive focus events from this
* component.
*
- * @param l the focus listener
+ * @param l the focus listener
* @see #removeFocusListener
*/
public void addFocusListener(FocusListener l);
@@ -308,7 +315,7 @@
* Removes the specified focus listener so it no longer receives focus
* events from this component.
*
- * @param l the focus listener
+ * @param l the focus listener
* @see #addFocusListener
*/
public void removeFocusListener(FocusListener l);
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,63 +25,63 @@
package javax.accessibility;
+import java.awt.IllegalComponentStateException;
+import java.beans.BeanProperty;
+import java.beans.JavaBean;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.Locale;
+
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
-import java.util.Locale;
-import java.beans.JavaBean;
-import java.beans.BeanProperty;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.beans.PropertyChangeEvent;
-import java.awt.IllegalComponentStateException;
-
/**
- * AccessibleContext represents the minimum information all accessible objects
- * return. This information includes the accessible name, description, role,
- * and state of the object, as well as information about its parent and
- * children. AccessibleContext also contains methods for
- * obtaining more specific accessibility information about a component.
- * If the component supports them, these methods will return an object that
- * implements one or more of the following interfaces:
+ * {@code AccessibleContext} represents the minimum information all accessible
+ * objects return. This information includes the accessible name, description,
+ * role, and state of the object, as well as information about its parent and
+ * children. {@code AccessibleContext} also contains methods for obtaining more
+ * specific accessibility information about a component. If the component
+ * supports them, these methods will return an object that implements one or
+ * more of the following interfaces:
* <ul>
- * <li>{@link AccessibleAction} - the object can perform one or more actions.
- * This interface provides the standard mechanism for an assistive
- * technology to determine what those actions are and tell the object
- * to perform them. Any object that can be manipulated should
- * support this interface.
- * <li>{@link AccessibleComponent} - the object has a graphical representation.
- * This interface provides the standard mechanism for an assistive
- * technology to determine and set the graphical representation of the
- * object. Any object that is rendered on the screen should support
- * this interface.
- * <li>{@link AccessibleSelection} - the object allows its children to be
- * selected. This interface provides the standard mechanism for an
- * assistive technology to determine the currently selected children of the object
- * as well as modify its selection set. Any object that has children
- * that can be selected should support this interface.
- * <li>{@link AccessibleText} - the object presents editable textual information
- * on the display. This interface provides the standard mechanism for
- * an assistive technology to access that text via its content, attributes,
- * and spatial location. Any object that contains editable text should
- * support this interface.
- * <li>{@link AccessibleValue} - the object supports a numerical value. This
- * interface provides the standard mechanism for an assistive technology
- * to determine and set the current value of the object, as well as obtain its
- * minimum and maximum values. Any object that supports a numerical value
- * should support this interface.</ul>
+ * <li>{@link AccessibleAction} - the object can perform one or more actions.
+ * This interface provides the standard mechanism for an assistive technology
+ * to determine what those actions are and tell the object to perform them.
+ * Any object that can be manipulated should support this interface.
+ * <li>{@link AccessibleComponent} - the object has a graphical
+ * representation. This interface provides the standard mechanism for an
+ * assistive technology to determine and set the graphical representation of
+ * the object. Any object that is rendered on the screen should support this
+ * interface.
+ * <li>{@link AccessibleSelection} - the object allows its children to be
+ * selected. This interface provides the standard mechanism for an assistive
+ * technology to determine the currently selected children of the object as
+ * well as modify its selection set. Any object that has children that can be
+ * selected should support this interface.
+ * <li>{@link AccessibleText} - the object presents editable textual
+ * information on the display. This interface provides the standard mechanism
+ * for an assistive technology to access that text via its content,
+ * attributes, and spatial location. Any object that contains editable text
+ * should support this interface.
+ * <li>{@link AccessibleValue} - the object supports a numerical value. This
+ * interface provides the standard mechanism for an assistive technology to
+ * determine and set the current value of the object, as well as obtain its
+ * minimum and maximum values. Any object that supports a numerical value
+ * should support this interface.
+ * </ul>
*
- * @author Peter Korn
- * @author Hans Muller
- * @author Willie Walker
- * @author Lynn Monsanto
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
+ * @author Lynn Monsanto
*/
@JavaBean(description = "Minimal information that all accessible objects return")
public abstract class AccessibleContext {
/**
- * The AppContext that should be used to dispatch events for this
- * AccessibleContext
+ * The {@code AppContext} that should be used to dispatch events for this
+ * {@code AccessibleContext}.
*/
private volatile AppContext targetAppContext;
@@ -109,115 +109,118 @@
});
}
- /**
- * Constant used to determine when the accessibleName property has
- * changed. The old value in the PropertyChangeEvent will be the old
- * accessibleName and the new value will be the new accessibleName.
- *
- * @see #getAccessibleName
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_NAME_PROPERTY = "AccessibleName";
-
- /**
- * Constant used to determine when the accessibleDescription property has
- * changed. The old value in the PropertyChangeEvent will be the
- * old accessibleDescription and the new value will be the new
- * accessibleDescription.
- *
- * @see #getAccessibleDescription
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_DESCRIPTION_PROPERTY = "AccessibleDescription";
+ /**
+ * Constant used to determine when the {@link #accessibleName} property has
+ * changed. The old value in the {@code PropertyChangeEvent} will be the old
+ * {@code accessibleName} and the new value will be the new
+ * {@code accessibleName}.
+ *
+ * @see #getAccessibleName
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_NAME_PROPERTY = "AccessibleName";
- /**
- * Constant used to determine when the accessibleStateSet property has
- * changed. The old value will be the old AccessibleState and the new
- * value will be the new AccessibleState in the accessibleStateSet.
- * For example, if a component that supports the vertical and horizontal
- * states changes its orientation from vertical to horizontal, the old
- * value will be AccessibleState.VERTICAL and the new value will be
- * AccessibleState.HORIZONTAL. Please note that either value can also
- * be null. For example, when a component changes from being enabled
- * to disabled, the old value will be AccessibleState.ENABLED
- * and the new value will be null.
- *
- * @see #getAccessibleStateSet
- * @see AccessibleState
- * @see AccessibleStateSet
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_STATE_PROPERTY = "AccessibleState";
-
- /**
- * Constant used to determine when the accessibleValue property has
- * changed. The old value in the PropertyChangeEvent will be a Number
- * representing the old value and the new value will be a Number
- * representing the new value
- *
- * @see #getAccessibleValue
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_VALUE_PROPERTY = "AccessibleValue";
+ /**
+ * Constant used to determine when the {@link #accessibleDescription}
+ * property has changed. The old value in the {@code PropertyChangeEvent}
+ * will be the old {@code accessibleDescription} and the new value will be
+ * the new {@code accessibleDescription}.
+ *
+ * @see #getAccessibleDescription
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_DESCRIPTION_PROPERTY = "AccessibleDescription";
- /**
- * Constant used to determine when the accessibleSelection has changed.
- * The old and new values in the PropertyChangeEvent are currently
- * reserved for future use.
- *
- * @see #getAccessibleSelection
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_SELECTION_PROPERTY = "AccessibleSelection";
-
- /**
- * Constant used to determine when the accessibleText caret has changed.
- * The old value in the PropertyChangeEvent will be an
- * integer representing the old caret position, and the new value will
- * be an integer representing the new/current caret position.
- *
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_CARET_PROPERTY = "AccessibleCaret";
+ /**
+ * Constant used to determine when the {@code accessibleStateSet} property
+ * has changed. The old value will be the old {@code AccessibleState} and
+ * the new value will be the new {@code AccessibleState} in the
+ * {@code accessibleStateSet}. For example, if a component that supports the
+ * vertical and horizontal states changes its orientation from vertical to
+ * horizontal, the old value will be {@code AccessibleState.VERTICAL} and
+ * the new value will be {@code AccessibleState.HORIZONTAL}. Please note
+ * that either value can also be {@code null}. For example, when a component
+ * changes from being enabled to disabled, the old value will be
+ * {@code AccessibleState.ENABLED} and the new value will be {@code null}.
+ *
+ * @see #getAccessibleStateSet
+ * @see AccessibleState
+ * @see AccessibleStateSet
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_STATE_PROPERTY = "AccessibleState";
- /**
- * Constant used to determine when the visual appearance of the object
- * has changed. The old and new values in the PropertyChangeEvent are
- * currently reserved for future use.
- *
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY = "AccessibleVisibleData";
-
- /**
- * Constant used to determine when Accessible children are added/removed
- * from the object. If an Accessible child is being added, the old
- * value will be null and the new value will be the Accessible child. If an
- * Accessible child is being removed, the old value will be the Accessible
- * child, and the new value will be null.
- *
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_CHILD_PROPERTY = "AccessibleChild";
-
- /**
- * Constant used to determine when the active descendant of a component
- * has changed. The active descendant is used for objects such as
- * list, tree, and table, which may have transient children. When the
- * active descendant has changed, the old value of the property change
- * event will be the Accessible representing the previous active child, and
- * the new value will be the Accessible representing the current active
- * child.
- *
- * @see #addPropertyChangeListener
- */
- public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY = "AccessibleActiveDescendant";
+ /**
+ * Constant used to determine when the {@code accessibleValue} property has
+ * changed. The old value in the {@code PropertyChangeEvent} will be a
+ * {@code Number} representing the old value and the new value will be a
+ * {@code Number} representing the new value.
+ *
+ * @see #getAccessibleValue
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_VALUE_PROPERTY = "AccessibleValue";
/**
- * Constant used to indicate that the table caption has changed
- * The old value in the PropertyChangeEvent will be an Accessible
- * representing the previous table caption and the new value will
- * be an Accessible representing the new table caption.
+ * Constant used to determine when the {@code accessibleSelection} has
+ * changed. The old and new values in the {@code PropertyChangeEvent} are
+ * currently reserved for future use.
+ *
+ * @see #getAccessibleSelection
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_SELECTION_PROPERTY = "AccessibleSelection";
+
+ /**
+ * Constant used to determine when the {@code accessibleText} caret has
+ * changed. The old value in the {@code PropertyChangeEvent} will be an
+ * integer representing the old caret position, and the new value will be an
+ * integer representing the new/current caret position.
+ *
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_CARET_PROPERTY = "AccessibleCaret";
+
+ /**
+ * Constant used to determine when the visual appearance of the object has
+ * changed. The old and new values in the {@code PropertyChangeEvent} are
+ * currently reserved for future use.
+ *
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY = "AccessibleVisibleData";
+
+ /**
+ * Constant used to determine when {@code Accessible} children are
+ * added/removed from the object. If an {@code Accessible} child is being
+ * added, the old value will be {@code null} and the new value will be the
+ * {@code Accessible} child. If an {@code Accessible} child is being
+ * removed, the old value will be the {@code Accessible} child, and the new
+ * value will be {@code null}.
+ *
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_CHILD_PROPERTY = "AccessibleChild";
+
+ /**
+ * Constant used to determine when the active descendant of a component has
+ * changed. The active descendant is used for objects such as list, tree,
+ * and table, which may have transient children. When the active descendant
+ * has changed, the old value of the property change event will be the
+ * {@code Accessible} representing the previous active child, and the new
+ * value will be the {@code Accessible} representing the current active
+ * child.
+ *
+ * @see #addPropertyChangeListener
+ */
+ public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY = "AccessibleActiveDescendant";
+
+ /**
+ * Constant used to indicate that the table caption has changed. The old
+ * value in the {@code PropertyChangeEvent} will be an {@code Accessible}
+ * representing the previous table caption and the new value will be an
+ * {@code Accessible} representing the new table caption.
+ *
* @see Accessible
* @see AccessibleTable
*/
@@ -225,10 +228,11 @@
"accessibleTableCaptionChanged";
/**
- * Constant used to indicate that the table summary has changed
- * The old value in the PropertyChangeEvent will be an Accessible
- * representing the previous table summary and the new value will
- * be an Accessible representing the new table summary.
+ * Constant used to indicate that the table summary has changed. The old
+ * value in the {@code PropertyChangeEvent} will be an {@code Accessible}
+ * representing the previous table summary and the new value will be an
+ * {@code Accessible} representing the new table summary.
+ *
* @see Accessible
* @see AccessibleTable
*/
@@ -236,10 +240,11 @@
"accessibleTableSummaryChanged";
/**
- * Constant used to indicate that table data has changed.
- * The old value in the PropertyChangeEvent will be null and the
- * new value will be an AccessibleTableModelChange representing
- * the table change.
+ * Constant used to indicate that table data has changed. The old value in
+ * the {@code PropertyChangeEvent} will be {@code null} and the new value
+ * will be an {@code AccessibleTableModelChange} representing the table
+ * change.
+ *
* @see AccessibleTable
* @see AccessibleTableModelChange
*/
@@ -247,10 +252,11 @@
"accessibleTableModelChanged";
/**
- * Constant used to indicate that the row header has changed
- * The old value in the PropertyChangeEvent will be null and the
- * new value will be an AccessibleTableModelChange representing
- * the header change.
+ * Constant used to indicate that the row header has changed. The old value
+ * in the {@code PropertyChangeEvent} will be {@code null} and the new value
+ * will be an {@code AccessibleTableModelChange} representing the header
+ * change.
+ *
* @see AccessibleTable
* @see AccessibleTableModelChange
*/
@@ -258,19 +264,21 @@
"accessibleTableRowHeaderChanged";
/**
- * Constant used to indicate that the row description has changed
- * The old value in the PropertyChangeEvent will be null and the
- * new value will be an Integer representing the row index.
+ * Constant used to indicate that the row description has changed. The old
+ * value in the {@code PropertyChangeEvent} will be {@code null} and the new
+ * value will be an {@code Integer} representing the row index.
+ *
* @see AccessibleTable
*/
public static final String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED =
"accessibleTableRowDescriptionChanged";
/**
- * Constant used to indicate that the column header has changed
- * The old value in the PropertyChangeEvent will be null and the
- * new value will be an AccessibleTableModelChange representing
- * the header change.
+ * Constant used to indicate that the column header has changed. The old
+ * value in the {@code PropertyChangeEvent} will be {@code null} and the new
+ * value will be an {@code AccessibleTableModelChange} representing the
+ * header change.
+ *
* @see AccessibleTable
* @see AccessibleTableModelChange
*/
@@ -278,20 +286,22 @@
"accessibleTableColumnHeaderChanged";
/**
- * Constant used to indicate that the column description has changed
- * The old value in the PropertyChangeEvent will be null and the
- * new value will be an Integer representing the column index.
+ * Constant used to indicate that the column description has changed. The
+ * old value in the {@code PropertyChangeEvent} will be {@code null} and the
+ * new value will be an {@code Integer} representing the column index.
+ *
* @see AccessibleTable
*/
public static final String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED =
"accessibleTableColumnDescriptionChanged";
/**
- * Constant used to indicate that the supported set of actions
- * has changed. The old value in the PropertyChangeEvent will
- * be an Integer representing the old number of actions supported
- * and the new value will be an Integer representing the new
- * number of actions supported.
+ * Constant used to indicate that the supported set of actions has changed.
+ * The old value in the {@code PropertyChangeEvent} will be an
+ * {@code Integer} representing the old number of actions supported and the
+ * new value will be an {@code Integer} representing the new number of
+ * actions supported.
+ *
* @see AccessibleAction
*/
public static final String ACCESSIBLE_ACTION_PROPERTY =
@@ -299,30 +309,33 @@
/**
* Constant used to indicate that a hypertext element has received focus.
- * The old value in the PropertyChangeEvent will be an Integer
- * representing the start index in the document of the previous element
- * that had focus and the new value will be an Integer representing
- * the start index in the document of the current element that has
- * focus. A value of -1 indicates that an element does not or did
- * not have focus.
+ * The old value in the {@code PropertyChangeEvent} will be an
+ * {@code Integer} representing the start index in the document of the
+ * previous element that had focus and the new value will be an
+ * {@code Integer} representing the start index in the document of the
+ * current element that has focus. A value of -1 indicates that an element
+ * does not or did not have focus.
+ *
* @see AccessibleHyperlink
*/
public static final String ACCESSIBLE_HYPERTEXT_OFFSET =
"AccessibleHypertextOffset";
/**
- * PropertyChangeEvent which indicates that text has changed.
+ * {@code PropertyChangeEvent} which indicates that text has changed.
* <br>
- * For text insertion, the oldValue is null and the newValue
- * is an AccessibleTextSequence specifying the text that was
- * inserted.
+ * For text insertion, the {@code oldValue} is {@code null} and the
+ * {@code newValue} is an {@code AccessibleTextSequence} specifying the text
+ * that was inserted.
* <br>
- * For text deletion, the oldValue is an AccessibleTextSequence
- * specifying the text that was deleted and the newValue is null.
+ * For text deletion, the {@code oldValue} is an
+ * {@code AccessibleTextSequence} specifying the text that was deleted and
+ * the {@code newValue} is {@code null}.
* <br>
- * For text replacement, the oldValue is an AccessibleTextSequence
- * specifying the old text and the newValue is an AccessibleTextSequence
- * specifying the new text.
+ * For text replacement, the {@code oldValue} is an
+ * {@code AccessibleTextSequence} specifying the old text and the
+ * {@code newValue} is an {@code AccessibleTextSequence} specifying the new
+ * text.
*
* @see #getAccessibleText
* @see #addPropertyChangeListener
@@ -332,53 +345,51 @@
= "AccessibleText";
/**
- * PropertyChangeEvent which indicates that a significant change
- * has occurred to the children of a component like a tree or text.
- * This change notifies the event listener that it needs to
- * reacquire the state of the subcomponents. The oldValue is
- * null and the newValue is the component whose children have
- * become invalid.
+ * {@code PropertyChangeEvent} which indicates that a significant change has
+ * occurred to the children of a component like a tree or text. This change
+ * notifies the event listener that it needs to reacquire the state of the
+ * subcomponents. The {@code oldValue} is {@code null} and the
+ * {@code newValue} is the component whose children have become invalid.
*
* @see #getAccessibleText
* @see #addPropertyChangeListener
* @see AccessibleTextSequence
- *
* @since 1.5
*/
public static final String ACCESSIBLE_INVALIDATE_CHILDREN =
"accessibleInvalidateChildren";
- /**
- * PropertyChangeEvent which indicates that text attributes have changed.
+ /**
+ * {@code PropertyChangeEvent} which indicates that text attributes have
+ * changed.
* <br>
- * For attribute insertion, the oldValue is null and the newValue
- * is an AccessibleAttributeSequence specifying the attributes that were
- * inserted.
+ * For attribute insertion, the {@code oldValue} is {@code null} and the
+ * {@code newValue} is an {@code AccessibleAttributeSequence} specifying the
+ * attributes that were inserted.
* <br>
- * For attribute deletion, the oldValue is an AccessibleAttributeSequence
- * specifying the attributes that were deleted and the newValue is null.
+ * For attribute deletion, the {@code oldValue} is an
+ * {@code AccessibleAttributeSequence} specifying the attributes that were
+ * deleted and the {@code newValue} is {@code null}.
* <br>
- * For attribute replacement, the oldValue is an AccessibleAttributeSequence
- * specifying the old attributes and the newValue is an
- * AccessibleAttributeSequence specifying the new attributes.
+ * For attribute replacement, the {@code oldValue} is an
+ * {@code AccessibleAttributeSequence} specifying the old attributes and the
+ * {@code newValue} is an {@code AccessibleAttributeSequence} specifying the
+ * new attributes.
*
* @see #getAccessibleText
* @see #addPropertyChangeListener
* @see AccessibleAttributeSequence
- *
* @since 1.5
*/
public static final String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED =
"accessibleTextAttributesChanged";
- /**
- * PropertyChangeEvent which indicates that a change has occurred
- * in a component's bounds.
- * The oldValue is the old component bounds and the newValue is
- * the new component bounds.
+ /**
+ * {@code PropertyChangeEvent} which indicates that a change has occurred in
+ * a component's bounds. The {@code oldValue} is the old component bounds
+ * and the {@code newValue} is the new component bounds.
*
* @see #addPropertyChangeListener
- *
* @since 1.5
*/
public static final String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED =
@@ -418,7 +429,8 @@
private PropertyChangeSupport accessibleChangeSupport = null;
/**
- * Used to represent the context's relation set
+ * Used to represent the context's relation set.
+ *
* @see #getAccessibleRelationSet
*/
private AccessibleRelationSet relationSet
@@ -427,18 +439,17 @@
private Object nativeAXResource;
/**
- * Gets the accessibleName property of this object. The accessibleName
- * property of an object is a localized String that designates the purpose
- * of the object. For example, the accessibleName property of a label
- * or button might be the text of the label or button itself. In the
- * case of an object that doesn't display its name, the accessibleName
- * should still be set. For example, in the case of a text field used
- * to enter the name of a city, the accessibleName for the en_US locale
- * could be 'city.'
+ * Gets the {@code accessibleName} property of this object. The
+ * {@code accessibleName} property of an object is a localized
+ * {@code String} that designates the purpose of the object. For example,
+ * the {@code accessibleName} property of a label or button might be the
+ * text of the label or button itself. In the case of an object that doesn't
+ * display its name, the {@code accessibleName} should still be set. For
+ * example, in the case of a text field used to enter the name of a city,
+ * the {@code accessibleName} for the {@code en_US} locale could be 'city.'
*
- * @return the localized name of the object; null if this
- * object does not have a name
- *
+ * @return the localized name of the object; {@code null} if this object
+ * does not have a name
* @see #setAccessibleName
*/
public String getAccessibleName() {
@@ -446,12 +457,11 @@
}
/**
- * Sets the localized accessible name of this object. Changing the
- * name will cause a PropertyChangeEvent to be fired for the
- * ACCESSIBLE_NAME_PROPERTY property.
+ * Sets the localized accessible name of this object. Changing the name will
+ * cause a {@code PropertyChangeEvent} to be fired for the
+ * {@code ACCESSIBLE_NAME_PROPERTY} property.
*
- * @param s the new localized name of the object.
- *
+ * @param s the new localized name of the object
* @see #getAccessibleName
* @see #addPropertyChangeListener
*/
@@ -464,15 +474,14 @@
}
/**
- * Gets the accessibleDescription property of this object. The
- * accessibleDescription property of this object is a short localized
- * phrase describing the purpose of the object. For example, in the
- * case of a 'Cancel' button, the accessibleDescription could be
+ * Gets the {@code accessibleDescription} property of this object. The
+ * {@code accessibleDescription} property of this object is a short
+ * localized phrase describing the purpose of the object. For example, in
+ * the case of a 'Cancel' button, the {@code accessibleDescription} could be
* 'Ignore changes and close dialog box.'
*
- * @return the localized description of the object; null if
- * this object does not have a description
- *
+ * @return the localized description of the object; {@code null} if this
+ * object does not have a description
* @see #setAccessibleDescription
*/
public String getAccessibleDescription() {
@@ -480,12 +489,11 @@
}
/**
- * Sets the accessible description of this object. Changing the
- * name will cause a PropertyChangeEvent to be fired for the
- * ACCESSIBLE_DESCRIPTION_PROPERTY property.
+ * Sets the accessible description of this object. Changing the name will
+ * cause a {@code PropertyChangeEvent} to be fired for the
+ * {@code ACCESSIBLE_DESCRIPTION_PROPERTY} property.
*
- * @param s the new localized description of the object
- *
+ * @param s the new localized description of the object
* @see #setAccessibleName
* @see #addPropertyChangeListener
*/
@@ -499,33 +507,36 @@
}
/**
- * Gets the role of this object. The role of the object is the generic
- * purpose or use of the class of this object. For example, the role
- * of a push button is AccessibleRole.PUSH_BUTTON. The roles in
- * AccessibleRole are provided so component developers can pick from
- * a set of predefined roles. This enables assistive technologies to
- * provide a consistent interface to various tweaked subclasses of
- * components (e.g., use AccessibleRole.PUSH_BUTTON for all components
- * that act like a push button) as well as distinguish between subclasses
- * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes
- * and AccessibleRole.RADIO_BUTTON for radio buttons).
- * <p>Note that the AccessibleRole class is also extensible, so
- * custom component developers can define their own AccessibleRole's
- * if the set of predefined roles is inadequate.
+ * Gets the role of this object. The role of the object is the generic
+ * purpose or use of the class of this object. For example, the role of a
+ * push button is {@code AccessibleRole.PUSH_BUTTON}. The roles in
+ * {@code AccessibleRole} are provided so component developers can pick from
+ * a set of predefined roles. This enables assistive technologies to provide
+ * a consistent interface to various tweaked subclasses of components (e.g.,
+ * use {@code AccessibleRole.PUSH_BUTTON} for all components that act like a
+ * push button) as well as distinguish between subclasses that behave
+ * differently (e.g., {@code AccessibleRole.CHECK_BOX} for check boxes and
+ * {@code AccessibleRole.RADIO_BUTTON} for radio buttons).
+ * <p>
+ * Note that the {@code AccessibleRole} class is also extensible, so custom
+ * component developers can define their own {@code AccessibleRole}'s if the
+ * set of predefined roles is inadequate.
*
- * @return an instance of AccessibleRole describing the role of the object
+ * @return an instance of {@code AccessibleRole} describing the role of the
+ * object
* @see AccessibleRole
*/
public abstract AccessibleRole getAccessibleRole();
/**
- * Gets the state set of this object. The AccessibleStateSet of an object
- * is composed of a set of unique AccessibleStates. A change in the
- * AccessibleStateSet of an object will cause a PropertyChangeEvent to
- * be fired for the ACCESSIBLE_STATE_PROPERTY property.
+ * Gets the state set of this object. The {@code AccessibleStateSet} of an
+ * object is composed of a set of unique {@code AccessibleStates}. A change
+ * in the {@code AccessibleStateSet} of an object will cause a
+ * {@code PropertyChangeEvent} to be fired for the
+ * {@code ACCESSIBLE_STATE_PROPERTY} property.
*
- * @return an instance of AccessibleStateSet containing the
- * current state set of the object
+ * @return an instance of {@code AccessibleStateSet} containing the current
+ * state set of the object
* @see AccessibleStateSet
* @see AccessibleState
* @see #addPropertyChangeListener
@@ -533,22 +544,22 @@
public abstract AccessibleStateSet getAccessibleStateSet();
/**
- * Gets the Accessible parent of this object.
+ * Gets the {@code Accessible} parent of this object.
*
- * @return the Accessible parent of this object; null if this
- * object does not have an Accessible parent
+ * @return the {@code Accessible} parent of this object; {@code null} if
+ * this object does not have an {@code Accessible} parent
*/
public Accessible getAccessibleParent() {
return accessibleParent;
}
/**
- * Sets the Accessible parent of this object. This is meant to be used
- * only in the situations where the actual component's parent should
- * not be treated as the component's accessible parent and is a method
- * that should only be called by the parent of the accessible child.
+ * Sets the {@code Accessible} parent of this object. This is meant to be
+ * used only in the situations where the actual component's parent should
+ * not be treated as the component's accessible parent and is a method that
+ * should only be called by the parent of the accessible child.
*
- * @param a - Accessible to be set as the parent
+ * @param a - {@code Accessible} to be set as the parent
*/
public void setAccessibleParent(Accessible a) {
accessibleParent = a;
@@ -557,9 +568,8 @@
/**
* Gets the 0-based index of this object in its accessible parent.
*
- * @return the 0-based index of this object in its parent; -1 if this
- * object does not have an accessible parent.
- *
+ * @return the 0-based index of this object in its parent; -1 if this object
+ * does not have an accessible parent.
* @see #getAccessibleParent
* @see #getAccessibleChildrenCount
* @see #getAccessibleChild
@@ -574,13 +584,13 @@
public abstract int getAccessibleChildrenCount();
/**
- * Returns the specified Accessible child of the object. The Accessible
- * children of an Accessible object are zero-based, so the first child
- * of an Accessible child is at index 0, the second child is at index 1,
- * and so on.
+ * Returns the specified {@code Accessible} child of the object. The
+ * {@code Accessible} children of an {@code Accessible} object are
+ * zero-based, so the first child of an {@code Accessible} child is at index
+ * 0, the second child is at index 1, and so on.
*
- * @param i zero-based index of child
- * @return the Accessible child of the object
+ * @param i zero-based index of child
+ * @return the {@code Accessible} child of the object
* @see #getAccessibleChildrenCount
*/
public abstract Accessible getAccessibleChild(int i);
@@ -589,21 +599,21 @@
* Gets the locale of the component. If the component does not have a
* locale, then the locale of its parent is returned.
*
- * @return this component's locale. If this component does not have
- * a locale, the locale of its parent is returned.
- *
- * @exception IllegalComponentStateException
- * If the Component does not have its own locale and has not yet been
- * added to a containment hierarchy such that the locale can be
- * determined from the containing parent.
+ * @return this component's locale. If this component does not have a
+ * locale, the locale of its parent is returned.
+ * @throws IllegalComponentStateException If the component does not have its
+ * own locale and has not yet been added to a containment hierarchy
+ * such that the locale can be determined from the containing
+ * parent
*/
public abstract Locale getLocale() throws IllegalComponentStateException;
/**
- * Adds a PropertyChangeListener to the listener list.
- * The listener is registered for all Accessible properties and will
- * be called when those properties change.
+ * Adds a {@code PropertyChangeListener} to the listener list. The listener
+ * is registered for all {@code Accessible} properties and will be called
+ * when those properties change.
*
+ * @param listener The PropertyChangeListener to be added
* @see #ACCESSIBLE_NAME_PROPERTY
* @see #ACCESSIBLE_DESCRIPTION_PROPERTY
* @see #ACCESSIBLE_STATE_PROPERTY
@@ -611,8 +621,6 @@
* @see #ACCESSIBLE_SELECTION_PROPERTY
* @see #ACCESSIBLE_TEXT_PROPERTY
* @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY
- *
- * @param listener The PropertyChangeListener to be added
*/
public void addPropertyChangeListener(PropertyChangeListener listener) {
if (accessibleChangeSupport == null) {
@@ -622,11 +630,11 @@
}
/**
- * Removes a PropertyChangeListener from the listener list.
- * This removes a PropertyChangeListener that was registered
- * for all properties.
+ * Removes a {@code PropertyChangeListener} from the listener list. This
+ * removes a {@code PropertyChangeListener} that was registered for all
+ * properties.
*
- * @param listener The PropertyChangeListener to be removed
+ * @param listener The PropertyChangeListener to be removed
*/
public void removePropertyChangeListener(PropertyChangeListener listener) {
if (accessibleChangeSupport != null) {
@@ -635,10 +643,11 @@
}
/**
- * Gets the AccessibleAction associated with this object that supports
- * one or more actions.
+ * Gets the {@code AccessibleAction} associated with this object that
+ * supports one or more actions.
*
- * @return AccessibleAction if supported by object; else return null
+ * @return {@code AccessibleAction} if supported by object; else return
+ * {@code null}
* @see AccessibleAction
*/
public AccessibleAction getAccessibleAction() {
@@ -646,10 +655,11 @@
}
/**
- * Gets the AccessibleComponent associated with this object that has a
- * graphical representation.
+ * Gets the {@code AccessibleComponent} associated with this object that has
+ * a graphical representation.
*
- * @return AccessibleComponent if supported by object; else return null
+ * @return {@code AccessibleComponent} if supported by object; else return
+ * {@code null}
* @see AccessibleComponent
*/
public AccessibleComponent getAccessibleComponent() {
@@ -657,10 +667,11 @@
}
/**
- * Gets the AccessibleSelection associated with this object which allows its
- * Accessible children to be selected.
+ * Gets the {@code AccessibleSelection} associated with this object which
+ * allows its {@code Accessible} children to be selected.
*
- * @return AccessibleSelection if supported by object; else return null
+ * @return {@code AccessibleSelection} if supported by object; else return
+ * {@code null}
* @see AccessibleSelection
*/
public AccessibleSelection getAccessibleSelection() {
@@ -668,10 +679,11 @@
}
/**
- * Gets the AccessibleText associated with this object presenting
+ * Gets the {@code AccessibleText} associated with this object presenting
* text on the display.
*
- * @return AccessibleText if supported by object; else return null
+ * @return {@code AccessibleText} if supported by object; else return
+ * {@code null}
* @see AccessibleText
*/
public AccessibleText getAccessibleText() {
@@ -679,10 +691,11 @@
}
/**
- * Gets the AccessibleEditableText associated with this object
+ * Gets the {@code AccessibleEditableText} associated with this object
* presenting editable text on the display.
*
- * @return AccessibleEditableText if supported by object; else return null
+ * @return {@code AccessibleEditableText} if supported by object; else
+ * return {@code null}
* @see AccessibleEditableText
* @since 1.4
*/
@@ -690,12 +703,12 @@
return null;
}
-
/**
- * Gets the AccessibleValue associated with this object that supports a
- * Numerical value.
+ * Gets the {@code AccessibleValue} associated with this object that
+ * supports a {@code Numerical} value.
*
- * @return AccessibleValue if supported by object; else return null
+ * @return {@code AccessibleValue} if supported by object; else return
+ * {@code null}
* @see AccessibleValue
*/
public AccessibleValue getAccessibleValue() {
@@ -703,11 +716,11 @@
}
/**
- * Gets the AccessibleIcons associated with an object that has
- * one or more associated icons
+ * Gets the {@code AccessibleIcons} associated with an object that has one
+ * or more associated icons.
*
- * @return an array of AccessibleIcon if supported by object;
- * otherwise return null
+ * @return an array of {@code AccessibleIcon} if supported by object;
+ * otherwise return {@code null}
* @see AccessibleIcon
* @since 1.3
*/
@@ -716,10 +729,10 @@
}
/**
- * Gets the AccessibleRelationSet associated with an object
+ * Gets the {@code AccessibleRelationSet} associated with an object.
*
- * @return an AccessibleRelationSet if supported by object;
- * otherwise return null
+ * @return an {@code AccessibleRelationSet} if supported by object;
+ * otherwise return {@code null}
* @see AccessibleRelationSet
* @since 1.3
*/
@@ -728,10 +741,10 @@
}
/**
- * Gets the AccessibleTable associated with an object
+ * Gets the {@code AccessibleTable} associated with an object.
*
- * @return an AccessibleTable if supported by object;
- * otherwise return null
+ * @return an {@code AccessibleTable} if supported by object; otherwise return
+ * {@code null}
* @see AccessibleTable
* @since 1.3
*/
@@ -740,16 +753,17 @@
}
/**
- * Support for reporting bound property changes. If oldValue and
- * newValue are not equal and the PropertyChangeEvent listener list
- * is not empty, then fire a PropertyChange event to each listener.
- * In general, this is for use by the Accessible objects themselves
- * and should not be called by an application program.
- * @param propertyName The programmatic name of the property that
- * was changed.
- * @param oldValue The old value of the property.
- * @param newValue The new value of the property.
- * @see java.beans.PropertyChangeSupport
+ * Support for reporting bound property changes. If {@code oldValue} and
+ * {@code newValue} are not equal and the {@code PropertyChangeEvent}
+ * listener list is not empty, then fire a {@code PropertyChange} event to
+ * each listener. In general, this is for use by the {@code Accessible}
+ * objects themselves and should not be called by an application program.
+ *
+ * @param propertyName The programmatic name of the property that was
+ * changed
+ * @param oldValue The old value of the property
+ * @param newValue The new value of the property
+ * @see PropertyChangeSupport
* @see #addPropertyChangeListener
* @see #removePropertyChangeListener
* @see #ACCESSIBLE_NAME_PROPERTY
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleEditableText.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleEditableText.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,109 +25,102 @@
package javax.accessibility;
-import java.util.*;
-import java.awt.*;
-import javax.swing.text.*;
+import javax.swing.text.AttributeSet;
/**
- * <P>The AccessibleEditableText interface should be implemented by all
- * classes that present editable textual information on the display.
- * Along with the AccessibleText interface, this interface provides
- * the standard mechanism for an assistive technology to access
- * that text via its content, attributes, and spatial location.
- * Applications can determine if an object supports the AccessibleEditableText
- * interface by first obtaining its AccessibleContext (see {@link Accessible})
- * and then calling the {@link AccessibleContext#getAccessibleEditableText}
- * method of AccessibleContext. If the return value is not null, the object
- * supports this interface.
+ * The {@code AccessibleEditableText} interface should be implemented by all
+ * classes that present editable textual information on the display. Along with
+ * the {@code AccessibleText} interface, this interface provides the standard
+ * mechanism for an assistive technology to access that text via its content,
+ * attributes, and spatial location. Applications can determine if an object
+ * supports the {@code AccessibleEditableText} interface by first obtaining its
+ * {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleEditableText} method of
+ * {@code AccessibleContext}. If the return value is not {@code null}, the
+ * object supports this interface.
*
+ * @author Lynn Monsanto
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleText
* @see AccessibleContext#getAccessibleEditableText
- *
- * @author Lynn Monsanto
* @since 1.4
*/
-
public interface AccessibleEditableText extends AccessibleText {
/**
* Sets the text contents to the specified string.
*
- * @param s the string to set the text contents
+ * @param s the string to set the text contents
*/
public void setTextContents(String s);
/**
- * Inserts the specified string at the given index/
+ * Inserts the specified string at the given index.
*
- * @param index the index in the text where the string will
- * be inserted
- * @param s the string to insert in the text
+ * @param index the index in the text where the string will be inserted
+ * @param s the string to insert in the text
*/
public void insertTextAtIndex(int index, String s);
/**
* Returns the text string between two indices.
*
- * @param startIndex the starting index in the text
- * @param endIndex the ending index in the text
+ * @param startIndex the starting index in the text
+ * @param endIndex the ending index in the text
* @return the text string between the indices
*/
public String getTextRange(int startIndex, int endIndex);
/**
- * Deletes the text between two indices
+ * Deletes the text between two indices.
*
- * @param startIndex the starting index in the text
- * @param endIndex the ending index in the text
+ * @param startIndex the starting index in the text
+ * @param endIndex the ending index in the text
*/
public void delete(int startIndex, int endIndex);
/**
* Cuts the text between two indices into the system clipboard.
*
- * @param startIndex the starting index in the text
- * @param endIndex the ending index in the text
+ * @param startIndex the starting index in the text
+ * @param endIndex the ending index in the text
*/
public void cut(int startIndex, int endIndex);
/**
- * Pastes the text from the system clipboard into the text
- * starting at the specified index.
+ * Pastes the text from the system clipboard into the text starting at the
+ * specified index.
*
- * @param startIndex the starting index in the text
+ * @param startIndex the starting index in the text
*/
public void paste(int startIndex);
/**
- * Replaces the text between two indices with the specified
- * string.
+ * Replaces the text between two indices with the specified string.
*
- * @param startIndex the starting index in the text
- * @param endIndex the ending index in the text
- * @param s the string to replace the text between two indices
+ * @param startIndex the starting index in the text
+ * @param endIndex the ending index in the text
+ * @param s the string to replace the text between two indices
*/
public void replaceText(int startIndex, int endIndex, String s);
/**
* Selects the text between two indices.
*
- * @param startIndex the starting index in the text
- * @param endIndex the ending index in the text
+ * @param startIndex the starting index in the text
+ * @param endIndex the ending index in the text
*/
public void selectText(int startIndex, int endIndex);
/**
* Sets attributes for the text between two indices.
*
- * @param startIndex the starting index in the text
- * @param endIndex the ending index in the text
- * @param as the attribute set
+ * @param startIndex the starting index in the text
+ * @param endIndex the ending index in the text
+ * @param as the attribute set
* @see AttributeSet
*/
public void setAttributes(int startIndex, int endIndex, AttributeSet as);
-
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedComponent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedComponent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,48 +26,46 @@
package javax.accessibility;
/**
- * The AccessibleExtendedComponent interface should be supported by any object
- * that is rendered on the screen. This interface provides the standard
- * mechanism for an assistive technology to determine the extended
- * graphical representation of an object. Applications can determine
- * if an object supports the AccessibleExtendedComponent interface by first
- * obtaining its AccessibleContext
- * and then calling the
- * {@link AccessibleContext#getAccessibleComponent} method.
- * If the return value is not null and the type of the return value is
- * AccessibleExtendedComponent, the object supports this interface.
+ * The {@code AccessibleExtendedComponent} interface should be supported by any
+ * object that is rendered on the screen. This interface provides the standard
+ * mechanism for an assistive technology to determine the extended graphical
+ * representation of an object. Applications can determine if an object supports
+ * the {@code AccessibleExtendedComponent} interface by first obtaining its
+ * {@code AccessibleContext} and then calling the
+ * {@link AccessibleContext#getAccessibleComponent} method. If the return value
+ * is not {@code null} and the type of the return value is
+ * {@code AccessibleExtendedComponent}, the object supports this interface.
*
+ * @author Lynn Monsanto
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleComponent
- *
- * @author Lynn Monsanto
* @since 1.4
*/
public interface AccessibleExtendedComponent extends AccessibleComponent {
/**
- * Returns the tool tip text
+ * Returns the tool tip text.
*
- * @return the tool tip text, if supported, of the object;
- * otherwise, null
+ * @return the tool tip text, if supported, of the object; otherwise,
+ * {@code null}
*/
public String getToolTipText();
/**
- * Returns the titled border text
+ * Returns the titled border text.
*
- * @return the titled border text, if supported, of the object;
- * otherwise, null
+ * @return the titled border text, if supported, of the object; otherwise,
+ * {@code null}
*/
public String getTitledBorderText();
/**
- * Returns key bindings associated with this object
+ * Returns key bindings associated with this object.
*
- * @return the key bindings, if supported, of the object;
- * otherwise, null
+ * @return the key bindings, if supported, of the object; otherwise,
+ * {@code null}
* @see AccessibleKeyBinding
*/
public AccessibleKeyBinding getAccessibleKeyBinding();
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedTable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedTable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, 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
@@ -22,52 +22,49 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package javax.accessibility;
/**
- * Class AccessibleExtendedTable provides extended information about
- * a user-interface component that presents data in a two-dimensional
- * table format.
- * Applications can determine if an object supports the
- * AccessibleExtendedTable interface by first obtaining its
- * AccessibleContext and then calling the
- * {@link AccessibleContext#getAccessibleTable} method.
- * If the return value is not null and the type of the return value is
- * AccessibleExtendedTable, the object supports this interface.
- *
- * @author Lynn Monsanto
- * @since 1.4
- */
+ * Class {@code AccessibleExtendedTable} provides extended information about a
+ * user-interface component that presents data in a two-dimensional table
+ * format. Applications can determine if an object supports the
+ * {@code AccessibleExtendedTable} interface by first obtaining its
+ * {@code AccessibleContext} and then calling the
+ * {@link AccessibleContext#getAccessibleTable} method. If the return value is
+ * not {@code null} and the type of the return value is
+ * {@code AccessibleExtendedTable}, the object supports this interface.
+ *
+ * @author Lynn Monsanto
+ * @since 1.4
+ */
public interface AccessibleExtendedTable extends AccessibleTable {
- /**
- * Returns the row number of an index in the table.
- *
- * @param index the zero-based index in the table. The index is
- * the table cell offset from row == 0 and column == 0.
- * @return the zero-based row of the table if one exists;
- * otherwise -1.
- */
- public int getAccessibleRow(int index);
-
- /**
- * Returns the column number of an index in the table.
- *
- * @param index the zero-based index in the table. The index is
- * the table cell offset from row == 0 and column == 0.
- * @return the zero-based column of the table if one exists;
- * otherwise -1.
- */
- public int getAccessibleColumn(int index);
+ /**
+ * Returns the row number of an index in the table.
+ *
+ * @param index the zero-based index in the table. The index is the table
+ * cell offset from row == 0 and column == 0.
+ * @return the zero-based row of the table if one exists; otherwise -1
+ */
+ public int getAccessibleRow(int index);
/**
- * Returns the index at a row and column in the table.
- *
- * @param r zero-based row of the table
- * @param c zero-based column of the table
- * @return the zero-based index in the table if one exists;
- * otherwise -1. The index is the table cell offset from
- * row == 0 and column == 0.
- */
- public int getAccessibleIndex(int r, int c);
+ * Returns the column number of an index in the table.
+ *
+ * @param index the zero-based index in the table. The index is the table
+ * cell offset from row == 0 and column == 0.
+ * @return the zero-based column of the table if one exists; otherwise -1
+ */
+ public int getAccessibleColumn(int index);
+
+ /**
+ * Returns the index at a row and column in the table.
+ *
+ * @param r zero-based row of the table
+ * @param c zero-based column of the table
+ * @return the zero-based index in the table if one exists; otherwise -1.
+ * The index is the table cell offset from row == 0 and column == 0.
+ */
+ public int getAccessibleIndex(int r, int c);
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedText.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedText.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, 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
@@ -25,29 +25,25 @@
package javax.accessibility;
-
-import java.util.*;
-import java.awt.*;
-import javax.swing.text.*;
-
+import java.awt.Rectangle;
/**
- * <P>The AccessibleExtendedText interface contains additional methods
- * not provided by the AccessibleText interface
+ * The {@code AccessibleExtendedText} interface contains additional methods not
+ * provided by the {@code AccessibleText} interface.
+ * <p>
+ * Applications can determine if an object supports the
+ * {@code AccessibleExtendedText} interface by first obtaining its
+ * {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleText} method of
+ * {@code AccessibleContext}. If the return value is an instance of
+ * {@code AccessibleExtendedText}, the object supports this interface.
*
- * Applications can determine if an object supports the AccessibleExtendedText
- * interface by first obtaining its AccessibleContext (see {@link Accessible})
- * and then calling the {@link AccessibleContext#getAccessibleText} method of
- * AccessibleContext. If the return value is an instance of
- * AccessibleExtendedText, the object supports this interface.
- *
+ * @author Peter Korn
+ * @author Lynn Monsanto
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleText
- *
- * @author Peter Korn
- * @author Lynn Monsanto
* @since 1.5
*/
public interface AccessibleExtendedText {
@@ -73,25 +69,24 @@
public static final int ATTRIBUTE_RUN = 5; // BugID: 4849720
/**
- * Returns the text between two indices
+ * Returns the text between two indices.
*
- * @param startIndex the start index in the text
- * @param endIndex the end index in the text
- * @return the text string if the indices are valid.
- * Otherwise, null is returned.
+ * @param startIndex the start index in the text
+ * @param endIndex the end index in the text
+ * @return the text string if the indices are valid. Otherwise, {@code null}
+ * is returned.
*/
public String getTextRange(int startIndex, int endIndex);
/**
* Returns the {@code AccessibleTextSequence} at a given index.
*
- * @param part the {@code CHARACTER}, {@code WORD},
- * {@code SENTENCE}, {@code LINE} or {@code ATTRIBUTE_RUN}
- * to retrieve
- * @param index an index within the text
- * @return an {@code AccessibleTextSequence} specifying the text
- * if part and index are valid. Otherwise, null is returned.
- *
+ * @param part the {@code CHARACTER}, {@code WORD}, {@code SENTENCE},
+ * {@code LINE} or {@code ATTRIBUTE_RUN} to retrieve
+ * @param index an index within the text
+ * @return an {@code AccessibleTextSequence} specifying the text if
+ * {@code part} and {@code index} are valid. Otherwise, {@code null}
+ * is returned.
* @see AccessibleText#CHARACTER
* @see AccessibleText#WORD
* @see AccessibleText#SENTENCE
@@ -101,13 +96,12 @@
/**
* Returns the {@code AccessibleTextSequence} after a given index.
*
- * @param part the {@code CHARACTER}, {@code WORD},
- * {@code SENTENCE}, {@code LINE} or {@code ATTRIBUTE_RUN}
- * to retrieve
- * @param index an index within the text
- * @return an {@code AccessibleTextSequence} specifying the text
- * if part and index are valid. Otherwise, null is returned.
- *
+ * @param part the {@code CHARACTER}, {@code WORD}, {@code SENTENCE},
+ * {@code LINE} or {@code ATTRIBUTE_RUN} to retrieve
+ * @param index an index within the text
+ * @return an {@code AccessibleTextSequence} specifying the text if
+ * {@code part} and {@code index} are valid. Otherwise, {@code null}
+ * is returned.
* @see AccessibleText#CHARACTER
* @see AccessibleText#WORD
* @see AccessibleText#SENTENCE
@@ -117,13 +111,12 @@
/**
* Returns the {@code AccessibleTextSequence} before a given index.
*
- * @param part the {@code CHARACTER}, {@code WORD},
- * {@code SENTENCE}, {@code LINE} or {@code ATTRIBUTE_RUN}
- * to retrieve
- * @param index an index within the text
- * @return an {@code AccessibleTextSequence} specifying the text
- * if part and index are valid. Otherwise, null is returned.
- *
+ * @param part the {@code CHARACTER}, {@code WORD}, {@code SENTENCE},
+ * {@code LINE} or {@code ATTRIBUTE_RUN} to retrieve
+ * @param index an index within the text
+ * @return an {@code AccessibleTextSequence} specifying the text if
+ * {@code part} and {@code index} are valid. Otherwise, {@code null}
+ * is returned.
* @see AccessibleText#CHARACTER
* @see AccessibleText#WORD
* @see AccessibleText#SENTENCE
@@ -133,10 +126,10 @@
/**
* Returns the bounding rectangle of the text between two indices.
*
- * @param startIndex the start index in the text
- * @param endIndex the end index in the text
+ * @param startIndex the start index in the text
+ * @param endIndex the end index in the text
* @return the bounding rectangle of the text if the indices are valid.
- * Otherwise, null is returned.
+ * Otherwise, {@code null} is returned.
*/
public Rectangle getTextBounds(int startIndex, int endIndex);
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleHyperlink.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleHyperlink.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,116 +25,103 @@
package javax.accessibility;
-
-import java.util.*;
-import java.awt.*;
-import javax.swing.text.*;
-
-
/**
- * Encapsulation of a link, or set of links (e.g. client side imagemap)
- * in a Hypertext document
+ * Encapsulation of a link, or set of links (e.g. client side imagemap) in a
+ * Hypertext document
*
+ * @author Peter Korn
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleText
* @see AccessibleContext#getAccessibleText
- *
- * @author Peter Korn
*/
public abstract class AccessibleHyperlink implements AccessibleAction {
- /**
- * Since the document a link is associated with may have
- * changed, this method returns whether or not this Link is still valid
- * (with respect to the document it references).
- *
- * @return a flag indicating whether this link is still valid with
- * respect to the AccessibleHypertext it belongs to
- */
- public abstract boolean isValid();
-
- /**
- * Returns the number of accessible actions available in this Link
- * If there are more than one, the first one is NOT considered the
- * "default" action of this LINK object (e.g. in an HTML imagemap).
- * In general, links will have only one AccessibleAction in them.
- *
- * @return the zero-based number of Actions in this object
- */
- public abstract int getAccessibleActionCount();
+ /**
+ * Since the document a link is associated with may have changed, this
+ * method returns whether or not this Link is still valid (with respect to
+ * the document it references).
+ *
+ * @return a flag indicating whether this link is still valid with respect
+ * to the {@code AccessibleHypertext} it belongs to
+ */
+ public abstract boolean isValid();
- /**
- * Performs the specified Action on the object
- *
- * @param i zero-based index of actions
- * @return true if the action was performed; otherwise false.
- * @see #getAccessibleActionCount
- */
- public abstract boolean doAccessibleAction(int i);
+ /**
+ * Returns the number of accessible actions available in this Link If there
+ * are more than one, the first one is NOT considered the "default" action
+ * of this LINK object (e.g. in an HTML imagemap). In general, links will
+ * have only one {@code AccessibleAction} in them.
+ *
+ * @return the zero-based number of actions in this object
+ */
+ public abstract int getAccessibleActionCount();
- /**
- * Returns a String description of this particular
- * link action. This should be a text string
- * associated with anchoring text, this should be the
- * anchor text. E.g. from HTML:
- * <a HREF="http://www.sun.com/access">Accessibility</a>
- * this method would return "Accessibility".
- *
- * Similarly, from this HTML:
- * <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a>
- * this method would return "top hat"
- *
- * @param i zero-based index of the actions
- * @return a String description of the action
- * @see #getAccessibleActionCount
- */
- public abstract String getAccessibleActionDescription(int i);
+ /**
+ * Performs the specified action on the object.
+ *
+ * @param i zero-based index of actions
+ * @return {@code true} if the action was performed; otherwise {@code false}
+ * @see #getAccessibleActionCount
+ */
+ public abstract boolean doAccessibleAction(int i);
- /**
- * Returns an object that represents the link action,
- * as appropriate for that link. E.g. from HTML:
- * <a HREF="http://www.sun.com/access">Accessibility</a>
- * this method would return a
- * java.net.URL("http://www.sun.com/access.html");
- *
- * @param i zero-based index of the actions
- * @return an Object representing the hypertext link itself
- * @see #getAccessibleActionCount
- */
- public abstract Object getAccessibleActionObject(int i);
+ /**
+ * Returns a string description of this particular link action. This should
+ * be a text string associated with anchoring text, this should be the
+ * anchor text. E.g. from HTML: <a
+ * HREF="http://www.sun.com/access">Accessibility</a> this method
+ * would return "Accessibility".
+ * <p>
+ * Similarly, from this HTML: <a HREF="#top"><img src="top-hat.gif"
+ * alt="top hat"></a> this method would return "top hat"
+ *
+ * @param i zero-based index of the actions
+ * @return a string description of the action
+ * @see #getAccessibleActionCount
+ */
+ public abstract String getAccessibleActionDescription(int i);
+
+ /**
+ * Returns an object that represents the link action, as appropriate for
+ * that link. E.g. from HTML: <a
+ * HREF="http://www.sun.com/access">Accessibility</a> this method
+ * would return a java.net.URL("http://www.sun.com/access.html");
+ *
+ * @param i zero-based index of the actions
+ * @return an object representing the hypertext link itself
+ * @see #getAccessibleActionCount
+ */
+ public abstract Object getAccessibleActionObject(int i);
- /**
- * Returns an object that represents the link anchor,
- * as appropriate for that link. E.g. from HTML:
- * <a href="http://www.sun.com/access">Accessibility</a>
- * this method would return a String containing the text:
- * "Accessibility".
- *
- * Similarly, from this HTML:
- * <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a>
- * this might return the object ImageIcon("top-hat.gif", "top hat");
- *
- * @param i zero-based index of the actions
- * @return an Object representing the hypertext anchor
- * @see #getAccessibleActionCount
- */
- public abstract Object getAccessibleActionAnchor(int i);
+ /**
+ * Returns an object that represents the link anchor, as appropriate for
+ * that link. E.g. from HTML: <a
+ * href="http://www.sun.com/access">Accessibility</a> this method
+ * would return a {@code String} containing the text: "Accessibility".
+ * <p>
+ * Similarly, from this HTML: <a HREF="#top"><img src="top-hat.gif"
+ * alt="top hat"></a> this might return the object
+ * ImageIcon("top-hat.gif", "top hat");
+ *
+ * @param i zero-based index of the actions
+ * @return an object representing the hypertext anchor
+ * @see #getAccessibleActionCount
+ */
+ public abstract Object getAccessibleActionAnchor(int i);
- /**
- * Gets the index with the hypertext document at which this
- * link begins
- *
- * @return index of start of link
- */
- public abstract int getStartIndex();
+ /**
+ * Gets the index with the hypertext document at which this link begins.
+ *
+ * @return index of start of link
+ */
+ public abstract int getStartIndex();
- /**
- * Gets the index with the hypertext document at which this
- * link ends
- *
- * @return index of end of link
- */
- public abstract int getEndIndex();
+ /**
+ * Gets the index with the hypertext document at which this link ends.
+ *
+ * @return index of end of link
+ */
+ public abstract int getEndIndex();
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleHypertext.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleHypertext.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,56 +25,50 @@
package javax.accessibility;
-
-import java.util.*;
-import java.awt.*;
-import javax.swing.text.*;
-
-
/**
- * <P>The AccessibleHypertext class is the base class for all
- * classes that present hypertext information on the display. This class
- * provides the standard mechanism for an assistive technology to access
- * that text via its content, attributes, and spatial location.
- * It also provides standard mechanisms for manipulating hyperlinks.
- * Applications can determine if an object supports the AccessibleHypertext
- * interface by first obtaining its AccessibleContext (see {@link Accessible})
- * and then calling the {@link AccessibleContext#getAccessibleText}
- * method of AccessibleContext. If the return value is a class which extends
- * AccessibleHypertext, then that object supports AccessibleHypertext.
+ * The {@code AccessibleHypertext} class is the base class for all classes that
+ * present hypertext information on the display. This class provides the
+ * standard mechanism for an assistive technology to access that text via its
+ * content, attributes, and spatial location. It also provides standard
+ * mechanisms for manipulating hyperlinks. Applications can determine if an
+ * object supports the {@code AccessibleHypertext} interface by first obtaining
+ * its {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleText} method of
+ * {@code AccessibleContext}. If the return value is a class which extends
+ * {@code AccessibleHypertext}, then that object supports
+ * {@code AccessibleHypertext}.
*
+ * @author Peter Korn
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleText
* @see AccessibleContext#getAccessibleText
- *
- * @author Peter Korn
*/
public interface AccessibleHypertext extends AccessibleText {
/**
* Returns the number of links within this hypertext document.
*
- * @return number of links in this hypertext doc.
+ * @return number of links in this hypertext doc
*/
public abstract int getLinkCount();
/**
* Returns the nth Link of this Hypertext document.
*
- * @param linkIndex within the links of this Hypertext
+ * @param linkIndex within the links of this Hypertext
* @return Link object encapsulating the nth link(s)
*/
public abstract AccessibleHyperlink getLink(int linkIndex);
/**
- * Returns the index into an array of hyperlinks that
- * is associated with this character index, or -1 if there
- * is no hyperlink associated with this index.
+ * Returns the index into an array of hyperlinks that is associated with
+ * this character index, or -1 if there is no hyperlink associated with this
+ * index.
*
- * @param charIndex index within the text
- * @return index into the set of hyperlinks for this hypertext doc.
+ * @param charIndex index within the text
+ * @return index into the set of hyperlinks for this hypertext doc
*/
public abstract int getLinkIndex(int charIndex);
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleIcon.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleIcon.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,57 +26,51 @@
package javax.accessibility;
/**
- * The AccessibleIcon interface should be supported by any object
- * that has an associated icon (e.g., buttons). This interface
- * provides the standard mechanism for an assistive technology
- * to get descriptive information about icons.
- * Applications can determine
- * if an object supports the AccessibleIcon interface by first
- * obtaining its AccessibleContext (see
- * {@link Accessible}) and then calling the
- * {@link AccessibleContext#getAccessibleIcon} method.
- * If the return value is not null, the object supports this interface.
+ * The {@code AccessibleIcon} interface should be supported by any object that
+ * has an associated icon (e.g., buttons). This interface provides the standard
+ * mechanism for an assistive technology to get descriptive information about
+ * icons. Applications can determine if an object supports the
+ * {@code AccessibleIcon} interface by first obtaining its
+ * {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleIcon} method. If the return value is
+ * not {@code null}, the object supports this interface.
*
+ * @author Lynn Monsanto
* @see Accessible
* @see AccessibleContext
- *
- * @author Lynn Monsanto
* @since 1.3
*/
public interface AccessibleIcon {
/**
- * Gets the description of the icon. This is meant to be a brief
- * textual description of the object. For example, it might be
- * presented to a blind user to give an indication of the purpose
- * of the icon.
+ * Gets the description of the icon. This is meant to be a brief textual
+ * description of the object. For example, it might be presented to a blind
+ * user to give an indication of the purpose of the icon.
*
* @return the description of the icon
*/
public String getAccessibleIconDescription();
/**
- * Sets the description of the icon. This is meant to be a brief
- * textual description of the object. For example, it might be
- * presented to a blind user to give an indication of the purpose
- * of the icon.
+ * Sets the description of the icon. This is meant to be a brief textual
+ * description of the object. For example, it might be presented to a blind
+ * user to give an indication of the purpose of the icon.
*
- * @param description the description of the icon
+ * @param description the description of the icon
*/
public void setAccessibleIconDescription(String description);
/**
- * Gets the width of the icon
+ * Gets the width of the icon.
*
- * @return the width of the icon.
+ * @return the width of the icon
*/
public int getAccessibleIconWidth();
/**
- * Gets the height of the icon
+ * Gets the height of the icon.
*
- * @return the height of the icon.
+ * @return the height of the icon
*/
public int getAccessibleIconHeight();
-
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleKeyBinding.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleKeyBinding.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,38 +26,36 @@
package javax.accessibility;
/**
- * The AccessibleKeyBinding interface should be supported by any object
+ * The {@code AccessibleKeyBinding} interface should be supported by any object
* that has a keyboard bindings such as a keyboard mnemonic and/or keyboard
- * shortcut which can be used to select the object. This interface provides
- * the standard mechanism for an assistive technology to determine the
- * key bindings which exist for this object.
- * Any object that has such key bindings should support this
- * interface.
+ * shortcut which can be used to select the object. This interface provides the
+ * standard mechanism for an assistive technology to determine the key bindings
+ * which exist for this object. Any object that has such key bindings should
+ * support this interface.
*
+ * @author Lynn Monsanto
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
- *
- * @author Lynn Monsanto
* @since 1.4
*/
public interface AccessibleKeyBinding {
/**
- * Returns the number of key bindings for this object
+ * Returns the number of key bindings for this object.
*
* @return the zero-based number of key bindings for this object
*/
public int getAccessibleKeyBindingCount();
/**
- * Returns a key binding for this object. The value returned is an
- * java.lang.Object which must be cast to appropriate type depending
+ * Returns a key binding for this object. The value returned is an
+ * {@code java.lang.Object} which must be cast to appropriate type depending
* on the underlying implementation of the key.
*
- * @param i zero-based index of the key bindings
- * @return a javax.lang.Object which specifies the key binding
+ * @param i zero-based index of the key bindings
+ * @return a {@code javax.lang.Object} which specifies the key binding
* @see #getAccessibleKeyBindingCount
*/
- public java.lang.Object getAccessibleKeyBinding(int i);
+ public Object getAccessibleKeyBinding(int i);
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRelation.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRelation.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,39 +25,36 @@
package javax.accessibility;
-import java.util.Vector;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
/**
- * <P>Class AccessibleRelation describes a relation between the
- * object that implements the AccessibleRelation and one or more other
- * objects. The actual relations that an object has with other
- * objects are defined as an AccessibleRelationSet, which is a composed
- * set of AccessibleRelations.
- * <p>The toDisplayString method allows you to obtain the localized string
- * for a locale independent key from a predefined ResourceBundle for the
- * keys defined in this class.
- * <p>The constants in this class present a strongly typed enumeration
- * of common object roles. If the constants in this class are not sufficient
- * to describe the role of an object, a subclass should be generated
- * from this class and it should provide constants in a similar manner.
+ * Class {@code AccessibleRelation} describes a relation between the object that
+ * implements the {@code AccessibleRelation} and one or more other objects. The
+ * actual relations that an object has with other objects are defined as an
+ * {@code AccessibleRelationSet}, which is a composed set of
+ * {@code AccessibleRelations}.
+ * <p>
+ * The {@link #toDisplayString()} method allows you to obtain the localized
+ * string for a locale independent key from a predefined {@code ResourceBundle}
+ * for the keys defined in this class.
+ * <p>
+ * The constants in this class present a strongly typed enumeration of common
+ * object roles. If the constants in this class are not sufficient to describe
+ * the role of an object, a subclass should be generated from this class and it
+ * should provide constants in a similar manner.
*
- * @author Lynn Monsanto
+ * @author Lynn Monsanto
* @since 1.3
*/
public class AccessibleRelation extends AccessibleBundle {
- /*
- * The group of objects that participate in the relation.
- * The relation may be one-to-one or one-to-many. For
- * example, in the case of a LABEL_FOR relation, the target
- * vector would contain a list of objects labeled by the object
- * that implements this AccessibleRelation. In the case of a
- * MEMBER_OF relation, the target vector would contain all
- * of the components that are members of the same group as the
- * object that implements this AccessibleRelation.
+ /**
+ * The group of objects that participate in the relation. The relation may
+ * be one-to-one or one-to-many. For example, in the case of a
+ * {@code LABEL_FOR} relation, the target vector would contain a list of
+ * objects labeled by the object that implements this
+ * {@code AccessibleRelation}. In the case of a {@code MEMBER_OF} relation,
+ * the target vector would contain all of the components that are members of
+ * the same group as the object that implements this
+ * {@code AccessibleRelation}.
*/
private Object [] target = new Object[0];
@@ -84,8 +81,7 @@
public static final String LABELED_BY = new String("labeledBy");
/**
- * Indicates an object is a member of a group of one or more
- * target objects.
+ * Indicates an object is a member of a group of one or more target objects.
*
* @see #getTarget
* @see #CONTROLLER_FOR
@@ -96,8 +92,7 @@
public static final String MEMBER_OF = new String("memberOf");
/**
- * Indicates an object is a controller for one or more target
- * objects.
+ * Indicates an object is a controller for one or more target objects.
*
* @see #getTarget
* @see #CONTROLLED_BY
@@ -108,8 +103,7 @@
public static final String CONTROLLER_FOR = new String("controllerFor");
/**
- * Indicates an object is controlled by one or more target
- * objects.
+ * Indicates an object is controlled by one or more target objects.
*
* @see #getTarget
* @see #CONTROLLER_FOR
@@ -120,83 +114,73 @@
public static final String CONTROLLED_BY = new String("controlledBy");
/**
- * Indicates an object is logically contiguous with a second
- * object where the second object occurs after the object.
- * An example is a paragraph of text that runs to the end of
- * a page and continues on the next page with an intervening
- * text footer and/or text header. The two parts of
- * the paragraph are separate text elements but are related
- * in that the second element is a continuation
- * of the first
- * element. In other words, the first element "flows to"
- * the second element.
+ * Indicates an object is logically contiguous with a second object where
+ * the second object occurs after the object. An example is a paragraph of
+ * text that runs to the end of a page and continues on the next page with
+ * an intervening text footer and/or text header. The two parts of the
+ * paragraph are separate text elements but are related in that the second
+ * element is a continuation of the first element. In other words, the first
+ * element "flows to" the second element.
*
* @since 1.5
*/
public static final String FLOWS_TO = "flowsTo";
/**
- * Indicates an object is logically contiguous with a second
- * object where the second object occurs before the object.
- * An example is a paragraph of text that runs to the end of
- * a page and continues on the next page with an intervening
- * text footer and/or text header. The two parts of
- * the paragraph are separate text elements but are related
- * in that the second element is a continuation of the first
- * element. In other words, the second element "flows from"
- * the second element.
+ * Indicates an object is logically contiguous with a second object where
+ * the second object occurs before the object. An example is a paragraph of
+ * text that runs to the end of a page and continues on the next page with
+ * an intervening text footer and/or text header. The two parts of the
+ * paragraph are separate text elements but are related in that the second
+ * element is a continuation of the first element. In other words, the
+ * second element "flows from" the second element.
*
* @since 1.5
*/
public static final String FLOWS_FROM = "flowsFrom";
/**
- * Indicates that an object is a subwindow of one or more
- * objects.
+ * Indicates that an object is a subwindow of one or more objects.
*
* @since 1.5
*/
public static final String SUBWINDOW_OF = "subwindowOf";
/**
- * Indicates that an object is a parent window of one or more
- * objects.
+ * Indicates that an object is a parent window of one or more objects.
*
* @since 1.5
*/
public static final String PARENT_WINDOW_OF = "parentWindowOf";
/**
- * Indicates that an object has one or more objects
- * embedded in it.
+ * Indicates that an object has one or more objects embedded in it.
*
* @since 1.5
*/
public static final String EMBEDS = "embeds";
/**
- * Indicates that an object is embedded in one or more
- * objects.
+ * Indicates that an object is embedded in one or more objects.
*
* @since 1.5
*/
public static final String EMBEDDED_BY = "embeddedBy";
/**
- * Indicates that an object is a child node of one
- * or more objects.
+ * Indicates that an object is a child node of one or more objects.
*
* @since 1.5
*/
public static final String CHILD_NODE_OF = "childNodeOf";
/**
- * Identifies that the target group for a label has changed
+ * Identifies that the target group for a label has changed.
*/
public static final String LABEL_FOR_PROPERTY = "labelForProperty";
/**
- * Identifies that the objects that are doing the labeling have changed
+ * Identifies that the objects that are doing the labeling have changed.
*/
public static final String LABELED_BY_PROPERTY = "labeledByProperty";
@@ -206,34 +190,33 @@
public static final String MEMBER_OF_PROPERTY = "memberOfProperty";
/**
- * Identifies that the controller for the target object has changed
+ * Identifies that the controller for the target object has changed.
*/
public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty";
/**
* Identifies that the target object that is doing the controlling has
- * changed
+ * changed.
*/
public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty";
/**
- * Indicates the FLOWS_TO relation between two objects
- * has changed.
+ * Indicates the {@code FLOWS_TO} relation between two objects has changed.
*
* @since 1.5
*/
public static final String FLOWS_TO_PROPERTY = "flowsToProperty";
/**
- * Indicates the FLOWS_FROM relation between two objects
- * has changed.
+ * Indicates the {@code FLOWS_FROM} relation between two objects has
+ * changed.
*
* @since 1.5
*/
public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty";
/**
- * Indicates the SUBWINDOW_OF relation between two or more objects
+ * Indicates the {@code SUBWINDOW_OF} relation between two or more objects
* has changed.
*
* @since 1.5
@@ -241,23 +224,23 @@
public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty";
/**
- * Indicates the PARENT_WINDOW_OF relation between two or more objects
- * has changed.
+ * Indicates the {@code PARENT_WINDOW_OF} relation between two or more
+ * objects has changed.
*
* @since 1.5
*/
public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty";
/**
- * Indicates the EMBEDS relation between two or more objects
- * has changed.
+ * Indicates the {@code EMBEDS} relation between two or more objects has
+ * changed.
*
* @since 1.5
*/
public static final String EMBEDS_PROPERTY = "embedsProperty";
/**
- * Indicates the EMBEDDED_BY relation between two or more objects
+ * Indicates the {@code EMBEDDED_BY} relation between two or more objects
* has changed.
*
* @since 1.5
@@ -265,7 +248,7 @@
public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty";
/**
- * Indicates the CHILD_NODE_OF relation between two or more objects
+ * Indicates the {@code CHILD_NODE_OF} relation between two or more objects
* has changed.
*
* @since 1.5
@@ -273,12 +256,13 @@
public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty";
/**
- * Create a new AccessibleRelation using the given locale independent key.
- * The key String should be a locale independent key for the relation.
- * It is not intended to be used as the actual String to display
- * to the user. To get the localized string, use toDisplayString.
+ * Create a new {@code AccessibleRelation} using the given locale
+ * independent key. The key {@code String} should be a locale independent
+ * key for the relation. It is not intended to be used as the actual
+ * {@code String} to display to the user. To get the localized string, use
+ * {@link #toDisplayString()}.
*
- * @param key the locale independent name of the relation.
+ * @param key the locale independent name of the relation
* @see AccessibleBundle#toDisplayString
*/
public AccessibleRelation(String key) {
@@ -287,13 +271,14 @@
}
/**
- * Creates a new AccessibleRelation using the given locale independent key.
- * The key String should be a locale independent key for the relation.
- * It is not intended to be used as the actual String to display
- * to the user. To get the localized string, use toDisplayString.
+ * Creates a new {@code AccessibleRelation} using the given locale
+ * independent key. The key {@code String} should be a locale independent
+ * key for the relation. It is not intended to be used as the actual
+ * {@code String} to display to the user. To get the localized string, use
+ * {@link #toDisplayString()}.
*
- * @param key the locale independent name of the relation.
- * @param target the target object for this relation
+ * @param key the locale independent name of the relation
+ * @param target the target object for this relation
* @see AccessibleBundle#toDisplayString
*/
public AccessibleRelation(String key, Object target) {
@@ -303,25 +288,25 @@
}
/**
- * Creates a new AccessibleRelation using the given locale independent key.
- * The key String should be a locale independent key for the relation.
- * It is not intended to be used as the actual String to display
- * to the user. To get the localized string, use toDisplayString.
+ * Creates a new {@code AccessibleRelation} using the given locale
+ * independent key. The key {@code String} should be a locale independent
+ * key for the relation. It is not intended to be used as the actual
+ * {@code String} to display to the user. To get the localized string, use
+ * {@link #toDisplayString()}.
*
- * @param key the locale independent name of the relation.
- * @param target the target object(s) for this relation
+ * @param key the locale independent name of the relation
+ * @param target the target object(s) for this relation
* @see AccessibleBundle#toDisplayString
*/
- public AccessibleRelation(String key, Object [] target) {
+ public AccessibleRelation(String key, Object[] target) {
this.key = key;
this.target = target;
}
/**
- * Returns the key for this relation
+ * Returns the key for this relation.
*
* @return the key for this relation
- *
* @see #CONTROLLER_FOR
* @see #CONTROLLED_BY
* @see #LABEL_FOR
@@ -333,7 +318,7 @@
}
/**
- * Returns the target objects for this relation
+ * Returns the target objects for this relation.
*
* @return an array containing the target objects for this relation
*/
@@ -349,9 +334,9 @@
}
/**
- * Sets the target object for this relation
+ * Sets the target object for this relation.
*
- * @param target the target object for this relation
+ * @param target the target object for this relation
*/
public void setTarget(Object target) {
this.target = new Object[1];
@@ -359,9 +344,9 @@
}
/**
- * Sets the target objects for this relation
+ * Sets the target objects for this relation.
*
- * @param target an array containing the target objects for this relation
+ * @param target an array containing the target objects for this relation
*/
public void setTarget(Object [] target) {
this.target = target;
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRelationSet.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRelationSet.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,24 +26,22 @@
package javax.accessibility;
import java.util.Vector;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
- * Class AccessibleRelationSet determines a component's relation set. The
- * relation set of a component is a set of AccessibleRelation objects that
- * describe the component's relationships with other components.
+ * Class {@code AccessibleRelationSet} determines a component's relation set.
+ * The relation set of a component is a set of {@code AccessibleRelation}
+ * objects that describe the component's relationships with other components.
*
+ * @author Lynn Monsanto
* @see AccessibleRelation
- *
- * @author Lynn Monsanto
* @since 1.3
*/
public class AccessibleRelationSet {
/**
- * Each entry in the Vector represents an AccessibleRelation.
+ * Each entry in the {@code Vector} represents an
+ * {@code AccessibleRelation}.
+ *
* @see #add
* @see #addAll
* @see #remove
@@ -63,11 +61,11 @@
}
/**
- * Creates a new relation with the initial set of relations contained in
- * the array of relations passed in. Duplicate entries are ignored.
+ * Creates a new relation with the initial set of relations contained in the
+ * array of relations passed in. Duplicate entries are ignored.
*
- * @param relations an array of AccessibleRelation describing the
- * relation set.
+ * @param relations an array of {@code AccessibleRelation} describing the
+ * relation set
*/
public AccessibleRelationSet(AccessibleRelation[] relations) {
if (relations.length != 0) {
@@ -79,14 +77,14 @@
}
/**
- * Adds a new relation to the current relation set. If the relation
- * is already in the relation set, the target(s) of the specified
- * relation is merged with the target(s) of the existing relation.
- * Otherwise, the new relation is added to the relation set.
+ * Adds a new relation to the current relation set. If the relation is
+ * already in the relation set, the target(s) of the specified relation is
+ * merged with the target(s) of the existing relation. Otherwise, the new
+ * relation is added to the relation set.
*
- * @param relation the relation to add to the relation set
- * @return true if relation is added to the relation set; false if the
- * relation set is unchanged
+ * @param relation the relation to add to the relation set
+ * @return {@code true} if relation is added to the relation set;
+ * {@code false} if the relation set is unchanged
*/
public boolean add(AccessibleRelation relation) {
if (relations == null) {
@@ -117,10 +115,11 @@
}
/**
- * Adds all of the relations to the existing relation set. Duplicate
- * entries are ignored.
+ * Adds all of the relations to the existing relation set. Duplicate entries
+ * are ignored.
*
- * @param relations AccessibleRelation array describing the relation set.
+ * @param relations {@code AccessibleRelation} array describing the
+ * relation set
*/
public void addAll(AccessibleRelation[] relations) {
if (relations.length != 0) {
@@ -134,15 +133,14 @@
}
/**
- * Removes a relation from the current relation set. If the relation
- * is not in the set, the relation set will be unchanged and the
- * return value will be false. If the relation is in the relation
- * set, it will be removed from the set and the return value will be
- * true.
+ * Removes a relation from the current relation set. If the relation is not
+ * in the set, the relation set will be unchanged and the return value will
+ * be {@code false}. If the relation is in the relation set, it will be
+ * removed from the set and the return value will be {@code true}.
*
- * @param relation the relation to remove from the relation set
- * @return true if the relation is in the relation set; false if the
- * relation set is unchanged
+ * @param relation the relation to remove from the relation set
+ * @return {@code true} if the relation is in the relation set;
+ * {@code false} if the relation set is unchanged
*/
public boolean remove(AccessibleRelation relation) {
if (relations == null) {
@@ -163,6 +161,7 @@
/**
* Returns the number of relations in the relation set.
+ *
* @return the number of relations in the relation set
*/
public int size() {
@@ -174,10 +173,12 @@
}
/**
- * Returns whether the relation set contains a relation
- * that matches the specified key.
- * @param key the AccessibleRelation key
- * @return true if the relation is in the relation set; otherwise false
+ * Returns whether the relation set contains a relation that matches the
+ * specified key.
+ *
+ * @param key the {@code AccessibleRelation} key
+ * @return {@code true} if the relation is in the relation set; otherwise
+ * {@code false}
*/
public boolean contains(String key) {
return get(key) != null;
@@ -185,9 +186,10 @@
/**
* Returns the relation that matches the specified key.
- * @param key the AccessibleRelation key
+ *
+ * @param key the {@code AccessibleRelation} key
* @return the relation, if one exists, that matches the specified key.
- * Otherwise, null is returned.
+ * Otherwise, {@code null} is returned.
*/
public AccessibleRelation get(String key) {
if (relations == null) {
@@ -205,8 +207,10 @@
}
/**
- * Returns the current relation set as an array of AccessibleRelation
- * @return AccessibleRelation array contacting the current relation.
+ * Returns the current relation set as an array of
+ * {@code AccessibleRelation}.
+ *
+ * @return {@code AccessibleRelation} array contacting the current relation
*/
public AccessibleRelation[] toArray() {
if (relations == null) {
@@ -222,10 +226,10 @@
}
/**
- * Creates a localized String representing all the relations in the set
+ * Creates a localized string representing all the relations in the set
* using the default locale.
*
- * @return comma separated localized String
+ * @return comma separated localized string
* @see AccessibleBundle#toDisplayString
*/
public String toString() {
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleResourceBundle.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleResourceBundle.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,19 +29,20 @@
/**
* A resource bundle containing the localized strings in the accessibility
- * package. This is meant only for internal use by Java Accessibility and
- * is not meant to be used by assistive technologies or applications.
+ * package. This is meant only for internal use by Java Accessibility and is not
+ * meant to be used by assistive technologies or applications.
*
- * @author Willie Walker
- * @deprecated This class is deprecated as of version 1.3 of the
- * Java Platform.
+ * @author Willie Walker
+ * @deprecated This class is deprecated as of version 1.3 of the Java Platform
*/
@Deprecated
public class AccessibleResourceBundle extends ListResourceBundle {
/**
- * Returns the mapping between the programmatic keys and the
- * localized display strings.
+ * Returns the mapping between the programmatic keys and the localized
+ * display strings.
+ *
+ * @return an array of an {@code Object} array representing a key-value pair
*/
public Object[][] getContents() {
// The table holding the mapping between the programmatic keys
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRole.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRole.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,32 +25,30 @@
package javax.accessibility;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
/**
- * <P>Class AccessibleRole determines the role of a component. The role of a
- * component describes its generic function. (E.G.,
-* "push button," "table," or "list.")
- * <p>The toDisplayString method allows you to obtain the localized string
- * for a locale independent key from a predefined ResourceBundle for the
- * keys defined in this class.
- * <p>The constants in this class present a strongly typed enumeration
- * of common object roles. A public constructor for this class has been
- * purposely omitted and applications should use one of the constants
- * from this class. If the constants in this class are not sufficient
- * to describe the role of an object, a subclass should be generated
- * from this class and it should provide constants in a similar manner.
+ * Class {@code AccessibleRole} determines the role of a component. The role of
+ * a component describes its generic function. (E.G., "push button," "table," or
+ * "list.")
+ * <p>
+ * The {@link #toDisplayString()} method allows you to obtain the localized
+ * string for a locale independent key from a predefined {@code ResourceBundle}
+ * for the keys defined in this class.
+ * <p>
+ * The constants in this class present a strongly typed enumeration of common
+ * object roles. A public constructor for this class has been purposely omitted
+ * and applications should use one of the constants from this class. If the
+ * constants in this class are not sufficient to describe the role of an object,
+ * a subclass should be generated from this class and it should provide
+ * constants in a similar manner.
*
- * @author Willie Walker
- * @author Peter Korn
- * @author Lynn Monsanto
+ * @author Willie Walker
+ * @author Peter Korn
+ * @author Lynn Monsanto
*/
public class AccessibleRole extends AccessibleBundle {
-// If you add or remove anything from here, make sure you
-// update AccessibleResourceBundle.java.
+ // If you add or remove anything from here, make sure you
+ // update AccessibleResourceBundle.java.
/**
* Object is used to alert the user about something.
@@ -65,8 +63,8 @@
= new AccessibleRole("columnheader");
/**
- * Object that can be drawn into and is used to trap
- * events.
+ * Object that can be drawn into and is used to trap events.
+ *
* @see #FRAME
* @see #GLASS_PANE
* @see #LAYERED_PANE
@@ -75,14 +73,15 @@
= new AccessibleRole("canvas");
/**
- * A list of choices the user can select from. Also optionally
- * allows the user to enter a choice of their own.
+ * A list of choices the user can select from. Also optionally allows the
+ * user to enter a choice of their own.
*/
public static final AccessibleRole COMBO_BOX
= new AccessibleRole("combobox");
/**
- * An iconified internal frame in a DESKTOP_PANE.
+ * An iconified internal frame in a {@code DESKTOP_PANE}.
+ *
* @see #DESKTOP_PANE
* @see #INTERNAL_FRAME
*/
@@ -90,11 +89,12 @@
= new AccessibleRole("desktopicon");
/**
- * An object containing a collection of {@code Accessibles} that
- * together represents {@code HTML} content. The child
- * {@code Accessibles} would include objects implementing
- * {@code AccessibleText}, {@code AccessibleHypertext},
- * {@code AccessibleIcon}, and other interfaces.
+ * An object containing a collection of {@code Accessibles} that together
+ * represents {@code HTML} content. The child {@code Accessibles} would
+ * include objects implementing {@code AccessibleText},
+ * {@code AccessibleHypertext}, {@code AccessibleIcon}, and other
+ * interfaces.
+ *
* @see #HYPERLINK
* @see AccessibleText
* @see AccessibleHypertext
@@ -106,10 +106,10 @@
= new AccessibleRole("htmlcontainer");
/**
- * A frame-like object that is clipped by a desktop pane. The
- * desktop pane, internal frame, and desktop icon objects are
- * often used to create multiple document interfaces within an
- * application.
+ * A frame-like object that is clipped by a desktop pane. The desktop pane,
+ * internal frame, and desktop icon objects are often used to create
+ * multiple document interfaces within an application.
+ *
* @see #DESKTOP_ICON
* @see #DESKTOP_PANE
* @see #FRAME
@@ -118,8 +118,9 @@
= new AccessibleRole("internalframe");
/**
- * A pane that supports internal frames and
- * iconified versions of those internal frames.
+ * A pane that supports internal frames and iconified versions of those
+ * internal frames.
+ *
* @see #DESKTOP_ICON
* @see #INTERNAL_FRAME
*/
@@ -127,7 +128,8 @@
= new AccessibleRole("desktoppane");
/**
- * A specialized pane whose primary use is inside a DIALOG
+ * A specialized pane whose primary use is inside a {@code DIALOG}.
+ *
* @see #DIALOG
*/
public static final AccessibleRole OPTION_PANE
@@ -135,6 +137,7 @@
/**
* A top level window with no title or border.
+ *
* @see #FRAME
* @see #DIALOG
*/
@@ -142,8 +145,9 @@
= new AccessibleRole("window");
/**
- * A top level window with a title bar, border, menu bar, etc. It is
- * often used as the primary window for an application.
+ * A top level window with a title bar, border, menu bar, etc. It is often
+ * used as the primary window for an application.
+ *
* @see #DIALOG
* @see #CANVAS
* @see #WINDOW
@@ -152,9 +156,10 @@
= new AccessibleRole("frame");
/**
- * A top level window with title bar and a border. A dialog is similar
- * to a frame, but it has fewer properties and is often used as a
- * secondary window for an application.
+ * A top level window with title bar and a border. A dialog is similar to a
+ * frame, but it has fewer properties and is often used as a secondary
+ * window for an application.
+ *
* @see #FRAME
* @see #WINDOW
*/
@@ -169,34 +174,34 @@
/**
- * A pane that allows the user to navigate through
- * and select the contents of a directory. May be used
- * by a file chooser.
+ * A pane that allows the user to navigate through and select the contents
+ * of a directory. May be used by a file chooser.
+ *
* @see #FILE_CHOOSER
*/
public static final AccessibleRole DIRECTORY_PANE
= new AccessibleRole("directorypane");
/**
- * A specialized dialog that displays the files in the directory
- * and lets the user select a file, browse a different directory,
- * or specify a filename. May use the directory pane to show the
- * contents of a directory.
+ * A specialized dialog that displays the files in the directory and lets
+ * the user select a file, browse a different directory, or specify a
+ * filename. May use the directory pane to show the contents of a directory.
+ *
* @see #DIRECTORY_PANE
*/
public static final AccessibleRole FILE_CHOOSER
= new AccessibleRole("filechooser");
/**
- * An object that fills up space in a user interface. It is often
- * used in interfaces to tweak the spacing between components,
- * but serves no other purpose.
+ * An object that fills up space in a user interface. It is often used in
+ * interfaces to tweak the spacing between components, but serves no other
+ * purpose.
*/
public static final AccessibleRole FILLER
= new AccessibleRole("filler");
/**
- * A hypertext anchor
+ * A hypertext anchor.
*/
public static final AccessibleRole HYPERLINK
= new AccessibleRole("hyperlink");
@@ -216,6 +221,7 @@
/**
* A specialized pane that has a glass pane and a layered pane as its
* children.
+ *
* @see #GLASS_PANE
* @see #LAYERED_PANE
*/
@@ -223,8 +229,8 @@
= new AccessibleRole("rootpane");
/**
- * A pane that is guaranteed to be painted on top
- * of all panes beneath it.
+ * A pane that is guaranteed to be painted on top of all panes beneath it.
+ *
* @see #ROOT_PANE
* @see #CANVAS
*/
@@ -233,9 +239,10 @@
/**
* A specialized pane that allows its children to be drawn in layers,
- * providing a form of stacking order. This is usually the pane that
- * holds the menu bar as well as the pane that contains most of the
- * visual components in a window.
+ * providing a form of stacking order. This is usually the pane that holds
+ * the menu bar as well as the pane that contains most of the visual
+ * components in a window.
+ *
* @see #GLASS_PANE
* @see #ROOT_PANE
*/
@@ -243,9 +250,10 @@
= new AccessibleRole("layeredpane");
/**
- * An object that presents a list of objects to the user and allows the
- * user to select one or more of them. A list is usually contained
- * within a scroll pane.
+ * An object that presents a list of objects to the user and allows the user
+ * to select one or more of them. A list is usually contained within a
+ * scroll pane.
+ *
* @see #SCROLL_PANE
* @see #LIST_ITEM
*/
@@ -253,8 +261,9 @@
= new AccessibleRole("list");
/**
- * An object that presents an element in a list. A list is usually
- * contained within a scroll pane.
+ * An object that presents an element in a list. A list is usually contained
+ * within a scroll pane.
+ *
* @see #SCROLL_PANE
* @see #LIST
*/
@@ -262,10 +271,10 @@
= new AccessibleRole("listitem");
/**
- * An object usually drawn at the top of the primary dialog box of
- * an application that contains a list of menus the user can choose
- * from. For example, a menu bar might contain menus for "File,"
- * "Edit," and "Help."
+ * An object usually drawn at the top of the primary dialog box of an
+ * application that contains a list of menus the user can choose from. For
+ * example, a menu bar might contain menus for "File," "Edit," and "Help."
+ *
* @see #MENU
* @see #POPUP_MENU
* @see #LAYERED_PANE
@@ -274,9 +283,9 @@
= new AccessibleRole("menubar");
/**
- * A temporary window that is usually used to offer the user a
- * list of choices, and then hides when the user selects one of
- * those choices.
+ * A temporary window that is usually used to offer the user a list of
+ * choices, and then hides when the user selects one of those choices.
+ *
* @see #MENU
* @see #MENU_ITEM
*/
@@ -284,12 +293,12 @@
= new AccessibleRole("popupmenu");
/**
- * An object usually found inside a menu bar that contains a list
- * of actions the user can choose from. A menu can have any object
- * as its children, but most often they are menu items, other menus,
- * or rudimentary objects such as radio buttons, check boxes, or
- * separators. For example, an application may have an "Edit" menu
- * that contains menu items for "Cut" and "Paste."
+ * An object usually found inside a menu bar that contains a list of actions
+ * the user can choose from. A menu can have any object as its children, but
+ * most often they are menu items, other menus, or rudimentary objects such
+ * as radio buttons, check boxes, or separators. For example, an application
+ * may have an "Edit" menu that contains menu items for "Cut" and "Paste."
+ *
* @see #MENU_BAR
* @see #MENU_ITEM
* @see #SEPARATOR
@@ -301,10 +310,11 @@
= new AccessibleRole("menu");
/**
- * An object usually contained in a menu that presents an action
- * the user can choose. For example, the "Cut" menu item in an
- * "Edit" menu would be an action the user can select to cut the
- * selected area of text in a document.
+ * An object usually contained in a menu that presents an action the user
+ * can choose. For example, the "Cut" menu item in an "Edit" menu would be
+ * an action the user can select to cut the selected area of text in a
+ * document.
+ *
* @see #MENU_BAR
* @see #SEPARATOR
* @see #POPUP_MENU
@@ -313,11 +323,11 @@
= new AccessibleRole("menuitem");
/**
- * An object usually contained in a menu to provide a visual
- * and logical separation of the contents in a menu. For example,
- * the "File" menu of an application might contain menu items for
- * "Open," "Close," and "Exit," and will place a separator between
- * "Close" and "Exit" menu items.
+ * An object usually contained in a menu to provide a visual and logical
+ * separation of the contents in a menu. For example, the "File" menu of an
+ * application might contain menu items for "Open," "Close," and "Exit," and
+ * will place a separator between "Close" and "Exit" menu items.
+ *
* @see #MENU
* @see #MENU_ITEM
*/
@@ -325,19 +335,21 @@
= new AccessibleRole("separator");
/**
- * An object that presents a series of panels (or page tabs), one at a
- * time, through some mechanism provided by the object. The most common
- * mechanism is a list of tabs at the top of the panel. The children of
- * a page tab list are all page tabs.
+ * An object that presents a series of panels (or page tabs), one at a time,
+ * through some mechanism provided by the object. The most common mechanism
+ * is a list of tabs at the top of the panel. The children of a page tab
+ * list are all page tabs.
+ *
* @see #PAGE_TAB
*/
public static final AccessibleRole PAGE_TAB_LIST
= new AccessibleRole("pagetablist");
/**
- * An object that is a child of a page tab list. Its sole child is
- * the panel that is to be presented to the user when the user
- * selects the page tab from the list of tabs in the page tab list.
+ * An object that is a child of a page tab list. Its sole child is the panel
+ * that is to be presented to the user when the user selects the page tab
+ * from the list of tabs in the page tab list.
+ *
* @see #PAGE_TAB_LIST
*/
public static final AccessibleRole PAGE_TAB
@@ -356,8 +368,8 @@
= new AccessibleRole("progressbar");
/**
- * A text object used for passwords, or other places where the
- * text contents is not shown visibly to the user
+ * A text object used for passwords, or other places where the text contents
+ * is not shown visibly to the user.
*/
public static final AccessibleRole PASSWORD_TEXT
= new AccessibleRole("passwordtext");
@@ -365,6 +377,7 @@
/**
* An object the user can manipulate to tell the application to do
* something.
+ *
* @see #CHECK_BOX
* @see #TOGGLE_BUTTON
* @see #RADIO_BUTTON
@@ -373,8 +386,9 @@
= new AccessibleRole("pushbutton");
/**
- * A specialized push button that can be checked or unchecked, but
- * does not provide a separate indicator for the current state.
+ * A specialized push button that can be checked or unchecked, but does not
+ * provide a separate indicator for the current state.
+ *
* @see #PUSH_BUTTON
* @see #CHECK_BOX
* @see #RADIO_BUTTON
@@ -383,8 +397,9 @@
= new AccessibleRole("togglebutton");
/**
- * A choice that can be checked or unchecked and provides a
- * separate indicator for the current state.
+ * A choice that can be checked or unchecked and provides a separate
+ * indicator for the current state.
+ *
* @see #PUSH_BUTTON
* @see #TOGGLE_BUTTON
* @see #RADIO_BUTTON
@@ -393,8 +408,9 @@
= new AccessibleRole("checkbox");
/**
- * A specialized check box that will cause other radio buttons in the
- * same group to become unchecked when this one is checked.
+ * A specialized check box that will cause other radio buttons in the same
+ * group to become unchecked when this one is checked.
+ *
* @see #PUSH_BUTTON
* @see #TOGGLE_BUTTON
* @see #CHECK_BOX
@@ -409,8 +425,9 @@
= new AccessibleRole("rowheader");
/**
- * An object that allows a user to incrementally view a large amount
- * of information. Its children can include scroll bars and a viewport.
+ * An object that allows a user to incrementally view a large amount of
+ * information. Its children can include scroll bars and a viewport.
+ *
* @see #SCROLL_BAR
* @see #VIEWPORT
*/
@@ -418,24 +435,26 @@
= new AccessibleRole("scrollpane");
/**
- * An object usually used to allow a user to incrementally view a
- * large amount of data. Usually used only by a scroll pane.
+ * An object usually used to allow a user to incrementally view a large
+ * amount of data. Usually used only by a scroll pane.
+ *
* @see #SCROLL_PANE
*/
public static final AccessibleRole SCROLL_BAR
= new AccessibleRole("scrollbar");
/**
- * An object usually used in a scroll pane. It represents the portion
- * of the entire data that the user can see. As the user manipulates
- * the scroll bars, the contents of the viewport can change.
+ * An object usually used in a scroll pane. It represents the portion of the
+ * entire data that the user can see. As the user manipulates the scroll
+ * bars, the contents of the viewport can change.
+ *
* @see #SCROLL_PANE
*/
public static final AccessibleRole VIEWPORT
= new AccessibleRole("viewport");
/**
- * An object that allows the user to select from a bounded range. For
+ * An object that allows the user to select from a bounded range. For
* example, a slider might be used to select a number between 0 and 100.
*/
public static final AccessibleRole SLIDER
@@ -443,54 +462,56 @@
/**
* A specialized panel that presents two other panels at the same time.
- * Between the two panels is a divider the user can manipulate to make
- * one panel larger and the other panel smaller.
+ * Between the two panels is a divider the user can manipulate to make one
+ * panel larger and the other panel smaller.
*/
public static final AccessibleRole SPLIT_PANE
= new AccessibleRole("splitpane");
/**
- * An object used to present information in terms of rows and columns.
- * An example might include a spreadsheet application.
+ * An object used to present information in terms of rows and columns. An
+ * example might include a spreadsheet application.
*/
public static final AccessibleRole TABLE
= new AccessibleRole("table");
/**
- * An object that presents text to the user. The text is usually
- * editable by the user as opposed to a label.
+ * An object that presents text to the user. The text is usually editable by
+ * the user as opposed to a label.
+ *
* @see #LABEL
*/
public static final AccessibleRole TEXT
= new AccessibleRole("text");
/**
- * An object used to present hierarchical information to the user.
- * The individual nodes in the tree can be collapsed and expanded
- * to provide selective disclosure of the tree's contents.
+ * An object used to present hierarchical information to the user. The
+ * individual nodes in the tree can be collapsed and expanded to provide
+ * selective disclosure of the tree's contents.
*/
public static final AccessibleRole TREE
= new AccessibleRole("tree");
/**
- * A bar or palette usually composed of push buttons or toggle buttons.
- * It is often used to provide the most frequently used functions for an
+ * A bar or palette usually composed of push buttons or toggle buttons. It
+ * is often used to provide the most frequently used functions for an
* application.
*/
public static final AccessibleRole TOOL_BAR
= new AccessibleRole("toolbar");
/**
- * An object that provides information about another object. The
- * accessibleDescription property of the tool tip is often displayed
- * to the user in a small "help bubble" when the user causes the
- * mouse to hover over the object associated with the tool tip.
+ * An object that provides information about another object. The
+ * {@code accessibleDescription} property of the tool tip is often displayed
+ * to the user in a small "help bubble" when the user causes the mouse to
+ * hover over the object associated with the tool tip.
*/
public static final AccessibleRole TOOL_TIP
= new AccessibleRole("tooltip");
/**
* An AWT component, but nothing else is known about it.
+ *
* @see #SWING_COMPONENT
* @see #UNKNOWN
*/
@@ -499,6 +520,7 @@
/**
* A Swing component, but nothing else is known about it.
+ *
* @see #AWT_COMPONENT
* @see #UNKNOWN
*/
@@ -506,8 +528,9 @@
= new AccessibleRole("swingcomponent");
/**
- * The object contains some Accessible information, but its role is
+ * The object contains some {@code Accessible} information, but its role is
* not known.
+ *
* @see #AWT_COMPONENT
* @see #SWING_COMPONENT
*/
@@ -515,42 +538,42 @@
= new AccessibleRole("unknown");
/**
- * A STATUS_BAR is an simple component that can contain
- * multiple labels of status information to the user.
+ * A {@code STATUS_BAR} is an simple component that can contain multiple
+ * labels of status information to the user.
*/
public static final AccessibleRole STATUS_BAR
= new AccessibleRole("statusbar");
/**
- * A DATE_EDITOR is a component that allows users to edit
- * java.util.Date and java.util.Time objects
+ * A {@code DATE_EDITOR} is a component that allows users to edit
+ * {@code java.util.Date} and {@code java.util.Time} objects.
*/
public static final AccessibleRole DATE_EDITOR
= new AccessibleRole("dateeditor");
/**
- * A SPIN_BOX is a simple spinner component and its main use
- * is for simple numbers.
+ * A {@code SPIN_BOX} is a simple spinner component and its main use is for
+ * simple numbers.
*/
public static final AccessibleRole SPIN_BOX
= new AccessibleRole("spinbox");
/**
- * A FONT_CHOOSER is a component that lets the user pick various
+ * A {@code FONT_CHOOSER} is a component that lets the user pick various
* attributes for fonts.
*/
public static final AccessibleRole FONT_CHOOSER
= new AccessibleRole("fontchooser");
/**
- * A GROUP_BOX is a simple container that contains a border
- * around it and contains components inside it.
+ * A {@code GROUP_BOX} is a simple container that contains a border around
+ * it and contains components inside it.
*/
public static final AccessibleRole GROUP_BOX
= new AccessibleRole("groupbox");
/**
- * A text header
+ * A text header.
*
* @since 1.5
*/
@@ -558,7 +581,7 @@
new AccessibleRole("header");
/**
- * A text footer
+ * A text footer.
*
* @since 1.5
*/
@@ -566,7 +589,7 @@
new AccessibleRole("footer");
/**
- * A text paragraph
+ * A text paragraph.
*
* @since 1.5
*/
@@ -574,7 +597,7 @@
new AccessibleRole("paragraph");
/**
- * A ruler is an object used to measure distance
+ * A ruler is an object used to measure distance.
*
* @since 1.5
*/
@@ -582,9 +605,8 @@
new AccessibleRole("ruler");
/**
- * A role indicating the object acts as a formula for
- * calculating a value. An example is a formula in
- * a spreadsheet cell.
+ * A role indicating the object acts as a formula for calculating a value.
+ * An example is a formula in a spreadsheet cell.
*
* @since 1.5
*/
@@ -592,8 +614,7 @@
new AccessibleRole("editbar");
/**
- * A role indicating the object monitors the progress
- * of some operation.
+ * A role indicating the object monitors the progress of some operation.
*
* @since 1.5
*/
@@ -643,16 +664,16 @@
// = new AccessibleRole("treenode");
/**
- * Creates a new AccessibleRole using the given locale independent key.
- * This should not be a public method. Instead, it is used to create
+ * Creates a new {@code AccessibleRole} using the given locale independent
+ * key. This should not be a public method. Instead, it is used to create
* the constants in this file to make it a strongly typed enumeration.
* Subclasses of this class should enforce similar policy.
* <p>
- * The key String should be a locale independent key for the role.
- * It is not intended to be used as the actual String to display
- * to the user. To get the localized string, use toDisplayString.
+ * The key {@code String} should be a locale independent key for the role.
+ * It is not intended to be used as the actual {@code String} to display to
+ * the user. To get the localized string, use {@link #toDisplayString()}.
*
- * @param key the locale independent name of the role.
+ * @param key the locale independent name of the role
* @see AccessibleBundle#toDisplayString
*/
protected AccessibleRole(String key) {
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleSelection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleSelection.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,89 +26,90 @@
package javax.accessibility;
/**
- * This AccessibleSelection interface
- * provides the standard mechanism for an assistive technology to determine
- * what the current selected children are, as well as modify the selection set.
- * Any object that has children that can be selected should support
- * the AccessibleSelection interface. Applications can determine if an object supports the
- * AccessibleSelection interface by first obtaining its AccessibleContext (see
- * {@link Accessible}) and then calling the
- * {@link AccessibleContext#getAccessibleSelection} method.
- * If the return value is not null, the object supports this interface.
+ * This {@code AccessibleSelection} interface provides the standard mechanism
+ * for an assistive technology to determine what the current selected children
+ * are, as well as modify the selection set. Any object that has children that
+ * can be selected should support the {@code AccessibleSelection} interface.
+ * Applications can determine if an object supports the
+ * {@code AccessibleSelection} interface by first obtaining its
+ * {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleSelection} method. If the return value
+ * is not {@code null}, the object supports this interface.
*
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleSelection
- *
- * @author Peter Korn
- * @author Hans Muller
- * @author Willie Walker
*/
public interface AccessibleSelection {
/**
- * Returns the number of Accessible children currently selected.
- * If no children are selected, the return value will be 0.
+ * Returns the number of {@code Accessible} children currently selected. If
+ * no children are selected, the return value will be 0.
*
- * @return the number of items currently selected.
+ * @return the number of items currently selected
*/
- public int getAccessibleSelectionCount();
+ public int getAccessibleSelectionCount();
/**
- * Returns an Accessible representing the specified selected child
- * of the object. If there isn't a selection, or there are
- * fewer children selected than the integer passed in, the return
- * value will be null.
- * <p>Note that the index represents the i-th selected child, which
- * is different from the i-th child.
+ * Returns an {@code Accessible} representing the specified selected child
+ * of the object. If there isn't a selection, or there are fewer children
+ * selected than the integer passed in, the return value will be
+ * {@code null}.
+ * <p>
+ * Note that the index represents the i-th selected child, which is
+ * different from the i-th child.
*
- * @param i the zero-based index of selected children
+ * @param i the zero-based index of selected children
* @return the i-th selected child
* @see #getAccessibleSelectionCount
*/
- public Accessible getAccessibleSelection(int i);
+ public Accessible getAccessibleSelection(int i);
/**
* Determines if the current child of this object is selected.
*
- * @return true if the current child of this object is selected; else false.
- * @param i the zero-based index of the child in this Accessible object.
+ * @param i the zero-based index of the child in this {@code Accessible}
+ * object
+ * @return {@code true} if the current child of this object is selected;
+ * else {@code false}
* @see AccessibleContext#getAccessibleChild
*/
- public boolean isAccessibleChildSelected(int i);
+ public boolean isAccessibleChildSelected(int i);
/**
- * Adds the specified Accessible child of the object to the object's
- * selection. If the object supports multiple selections,
- * the specified child is added to any existing selection, otherwise
- * it replaces any existing selection in the object. If the
- * specified child is already selected, this method has no effect.
+ * Adds the specified {@code Accessible} child of the object to the object's
+ * selection. If the object supports multiple selections, the specified
+ * child is added to any existing selection, otherwise it replaces any
+ * existing selection in the object. If the specified child is already
+ * selected, this method has no effect.
*
- * @param i the zero-based index of the child
+ * @param i the zero-based index of the child
* @see AccessibleContext#getAccessibleChild
*/
- public void addAccessibleSelection(int i);
+ public void addAccessibleSelection(int i);
/**
- * Removes the specified child of the object from the object's
- * selection. If the specified item isn't currently selected, this
- * method has no effect.
+ * Removes the specified child of the object from the object's selection. If
+ * the specified item isn't currently selected, this method has no effect.
*
- * @param i the zero-based index of the child
+ * @param i the zero-based index of the child
* @see AccessibleContext#getAccessibleChild
*/
- public void removeAccessibleSelection(int i);
+ public void removeAccessibleSelection(int i);
/**
- * Clears the selection in the object, so that no children in the
- * object are selected.
+ * Clears the selection in the object, so that no children in the object are
+ * selected.
*/
- public void clearAccessibleSelection();
+ public void clearAccessibleSelection();
/**
- * Causes every child of the object to be selected
- * if the object supports multiple selections.
+ * Causes every child of the object to be selected if the object supports
+ * multiple selections.
*/
- public void selectAllAccessibleSelection();
+ public void selectAllAccessibleSelection();
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleState.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleState.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,27 +25,24 @@
package javax.accessibility;
-import java.util.Vector;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
/**
- * <P>Class AccessibleState describes a component's particular state. The actual
- * state of the component is defined as an AccessibleStateSet, which is a
- * composed set of AccessibleStates.
- * <p>The toDisplayString method allows you to obtain the localized string
- * for a locale independent key from a predefined ResourceBundle for the
- * keys defined in this class.
- * <p>The constants in this class present a strongly typed enumeration
- * of common object roles. A public constructor for this class has been
- * purposely omitted and applications should use one of the constants
- * from this class. If the constants in this class are not sufficient
- * to describe the role of an object, a subclass should be generated
- * from this class and it should provide constants in a similar manner.
+ * Class {@code AccessibleState} describes a component's particular state. The
+ * actual state of the component is defined as an {@code AccessibleStateSet},
+ * which is a composed set of {@code AccessibleStates}.
+ * <p>
+ * The {@link #toDisplayString()} method allows you to obtain the localized
+ * string for a locale independent key from a predefined {@code ResourceBundle}
+ * for the keys defined in this class.
+ * <p>
+ * The constants in this class present a strongly typed enumeration of common
+ * object roles. A public constructor for this class has been purposely omitted
+ * and applications should use one of the constants from this class. If the
+ * constants in this class are not sufficient to describe the role of an object,
+ * a subclass should be generated from this class and it should provide
+ * constants in a similar manner.
*
- * @author Willie Walker
- * @author Peter Korn
+ * @author Willie Walker
+ * @author Peter Korn
*/
public class AccessibleState extends AccessibleBundle {
@@ -53,11 +50,12 @@
// update AccessibleResourceBundle.java.
/**
- * Indicates a window is currently the active window. This includes
- * windows, dialogs, frames, etc. In addition, this state is used
- * to indicate the currently active child of a component such as a
- * list, table, or tree. For example, the active child of a list
- * is the child that is drawn with a rectangle around it.
+ * Indicates a window is currently the active window. This includes windows,
+ * dialogs, frames, etc. In addition, this state is used to indicate the
+ * currently active child of a component such as a list, table, or tree. For
+ * example, the active child of a list is the child that is drawn with a
+ * rectangle around it.
+ *
* @see AccessibleRole#WINDOW
* @see AccessibleRole#FRAME
* @see AccessibleRole#DIALOG
@@ -66,28 +64,30 @@
= new AccessibleState("active");
/**
- * Indicates this object is currently pressed. This is usually
- * associated with buttons and indicates the user has pressed a
- * mouse button while the pointer was over the button and has
- * not yet released the mouse button.
+ * Indicates this object is currently pressed. This is usually associated
+ * with buttons and indicates the user has pressed a mouse button while the
+ * pointer was over the button and has not yet released the mouse button.
+ *
* @see AccessibleRole#PUSH_BUTTON
*/
public static final AccessibleState PRESSED
= new AccessibleState("pressed");
/**
- * Indicates that the object is armed. This is usually used on buttons
- * that have been pressed but not yet released, and the mouse pointer
- * is still over the button.
+ * Indicates that the object is armed. This is usually used on buttons that
+ * have been pressed but not yet released, and the mouse pointer is still
+ * over the button.
+ *
* @see AccessibleRole#PUSH_BUTTON
*/
public static final AccessibleState ARMED
= new AccessibleState("armed");
/**
- * Indicates the current object is busy. This is usually used on objects
- * such as progress bars, sliders, or scroll bars to indicate they are
- * in a state of transition.
+ * Indicates the current object is busy. This is usually used on objects
+ * such as progress bars, sliders, or scroll bars to indicate they are in a
+ * state of transition.
+ *
* @see AccessibleRole#PROGRESS_BAR
* @see AccessibleRole#SCROLL_BAR
* @see AccessibleRole#SLIDER
@@ -96,8 +96,9 @@
= new AccessibleState("busy");
/**
- * Indicates this object is currently checked. This is usually used on
+ * Indicates this object is currently checked. This is usually used on
* objects such as toggle buttons, radio buttons, and check boxes.
+ *
* @see AccessibleRole#TOGGLE_BUTTON
* @see AccessibleRole#RADIO_BUTTON
* @see AccessibleRole#CHECK_BOX
@@ -106,19 +107,21 @@
= new AccessibleState("checked");
/**
- * Indicates the user can change the contents of this object. This
- * is usually used primarily for objects that allow the user to
- * enter text. Other objects, such as scroll bars and sliders,
- * are automatically editable if they are enabled.
+ * Indicates the user can change the contents of this object. This is
+ * usually used primarily for objects that allow the user to enter text.
+ * Other objects, such as scroll bars and sliders, are automatically
+ * editable if they are enabled.
+ *
* @see #ENABLED
*/
public static final AccessibleState EDITABLE
= new AccessibleState("editable");
/**
- * Indicates this object allows progressive disclosure of its children.
- * This is usually used with hierarchical objects such as trees and
- * is often paired with the EXPANDED or COLLAPSED states.
+ * Indicates this object allows progressive disclosure of its children. This
+ * is usually used with hierarchical objects such as trees and is often
+ * paired with the {@code EXPANDED} or {@code COLLAPSED} states.
+ *
* @see #EXPANDED
* @see #COLLAPSED
* @see AccessibleRole#TREE
@@ -127,9 +130,10 @@
= new AccessibleState("expandable");
/**
- * Indicates this object is collapsed. This is usually paired with the
- * EXPANDABLE state and is used on objects that provide progressive
+ * Indicates this object is collapsed. This is usually paired with the
+ * {@code EXPANDABLE} state and is used on objects that provide progressive
* disclosure such as trees.
+ *
* @see #EXPANDABLE
* @see #EXPANDED
* @see AccessibleRole#TREE
@@ -138,9 +142,10 @@
= new AccessibleState("collapsed");
/**
- * Indicates this object is expanded. This is usually paired with the
- * EXPANDABLE state and is used on objects that provide progressive
+ * Indicates this object is expanded. This is usually paired with the
+ * {@code EXPANDABLE} state and is used on objects that provide progressive
* disclosure such as trees.
+ *
* @see #EXPANDABLE
* @see #COLLAPSED
* @see AccessibleRole#TREE
@@ -149,18 +154,19 @@
= new AccessibleState("expanded");
/**
- * Indicates this object is enabled. The absence of this state from an
- * object's state set indicates this object is not enabled. An object
- * that is not enabled cannot be manipulated by the user. In a graphical
- * display, it is usually grayed out.
+ * Indicates this object is enabled. The absence of this state from an
+ * object's state set indicates this object is not enabled. An object that
+ * is not enabled cannot be manipulated by the user. In a graphical display,
+ * it is usually grayed out.
*/
public static final AccessibleState ENABLED
= new AccessibleState("enabled");
/**
- * Indicates this object can accept keyboard focus, which means all
- * events resulting from typing on the keyboard will normally be
- * passed to it when it has focus.
+ * Indicates this object can accept keyboard focus, which means all events
+ * resulting from typing on the keyboard will normally be passed to it when
+ * it has focus.
+ *
* @see #FOCUSED
*/
public static final AccessibleState FOCUSABLE
@@ -168,15 +174,16 @@
/**
* Indicates this object currently has the keyboard focus.
+ *
* @see #FOCUSABLE
*/
public static final AccessibleState FOCUSED
= new AccessibleState("focused");
/**
- * Indicates this object is minimized and is represented only by an
- * icon. This is usually only associated with frames and internal
- * frames.
+ * Indicates this object is minimized and is represented only by an icon.
+ * This is usually only associated with frames and internal frames.
+ *
* @see AccessibleRole#FRAME
* @see AccessibleRole#INTERNAL_FRAME
*/
@@ -184,20 +191,21 @@
= new AccessibleState("iconified");
/**
- * Indicates something must be done with this object before the
- * user can interact with an object in a different window. This
- * is usually associated only with dialogs.
+ * Indicates something must be done with this object before the user can
+ * interact with an object in a different window. This is usually associated
+ * only with dialogs.
+ *
* @see AccessibleRole#DIALOG
*/
public static final AccessibleState MODAL
= new AccessibleState("modal");
/**
- * Indicates this object paints every pixel within its
- * rectangular region. A non-opaque component paints only some of
- * its pixels, allowing the pixels underneath it to "show through".
- * A component that does not fully paint its pixels therefore
- * provides a degree of transparency.
+ * Indicates this object paints every pixel within its rectangular region. A
+ * non-opaque component paints only some of its pixels, allowing the pixels
+ * underneath it to "show through". A component that does not fully paint
+ * its pixels therefore provides a degree of transparency.
+ *
* @see Accessible#getAccessibleContext
* @see AccessibleContext#getAccessibleComponent
* @see AccessibleComponent#getBounds
@@ -207,6 +215,7 @@
/**
* Indicates the size of this object is not fixed.
+ *
* @see Accessible#getAccessibleContext
* @see AccessibleContext#getAccessibleComponent
* @see AccessibleComponent#getSize
@@ -217,8 +226,9 @@
/**
- * Indicates this object allows more than one of its children to
- * be selected at the same time.
+ * Indicates this object allows more than one of its children to be selected
+ * at the same time.
+ *
* @see Accessible#getAccessibleContext
* @see AccessibleContext#getAccessibleSelection
* @see AccessibleSelection
@@ -227,9 +237,10 @@
= new AccessibleState("multiselectable");
/**
- * Indicates this object is the child of an object that allows its
- * children to be selected, and that this child is one of those
- * children that can be selected.
+ * Indicates this object is the child of an object that allows its children
+ * to be selected, and that this child is one of those children that can be
+ * selected.
+ *
* @see #SELECTED
* @see Accessible#getAccessibleContext
* @see AccessibleContext#getAccessibleSelection
@@ -239,9 +250,10 @@
= new AccessibleState("selectable");
/**
- * Indicates this object is the child of an object that allows its
- * children to be selected, and that this child is one of those
- * children that has been selected.
+ * Indicates this object is the child of an object that allows its children
+ * to be selected, and that this child is one of those children that has
+ * been selected.
+ *
* @see #SELECTABLE
* @see Accessible#getAccessibleContext
* @see AccessibleContext#getAccessibleSelection
@@ -251,29 +263,31 @@
= new AccessibleState("selected");
/**
- * Indicates this object, the object's parent, the object's parent's
- * parent, and so on, are all visible. Note that this does not
- * necessarily mean the object is painted on the screen. It might
- * be occluded by some other showing object.
+ * Indicates this object, the object's parent, the object's parent's parent,
+ * and so on, are all visible. Note that this does not necessarily mean the
+ * object is painted on the screen. It might be occluded by some other
+ * showing object.
+ *
* @see #VISIBLE
*/
public static final AccessibleState SHOWING
= new AccessibleState("showing");
/**
- * Indicates this object is visible. Note: this means that the
- * object intends to be visible; however, it may not in fact be
- * showing on the screen because one of the objects that this object
- * is contained by is not visible.
+ * Indicates this object is visible. Note: this means that the object
+ * intends to be visible; however, it may not in fact be showing on the
+ * screen because one of the objects that this object is contained by is not
+ * visible.
+ *
* @see #SHOWING
*/
public static final AccessibleState VISIBLE
= new AccessibleState("visible");
/**
- * Indicates the orientation of this object is vertical. This is
- * usually associated with objects such as scrollbars, sliders, and
- * progress bars.
+ * Indicates the orientation of this object is vertical. This is usually
+ * associated with objects such as scrollbars, sliders, and progress bars.
+ *
* @see #VERTICAL
* @see AccessibleRole#SCROLL_BAR
* @see AccessibleRole#SLIDER
@@ -283,9 +297,9 @@
= new AccessibleState("vertical");
/**
- * Indicates the orientation of this object is horizontal. This is
- * usually associated with objects such as scrollbars, sliders, and
- * progress bars.
+ * Indicates the orientation of this object is horizontal. This is usually
+ * associated with objects such as scrollbars, sliders, and progress bars.
+ *
* @see #HORIZONTAL
* @see AccessibleRole#SCROLL_BAR
* @see AccessibleRole#SLIDER
@@ -295,39 +309,38 @@
= new AccessibleState("horizontal");
/**
- * Indicates this (text) object can contain only a single line of text
+ * Indicates this (text) object can contain only a single line of text.
*/
public static final AccessibleState SINGLE_LINE
= new AccessibleState("singleline");
/**
- * Indicates this (text) object can contain multiple lines of text
+ * Indicates this (text) object can contain multiple lines of text.
*/
public static final AccessibleState MULTI_LINE
= new AccessibleState("multiline");
/**
- * Indicates this object is transient. An assistive technology should
- * not add a PropertyChange listener to an object with transient state,
- * as that object will never generate any events. Transient objects
- * are typically created to answer Java Accessibility method queries,
- * but otherwise do not remain linked to the underlying object (for
- * example, those objects underneath lists, tables, and trees in Swing,
- * where only one actual UI Component does shared rendering duty for
- * all of the data objects underneath the actual list/table/tree elements).
+ * Indicates this object is transient. An assistive technology should not
+ * add a {@code PropertyChange} listener to an object with transient state,
+ * as that object will never generate any events. Transient objects are
+ * typically created to answer Java Accessibility method queries, but
+ * otherwise do not remain linked to the underlying object (for example,
+ * those objects underneath lists, tables, and trees in Swing, where only
+ * one actual {@code UI Component} does shared rendering duty for all of the
+ * data objects underneath the actual list/table/tree elements).
*
* @since 1.5
- *
*/
public static final AccessibleState TRANSIENT
= new AccessibleState("transient");
/**
- * Indicates this object is responsible for managing its
- * subcomponents. This is typically used for trees and tables
- * that have a large number of subcomponents and where the
- * objects are created only when needed and otherwise remain virtual.
- * The application should not manage the subcomponents directly.
+ * Indicates this object is responsible for managing its subcomponents. This
+ * is typically used for trees and tables that have a large number of
+ * subcomponents and where the objects are created only when needed and
+ * otherwise remain virtual. The application should not manage the
+ * subcomponents directly.
*
* @since 1.5
*/
@@ -335,10 +348,9 @@
= new AccessibleState ("managesDescendants");
/**
- * Indicates that the object state is indeterminate. An example
- * is selected text that is partially bold and partially not
- * bold. In this case the attributes associated with the selected
- * text are indeterminate.
+ * Indicates that the object state is indeterminate. An example is selected
+ * text that is partially bold and partially not bold. In this case the
+ * attributes associated with the selected text are indeterminate.
*
* @since 1.5
*/
@@ -346,10 +358,9 @@
= new AccessibleState ("indeterminate");
/**
- * A state indicating that text is truncated by a bounding rectangle
- * and that some of the text is not displayed on the screen. An example
- * is text in a spreadsheet cell that is truncated by the bounds of
- * the cell.
+ * A state indicating that text is truncated by a bounding rectangle and
+ * that some of the text is not displayed on the screen. An example is text
+ * in a spreadsheet cell that is truncated by the bounds of the cell.
*
* @since 1.5
*/
@@ -357,16 +368,16 @@
= new AccessibleState("truncated");
/**
- * Creates a new AccessibleState using the given locale independent key.
- * This should not be a public method. Instead, it is used to create
+ * Creates a new {@code AccessibleState} using the given locale independent
+ * key. This should not be a public method. Instead, it is used to create
* the constants in this file to make it a strongly typed enumeration.
* Subclasses of this class should enforce similar policy.
* <p>
- * The key String should be a locale independent key for the state.
- * It is not intended to be used as the actual String to display
- * to the user. To get the localized string, use toDisplayString.
+ * The key {@code String} should be a locale independent key for the state.
+ * It is not intended to be used as the actual {@code String} to display to
+ * the user. To get the localized string, use {@link #toDisplayString()}.
*
- * @param key the locale independent name of the state.
+ * @param key the locale independent name of the state
* @see AccessibleBundle#toDisplayString
*/
protected AccessibleState(String key) {
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleStateSet.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleStateSet.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,24 +26,21 @@
package javax.accessibility;
import java.util.Vector;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
- * Class AccessibleStateSet determines a component's state set. The state set
- * of a component is a set of AccessibleState objects and descriptions. E.G., The
- * current overall state of the object, such as whether it is enabled,
- * has focus, etc.
+ * Class {@code AccessibleStateSet} determines a component's state set. The
+ * state set of a component is a set of {@code AccessibleState} objects and
+ * descriptions. E.G., The current overall state of the object, such as whether
+ * it is enabled, has focus, etc.
*
+ * @author Willie Walker
* @see AccessibleState
- *
- * @author Willie Walker
*/
public class AccessibleStateSet {
/**
- * Each entry in the Vector represents an AccessibleState.
+ * Each entry in the {@code Vector} represents an {@code AccessibleState}.
+ *
* @see #add
* @see #addAll
* @see #remove
@@ -61,10 +58,11 @@
}
/**
- * Creates a new state with the initial set of states contained in
- * the array of states passed in. Duplicate entries are ignored.
+ * Creates a new state with the initial set of states contained in the array
+ * of states passed in. Duplicate entries are ignored.
*
- * @param states an array of AccessibleState describing the state set.
+ * @param states an array of {@code AccessibleState} describing the state
+ * set
*/
public AccessibleStateSet(AccessibleState[] states) {
if (states.length != 0) {
@@ -78,14 +76,14 @@
}
/**
- * Adds a new state to the current state set if it is not already
- * present. If the state is already in the state set, the state
- * set is unchanged and the return value is false. Otherwise,
- * the state is added to the state set and the return value is
- * true.
- * @param state the state to add to the state set
- * @return true if state is added to the state set; false if the state set
- * is unchanged
+ * Adds a new state to the current state set if it is not already present.
+ * If the state is already in the state set, the state set is unchanged and
+ * the return value is {@code false}. Otherwise, the state is added to the
+ * state set and the return value is {@code true}.
+ *
+ * @param state the state to add to the state set
+ * @return {@code true} if state is added to the state set; {@code false} if
+ * the state set is unchanged
*/
public boolean add(AccessibleState state) {
// [[[ PENDING: WDW - the implementation of this does not need
@@ -104,9 +102,10 @@
}
/**
- * Adds all of the states to the existing state set. Duplicate entries
- * are ignored.
- * @param states AccessibleState array describing the state set.
+ * Adds all of the states to the existing state set. Duplicate entries are
+ * ignored.
+ *
+ * @param states {@code AccessibleState} array describing the state set
*/
public void addAll(AccessibleState[] states) {
if (states.length != 0) {
@@ -122,14 +121,14 @@
}
/**
- * Removes a state from the current state set. If the state is not
- * in the set, the state set will be unchanged and the return value
- * will be false. If the state is in the state set, it will be removed
- * from the set and the return value will be true.
+ * Removes a state from the current state set. If the state is not in the
+ * set, the state set will be unchanged and the return value will be
+ * {@code false}. If the state is in the state set, it will be removed from
+ * the set and the return value will be {@code true}.
*
- * @param state the state to remove from the state set
- * @return true if the state is in the state set; false if the state set
- * will be unchanged
+ * @param state the state to remove from the state set
+ * @return {@code true} if the state is in the state set; {@code false} if
+ * the state set will be unchanged
*/
public boolean remove(AccessibleState state) {
if (states == null) {
@@ -150,8 +149,10 @@
/**
* Checks if the current state is in the state set.
- * @param state the state
- * @return true if the state is in the state set; otherwise false
+ *
+ * @param state the state
+ * @return {@code true} if the state is in the state set; otherwise
+ * {@code false}
*/
public boolean contains(AccessibleState state) {
if (states == null) {
@@ -162,8 +163,9 @@
}
/**
- * Returns the current state set as an array of AccessibleState
- * @return AccessibleState array containing the current state.
+ * Returns the current state set as an array of {@code AccessibleState}.
+ *
+ * @return {@code AccessibleState} array containing the current state
*/
public AccessibleState[] toArray() {
if (states == null) {
@@ -178,10 +180,10 @@
}
/**
- * Creates a localized String representing all the states in the set
- * using the default locale.
+ * Creates a localized string representing all the states in the set using
+ * the default locale.
*
- * @return comma separated localized String
+ * @return comma separated localized string
* @see AccessibleBundle#toDisplayString
*/
public String toString() {
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleStreamable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleStreamable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, 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
@@ -25,41 +25,40 @@
package javax.accessibility;
+import java.awt.datatransfer.DataFlavor;
import java.io.InputStream;
-import java.awt.datatransfer.DataFlavor;
/**
- *
- * The {@code AccessibleStreamable} interface should be implemented
- * by the {@code AccessibleContext} of any component that presents the
- * raw stream behind a component on the display screen. Examples of such
- * components are HTML, bitmap images and MathML. An object that implements
- * {@code AccessibleStreamable} provides two things: a list of MIME
- * types supported by the object and a streaming interface for each MIME type to
- * get the data.
+ * The {@code AccessibleStreamable} interface should be implemented by the
+ * {@code AccessibleContext} of any component that presents the raw stream
+ * behind a component on the display screen. Examples of such components are
+ * HTML, bitmap images and MathML. An object that implements
+ * {@code AccessibleStreamable} provides two things: a list of MIME types
+ * supported by the object and a streaming interface for each MIME type to get
+ * the data.
*
* @author Lynn Monsanto
* @author Peter Korn
- *
- * @see javax.accessibility.AccessibleContext
+ * @see AccessibleContext
* @since 1.5
*/
public interface AccessibleStreamable {
- /**
- * Returns an array of DataFlavor objects for the MIME types
- * this object supports.
- *
- * @return an array of DataFlavor objects for the MIME types
- * this object supports.
- */
- DataFlavor[] getMimeTypes();
/**
- * Returns an InputStream for a DataFlavor
- *
- * @param flavor the DataFlavor
- * @return an ImputStream if an ImputStream for this DataFlavor exists.
- * Otherwise, null is returned.
- */
- InputStream getStream(DataFlavor flavor);
+ * Returns an array of {@code DataFlavor} objects for the MIME types this
+ * object supports.
+ *
+ * @return an array of {@code DataFlavor} objects for the MIME types this
+ * object supports
+ */
+ DataFlavor[] getMimeTypes();
+
+ /**
+ * Returns an {@code InputStream} for a {@code DataFlavor}.
+ *
+ * @param flavor the {@code DataFlavor}
+ * @return an {@code ImputStream} if an input stream for this
+ * {@code DataFlavor} exists. Otherwise, {@code null} is returned.
+ */
+ InputStream getStream(DataFlavor flavor);
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,10 +26,10 @@
package javax.accessibility;
/**
- * Class AccessibleTable describes a user-interface component that
+ * Class {@code AccessibleTable} describes a user-interface component that
* presents data in a two-dimensional table format.
*
- * @author Lynn Monsanto
+ * @author Lynn Monsanto
* @since 1.3
*/
public interface AccessibleTable {
@@ -44,7 +44,7 @@
/**
* Sets the caption for the table.
*
- * @param a the caption for the table
+ * @param a the caption for the table
*/
public void setAccessibleCaption(Accessible a);
@@ -56,9 +56,9 @@
public Accessible getAccessibleSummary();
/**
- * Sets the summary description of the table
+ * Sets the summary description of the table.
*
- * @param a the summary description of the table
+ * @param a the summary description of the table
*/
public void setAccessibleSummary(Accessible a);
@@ -77,73 +77,69 @@
public int getAccessibleColumnCount();
/**
- * Returns the Accessible at a specified row and column
- * in the table.
+ * Returns the {@code Accessible} at a specified row and column in the
+ * table.
*
- * @param r zero-based row of the table
- * @param c zero-based column of the table
- * @return the Accessible at the specified row and column
+ * @param r zero-based row of the table
+ * @param c zero-based column of the table
+ * @return the {@code Accessible} at the specified row and column
*/
public Accessible getAccessibleAt(int r, int c);
/**
- * Returns the number of rows occupied by the Accessible at
- * a specified row and column in the table.
+ * Returns the number of rows occupied by the {@code Accessible} at a
+ * specified row and column in the table.
*
- * @param r zero-based row of the table
- * @param c zero-based column of the table
- * @return the number of rows occupied by the Accessible at a
- * given specified (row, column)
+ * @param r zero-based row of the table
+ * @param c zero-based column of the table
+ * @return the number of rows occupied by the {@code Accessible} at a given
+ * specified (row, column)
*/
public int getAccessibleRowExtentAt(int r, int c);
/**
- * Returns the number of columns occupied by the Accessible at
- * a specified row and column in the table.
+ * Returns the number of columns occupied by the {@code Accessible} at a
+ * specified row and column in the table.
*
- * @param r zero-based row of the table
- * @param c zero-based column of the table
- * @return the number of columns occupied by the Accessible at a
- * given specified row and column
+ * @param r zero-based row of the table
+ * @param c zero-based column of the table
+ * @return the number of columns occupied by the {@code Accessible} at a
+ * given specified row and column
*/
public int getAccessibleColumnExtentAt(int r, int c);
/**
- * Returns the row headers as an AccessibleTable.
+ * Returns the row headers as an {@code AccessibleTable}.
*
- * @return an AccessibleTable representing the row
- * headers
+ * @return an {@code AccessibleTable} representing the row headers
*/
public AccessibleTable getAccessibleRowHeader();
/**
* Sets the row headers.
*
- * @param table an AccessibleTable representing the
- * row headers
+ * @param table an {@code AccessibleTable} representing the row headers
*/
public void setAccessibleRowHeader(AccessibleTable table);
/**
- * Returns the column headers as an AccessibleTable.
+ * Returns the column headers as an {@code AccessibleTable}.
*
- * @return an AccessibleTable representing the column
- * headers
+ * @return an {@code AccessibleTable} representing the column headers
*/
public AccessibleTable getAccessibleColumnHeader();
/**
* Sets the column headers.
*
- * @param table an AccessibleTable representing the
- * column headers
+ * @param table an {@code AccessibleTable} representing the column headers
*/
public void setAccessibleColumnHeader(AccessibleTable table);
/**
* Returns the description of the specified row in the table.
*
- * @param r zero-based row of the table
+ * @param r zero-based row of the table
* @return the description of the row
*/
public Accessible getAccessibleRowDescription(int r);
@@ -151,15 +147,15 @@
/**
* Sets the description text of the specified row of the table.
*
- * @param r zero-based row of the table
- * @param a the description of the row
+ * @param r zero-based row of the table
+ * @param a the description of the row
*/
public void setAccessibleRowDescription(int r, Accessible a);
/**
* Returns the description text of the specified column in the table.
*
- * @param c zero-based column of the table
+ * @param c zero-based column of the table
* @return the text description of the column
*/
public Accessible getAccessibleColumnDescription(int c);
@@ -167,56 +163,54 @@
/**
* Sets the description text of the specified column in the table.
*
- * @param c zero-based column of the table
- * @param a the text description of the column
+ * @param c zero-based column of the table
+ * @param a the text description of the column
*/
public void setAccessibleColumnDescription(int c, Accessible a);
/**
- * Returns a boolean value indicating whether the accessible at
- * a specified row and column is selected.
+ * Returns a boolean value indicating whether the accessible at a specified
+ * row and column is selected.
*
- * @param r zero-based row of the table
- * @param c zero-based column of the table
- * @return the boolean value true if the accessible at the
- * row and column is selected. Otherwise, the boolean value
- * false
+ * @param r zero-based row of the table
+ * @param c zero-based column of the table
+ * @return the boolean value {@code true} if the accessible at the row and
+ * column is selected. Otherwise, the boolean value {@code false}
*/
public boolean isAccessibleSelected(int r, int c);
/**
- * Returns a boolean value indicating whether the specified row
- * is selected.
+ * Returns a boolean value indicating whether the specified row is selected.
*
- * @param r zero-based row of the table
- * @return the boolean value true if the specified row is selected.
- * Otherwise, false.
+ * @param r zero-based row of the table
+ * @return the boolean value {@code true} if the specified row is selected.
+ * Otherwise, {@code false}.
*/
public boolean isAccessibleRowSelected(int r);
/**
- * Returns a boolean value indicating whether the specified column
- * is selected.
+ * Returns a boolean value indicating whether the specified column is
+ * selected.
*
- * @param c zero-based column of the table
- * @return the boolean value true if the specified column is selected.
- * Otherwise, false.
+ * @param c zero-based column of the table
+ * @return the boolean value {@code true} if the specified column is
+ * selected. Otherwise, {@code false}.
*/
public boolean isAccessibleColumnSelected(int c);
/**
* Returns the selected rows in a table.
*
- * @return an array of selected rows where each element is a
- * zero-based row of the table
+ * @return an array of selected rows where each element is a zero-based row
+ * of the table
*/
- public int [] getSelectedAccessibleRows();
+ public int[] getSelectedAccessibleRows();
/**
* Returns the selected columns in a table.
*
- * @return an array of selected columns where each element is a
- * zero-based column of the table
+ * @return an array of selected columns where each element is a zero-based
+ * column of the table
*/
- public int [] getSelectedAccessibleColumns();
+ public int[] getSelectedAccessibleColumns();
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTableModelChange.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTableModelChange.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,31 +26,30 @@
package javax.accessibility;
/**
- * The AccessibleTableModelChange interface describes a change to
- * the table model. The attributes of the model change can be
- * obtained by the following methods:
+ * The {@code AccessibleTableModelChange} interface describes a change to the
+ * table model. The attributes of the model change can be obtained by the
+ * following methods:
* <ul>
- * <li> public int getType()
- * <li> public int getFirstRow();
- * <li> public int getLastRow();
- * <li> public int getFirstColumn();
- * <li> public int getLastColumn();
+ * <li>{@code public int getType();}
+ * <li>{@code public int getFirstRow();}
+ * <li>{@code public int getLastRow();}
+ * <li>{@code public int getFirstColumn();}
+ * <li>{@code public int getLastColumn();}
* </ul>
* The model change type returned by getType() will be one of:
* <ul>
- * <li> INSERT - one or more rows and/or columns have been inserted
- * <li> UPDATE - some of the table data has changed
- * <li> DELETE - one or more rows and/or columns have been deleted
+ * <li>{@code INSERT} - one or more rows and/or columns have been inserted
+ * <li>{@code UPDATE} - some of the table data has changed
+ * <li>{@code DELETE} - one or more rows and/or columns have been deleted
* </ul>
- * The affected area of the table can be determined by the other
- * four methods which specify ranges of rows and columns
+ * The affected area of the table can be determined by the other four methods
+ * which specify ranges of rows and columns
*
+ * @author Lynn Monsanto
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleTable
- *
- * @author Lynn Monsanto
* @since 1.3
*/
public interface AccessibleTableModelChange {
@@ -71,34 +70,39 @@
public static final int DELETE = -1;
/**
- * Returns the type of event.
- * @return the type of event
- * @see #INSERT
- * @see #UPDATE
- * @see #DELETE
+ * Returns the type of event.
+ *
+ * @return the type of event
+ * @see #INSERT
+ * @see #UPDATE
+ * @see #DELETE
*/
public int getType();
/**
* Returns the first row that changed.
+ *
* @return the first row that changed
*/
public int getFirstRow();
/**
* Returns the last row that changed.
+ *
* @return the last row that changed
*/
public int getLastRow();
/**
* Returns the first column that changed.
+ *
* @return the first column that changed
*/
public int getFirstColumn();
/**
* Returns the last column that changed.
+ *
* @return the last column that changed
*/
public int getLastColumn();
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleText.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleText.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,29 +25,27 @@
package javax.accessibility;
+import java.awt.Point;
+import java.awt.Rectangle;
-import java.util.*;
-import java.awt.*;
-import javax.swing.text.*;
-
+import javax.swing.text.AttributeSet;
/**
- * <P>The AccessibleText interface should be implemented by all
- * classes that present textual information on the display. This interface
- * provides the standard mechanism for an assistive technology to access
- * that text via its content, attributes, and spatial location.
- * Applications can determine if an object supports the AccessibleText
- * interface by first obtaining its AccessibleContext (see {@link Accessible})
- * and then calling the {@link AccessibleContext#getAccessibleText} method of
- * AccessibleContext. If the return value is not null, the object supports this
- * interface.
+ * The {@code AccessibleText} interface should be implemented by all classes
+ * that present textual information on the display. This interface provides the
+ * standard mechanism for an assistive technology to access that text via its
+ * content, attributes, and spatial location. Applications can determine if an
+ * object supports the {@code AccessibleText} interface by first obtaining its
+ * {@code AccessibleContext} (see {@link Accessible}) and then calling the
+ * {@link AccessibleContext#getAccessibleText} method of
+ * {@code AccessibleContext}. If the return value is not {@code null}, the
+ * object supports this interface.
*
+ * @author Peter Korn
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleText
- *
- * @author Peter Korn
*/
public interface AccessibleText {
@@ -74,13 +72,13 @@
/**
* Constant used to indicate that the part of the text that should be
* retrieved is a sentence.
- *
- * A sentence is a string of words which expresses an assertion,
- * a question, a command, a wish, an exclamation, or the performance
- * of an action. In English locales, the string usually begins with
- * a capital letter and concludes with appropriate end punctuation;
- * such as a period, question or exclamation mark. Other locales may
- * use different capitalization and/or punctuation.
+ * <p>
+ * A sentence is a string of words which expresses an assertion, a question,
+ * a command, a wish, an exclamation, or the performance of an action. In
+ * English locales, the string usually begins with a capital letter and
+ * concludes with appropriate end punctuation; such as a period, question or
+ * exclamation mark. Other locales may use different capitalization and/or
+ * punctuation.
*
* @see #getAtIndex
* @see #getAfterIndex
@@ -89,29 +87,29 @@
public static final int SENTENCE = 3;
/**
- * Given a point in local coordinates, return the zero-based index
- * of the character under that Point. If the point is invalid,
- * this method returns -1.
+ * Given a point in local coordinates, return the zero-based index of the
+ * character under that point. If the point is invalid, this method returns
+ * -1.
*
- * @param p the Point in local coordinates
- * @return the zero-based index of the character under Point p; if
- * Point is invalid return -1.
+ * @param p the point in local coordinates
+ * @return the zero-based index of the character under {@code Point p}; if
+ * point is invalid return -1.
*/
public int getIndexAtPoint(Point p);
/**
- * Determines the bounding box of the character at the given
- * index into the string. The bounds are returned in local
- * coordinates. If the index is invalid an empty rectangle is returned.
+ * Determines the bounding box of the character at the given index into the
+ * string. The bounds are returned in local coordinates. If the index is
+ * invalid an empty rectangle is returned.
*
- * @param i the index into the String
- * @return the screen coordinates of the character's bounding box,
- * if index is invalid return an empty rectangle.
+ * @param i the index into the string
+ * @return the screen coordinates of the character's bounding box, if index
+ * is invalid return an empty rectangle.
*/
public Rectangle getCharacterBounds(int i);
/**
- * Returns the number of characters (valid indicies)
+ * Returns the number of characters (valid indicies).
*
* @return the number of characters
*/
@@ -119,61 +117,62 @@
/**
* Returns the zero-based offset of the caret.
+ * <p>
+ * Note: That to the right of the caret will have the same index value as
+ * the offset (the caret is between two characters).
*
- * Note: That to the right of the caret will have the same index
- * value as the offset (the caret is between two characters).
- * @return the zero-based offset of the caret.
+ * @return the zero-based offset of the caret
*/
public int getCaretPosition();
/**
- * Returns the String at a given index.
+ * Returns the {@code String} at a given index.
*
- * @param part the CHARACTER, WORD, or SENTENCE to retrieve
- * @param index an index within the text
+ * @param part the CHARACTER, WORD, or SENTENCE to retrieve
+ * @param index an index within the text
* @return the letter, word, or sentence
*/
public String getAtIndex(int part, int index);
/**
- * Returns the String after a given index.
+ * Returns the {@code String} after a given index.
*
- * @param part the CHARACTER, WORD, or SENTENCE to retrieve
- * @param index an index within the text
+ * @param part the CHARACTER, WORD, or SENTENCE to retrieve
+ * @param index an index within the text
* @return the letter, word, or sentence
*/
public String getAfterIndex(int part, int index);
/**
- * Returns the String before a given index.
+ * Returns the {@code String} before a given index.
*
- * @param part the CHARACTER, WORD, or SENTENCE to retrieve
- * @param index an index within the text
+ * @param part the CHARACTER, WORD, or SENTENCE to retrieve
+ * @param index an index within the text
* @return the letter, word, or sentence
*/
public String getBeforeIndex(int part, int index);
/**
- * Returns the AttributeSet for a given character at a given index
+ * Returns the {@code AttributeSet} for a given character at a given index.
*
- * @param i the zero-based index into the text
- * @return the AttributeSet of the character
+ * @param i the zero-based index into the text
+ * @return the {@code AttributeSet} of the character
*/
public AttributeSet getCharacterAttribute(int i);
/**
- * Returns the start offset within the selected text.
- * If there is no selection, but there is
- * a caret, the start and end offsets will be the same.
+ * Returns the start offset within the selected text. If there is no
+ * selection, but there is a caret, the start and end offsets will be the
+ * same.
*
* @return the index into the text of the start of the selection
*/
public int getSelectionStart();
/**
- * Returns the end offset within the selected text.
- * If there is no selection, but there is
- * a caret, the start and end offsets will be the same.
+ * Returns the end offset within the selected text. If there is no
+ * selection, but there is a caret, the start and end offsets will be the
+ * same.
*
* @return the index into the text of the end of the selection
*/
@@ -182,7 +181,7 @@
/**
* Returns the portion of the text that is selected.
*
- * @return the String portion of the text that is selected
+ * @return the {@code String} portion of the text that is selected
*/
public String getSelectedText();
}
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTextSequence.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTextSequence.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -22,50 +22,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package javax.accessibility;
-
/**
- * <P>The AccessibleTextSequence provides information about
- * a contiguous sequence of text.
- *
- * @see Accessible
- * @see Accessible#getAccessibleContext
- * @see AccessibleContext
- * @see AccessibleContext#getAccessibleText
- * @see AccessibleAttributeSequence
+ * This class collects together key details of a span of text. It is used by
+ * implementors of the class {@code AccessibleExtendedText} in order to return
+ * the requested triplet of a {@code String}, and the start and end
+ * indicies/offsets into a larger body of text that the {@code String} comes
+ * from.
*
- * @author Lynn Monsanto
- */
-
-/**
- * This class collects together key details of a span of text. It
- * is used by implementors of the class {@code AccessibleExtendedText} in
- * order to return the requested triplet of a {@code String}, and the
- * start and end indicies/offsets into a larger body of text that the
- * {@code String} comes from.
- *
- * @see javax.accessibility.AccessibleExtendedText
+ * @see AccessibleExtendedText
*/
public class AccessibleTextSequence {
- /** The start index of the text sequence */
+ /**
+ * The start index of the text sequence.
+ */
public int startIndex;
- /** The end index of the text sequence */
+ /**
+ * The end index of the text sequence.
+ */
public int endIndex;
- /** The text */
+ /**
+ * The text.
+ */
public String text;
/**
- * Constructs an {@code AccessibleTextSequence} with the given
- * parameters.
+ * Constructs an {@code AccessibleTextSequence} with the given parameters.
*
- * @param start the beginning index of the span of text
- * @param end the ending index of the span of text
- * @param txt the {@code String} shared by this text span
- *
+ * @param start the beginning index of the span of text
+ * @param end the ending index of the span of text
+ * @param txt the {@code String} shared by this text span
* @since 1.6
*/
public AccessibleTextSequence(int start, int end, String txt) {
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleValue.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleValue.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,31 +26,28 @@
package javax.accessibility;
/**
- * The AccessibleValue interface should be supported by any object
- * that supports a numerical value (e.g., a scroll bar). This interface
- * provides the standard mechanism for an assistive technology to determine
- * and set the numerical value as well as get the minimum and maximum values.
- * Applications can determine
- * if an object supports the AccessibleValue interface by first
- * obtaining its AccessibleContext (see
- * {@link Accessible}) and then calling the
- * {@link AccessibleContext#getAccessibleValue} method.
- * If the return value is not null, the object supports this interface.
+ * The {@code AccessibleValue} interface should be supported by any object that
+ * supports a numerical value (e.g., a scroll bar). This interface provides the
+ * standard mechanism for an assistive technology to determine and set the
+ * numerical value as well as get the minimum and maximum values. Applications
+ * can determine if an object supports the {@code AccessibleValue} interface by
+ * first obtaining its {@code AccessibleContext} (see {@link Accessible}) and
+ * then calling the {@link AccessibleContext#getAccessibleValue} method. If the
+ * return value is not {@code null}, the object supports this interface.
*
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleValue
- *
- * @author Peter Korn
- * @author Hans Muller
- * @author Willie Walker
*/
public interface AccessibleValue {
/**
- * Get the value of this object as a Number. If the value has not been
- * set, the return value will be null.
+ * Get the value of this object as a {@code Number}. If the value has not
+ * been set, the return value will be {@code null}.
*
* @return value of the object
* @see #setCurrentAccessibleValue
@@ -58,35 +55,35 @@
public Number getCurrentAccessibleValue();
/**
- * Set the value of this object as a Number.
+ * Set the value of this object as a {@code Number}.
*
- * @param n the number to use for the value
- * @return True if the value was set; else False
+ * @param n the number to use for the value
+ * @return {@code true} if the value was set; else {@code false}
* @see #getCurrentAccessibleValue
*/
public boolean setCurrentAccessibleValue(Number n);
-// /**
-// * Get the description of the value of this object.
-// *
-// * @return description of the value of the object
-// */
-// public String getAccessibleValueDescription();
+ // /**
+ // * Get the description of the value of this object.
+ // *
+ // * @return description of the value of the object
+ // */
+ // public String getAccessibleValueDescription();
/**
- * Get the minimum value of this object as a Number.
+ * Get the minimum value of this object as a {@code Number}.
*
- * @return Minimum value of the object; null if this object does not
- * have a minimum value
+ * @return minimum value of the object; {@code null} if this object does not
+ * have a minimum value
* @see #getMaximumAccessibleValue
*/
public Number getMinimumAccessibleValue();
/**
- * Get the maximum value of this object as a Number.
+ * Get the maximum value of this object as a {@code Number}.
*
- * @return Maximum value of the object; null if this object does not
- * have a maximum value
+ * @return maximum value of the object; {@code null} if this object does not
+ * have a maximum value
* @see #getMinimumAccessibleValue
*/
public Number getMaximumAccessibleValue();
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -57,7 +57,7 @@
* accessible name, description, <a href="#AccessibleRole">role</a>, and
* <a href="#AccessibleState">state</a> of the object, as well as information
* about the parent and children of the object. In addition,
- * JavaBeans™ property change support is also included to allow assisitive
+ * JavaBeans™ property change support is also included to allow assistive
* technologies learn when the values of the accessible properties change.
* AccessibleContext also contains methods for obtaining more specific
* accessibility information about a component. If the component supports it,
@@ -175,7 +175,7 @@
* <a href="#Accessible">Accessible</a>) and then calling the
* {@code getAccessibleAction} method of
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
- * not null, the object supports this interface.
+ * not {@code null}, the object supports this interface.
*
* <h3> <a id="AccessibleComponent"></a><a href="AccessibleComponent.html">
* Interface AccessibleComponent</a></h3>
@@ -188,7 +188,7 @@
* <a href="#Accessible">Accessible</a>) and then calling the
* {@code getAccessibleComponent} method of
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
- * not null, the object supports this interface.
+ * not {@code null}, the object supports this interface.
*
* <h3><a id="AccessibleSelection"></a><a href="AccessibleSelection.html">
* Interface AccessibleSelection</a></h3>
@@ -204,7 +204,7 @@
* <a href="#Accessible">Accessible</a>) and then calling the
* {@code getAccessibleSelection} method of
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
- * not null, the object supports this interface.
+ * not {@code null}, the object supports this interface.
*
* <h3><a id="AccessibleText"></a><a href="AccessibleText.html">Interface
* AccessibleText</a></h3>
@@ -228,7 +228,7 @@
* (see <a href="#Accessible">Accessible</a>) and then calling the
* {@code getAccessibleText} method of
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
- * not null, the object supports this interface.
+ * not {@code null}, the object supports this interface.
*
* <h3><a id="AccessibleHypertext"></a> <a href="AccessibleHypertext.html">
* Interface AccessibleHypertext</a></h3>
@@ -268,7 +268,7 @@
* <a href="#Accessible">Accessible</a>) and then calling the
* {@code getAccessibleValue} method of
* <a href="#AccessibleContext">AccessibleContext</a>. If the return value is
- * not null, the object supports this interface.
+ * not {@code null}, the object supports this interface.
*
* @since 1.2
*/
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -104,10 +104,8 @@
* sees fit.
*
* <p> For more details on declaring service providers, and the JAR
- * format in general, see the <a
- * href="{@docRoot}/../technotes/guides/jar/jar.html">
- * JAR File Specification</a>.
- *
+ * format in general, see the
+ * <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>.
*/
public final class IIORegistry extends ServiceRegistry {
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java Thu Aug 24 16:24:44 2017 +0200
@@ -104,9 +104,8 @@
* sees fit, so long as it has the appropriate runtime permission.
*
* <p> For more details on declaring service providers, and the JAR
- * format in general, see the <a
- * href="../../../../technotes/guides/jar/jar.html">
- * JAR File Specification</a>.
+ * format in general, see the
+ * <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>.
*
* @see RegisterableService
* @see java.util.ServiceLoader
--- a/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -194,10 +194,14 @@
* constructor can be used to create an arbitrary doc flavor.
* <UL>
* <LI>Preformatted text
- * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
+ * <table class="striped">
+ * <caption>MIME-Types and their descriptions</caption>
+ * <thead>
* <TR>
* <TH>MIME-Type</TH><TH>Description</TH>
* </TR>
+ * </thead>
+ * <tbody>
* <TR>
* <TD>{@code "text/plain"}</TD>
* <TD>Plain text in the default character set (US-ASCII)</TD>
@@ -214,6 +218,7 @@
* <TD><code>"text/html; charset=<I>xxx</I>"</code></TD>
* <TD>HyperText Markup Language in character set <I>xxx</I></TD>
* </TR>
+ * </tbody>
* </TABLE>
* <P>
* In general, preformatted text print data is provided either in a character
@@ -222,11 +227,15 @@
*
* <LI>Preformatted page description language (PDL) documents
*
- * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
+ * <table class="striped">
+ * <caption>MIME-Types and their descriptions</caption>
+ * <thead>
* <TR>
* <TH>MIME-Type</TH><TH>Description</TH>
* </TR>
- *<TR>
+ * </thead>
+ * <tbody>
+ * <TR>
* <TD>{@code "application/pdf"}</TD>
* <TD>Portable Document Format document</TD>
* </TR>
@@ -238,6 +247,7 @@
* <TD>{@code "application/vnd.hp-PCL"}</TD>
* <TD>Printer Control Language document</TD>
* </TR>
+ * </tbody>
* </TABLE>
* <P>
* In general, preformatted PDL print data is provided in a byte oriented
@@ -245,11 +255,14 @@
*
* <LI>Preformatted images
*
- * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
+ * <table class="striped">
+ * <caption>MIME-Types and their descriptions</caption>
+ * <thead>
* <TR>
* <TH>MIME-Type</TH><TH>Description</TH>
* </TR>
- *
+ * </thead>
+ * <tbody>
* <TR>
* <TD>{@code "image/gif"}</TD>
* <TD>Graphics Interchange Format image</TD>
@@ -262,6 +275,7 @@
* <TD>{@code "image/png"}</TD>
* <TD>Portable Network Graphics image</TD>
* </TR>
+ * </tbody>
* </TABLE>
* <P>
* In general, preformatted image print data is provided in a byte oriented
@@ -269,14 +283,19 @@
*
* <LI>Preformatted autosense print data
*
- * <TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0 SUMMARY="MIME-Types and their descriptions">
+ * <table class="striped">
+ * <caption>MIME-Types and their descriptions</caption>
+ * <thead>
* <TR>
* <TH>MIME-Type</TH><TH>Description</TH>
* </TR>
- *
+ * </thead>
+ * <tbody>
* <TR>
* <TD>{@code "application/octet-stream"}</TD>
* <TD>The print data format is unspecified (just an octet stream)</TD>
+ * </TR>
+ * </tbody>
* </TABLE>
* <P>
* The printer decides how to interpret the print data; the way this
--- a/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,9 +44,7 @@
* A typical output document format may be Postscript(TM).
* <p>
* This class is implemented by a service and located by the
- * implementation using the
- * <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">
- * SPI JAR File specification</a>.
+ * implementation using the {@link java.util.ServiceLoader} facility.
* <p>
* Applications locate instances of this class by calling the
* {@link #lookupStreamPrintServiceFactories(DocFlavor, String)} method.
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,10 @@
* {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR}
* for a monochrome or color document.
*
- * <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=1 SUMMARY="Shows effects of specifying MONOCHROME or COLOR Chromaticity attributes">
+ * <table class="striped">
+ * <caption>Shows effects of specifying MONOCHROME or COLOR Chromaticity
+ * attributes</caption>
+ * <thead>
* <TR>
* <TH>
* Chromaticity<BR>Attribute
@@ -54,6 +57,8 @@
* Effect on<BR>Color Document
* </TH>
* </TR>
+ * </thead>
+ * <tbody>
* <TR>
* <TD>
* {@link #MONOCHROME MONOCHROME}
@@ -76,6 +81,7 @@
* Printed as is, in color
* </TD>
* </TR>
+ * </tbody>
* </TABLE>
* <P>
* <B>IPP Compatibility:</B> Chromaticity is not an IPP attribute at present.
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java Thu Aug 24 16:24:44 2017 +0200
@@ -40,7 +40,8 @@
* for purposes of finishing.
* <P>
* Standard Finishings values are:
- * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style="width:100%" SUMMARY="layout">
+ * <table class="borderless" style="width:100%;margin: 0px auto">
+ * <caption>Standard Finishings values</caption>
* <TR>
* <TD STYLE="WIDTH:10%">
*
@@ -76,7 +77,8 @@
* <P>
* The following Finishings values are more specific; they indicate a
* corner or an edge as if the document were a portrait document:
- * <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style="width:100%" SUMMARY="layout">
+ * <table class="borderless" style="width:100%;margin: 0px auto">
+ * <caption>Specific Finishings values</caption>
* <TR>
* <TD STYLE="WIDTH:10%">
*
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,11 +66,15 @@
* specified by the doc's {@link javax.print.DocFlavor DocFlavor}, as
* shown in the table below.
*
- * <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=1 SUMMARY="Table showing computation of doc sizes">
+ * <table class="striped">
+ * <caption>Table showing computation of doc sizes</caption>
+ * <thead>
* <TR>
* <TH>Representation Class</TH>
* <TH>Document Size</TH>
* </TR>
+ * </thead>
+ * <tbody>
* <TR>
* <TD>byte[]</TD>
* <TD>Length of the byte array</TD>
@@ -107,6 +111,7 @@
* <TD>java.awt.print.Pageable</TD>
* <TD>Implementation dependent*</TD>
* </TR>
+ * </tbody>
* </TABLE>
* <P>
* * In these cases the Print Service itself generates the print data sent
--- a/jdk/src/java.desktop/share/classes/javax/print/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/print/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,8 +46,7 @@
* IPP printers or JINI printers, a print-service provider can write
* implementations of {@code PrintServiceLookup}. The print-service provider can
* dynamically install these {@code PrintServiceLookup} implementations using
- * the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">
- * SPI JAR file specification</a>.
+ * the {@link java.util.ServiceLoader} facility.
*
* <h3>Attribute Definitions</h3>
* The {@link javax.print.attribute} and {@link javax.print.attribute.standard}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -74,13 +74,16 @@
* following table lists the available property keys and which methods consider
* them:
*
- * <table border=0>
- * <caption>MIDI System Property Keys</caption>
+ * <table class="striped">
+ * <caption>MIDI System Property Keys</caption>
+ * <thead>
* <tr>
* <th>Property Key</th>
* <th>Interface</th>
* <th>Affected Method</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>{@code javax.sound.midi.Receiver}</td>
* <td>{@link Receiver}</td>
@@ -101,6 +104,7 @@
* <td>{@link Transmitter}</td>
* <td>{@link #getTransmitter}</td>
* </tr>
+ * </tbody>
* </table>
*
* The property value consists of the provider class name and the device name,
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -89,13 +89,16 @@
* The following table lists some common properties which service providers
* should use, if applicable:
*
- * <table border=0>
- * <caption>Audio Format Properties</caption>
+ * <table class="striped">
+ * <caption>Audio Format Properties</caption>
+ * <thead>
* <tr>
* <th>Property key</th>
* <th>Value type</th>
* <th>Description</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>"bitrate"</td>
* <td>{@link java.lang.Integer Integer}</td>
@@ -112,6 +115,7 @@
* <td>{@link java.lang.Integer Integer}</td>
* <td>encoding/conversion quality, 1..100</td>
* </tr>
+ * </tbody>
* </table>
* <p>
* Vendors of service providers (plugins) are encouraged to seek information
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -41,13 +41,17 @@
* permission allows, as well as a discussion of the risks of granting code the
* permission.
*
- * <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
+ * <table class="striped">
+ * <caption>Permission target name, what the permission allows, and associated
+ * risks</caption>
+ * <thead>
* <tr>
* <th>Permission Target Name</th>
* <th>What the Permission Allows</th>
* <th>Risks of Allowing this Permission</th>
* </tr>
- *
+ * </thead>
+ * <tbody>
* <tr>
* <td>play</td>
* <td>Audio playback through the audio device or devices on the system.
@@ -69,6 +73,7 @@
* using that mixer.
* This permission can enable an applet or application to eavesdrop on a user.</td>
* </tr>
+ * </tbody>
* </table>
*
* @author Kara Kytle
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -72,13 +72,16 @@
* {@link Properties#load(InputStream) Properties.load}. The following table
* lists the available property keys and which methods consider them:
*
- * <table border=0>
- * <caption>Audio System Property Keys</caption>
+ * <table class="striped">
+ * <caption>Audio System Property Keys</caption>
+ * <thead>
* <tr>
* <th>Property Key</th>
* <th>Interface</th>
* <th>Affected Method(s)</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>{@code javax.sound.sampled.Clip}</td>
* <td>{@link Clip}</td>
@@ -99,6 +102,7 @@
* <td>{@link TargetDataLine}</td>
* <td>{@link #getLine}, {@link #getTargetDataLine}</td>
* </tr>
+ * </tbody>
* </table>
*
* The property value consists of the provider class name and the mixer name,
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -69,12 +69,11 @@
* <p>
* The following table shows what parameter values an implementation might use
* for a representative set of reverberation settings.
- * <p>
*
- * <b>Reverberation Types and Parameters</b>
- *
- * <table border=1 cellpadding=5 summary="reverb types and params: decay time, late intensity, late delay, early intensity, and early delay">
- *
+ * <table class="striped">
+ * <caption>Reverb types and params: decay time, late intensity, late delay,
+ * early intensity, and early delay</caption>
+ * <thead>
* <tr>
* <th>Type</th>
* <th>Decay Time (ms)</th>
@@ -83,7 +82,8 @@
* <th>Early Intensity (dB)</th>
* <th>Early Delay(ms)</th>
* </tr>
- *
+ * </thead>
+ * <tbody>
* <tr>
* <td>Cavern</td>
* <td>2250</td>
@@ -128,7 +128,7 @@
* <td>-7.0</td>
* <td>0.6</td>
* </tr>
- *
+ * </tbody>
* </table>
*
* @author Kara Kytle
--- a/jdk/src/java.desktop/share/classes/javax/swing/Action.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Action.java Thu Aug 24 16:24:44 2017 +0200
@@ -94,13 +94,16 @@
* <code>Action</code> that is <code>null</code>) results in the
* button's corresponding property being set to <code>null</code>.
*
- * <table border="1" cellpadding="1" cellspacing="0"
- * summary="Supported Action properties">
- * <tr valign="top" style="text-align:left">
- * <th style="background-color:#CCCCFF;text-align:left">Component Property
- * <th style="background-color:#CCCCFF;text-align:left">Components
- * <th style="background-color:#CCCCFF;text-align:left">Action Key
- * <th style="background-color:#CCCCFF;text-align:left">Notes
+ * <table class="striped">
+ * <caption>Supported Action properties</caption>
+ * <thead>
+ * <tr>
+ * <th>Component Property
+ * <th>Components
+ * <th>Action Key
+ * <th>Notes
+ * </thead>
+ * <tbody>
* <tr valign="top" style="text-align:left">
* <td><b><code>enabled</code></b>
* <td>All
@@ -191,6 +194,7 @@
* use the same {@code Action} that defines a value for the
* {@code SELECTED_KEY} property with multiple mutually
* exclusive buttons.
+ * </tbody>
* </table>
* <p>
* <code>JPopupMenu</code>, <code>JToolBar</code> and <code>JMenu</code>
--- a/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java Thu Aug 24 16:24:44 2017 +0200
@@ -36,7 +36,8 @@
* vertically or horizontally. The components will not wrap so, for
* example, a vertical arrangement of components will stay vertically
* arranged when the frame is resized.
- * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
+ * <table class="borderless" style="float:right">
+ * <caption>Example:</caption>
* <TR>
* <TD style="text-align:center">
* <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/BoxLayout-1.gif"
--- a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java Thu Aug 24 16:24:44 2017 +0200
@@ -812,7 +812,7 @@
/**
* Scrolls the view to the given reference location
- * (that is, the value returned by the <code>UL.getRef</code>
+ * (that is, the value returned by the <code>URL.getRef</code>
* method for the URL being displayed). By default, this
* method only knows how to locate a reference in an
* HTMLDocument. The implementation calls the
--- a/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,8 +54,15 @@
* <code>JFormattedTextField</code> allows
* configuring what action should be taken when focus is lost. The possible
* configurations are:
- * <table summary="Possible JFormattedTextField configurations and their descriptions">
- * <tr><th><p style="text-align:left">Value</p></th><th><p style="text-align:left">Description</p></th></tr>
+ *
+ * <table class="striped">
+ * <caption>Possible JFormattedTextField configurations and their descriptions
+ * </caption>
+ * <thead>
+ * <tr><th>Value</th>
+ * <th>Description</th></tr>
+ * </thead>
+ * <tbody>
* <tr><td>JFormattedTextField.REVERT
* <td>Revert the display to match that of <code>getValue</code>,
* possibly losing the current edit.
@@ -71,6 +78,7 @@
* <tr><td>JFormattedTextField.PERSIST
* <td>Do nothing, don't obtain a new
* <code>AbstractFormatter</code>, and don't update the value.
+ * </tbody>
* </table>
* The default is <code>JFormattedTextField.COMMIT_OR_REVERT</code>,
* refer to {@link #setFocusLostBehavior} for more information on this.
--- a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java Thu Aug 24 16:24:44 2017 +0200
@@ -47,7 +47,8 @@
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>,
* a section in <em>The Java Tutorial</em>.
*
- * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
+ * <table class="borderless" style="float:right">
+ * <caption>Example</caption>
* <TR>
* <TD style="text-align:center">
* <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JLayeredPane-1.gif"
--- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java Thu Aug 24 16:24:44 2017 +0200
@@ -962,9 +962,13 @@
* <p>
* A description of these layouts follows:
*
- * <table border="1"
- * summary="Describes layouts VERTICAL, HORIZONTAL_WRAP, and VERTICAL_WRAP">
- * <tr><th><p style="text-align:left">Value</p></th><th><p style="text-align:left">Description</p></th></tr>
+ * <table class="striped">
+ * <caption>Describes layouts VERTICAL,HORIZONTAL_WRAP, and VERTICAL_WRAP
+ * </caption>
+ * <thead>
+ * <tr><th>Value</th><th>Description</th></tr>
+ * </thead>
+ * <tbody>
* <tr><td><code>VERTICAL</code>
* <td>Cells are layed out vertically in a single column.
* <tr><td><code>HORIZONTAL_WRAP</code>
@@ -978,7 +982,8 @@
* necessary. If the {@code visibleRowCount} property is less than
* or equal to zero, wrapping is determined by the height of the
* list; otherwise wrapping is done at {@code visibleRowCount} rows.
- * </table>
+ * </tbody>
+ * </table>
* <p>
* The default value of this property is <code>VERTICAL</code>.
*
--- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java Thu Aug 24 16:24:44 2017 +0200
@@ -73,12 +73,15 @@
* <code>showXxxDialog</code> methods shown below:
* <blockquote>
*
- *
- * <table border=1 summary="Common JOptionPane method names and their descriptions">
+ * <table class="striped">
+ * <caption>Common JOptionPane method names and their descriptions</caption>
+ * <thead>
* <tr>
* <th>Method Name</th>
* <th>Description</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>showConfirmDialog</td>
* <td>Asks a confirming question, like yes/no/cancel.</td>
@@ -95,6 +98,7 @@
* <td>showOptionDialog</td>
* <td>The Grand Unification of the above three.</td>
* </tr>
+ * </tbody>
* </table>
*
* </blockquote>
@@ -107,7 +111,8 @@
* All dialogs are modal. Each <code>showXxxDialog</code> method blocks
* the caller until the user's interaction is complete.
*
- * <table cellspacing=6 cellpadding=4 border=0 style="float:right" summary="layout">
+ * <table class="borderless">
+ * <caption>Common dialog</caption>
* <tr>
* <td style="background-color:#FFe0d0" rowspan=2>icon</td>
* <td style="background-color:#FFe0d0">message</td>
@@ -121,7 +126,7 @@
* </table>
*
* The basic appearance of one of these dialog boxes is generally
- * similar to the picture at the right, although the various
+ * similar to the picture above, although the various
* look-and-feels are
* ultimately responsible for the final result. In particular, the
* look-and-feels will adjust the layout to accommodate the option pane's
--- a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java Thu Aug 24 16:24:44 2017 +0200
@@ -70,7 +70,9 @@
* can be used to obtain the <code>JRootPane</code> that contains
* a given component.
* </blockquote>
- * <table style="float:right" border="0" summary="layout">
+ *
+ * <table class="borderless" style="float:right">
+ * <caption>Example</caption>
* <tr>
* <td style="text-align:center">
* <img src="doc-files/JRootPane-2.gif"
--- a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java Thu Aug 24 16:24:44 2017 +0200
@@ -55,7 +55,8 @@
* a section in <em>The Java Tutorial</em>. Note that
* <code>JScrollPane</code> does not support heavyweight components.
*
- * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout">
+ * <table class="borderless" style="float:right">
+ * <caption>Example</caption>
* <TR>
* <TD style="text-align:center">
* <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JScrollPane-1.gif"
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java Thu Aug 24 16:24:44 2017 +0200
@@ -1900,7 +1900,7 @@
* Returns the accessible name of this object, or {@code null} if
* there is no accessible name.
*
- * @return the accessible name of this object, nor {@code null}.
+ * @return the accessible name of this object, or {@code null}.
* @since 1.6
*/
public String getAccessibleName() {
--- a/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -42,10 +42,8 @@
* <li><a href="http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html"
* target="_top">How to Use File Choosers</a>,
* a section in <em>The Java Tutorial</em></li>
- * <li><a href="../../../../technotes/guides/intl/index.html"
- * target="_top">Internationalization Documentation</a></li>
- * <li><a href="../../../../technotes/guides/imf/index.html"
- * target="_top">Input Method Framework Documentation</a></li>
+ * <li>{@extLink i18n_overview Internationalization Overview}</li>
+ * <li>{@extLink imf_overview Input Method Framework Overview}</li>
* </ul>
*
* @since 1.2
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -583,8 +583,14 @@
/**
* The preferredSize of the list depends upon the layout orientation.
- * <table summary="Describes the preferred size for each layout orientation">
+ *
+ * <table class="striped">
+ * <caption>Describes the preferred size for each layout orientation
+ * </caption>
+ * <thead>
* <tr><th>Layout Orientation</th><th>Preferred Size</th></tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>JList.VERTICAL
* <td>The preferredSize of the list is total height of the rows
@@ -626,6 +632,7 @@
* Max cell height is either the fixed
* cell height, or is determined by iterating through all the cells
* to find the maximum height from the ListCellRenderer.
+ * </tbody>
* </table>
* The above specifies the raw preferred width and height. The resulting
* preferred width is the above width + insets.left + insets.right and
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Thu Aug 24 16:24:44 2017 +0200
@@ -290,11 +290,15 @@
/**
* Populates {@code table} with system colors. The following values are
* added to {@code table}:
- * <table border="1" cellpadding="1" cellspacing="0"
- * summary="Metal's system color mapping">
- * <tr valign="top" style="text-align:left">
- * <th style="background-color:#CCCCFF;text-align:left">Key
- * <th style="background-color:#CCCCFF;text-align:left">Value
+ *
+ * <table class="striped">
+ * <caption>Metal's system color mapping</caption>
+ * <thead>
+ * <tr>
+ * <th>Key
+ * <th>Value
+ * </thead>
+ * <tbody>
* <tr valign="top" style="text-align:left">
* <td>"desktop"
* <td>{@code theme.getDesktopColor()}
@@ -373,6 +377,7 @@
* <tr valign="top" style="text-align:left">
* <td>"infoText"
* <td>{@code theme.getPrimaryControlInfo()}
+ * </tbody>
* </table>
* The value {@code theme} corresponds to the current {@code MetalTheme}.
*
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,9 +44,11 @@
* visually render the spacing and delineation between nodes. The following
* hints are supported:
*
- * <table summary="Descriptions of supported hints: Angled, Horizontal, and None">
+ * <table class="striped">
+ * <caption>Descriptions of supported hints: Angled, Horizontal, and None
+ * </caption>
* <tr>
- * <th><p style="text-align:left">Angled</p></th>
+ * <th>Angled</th>
* <td>A line is drawn connecting the child to the parent. For handling
* of the root node refer to
* {@link javax.swing.JTree#setRootVisible} and
@@ -54,11 +56,11 @@
* </td>
* </tr>
* <tr>
- * <th><p style="text-align:left">Horizontal</p></th>
+ * <th>Horizontal</th>
* <td>A horizontal line is drawn dividing the children of the root node.</td>
* </tr>
* <tr>
- * <th><p style="text-align:left">None</p></th>
+ * <th>None</th>
* <td>Do not draw any visual indication between nodes.</td>
* </tr>
* </table>
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -157,11 +157,15 @@
* Keyboard event and input method events are handled in the following stages,
* with each stage capable of consuming the event:
*
- * <table border=1 summary="Stages of keyboard and input method event handling">
+ * <table class="striped">
+ * <caption>Stages of keyboard and input method event handling</caption>
+ * <thead>
* <tr>
- * <th id="stage"><p style="text-align:left">Stage</p></th>
- * <th id="ke"><p style="text-align:left">KeyEvent</p></th>
- * <th id="ime"><p style="text-align:left">InputMethodEvent</p></th></tr>
+ * <th id="stage">Stage</th>
+ * <th id="ke">KeyEvent</th>
+ * <th id="ime">InputMethodEvent</th></tr>
+ * </thead>
+ * <tbody>
* <tr><td headers="stage">1. </td>
* <td headers="ke">input methods </td>
* <td headers="ime">(generated here)</td></tr>
@@ -181,6 +185,7 @@
* <td headers="stage">5. </td><td headers="ke ime" colspan=2>keymap handling using the current keymap</td></tr>
* <tr><td headers="stage">6. </td><td headers="ke">keyboard handling in JComponent (e.g. accelerators, component navigation, etc.)</td>
* <td headers="ime"></td></tr>
+ * </tbody>
* </table>
*
* <p>
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/MaskFormatter.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/MaskFormatter.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,11 +37,15 @@
* location in the <code>Document</code> model. The following characters can
* be specified:
*
- * <table border=1 summary="Valid characters and their descriptions">
+ * <table class="striped">
+ * <caption>Valid characters and their descriptions</caption>
+ * <thead>
* <tr>
* <th>Character </th>
- * <th><p style="text-align:left">Description</p></th>
+ * <th>Description</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>#</td>
* <td>Any valid number, uses <code>Character.isDigit</code>.</td>
@@ -66,6 +70,7 @@
* </tr>
* <tr><td>*</td><td>Anything.</td></tr>
* <tr><td>H</td><td>Any hex character (0-9, a-f or A-F).</td></tr>
+ * </tbody>
* </table>
*
* <p>
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,11 +46,16 @@
* <p>
* The following table shows what components get built
* by this view.
- * <table summary="shows what components get built by this view">
+ *
+ * <table class="striped">
+ * <caption>Shows what components get built by this view</caption>
+ * <thead>
* <tr>
* <th>Element Type</th>
* <th>Component built</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>input, type button</td>
* <td>JButton</td>
@@ -99,6 +104,7 @@
* <td>input, type file</td>
* <td>JTextField</td>
* </tr>
+ * </tbody>
* </table>
*
* @author Timothy Prinzing
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java Thu Aug 24 16:24:44 2017 +0200
@@ -183,7 +183,8 @@
* <p>The following table shows the example document and the results
* of various methods described above.</p>
*
- * <table border=1 cellspacing=0 summary="HTML Content of example above">
+ * <table class="plain">
+ * <caption>HTML Content of example above</caption>
* <tr>
* <th>Example</th>
* <th><code>insertAfterStart</code></th>
@@ -2129,8 +2130,13 @@
* <p>
* The assignment of the actions described is shown in the
* following table for the tags defined in <code>HTML.Tag</code>.
- * <table border=1 summary="HTML tags and assigned actions">
+ *
+ * <table class="striped">
+ * <caption>HTML tags and assigned actions</caption>
+ * <thead>
* <tr><th>Tag</th><th>Action</th></tr>
+ * </thead>
+ * <tbody>
* <tr><td><code>HTML.Tag.A</code> <td>CharacterAction
* <tr><td><code>HTML.Tag.ADDRESS</code> <td>CharacterAction
* <tr><td><code>HTML.Tag.APPLET</code> <td>HiddenAction
@@ -2203,6 +2209,7 @@
* <tr><td><code>HTML.Tag.U</code> <td>CharacterAction
* <tr><td><code>HTML.Tag.UL</code> <td>BlockAction
* <tr><td><code>HTML.Tag.VAR</code> <td>CharacterAction
+ * </tbody>
* </table>
* <p>
* Once </html> is encountered, the Actions are no longer notified.
@@ -3385,10 +3392,17 @@
* be iterated over picking up the data of the form.
* The following are the model assignments for the
* various type of form elements.
- * <table summary="model assignments for the various types of form elements">
+ *
+ * <table class="striped">
+ * <caption>Model assignments for the various types of form elements
+ * </caption>
+ * <thead>
* <tr>
* <th>Element Type
* <th>Model Type
+ * </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td>input, type button
* <td>{@link DefaultButtonModel}
@@ -3419,6 +3433,7 @@
* <tr>
* <td>textarea
* <td>{@link PlainDocument}
+ * </tbody>
* </table>
*
*/
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu Aug 24 16:24:44 2017 +0200
@@ -1118,10 +1118,17 @@
* table describes what this factory will build by
* default.
*
- * <table summary="Describes the tag and view created by this factory by default">
+ * <table class="striped">
+ * <caption>Describes the tag and view created by this factory by default
+ * </caption>
+ * <thead>
* <tr>
- * <th style="text-align:left">Tag<th style="text-align:left">View created
- * </tr><tr>
+ * <th>Tag
+ * <th>View created
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
* <td>HTML.Tag.CONTENT<td>InlineView
* </tr><tr>
* <td>HTML.Tag.IMPLIED<td>javax.swing.text.html.ParagraphView
@@ -1192,6 +1199,7 @@
* </tr><tr>
* <td>HTML.Tag.FRAME<td>FrameView
* </tr>
+ * </tbody>
* </table>
*/
public static class HTMLFactory implements ViewFactory {
--- a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java Thu Aug 24 16:24:44 2017 +0200
@@ -60,10 +60,16 @@
* that have a value of type {@code UIResource} are refreshed from the
* defaults table. The following table lists the mapping between
* {@code DefaultTreeCellRenderer} property and defaults table key:
- * <table border="1" cellpadding="1" cellspacing="0" summary="">
- * <tr valign="top" style="text-align:left">
- * <th style="background-color:#CCCCFF;text-align:left">Property:
- * <th style="background-color:#CCCCFF;text-align:left">Key:
+ *
+ * <table class="striped">
+ * <caption>Properties</caption>
+ * <thead>
+ * <tr>
+ * <th>Property:
+ * <th>Key:
+ * </tr>
+ * </thead>
+ * <tbody>
* <tr><td>"leafIcon"<td>"Tree.leafIcon"
* <tr><td>"closedIcon"<td>"Tree.closedIcon"
* <tr><td>"openIcon"<td>"Tree.openIcon"
@@ -72,6 +78,7 @@
* <tr><td>"backgroundSelectionColor"<td>"Tree.selectionBackground"
* <tr><td>"backgroundNonSelectionColor"<td>"Tree.textBackground"
* <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"
+ * </tbody>
* </table>
* <p>
* <strong><a id="override">Implementation Note:</a></strong>
--- a/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java Thu Aug 24 16:24:44 2017 +0200
@@ -58,7 +58,8 @@
* and italicized are insignificant.
* <p>
* <a id="figure1"></a>
- * <table border=0 summary="">
+ * <table class="borderless">
+ * <caption style="display:none">Figure 1</caption>
* <tr><td>
* <img src="doc-files/UndoManager-1.gif" alt="">
* <tr><td style="text-align:center">Figure 1
@@ -71,7 +72,8 @@
* figure.
* <p>
* <a id="figure2"></a>
- * <table border=0 summary="">
+ * <table class="borderless">
+ * <caption style="display:none">Figure 2</caption>
* <tr><td>
* <img src="doc-files/UndoManager-2.gif" alt="">
* <tr><td style="text-align:center">Figure 2
@@ -83,7 +85,8 @@
* next edit to 0, as shown in the following figure.
* <p>
* <a id="figure3"></a>
- * <table border=0 summary="">
+ * <table class="borderless">
+ * <caption style="display:none">Figure 3</caption>
* <tr><td>
* <img src="doc-files/UndoManager-3.gif" alt="">
* <tr><td style="text-align:center">Figure 3
@@ -109,7 +112,8 @@
* figure.
* <p>
* <a id="figure4"></a>
- * <table border=0 summary="">
+ * <table class="borderless">
+ * <caption style="display:none">Figure 4</caption>
* <tr><td>
* <img src="doc-files/UndoManager-4.gif" alt="">
* <tr><td style="text-align:center">Figure 4
--- a/jdk/src/java.desktop/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,13 +27,32 @@
* Defines the AWT and Swing user interface toolkits, plus APIs for
* accessibility, audio, imaging, printing, and JavaBeans.
*
+ * @uses java.awt.im.spi.InputMethodDescriptor
+ * @uses javax.accessibility.AccessibilityProvider
+ * @uses javax.imageio.spi.ImageInputStreamSpi
+ * @uses javax.imageio.spi.ImageOutputStreamSpi
+ * @uses javax.imageio.spi.ImageReaderSpi
+ * @uses javax.imageio.spi.ImageTranscoderSpi
+ * @uses javax.imageio.spi.ImageWriterSpi
+ * @uses javax.print.PrintServiceLookup
+ * @uses javax.print.StreamPrintServiceFactory
+ * @uses javax.sound.midi.spi.MidiDeviceProvider
+ * @uses javax.sound.midi.spi.MidiFileReader
+ * @uses javax.sound.midi.spi.MidiFileWriter
+ * @uses javax.sound.midi.spi.SoundbankReader
+ * @uses javax.sound.sampled.spi.AudioFileReader
+ * @uses javax.sound.sampled.spi.AudioFileWriter
+ * @uses javax.sound.sampled.spi.FormatConversionProvider
+ * @uses javax.sound.sampled.spi.MixerProvider
+ *
* @moduleGraph
* @since 9
*/
module java.desktop {
+ requires java.prefs;
+
requires transitive java.datatransfer;
requires transitive java.xml;
- requires java.prefs;
exports java.applet;
exports java.awt;
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Thu Aug 24 16:24:44 2017 +0200
@@ -886,6 +886,14 @@
}
}
+ protected PageFormat getPageFormatFromAttributes() {
+ if (attributes == null || attributes.isEmpty()) {
+ return null;
+ }
+ return attributeToPageFormat(getPrintService(), this.attributes);
+ }
+
+
/**
* Presents the user a dialog for changing properties of the
* print job interactively.
--- a/jdk/src/java.desktop/share/specs/AWT_Native_Interface.html Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,776 +0,0 @@
-<!--
- Copyright (c) 2005, 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.
--->
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang=
-"en-US">
-<head>
-<title>Java AWT Native Interface Specification and Guide</title>
-</head>
-<body>
-<h2>The Java AWT Native Interface Specification and Guide</h2>
-<h3>Introduction</h3>
-<p>The Java AWT Native Interface (JAWT) comprises a small set of native
-(eg C language-based) APIs that provide a standard supported way
-for interaction between Java API windows and surfaces, and
-platform native API windows and surfaces.
-Non-Java libraries may then render to a Java owned window.
-<p>
-Note: in this document the terms "Java AWT Native Interface",
-"AWT Native Interface" and "JAWT" are interchangeable and
-refer to this same specification.
-<p>
-The fundamental obstacle to native rendering without JAWT is that
-is that the rendering code cannot identify where to draw.
-The native code needs access to information about a Java
-drawing surface (such as a handle to the underlying native ID of a
-<tt>Canvas</tt>), but cannot get it.</p>
-Without that information (ie without JAWT) an application could
-use native rendering only by creating its own top-level window
-not shared at all with Java. This is unacceptable for most uses.
-Except for usage via JAWT, this is considered to be entirely
-internal to the Java platform implementation: private, unsupported
-and undocumented.
-<p>
-JAWT should be supported in all headful implementations
-where technically possible although this is not enforced by the JCK.
-There is a platform-specific and a platform
-independent portion to the API, to account for the differing
-data structures and requirements of each platform.
-This document specifies the platform independent portions and
-also documents the platform dependent portions for the Oracle JDK
-supported desktop operating environments.
-For AWT the term platform is less tied to the underlying operating
-system than it is to the desktop windowing environment.
-<p>
-Reasons for using the AWT Native Interface include
-<ul>
-<li>Use of a 3rd party native library not available in Java
-<li>A temporary porting aid before converting legacy code to Java
-<li>Rendering performance available only to native hardware accelerated APIs
-<li>Interoperation with another toolkit
-</ul>
-<p>
-Drawbacks include
-<ul>
-<li>A more complex application implementation, eg for painting
-<li>Potential for application instability if the native library does
-not interoperate properly with AWT.
-<li>Increased application delivery complexity - per platform binaries
-</ul>
-The header file <a href="#jawt.h"> "jawt.h"</a>
-in the Appendix fully specifies the APIs provided by JAWT.
-<p>
-An example illustrating how easy it is to use the AWT Native Interface
-is presented and discussed later in this document.</p>
-
-<p><b>JAWT usage depends on JNI</b></p>
-<p>The definition of Java Standard Edition includes JNI, the Java
-Native Interface. Many Java developers will never need to use it,
-but the interface is the only standard supported way for a Java
-language program to interact directly with
-application code that has been compiled to the native machine
-instructions for the host processor architecture.
-JNI is used where ever there is a need for mixed languages.
-These are by no means limited to cases like AWT. For example, you
-could use JNI to integrate with native code that communicates with
-a peripheral device, such as a scanner, connected to a system via a
-USB port.</p>
-<p>So JNI is general enough to be used to access almost any
-sort of native library.
-The rest of this document assumes a familiarity with how
-to use JNI.
-
-<p><b>How to use JAWT </b></p>
-<p>In this section we describe the most common usage of the AWT
-Native Interface — overriding the <tt>paint</tt> method to
-direct drawing operations to a native rendering library which then
-queries the Java VM to determine the information it needs in order
-to render. Note, however, that any native code may use the AWT
-Native Interface to learn about a target drawing surface, not just
-code in a <tt>paint</tt> method.</p>
-<p>The first step in hooking up a native rendering library to a
-Java <tt>Canvas</tt> is to define a new class that extends
-<tt>Canvas</tt> and overrides the <tt>paint</tt> method. The Java
-system routes all drawing operations for a <tt>Canvas</tt> object
-through the <tt>paint</tt> method, as it does for all other GUI
-objects. Canvas is a good candidate for the rendering surface as
-it does not have any content as a Button would.</p>
-<p>The new <tt>paint</tt> method, to be implemented in the native
-rendering library, must be declared as <tt>public native void</tt>
-, and the native library itself is loaded at runtime by including a
-call to <tt>System.loadLibrary( "myRenderingLib")</tt>in
-the <tt>static</tt> block of the class. The <tt>myRenderingLib</tt>
-name is used for the native shared library; for Linux or the Solaris
-operating environment, the actual name for the library file on disk
-is <tt>libmyRenderingLib.so</tt> .</p>
-<p>Here is a simple example of such a class:</p>
-<pre>
-import java.awt.*;
-import java.awt.event.*;
-
-public class MyCanvas extends Canvas {
- static {
- System.loadLibrary("myRenderingLib");
- }
- public native void paint(Graphics g);
-
- public static void main(String[] args) {
- Frame f = new Frame();
- f.setBounds(0, 0, 500, 110);
- f.add(new MyCanvas());
- f.addWindowListener( new WindowAdapter() {
- public void windowClosing(WindowEvent ev) {
- System.exit(0);
- }
- } );
- f.show();
- }
-}
-<br />
-</pre>
-<p>Note that this class has a <tt>main</tt> method that can be used
-to run this code as an application for testing purposes.</p>
-<p>The next step is to run the <tt>javah</tt> tool on the
-<tt>MyCanvas</tt> class file above to generate a C/C++ header file
-that describes the interface to the native <tt>paint</tt> method
-that Java expects to be used. <tt>javah</tt> is a standard tool
-included with the JDK. NB: <tt>javac -h outputdir</tt> may also be used.</p>
-
-<p>The final step ­ and the most interesting one ­ is to
-write the native rendering method, with an interface that conforms
-to the header file that <tt>javah</tt> generated, and build it as a
-standard shared library (called <tt>myRenderingLib</tt> in the
-above example) by linking it, against the appropriate JDK provided
-$JDK_HOME/lib/$JAWT_LIB library for the target platform.
-Where JAWT_LIB has the base name "jawt" and follows platform
-shared object naming rules. i.e.:
-<ul>
-<li>Windows: jawt.dll
-<li>MacOS: libjawt.dylib
-<li>Linux: libjawt.so
-<li>Solaris: libjawt.so
-</ul>
-
-This code will call back to the Java virtual machine to
-get the drawing surface information it needs to access the
-<tt>MyCanvas</tt> peer. Once this information is available, the
-code can draw directly to <tt>MyCanvas</tt> using standard drawing
-routines supplied by the underlying operating system.</p>
-<p>Here is sample source code for a native <tt>paint</tt> method
-designed for use in a X11-based drawing environment (Linux
-or Solaris) and a Java VM where the AWT Native Interface is present:</p>
-<pre>
-#include "MyCanvas.h"
-#include "jawt_md.h"
-
-/*
- * Class: MyCanvas
- * Method: paint
- * Signature: (Ljava/awt/Graphics;)V
- */
-JNIEXPORT void JNICALL Java_MyCanvas_paint
-(JNIEnv* env, jobject canvas, jobject graphics)
-{
- JAWT awt;
- JAWT_DrawingSurface* ds;
- JAWT_DrawingSurfaceInfo* dsi;
- JAWT_X11DrawingSurfaceInfo* dsi_x11;
- jboolean result;
- jint lock;
- GC gc;
-
- short i;
- char *testString = "^^^ rendered from native code ^^^";
-
- /* Get the AWT */
- awt.version = JAWT_VERSION_9;
- if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
- printf("AWT Not found\n");
- return;
- }
-
- /* Get the drawing surface */
- ds = awt.GetDrawingSurface(env, canvas);
- if (ds == NULL) {
- printf("NULL drawing surface\n");
- return;
- }
-
- /* Lock the drawing surface */
- lock = ds->Lock(ds);
- if((lock & JAWT_LOCK_ERROR) != 0) {
- printf("Error locking surface\n");
- awt.FreeDrawingSurface(ds);
- return;
- }
-
- /* Get the drawing surface info */
- dsi = ds->GetDrawingSurfaceInfo(ds);
- if (dsi == NULL) {
- printf("Error getting surface info\n");
- ds->Unlock(ds);
- awt.FreeDrawingSurface(ds);
- return;
- }
-
- /* Get the platform-specific drawing info */
- dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
-
-
- /* Now paint */
- gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0);
- XSetBackground(dsi_x11->display, gc, 0);
- for (i=0; i<36;i++)
- {
- XSetForeground(dsi_x11->display, gc, 10*i);
- XFillRectangle(dsi_x11->display, dsi_x11->drawable, gc,
- 10*i, 5, 90, 90);
- }
- XSetForeground(dsi_x11->display, gc, 155);
- XDrawImageString(dsi_x11->display, dsi_x11->drawable, gc,
- 100, 110, testString, strlen(testString));
- XFreeGC(dsi_x11->display, gc);
-
-
- /* Free the drawing surface info */
- ds->FreeDrawingSurfaceInfo(dsi);
-
- /* Unlock the drawing surface */
- ds->Unlock(ds);
-
- /* Free the drawing surface */
- awt.FreeDrawingSurface(ds);
-}
-</pre>
-<p>The key data structure here is <tt>JAWT</tt> , which is defined
-in <tt>jawt.h</tt> (included by <tt>jawt_md.h)</tt> ; it provides
-access to all the information the native code needs to get the job
-done. The first part of the native method is boilerplate: it
-populates the <tt>JAWT</tt> structure, gets a
-<tt>JAWT_DrawingSurface</tt> structure, locks the surface (only one
-drawing engine at a time, please!), then gets a
-<tt>JAWT_DrawingSurfaceInfo</tt> structure that contains a pointer
-(in the <tt>platformInfo</tt> field) to the necessary
-platform-specific drawing information. It also includes the
-bounding rectangle of the drawing surface and the current clipping
-region.</p>
-<p>The structure of the information pointed to by
-<tt>platformInfo</tt> is defined in a machine-dependent header file
-called <tt>jawt_md.h</tt>. For X11 drawing, it includes
-information about the X11 display and X11 drawable associated with
-<tt>MyCanvas</tt>. After the drawing operations are completed,
-there is more boilerplate code as <tt>JAWT_DrawingSurfaceInfo</tt>
-is freed and <tt>JAWT_DrawingSurface</tt> is unlocked and
-freed.</p>
-<p>The corresponding code for the GDI API on the Microsoft Windows platform would
-be structured similarly, but would include the version of
-<tt>jawt_md.h</tt> for Microsoft Windows and the structure located
-in the <tt>platformInfo</tt> field of drawing surface info would be
-cast as a <tt>JAWT_Win32DrawingSurfaceInfo*</tt> . And, of course,
-the actual drawing operations would need to be changed to those
-appropriate for the Microsoft Windows platform.
-The same also for MacOS.
-</p>
-<p><b>Summary</b></p>
-<p>The ability to draw directly into a Java <tt>Canvas</tt> from a
-native code library is extremely useful for developers planning to
-migrate a legacy software system to Java, especially one that
-includes a high-performance rendering engine. It makes it much
-easier to migrate in stages, leaving performance-sensitive
-rendering code alone, while other less-sensitive portions of code
-are converted to Java. The result can be a modern Java-centric
-application, providing the benefit of portability and development
-efficiency, but one that does not sacrifice an investment in
-performance of a key piece of native code.</p>
-<p><b>References</b></p>
-<p>The definitive reference to the Java Native Interface is <i>The
-Java Native Interface: Programmer's Guide and Specification</i> by
-Sheng Liang. This book was published in June
-1999 by Addison-Wesley. The ISBN is 0-201-32577-2.</p>
-<p><b>Appendix</b></p>
-<p><b>Header Files for jawt.h and jawt_md.h</b></p>
-<a name="jawt.h"></a>
-<p>jawt.h</p>
-<pre>
-#ifndef _JAVASOFT_JAWT_H_
-#define _JAVASOFT_JAWT_H_
-
-#include "jni.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * AWT native interface.
- *
- * The AWT native interface allows a native C or C++ application a means
- * by which to access native structures in AWT. This is to facilitate moving
- * legacy C and C++ applications to Java and to target the needs of the
- * developers who need to do their own native rendering to canvases
- * for performance or other reasons.
- *
- * Conversely it also provides mechanisms for an application which already
- * has a native window to provide that to AWT for AWT rendering.
- *
- * Since every platform may be different in its native data structures
- * and APIs for windowing systems the application must necessarily
- * provided per-platform source and compile and deliver per-platform
- * native code to use this API.
- *
- * These interfaces are not part of the Java SE specification and
- * a VM is not required to implement this API. However it is strongly
- * recommended that all implementations which support headful AWT
- * also support these interfaces.
- *
- */
-
-/*
- * AWT Native Drawing Surface (JAWT_DrawingSurface).
- *
- * For each platform, there is a native drawing surface structure. This
- * platform-specific structure can be found in jawt_md.h. It is recommended
- * that additional platforms follow the same model. It is also recommended
- * that VMs on all platforms support the existing structures in jawt_md.h.
- *
- *******************
- * EXAMPLE OF USAGE:
- *******************
- *
- * On Microsoft Windows, a programmer wishes to access the HWND of a canvas
- * to perform native rendering into it. The programmer has declared the
- * paint() method for their canvas subclass to be native:
- *
- *
- * MyCanvas.java:
- *
- * import java.awt.*;
- *
- * public class MyCanvas extends Canvas {
- *
- * static {
- * System.loadLibrary("mylib");
- * }
- *
- * public native void paint(Graphics g);
- * }
- *
- *
- * myfile.c:
- *
- * #include "jawt_md.h"
- * #include <assert.h>
- *
- * JNIEXPORT void JNICALL
- * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
- * {
- * JAWT awt;
- * JAWT_DrawingSurface* ds;
- * JAWT_DrawingSurfaceInfo* dsi;
- * JAWT_Win32DrawingSurfaceInfo* dsi_win;
- * jboolean result;
- * jint lock;
- *
- * // Get the AWT. Request version 9 to access features in that release.
- * awt.version = JAWT_VERSION_9;
- * result = JAWT_GetAWT(env, &awt);
- * assert(result != JNI_FALSE);
- *
- * // Get the drawing surface
- * ds = awt.GetDrawingSurface(env, canvas);
- * assert(ds != NULL);
- *
- * // Lock the drawing surface
- * lock = ds->Lock(ds);
- * assert((lock & JAWT_LOCK_ERROR) == 0);
- *
- * // Get the drawing surface info
- * dsi = ds->GetDrawingSurfaceInfo(ds);
- *
- * // Get the platform-specific drawing info
- * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
- *
- * //////////////////////////////
- * // !!! DO PAINTING HERE !!! //
- * //////////////////////////////
- *
- * // Free the drawing surface info
- * ds->FreeDrawingSurfaceInfo(dsi);
- *
- * // Unlock the drawing surface
- * ds->Unlock(ds);
- *
- * // Free the drawing surface
- * awt.FreeDrawingSurface(ds);
- * }
- *
- */
-
-/*
- * JAWT_Rectangle
- * Structure for a native rectangle.
- */
-typedef struct jawt_Rectangle {
- jint x;
- jint y;
- jint width;
- jint height;
-} JAWT_Rectangle;
-
-struct jawt_DrawingSurface;
-
-/*
- * JAWT_DrawingSurfaceInfo
- * Structure for containing the underlying drawing information of a component.
- */
-typedef struct jawt_DrawingSurfaceInfo {
- /*
- * Pointer to the platform-specific information. This can be safely
- * cast to a JAWT_Win32DrawingSurfaceInfo on Microsoft Windows or a
- * JAWT_X11DrawingSurfaceInfo on Linux and Solaris. On MacOS this is a
- * pointer to a NSObject that conforms to the JAWT_SurfaceLayers protocol.
- * See jawt_md.h for details.
- */
- void* platformInfo;
- /* Cached pointer to the underlying drawing surface */
- struct jawt_DrawingSurface* ds;
- /* Bounding rectangle of the drawing surface */
- JAWT_Rectangle bounds;
- /* Number of rectangles in the clip */
- jint clipSize;
- /* Clip rectangle array */
- JAWT_Rectangle* clip;
-} JAWT_DrawingSurfaceInfo;
-
-#define JAWT_LOCK_ERROR 0x00000001
-#define JAWT_LOCK_CLIP_CHANGED 0x00000002
-#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
-#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
-
-/*
- * JAWT_DrawingSurface
- * Structure for containing the underlying drawing information of a component.
- * All operations on a JAWT_DrawingSurface MUST be performed from the same
- * thread as the call to GetDrawingSurface.
- */
-typedef struct jawt_DrawingSurface {
- /* Cached reference to the Java environment of the calling thread.
- * If Lock(), Unlock(), GetDrawingSurfaceInfo() or
- * FreeDrawingSurfaceInfo() are called from a different thread,
- * this data member should be set before calling those functions.
- */
- JNIEnv* env;
- /* Cached reference to the target object */
- jobject target;
- /*
- * Lock the surface of the target component for native rendering.
- * When finished drawing, the surface must be unlocked with
- * Unlock(). This function returns a bitmask with one or more of the
- * following values:
- *
- * JAWT_LOCK_ERROR - When an error has occurred and the surface could not
- * be locked.
- *
- * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
- *
- * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
- *
- * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
- */
- jint (JNICALL *Lock)
- (struct jawt_DrawingSurface* ds);
- /*
- * Get the drawing surface info.
- * The value returned may be cached, but the values may change if
- * additional calls to Lock() or Unlock() are made.
- * Lock() must be called before this can return a valid value.
- * Returns NULL if an error has occurred.
- * When finished with the returned value, FreeDrawingSurfaceInfo must be
- * called.
- */
- JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
- (struct jawt_DrawingSurface* ds);
- /*
- * Free the drawing surface info.
- */
- void (JNICALL *FreeDrawingSurfaceInfo)
- (JAWT_DrawingSurfaceInfo* dsi);
- /*
- * Unlock the drawing surface of the target component for native rendering.
- */
- void (JNICALL *Unlock)
- (struct jawt_DrawingSurface* ds);
-} JAWT_DrawingSurface;
-
-/*
- * JAWT
- * Structure for containing native AWT functions.
- */
-typedef struct jawt {
- /*
- * Version of this structure. This must always be set before
- * calling JAWT_GetAWT(). It affects the functions returned.
- * Must be one of the known pre-defined versions.
- */
- jint version;
- /*
- * Return a drawing surface from a target jobject. This value
- * may be cached.
- * Returns NULL if an error has occurred.
- * Target must be a java.awt.Component (should be a Canvas
- * or Window for native rendering).
- * FreeDrawingSurface() must be called when finished with the
- * returned JAWT_DrawingSurface.
- */
- JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
- (JNIEnv* env, jobject target);
- /*
- * Free the drawing surface allocated in GetDrawingSurface.
- */
- void (JNICALL *FreeDrawingSurface)
- (JAWT_DrawingSurface* ds);
- /*
- * Since 1.4
- * Locks the entire AWT for synchronization purposes
- */
- void (JNICALL *Lock)(JNIEnv* env);
- /*
- * Since 1.4
- * Unlocks the entire AWT for synchronization purposes
- */
- void (JNICALL *Unlock)(JNIEnv* env);
- /*
- * Since 1.4
- * Returns a reference to a java.awt.Component from a native
- * platform handle. On Windows, this corresponds to an HWND;
- * on Solaris and Linux, this is a Drawable. For other platforms,
- * see the appropriate machine-dependent header file for a description.
- * The reference returned by this function is a local
- * reference that is only valid in this environment.
- * This function returns a NULL reference if no component could be
- * found with matching platform information.
- */
- jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
-
- /**
- * Since 9
- * Creates a java.awt.Frame placed in a native container. Container is
- * referenced by the native platform handle. For example on Windows this
- * corresponds to an HWND. For other platforms, see the appropriate
- * machine-dependent header file for a description. The reference returned
- * by this function is a local reference that is only valid in this
- * environment. This function returns a NULL reference if no frame could be
- * created with matching platform information.
- */
- jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo);
-
- /**
- * Since 9
- * Moves and resizes the embedded frame. The new location of the top-left
- * corner is specified by x and y parameters relative to the native parent
- * component. The new size is specified by width and height.
- *
- * The embedded frame should be created by CreateEmbeddedFrame() method, or
- * this function will not have any effect.
- *
- * java.awt.Component.setLocation() and java.awt.Component.setBounds() for
- * EmbeddedFrame really don't move it within the native parent. These
- * methods always locate the embedded frame at (0, 0) for backward
- * compatibility. To allow moving embedded frames this method was
- * introduced, and it works just the same way as setLocation() and
- * setBounds() for usual, non-embedded components.
- *
- * Using usual get/setLocation() and get/setBounds() together with this new
- * method is not recommended.
- */
- void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame,
- jint x, jint y, jint w, jint h);
- /**
- * Since 9
- * Synthesize a native message to activate or deactivate an EmbeddedFrame
- * window depending on the value of parameter doActivate, if "true"
- * activates the window; otherwise, deactivates the window.
- *
- * The embedded frame should be created by CreateEmbeddedFrame() method, or
- * this function will not have any effect.
- */
- void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env,
- jobject embeddedFrame, jboolean doActivate);
-} JAWT;
-
-/*
- * Get the AWT native structure. This function returns JNI_FALSE if
- * an error occurs.
- */
-_JNI_IMPORT_OR_EXPORT_
-jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
-
-/*
- * Specify one of these constants as the JAWT.version
- * Specifying an earlier version will limit the available functions to
- * those provided in that earlier version of JAWT.
- * See the "Since" note on each API. Methods with no "Since"
- * may be presumed to be present in JAWT_VERSION_1_3.
- */
-#define JAWT_VERSION_1_3 0x00010003
-#define JAWT_VERSION_1_4 0x00010004
-#define JAWT_VERSION_1_7 0x00010007
-#define JAWT_VERSION_9 0x00090000
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* !_JAVASOFT_JAWT_H_ */
-
-</pre>
-<p>jawt_md.h (Linux/Solaris/X11 operating environment version)</p>
-<pre>
-#ifndef _JAVASOFT_JAWT_MD_H_
-#define _JAVASOFT_JAWT_MD_H_
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Intrinsic.h>
-#include "jawt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * X11-specific declarations for AWT native interface.
- * See notes in jawt.h for an example of use.
- */
-typedef struct jawt_X11DrawingSurfaceInfo {
- Drawable drawable;
- Display* display;
- VisualID visualID;
- Colormap colormapID;
- int depth;
-} JAWT_X11DrawingSurfaceInfo;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_JAVASOFT_JAWT_MD_H_ */
-</pre>
-<p>jawt_md.h (Microsoft Windows version)</p>
-<pre>
-#ifndef _JAVASOFT_JAWT_MD_H_
-#define _JAVASOFT_JAWT_MD_H_
-
-#include <windows.h>
-#include "jawt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Microsoft Windows specific declarations for AWT native interface.
- * See notes in jawt.h for an example of use.
- */
-typedef struct jawt_Win32DrawingSurfaceInfo {
- /* Native window, DDB, or DIB handle */
- union {
- HWND hwnd;
- HBITMAP hbitmap;
- void* pbits;
- };
- /*
- * This HDC should always be used instead of the HDC returned from
- * BeginPaint() or any calls to GetDC().
- */
- HDC hdc;
- HPALETTE hpalette;
-} JAWT_Win32DrawingSurfaceInfo;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_JAVASOFT_JAWT_MD_H_ */
-</pre>
-<p>jawt_md.h (MacOS version)</p>
-<pre>
-#ifndef _JAVASOFT_JAWT_MD_H_
-#define _JAVASOFT_JAWT_MD_H_
-
-#include "jawt.h"
-
-#ifdef __OBJC__
-#import <QuartzCore/CALayer.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * MacOS specific declarations for AWT native interface.
- * See notes in jawt.h for an example of use.
- */
-
-/*
- * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
- * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
- * return false. This is to maintain compatibility with applications that used the
- * interface with Java 6 which had multiple rendering models. This flag is not necessary
- * when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
- *
- * Example:
- * JAWT awt;
- * awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
- * jboolean success = JAWT_GetAWT(env, &awt);
- */
-#define JAWT_MACOSX_USE_CALAYER 0x80000000
-
-/*
- * When the native Cocoa toolkit is in use, the pointer stored in
- * JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the
- * JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the
- * specified layer to be overlaid on the Components rectangle. If the window the
- * Component belongs to has a CALayer attached to it, this layer will be accessible via
- * the windowLayer property.
- */
-#ifdef __OBJC__
-@protocol JAWT_SurfaceLayers
-@property (readwrite, retain) CALayer *layer;
-@property (readonly) CALayer *windowLayer;
-@end
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_JAVASOFT_JAWT_MD_H_ */
-</pre>
-<!-- Body text ends here -->
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,326 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the Classpath exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Copyright 2003 Wily Technology, Inc.
+ */
+
+/**
+ * Provides services that allow Java programming language agents to instrument
+ * programs running on the JVM. The mechanism for instrumentation is modification
+ * of the byte-codes of methods.
+ *
+ * <p> An agent is deployed as a JAR file. An attribute in the JAR file manifest
+ * specifies the agent class which will be loaded to start the agent. Agents can
+ * be started in several ways:
+ *
+ * <ol>
+ * <li><p> For implementations that support a command-line interface, an agent
+ * can be started by specifying an option on the command-line. </p></li>
+ *
+ * <li><p> An implementation may support a mechanism to start agents some time
+ * after the VM has started. For example, an implementation may provide a
+ * mechanism that allows a tool to <i>attach</i> to a running application, and
+ * initiate the loading of the tool's agent into the running application. </p></li>
+ *
+ * <li><p> An agent may be packaged with an application in an executable JAR
+ * file.</p></li>
+ * </ol>
+ *
+ * <p> Each of these ways to start an agent is described below.
+ *
+ *
+ * <h3>Starting an Agent from the Command-Line Interface</h3>
+ *
+ * <p> Where an implementation provides a means to start agents from the
+ * command-line interface, an agent is started by adding the following option
+ * to the command-line:
+ *
+ * <blockquote>{@code
+ * -javaagent:<jarpath>[=<options>]
+ * }</blockquote>
+ *
+ * where <i>{@code <jarpath>}</i> is the path to the agent JAR file and
+ * <i>{@code <options>}</i> is the agent options.
+ *
+ * <p> The manifest of the agent JAR file must contain the attribute {@code
+ * Premain-Class} in its main manifest. The value of this attribute is the
+ * name of the <i>agent class</i>. The agent class must implement a public
+ * static {@code premain} method similar in principle to the {@code main}
+ * application entry point. After the Java Virtual Machine (JVM) has
+ * initialized, the {@code premain} method will be called, then the real
+ * application {@code main} method. The {@code premain} method must return
+ * in order for the startup to proceed.
+ *
+ * <p> The {@code premain} method has one of two possible signatures. The
+ * JVM first attempts to invoke the following method on the agent class:
+ *
+ * <blockquote>{@code
+ * public static void premain(String agentArgs, Instrumentation inst)
+ * }</blockquote>
+ *
+ * <p> If the agent class does not implement this method then the JVM will
+ * attempt to invoke:
+ * <blockquote>{@code
+ * public static void premain(String agentArgs)
+ * }</blockquote>
+
+ * <p> The agent class may also have an {@code agentmain} method for use when
+ * the agent is started after VM startup (see below). When the agent is started
+ * using a command-line option, the {@code agentmain} method is not invoked.
+ *
+ * <p> Each agent is passed its agent options via the {@code agentArgs} parameter.
+ * The agent options are passed as a single string, any additional parsing
+ * should be performed by the agent itself.
+ *
+ * <p> If the agent cannot be started (for example, because the agent class
+ * cannot be loaded, or because the agent class does not have an appropriate
+ * {@code premain} method), the JVM will abort. If a {@code premain} method
+ * throws an uncaught exception, the JVM will abort.
+ *
+ * <p> An implementation is not required to provide a way to start agents
+ * from the command-line interface. When it does, then it supports the
+ * {@code -javaagent} option as specified above. The {@code -javaagent} option
+ * may be used multiple times on the same command-line, thus starting multiple
+ * agents. The {@code premain} methods will be called in the order that the
+ * agents are specified on the command line. More than one agent may use the
+ * same <i>{@code <jarpath>}</i>.
+ *
+ * <p> There are no modeling restrictions on what the agent {@code premain}
+ * method may do. Anything application {@code main} can do, including creating
+ * threads, is legal from {@code premain}.
+ *
+ *
+ * <h3>Starting an Agent After VM Startup</h3>
+ *
+ * <p> An implementation may provide a mechanism to start agents sometime after
+ * the the VM has started. The details as to how this is initiated are
+ * implementation specific but typically the application has already started and
+ * its {@code main} method has already been invoked. In cases where an
+ * implementation supports the starting of agents after the VM has started the
+ * following applies:
+ *
+ * <ol>
+ *
+ * <li><p> The manifest of the agent JAR must contain the attribute {@code
+ * Agent-Class} in its main manfiest. The value of this attribute is the name
+ * of the <i>agent class</i>. </p></li>
+ *
+ * <li><p> The agent class must implement a public static {@code agentmain}
+ * method. </p></li>
+ *
+ * </ol>
+ *
+ * <p> The {@code agentmain} method has one of two possible signatures. The JVM
+ * first attempts to invoke the following method on the agent class:
+ *
+ * <blockquote>{@code
+ * public static void agentmain(String agentArgs, Instrumentation inst)
+ * }</blockquote>
+ *
+ * <p> If the agent class does not implement this method then the JVM will
+ * attempt to invoke:
+ *
+ * <blockquote>{@code
+ * public static void agentmain(String agentArgs)
+ * }</blockquote>
+ *
+ * <p> The agent class may also have a {@code premain} method for use when the
+ * agent is started using a command-line option. When the agent is started after
+ * VM startup the {@code premain} method is not invoked.
+ *
+ * <p> The agent is passed its agent options via the {@code agentArgs}
+ * parameter. The agent options are passed as a single string, any additional
+ * parsing should be performed by the agent itself.
+ *
+ * <p> The {@code agentmain} method should do any necessary initialization
+ * required to start the agent. When startup is complete the method should
+ * return. If the agent cannot be started (for example, because the agent class
+ * cannot be loaded, or because the agent class does not have a conformant
+ * {@code agentmain} method), the JVM will not abort. If the {@code agentmain}
+ * method throws an uncaught exception it will be ignored (but may be logged
+ * by the JVM for troubleshooting purposes).
+ *
+ *
+ * <h3>Including an Agent in an Executable JAR file</h3>
+ *
+ * <p> The JAR File Specification defines manifest attributes for standalone
+ * applications that are packaged as <em>executable JAR files</em>. If an
+ * implementation supports a mechanism to start an application as an executable
+ * JAR then the main manifest may include the {@code Launcher-Agent-Class}
+ * attribute to specify the class name of an agent to start before the application
+ * {@code main} method is invoked. The Java virtual machine attempts to
+ * invoke the following method on the agent class:
+ *
+ * <blockquote>{@code
+ * public static void agentmain(String agentArgs, Instrumentation inst)
+ * }</blockquote>
+ *
+ * <p> If the agent class does not implement this method then the JVM will
+ * attempt to invoke:
+ *
+ * <blockquote>{@code
+ * public static void agentmain(String agentArgs)
+ * }</blockquote>
+ *
+ * <p> The value of the {@code agentArgs} parameter is always the empty string.
+ *
+ * <p> The {@code agentmain} method should do any necessary initialization
+ * required to start the agent and return. If the agent cannot be started, for
+ * example the agent class cannot be loaded, the agent class does not define a
+ * conformant {@code agentmain} method, or the {@code agentmain} method throws
+ * an uncaught exception or error, the JVM will abort.
+ *
+ *
+ * <h3> Loading agent classes and the modules/classes available to the agent
+ * class </h3>
+ *
+ * <p> Classes loaded from the agent JAR file are loaded by the
+ * {@linkplain ClassLoader#getSystemClassLoader() system class loader} and are
+ * members of the system class loader's {@linkplain ClassLoader#getUnnamedModule()
+ * unnamed module}. The system class loader typically defines the class containing
+ * the application {@code main} method too.
+ *
+ * <p> The classes visible to the agent class are the classes visible to the system
+ * class loader and minimally include:
+ *
+ * <ul>
+ *
+ * <li><p> The classes in packages exported by the modules in the {@linkplain
+ * ModuleLayer#boot() boot layer}. Whether the boot layer contains all platform
+ * modules or not will depend on the initial module or how the application was
+ * started. </p></li>
+ *
+ * <li><p> The classes that can be defined by the system class loader (typically
+ * the class path) to be members of its unnamed module. </p></li>
+ *
+ * <li><p> Any classes that the agent arranges to be defined by the bootstrap
+ * class loader to be members of its unnamed module. </p></li>
+ *
+ * </ul>
+ *
+ * <p> If agent classes need to link to classes in platform (or other) modules
+ * that are not in the boot layer then the application may need to be started in
+ * a way that ensures that these modules are in the boot layer. In the JDK
+ * implementation for example, the {@code --add-modules} command line option can
+ * be used to add modules to the set of root modules to resolve at startup. </p>
+ *
+ * <p> Supporting classes that the agent arranges to be loaded by the bootstrap
+ * class loader (by means of {@link Instrumentation#appendToBootstrapClassLoaderSearch
+ * appendToBootstrapClassLoaderSearch} or the {@code Boot-Class-Path} attribute
+ * specified below), must link only to classes defined to the bootstrap class loader.
+ * There is no guarantee that all platform classes can be defined by the boot
+ * class loader.
+ *
+ * <p> If a custom system class loader is configured (by means of the system property
+ * {@code java.system.class.loader} as specified in the {@link
+ * ClassLoader#getSystemClassLoader() getSystemClassLoader} method) then it must
+ * define the {@code appendToClassPathForInstrumentation} method as specified in
+ * {@link Instrumentation#appendToSystemClassLoaderSearch appendToSystemClassLoaderSearch}.
+ * In other words, a custom system class loader must support the mechanism to
+ * add an agent JAR file to the system class loader search.
+ *
+ * <h3>Manifest Attributes</h3>
+ *
+ * <p> The following manifest attributes are defined for an agent JAR file:
+ *
+ * <blockquote><dl>
+ *
+ * <dt>{@code Premain-Class}</dt>
+ * <dd> When an agent is specified at JVM launch time this attribute specifies
+ * the agent class. That is, the class containing the {@code premain} method.
+ * When an agent is specified at JVM launch time this attribute is required. If
+ * the attribute is not present the JVM will abort. Note: this is a class name,
+ * not a file name or path. </dd>
+ *
+ * <dt>{@code Agent-Class}</dt>
+ * <dd> If an implementation supports a mechanism to start agents sometime after
+ * the VM has started then this attribute specifies the agent class. That is,
+ * the class containing the {@code agentmain} method. This attribute is required
+ * if it is not present the agent will not be started. Note: this is a class name,
+ * not a file name or path. </dd>
+ *
+ * <dt>{@code Launcher-Agent-Class}</dt>
+ * <dd> If an implementation supports a mechanism to start an application as an
+ * executable JAR then the main manifest may include this attribute to specify
+ * the class name of an agent to start before the application {@code main}
+ * method is invoked. </dd>
+ *
+ * <dt>{@code Boot-Class-Path}</dt>
+ * <dd> A list of paths to be searched by the bootstrap class loader. Paths
+ * represent directories or libraries (commonly referred to as JAR or zip
+ * libraries on many platforms). These paths are searched by the bootstrap class
+ * loader after the platform specific mechanisms of locating a class have failed.
+ * Paths are searched in the order listed. Paths in the list are separated by one
+ * or more spaces. A path takes the syntax of the path component of a hierarchical
+ * URI. The path is absolute if it begins with a slash character ('/'), otherwise
+ * it is relative. A relative path is resolved against the absolute path of the
+ * agent JAR file. Malformed and non-existent paths are ignored. When an agent is
+ * started sometime after the VM has started then paths that do not represent a
+ * JAR file are ignored. This attribute is optional. </dd>
+ *
+ * <dt>{@code Can-Redefine-Classes}</dt>
+ * <dd> Boolean ({@code true} or {@code false}, case irrelevant). Is the ability
+ * to redefine classes needed by this agent. Values other than {@code true} are
+ * considered {@code false}. This attribute is optional, the default is {@code
+ * false}. </dd>
+ *
+ * <dt>{@code Can-Retransform-Classes}</dt>
+ * <dd> Boolean ({@code true} or {@code false}, case irrelevant). Is the ability
+ * to retransform classes needed by this agent. Values other than {@code true}
+ * are considered {@code false}. This attribute is optional, the default is
+ * {@code false}. </dd>
+ *
+ * <dt>{@code Can-Set-Native-Method-Prefix}</dt>
+ * <dd> Boolean ({@code true} or {@code false}, case irrelevant). Is the ability
+ * to set native method prefix needed by this agent. Values other than {@code
+ * true} are considered {@code false}. This attribute is optional, the default
+ * is {@code false}. </dd>
+ *
+ * </dl></blockquote>
+ *
+ * <p> An agent JAR file may have both the {@code Premain-Class} and {@code
+ * Agent-Class} attributes present in the manifest. When the agent is started
+ * on the command-line using the {@code -javaagent} option then the {@code
+ * Premain-Class} attribute specifies the name of the agent class and the {@code
+ * Agent-Class} attribute is ignored. Similarly, if the agent is started sometime
+ * after the VM has started, then the {@code Agent-Class} attribute specifies
+ * the name of the agent class (the value of {@code Premain-Class} attribute is
+ * ignored).
+ *
+ *
+ * <h3>Instrumenting code in modules</h3>
+ *
+ * <p> As an aid to agents that deploy supporting classes on the search path of
+ * the bootstrap class loader, or the search path of the class loader that loads
+ * the main agent class, the Java virtual machine arranges for the module of
+ * transformed classes to read the unnamed module of both class loaders.
+ *
+ * @since 1.5
+ * @revised 1.6
+ * @revised 9
+ */
+
+package java.lang.instrument;
\ No newline at end of file
--- a/jdk/src/java.instrument/share/classes/java/lang/instrument/package.html Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-<!--
- 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
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
- Copyright 2003 Wily Technology, Inc.
-
--->
-</head>
-
-<body bgcolor="white">
-
-Provides services that allow Java programming language agents to instrument programs running on the JVM.
-The mechanism for instrumentation is modification of the byte-codes of methods.
-
-<h2>Package Specification</h2>
-
-<P>
-An agent is deployed as a JAR file. An attribute in the JAR file manifest specifies the
-agent class which will be loaded to start the agent. For implementations that support a command-line
-interface, an agent is started by specifying an option on the command-line.
-Implementations may also support a mechanism to start agents some time after the VM has
-started. For example, an implementation may provide a mechanism that allows a tool to
-<i>attach</i> to a running application, and initiate the loading of the tool's agent into
-the running application. The details as to how the load is initiated, is implementation
-dependent.
-
-<h3>Command-Line Interface</h3>
-
-<P>
-An implementation is not required to provide a way to start agents from the
-command-line interface. On implementations that do provide a way to start agents
-from the command-line interface, an agent is started by adding this option to
-the command-line:
-<blockquote>
-<code><b>-javaagent:</b></code><i>jarpath[</i><code><b>=</b></code><i>options]</i>
-</blockquote>
-<i>jarpath</i> is the path to the agent JAR file.
-<i>options</i> is the agent options.
-This switch may be used multiple times on the same command-line,
-thus creating multiple agents.
-More than one agent may use the same <i>jarpath</i>.
-An agent JAR file must conform to the JAR file specification.
-
-<P>
-The manifest of the agent JAR file must contain the attribute <code>Premain-Class</code>. The
-value of this attribute is the name of the <i>agent class</i>. The agent class must implement a
-public static <code>premain</code> method similar in principle to the <code>main</code> application
-entry point. After the Java Virtual Machine (JVM) has initialized, each <code>premain</code> method
-will be called in the order the agents were specified, then the real application
-<code>main</code> method will be called.
-Each <code>premain</code> method must return in order for the startup sequence to proceed.
-
-<P>
-The <code>premain</code> method has one of two possible signatures. The JVM first attempts to
-invoke the following method on the agent class:
-
-<blockquote>
-<code>public static void
-premain(String agentArgs, Instrumentation inst);
-</code>
-</blockquote>
-
-<P>
-If the agent class does not implement this method then the JVM will attempt to invoke:
-
-<blockquote>
-<code>public static void
-premain(String agentArgs);
-</code>
-</blockquote>
-
-<P>
-The agent class may also have an <code>agentmain</code> method for use when the agent is started
-after VM startup. When the agent is started using a command-line option, the <code>agentmain</code>
-method is not invoked.
-
-
-<P>
-The agent class will be loaded by the system class loader
-(see {@link java.lang.ClassLoader#getSystemClassLoader ClassLoader.getSystemClassLoader}). This is
-the class loader which typically loads the class containing the application <code>main</code> method.
-The system class loader must support a mechanism to add an agent JAR file to the system class path.
-If it is a custom system class loader then it must define the
-<code>appendToClassPathForInstrumentation</code> method as specified in
-{@link Instrumentation#appendToSystemClassLoaderSearch appendToSystemClassLoaderSearch}.
-The <code>premain</code> methods will be run under the same security and classloader
-rules as the application <code>main</code> method.
-There are no modeling restrictions on what the agent <code>premain</code> method may do.
-Anything application <code>main</code> can do, including creating threads, is legal from
-<code>premain</code>.
-
-
-<P>
-Each agent is passed its agent options via the <code>agentArgs</code> parameter.
-The agent options are passed as a single string,
-any additional parsing should be performed by the agent itself.
-
-<P>
-If the agent cannot be resolved
-(for example, because the agent class cannot be loaded,
-or because the agent class does not have an appropriate <code>premain</code> method), the JVM will abort.
-If a <code>premain</code> method throws an uncaught exception, the JVM will abort.
-
-
-<h3>Starting Agents After VM Startup</h3>
-
-<p>
-An implementation may provide a mechanism to start agents sometime after the
-the VM has started. The details as to how this is initiated are implementation
-specific but typically the application has already started and its <code>
-main</code> method has already been invoked. In cases where an implementation
-supports the starting of agents after the VM has started the following applies:
-
-<ol>
- <li><p>The manifest of the agent JAR must contain the attribute <code>Agent-Class</code>.
- The value of this attribute is the name of the <i>agent class</i>. </p></li>
-
- <li><p>The agent class must implement a public static <code>agentmain</code> method. </p></li>
-
- <li><p>The system class loader (
- {@link java.lang.ClassLoader#getSystemClassLoader ClassLoader.getSystemClassLoader}) must
- support a mechanism to add an agent JAR file to the system class path.
- If it is a custom system class loader then it must define the
- <code>appendToClassPathForInstrumentation</code> method as specified in
- {@link Instrumentation#appendToSystemClassLoaderSearch appendToSystemClassLoaderSearch}.</li>
-</ol>
-
-<P>
-The agent JAR is appended to the system class path. This is the class loader that typically loads
-the class containing the application <code>main</code> method. The agent class is loaded and the
-JVM attempts to invoke the <code>agentmain</code> method. The JVM first attempts to invoke
-the following method on the agent class:
-
-<blockquote>
-<code>public static void
-agentmain(String agentArgs, Instrumentation inst);
-</code>
-</blockquote>
-
-<P>
-If the agent class does not implement this method then the JVM will attempt to invoke:
-
-<blockquote>
-<code>public static void
-agentmain(String agentArgs);
-</code>
-</blockquote>
-
-<P>
-The agent class may also have an <code>premain</code> method for use when the agent is started
-using a command-line option. When the agent is started after VM startup the <code>premain</code>
-method is not invoked.
-
-
-<P>
-The agent is passed its agent options via the <code>agentArgs</code> parameter.
-The agent options are passed as a single string,
-any additional parsing should be performed by the agent itself.
-
-<P>
-The <code>agentmain</code> method should do any necessary initialization
-required to start the agent. When startup is complete the method should
-return. If the agent cannot be started
-(for example, because the agent class cannot be loaded,
-or because the agent class does not have a conformant <code>agentmain</code> method), the JVM will
-not abort. If the <code>agentmain</code> method throws an uncaught exception it will be ignored.
-
-
-<h3>Deploying Agents in Executable JAR file</h3>
-
-The JAR File Specification defines manifest attributes for standalone applications that are
-bundled as <em>executable JAR files</em>. If an implementation supports a mechanism to start
-an application as an executable JAR then the main manifest may include the
-<code>Launcher-Agent-Class</code> attribute to specify the class name
-of an agent to start before the application <code>main</code> method is invoked. The Java
-virtual machine attempts to invoke the following method on the agent class:
-
-<blockquote>
- <code>public static void
- agentmain(String agentArgs, Instrumentation inst);
- </code>
-</blockquote>
-
-<P>
-If the agent class does not implement this method then the JVM will attempt to invoke:
-
-<blockquote>
- <code>public static void
- agentmain(String agentArgs);
- </code>
-</blockquote>
-
-<p>
-The value of the <code>agentArgs</code> parameter is always the empty string.
-
-<P>
-The <code>agentmain</code> method should do any necessary initialization
-required to start the agent and return. If the agent cannot be started, for
-example the agent class cannot be loaded, the agent class does not define a
-conformant <code>agentmain</code> method, or the <code>agentmain</code> method
-throws an uncaught exception or error, the JVM will abort.
-
-
-<h3>Visibility</h3>
-
-The types visible to the agent class are the types visible to the system class
-loader. They minimally include the types in packages exported by
-<a href="{@docRoot}/java.base-summary.html">java.base</a> and
-<a href="{@docRoot}/java.instrument-summary.html">java.instrument</a>.
-Whether all {@linkplain ClassLoader#getPlatformClassLoader() platform classes}
-are visible or not will depend on the initial module or application.
-
-<p>
-Supporting classes that the agent makes visible to the bootstrap class loader
-(by means of {@link Instrumentation#appendToBootstrapClassLoaderSearch
-appendToBootstrapClassLoaderSearch} or the <code>Boot-Class-Path</code> attribute
-specified below) can only link to types defined to the bootstrap class loader.
-There is no guarantee that all platform classes are visible to the boot class
-loader.
-
-
-<h3>Manifest Attributes</h3>
-
-The following manifest attributes are defined for an agent JAR file:
-<blockquote>
-<dl>
-<dt><code>Premain-Class</code></dt>
-<dd>
- When an agent is specified at JVM launch time this attribute
- specifies the agent class.
- That is, the class containing the <code>premain</code> method.
- When an agent is specified at JVM launch time this attribute
- is required. If the attribute is not present the JVM will abort.
- Note: this is a class name, not a file name or path.
-</dd>
-<dt><code>Agent-Class</code></dt>
-<dd>
- If an implementation supports a mechanism to start agents
- sometime after the VM has started then this attribute specifies
- the agent class.
- That is, the class containing the <code>agentmain</code> method.
- This attribute is required, if it is not present the agent
- will not be started.
- Note: this is a class name, not a file name or path.
-</dd>
-<dt><code>Launcher-Agent-Class</code></dt>
-<dd>
- If an implementation supports a mechanism to start an application
- as an executable JAR then the main manifest may include this
- attribute to specify the class name of an agent to start before the
- application <code>main</code> method is invoked.
-</dd>
-<dt><code>Boot-Class-Path</code></dt>
-<dd>
- A list of paths to be searched by the bootstrap class
- loader. Paths represent directories or libraries
- (commonly referred to as JAR or zip libraries on
- many platforms).
- These paths are searched by the
- bootstrap class loader after the platform specific
- mechanisms of locating a class have failed.
- Paths are searched in the order listed.
- Paths in the list are separated by one or more spaces.
- A path takes the syntax of the path component of a
- hierarchical URI. The path is
- absolute if it begins with a slash character ('/'),
- otherwise it is relative. A relative path is resolved
- against the absolute path of the agent JAR file.
- Malformed and non-existent paths are ignored.
- When an agent is started sometime after the VM has
- started then paths that do not represent a JAR file
- are ignored.
- This attribute is optional.
-</dd>
-<dt><code>Can-Redefine-Classes</code></dt>
-<dd>
- Boolean (<code>true</code> or <code>false</code>, case irrelevant).
- Is the ability to redefine classes
- needed by this agent.
- Values other than <code>true</code> are considered <code>false</code>.
- This attribute is optional, the default is <code>false</code>.
-</dd>
-<dt><code>Can-Retransform-Classes</code></dt>
-<dd>
- Boolean (<code>true</code> or <code>false</code>, case irrelevant).
- Is the ability to retransform classes
- needed by this agent.
- Values other than <code>true</code> are considered <code>false</code>.
- This attribute is optional, the default is <code>false</code>.
-</dd>
-<dt><code>Can-Set-Native-Method-Prefix</code></dt>
-<dd>
- Boolean (<code>true</code> or <code>false</code>, case irrelevant).
- Is the ability to set native method prefix needed by this agent.
- Values other than <code>true</code> are considered <code>false</code>.
- This attribute is optional, the default is <code>false</code>.
-</dd>
-</dl>
-</blockquote>
-
-<p>
-An agent JAR file may have both the <code>Premain-Class</code> and <code>Agent-Class</code>
-attributes present in the manifest. When the agent is started on the command-line using
-the <code>-javaagent</code> option then the <code>Premain-Class</code> attribute
-specifies the name of the agent class and the <code>Agent-Class</code> attribute is
-ignored. Similarly, if the agent is started sometime after the VM has started, then
-the <code>Agent-Class</code> attribute specifies the name of the agent class
-(the value of <code>Premain-Class</code> attribute is ignored).
-
-
-<h3>Instrumenting code in modules</h3>
-
-As an aid to agents that deploy supporting classes on the search path of the
-bootstrap class loader, or the search path of the class loader that loads
-the main agent class, the Java virtual machine arranges for the module of
-transformed classes to read the unnamed module of both class loaders.
-
-
-<h2>Related Documentation</h2>
-
-For tool documentation, please see:
-<ul>
- <li><a href="{@docRoot}/../technotes/tools/index.html">JDK Tools and Utilities</a>
-</ul>
-
-@since 1.5
-@revised 1.6
-
-</body>
-</html>
--- a/jdk/src/java.logging/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.logging/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,6 +31,7 @@
*/
module java.logging {
exports java.util.logging;
+
provides jdk.internal.logger.DefaultLoggerFinder with
sun.util.logging.internal.LoggingProviderImpl;
}
--- a/jdk/src/java.management.rmi/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.management.rmi/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,36 +24,37 @@
*/
/**
- * Defines the RMI Connector for the Java Management Extensions (JMX) Remote API.
- * <P>
- * The {@linkplain javax.management.remote.rmi RMI connector} is a connector
- * for the JMX Remote API that uses RMI to transmit client requests to a remote
- * MBean server.
+ * Defines the {@linkplain javax.management.remote.rmi RMI connector}
+ * for the Java Management Extensions (JMX) Remote API.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Providers:</dt>
+ * <dd>This module provides
+ * {@link javax.management.remote.JMXConnectorProvider} service
+ * that creates the JMX connector clients using RMI protocol.
+ * Instances of {@code JMXConnector} can be obtained via the
+ * {@link javax.management.remote.JMXConnectorFactory#newJMXConnector
+ * JMXConnectorFactory.newJMXConnector} factory method.
+ * It also provides {@link javax.management.remote.JMXConnectorServerProvider} service
+ * that creates the JMX connector servers using RMI protocol.
+ * Instances of {@code JMXConnectorServer} can be obtained via the
+ * {@link javax.management.remote.JMXConnectorServerFactory#newJMXConnectorServer
+ * JMXConnectorServerFactory.newJMXConnectorServer} factory method.
+ * </dd>
+ * </dl>
*
* @provides javax.management.remote.JMXConnectorProvider
- * A provider of {@code JMXConnector} for the RMI protocol.<br>
- * Instances of {@code JMXConnector} using the RMI protocol
- * are usually created by the {@link
- * javax.management.remote.JMXConnectorFactory} which will locate
- * and load the appropriate {@code JMXConnectorProvider} service
- * implementation for the given protocol.
- *
* @provides javax.management.remote.JMXConnectorServerProvider
- * A provider of {@code JMXConnectorServer} for the RMI protocol.<br>
- * Instances of {@code JMXConnectorServer} using the RMI protocol
- * are usually created by the {@link
- * javax.management.remote.JMXConnectorServerFactory} which will locate
- * and load the appropriate {@code JMXConnectorServerProvider} service
- * implementation for the given protocol.
*
* @moduleGraph
* @since 9
*/
module java.management.rmi {
+ requires java.naming;
+
requires transitive java.management;
requires transitive java.rmi;
- requires java.naming;
exports javax.management.remote.rmi;
@@ -68,9 +69,9 @@
// The java.management.rmi module provides implementations
// of the JMXConnectorProvider and JMXConnectorServerProvider
// services supporting the RMI protocol.
- provides javax.management.remote.JMXConnectorProvider
- with com.sun.jmx.remote.protocol.rmi.ClientProvider;
- provides javax.management.remote.JMXConnectorServerProvider
- with com.sun.jmx.remote.protocol.rmi.ServerProvider;
+ provides javax.management.remote.JMXConnectorProvider with
+ com.sun.jmx.remote.protocol.rmi.ClientProvider;
+ provides javax.management.remote.JMXConnectorServerProvider with
+ com.sun.jmx.remote.protocol.rmi.ServerProvider;
}
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -136,10 +136,9 @@
* <code><em>protocol</em></code>, or it will throw a
* <code>MalformedURLException</code> if there is none. An
* implementation may choose to find providers by other means. For
- * example, it may support the <a
- * href="{@docRoot}/../technotes/guides/jar/jar.html#Service%20Provider">
- * JAR conventions for service providers</a>, where the service
- * interface is <code>JMXConnectorProvider</code>.</p>
+ * example, it may support <a
+ * href="{@docRoot}/../java/util/ServiceLoader.html#developing-service-providers">service providers</a>,
+ * where the service interface is <code>JMXConnectorProvider</code>.</p>
*
* <p>Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string <code>rmi</code>.
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -127,10 +127,9 @@
* <code><em>protocol</em></code>, or it will throw a
* <code>MalformedURLException</code> if there is none. An
* implementation may choose to find providers by other means. For
- * example, it may support the <a
- * href="{@docRoot}/../technotes/guides/jar/jar.html#Service%20Provider">
- * JAR conventions for service providers</a>, where the service
- * interface is <code>JMXConnectorServerProvider</code>.</p>
+ * example, it may support <a
+ * href="{@docRoot}/../java/util/ServiceLoader.html#developing-service-providers">service providers</a>,
+ * where the service interface is <code>JMXConnectorServerProvider</code>.</p>
*
* <p>Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string <code>rmi</code>.
--- a/jdk/src/java.management/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.management/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -29,6 +29,9 @@
* The JMX API consists of interfaces for monitoring and management of the
* JVM and other components in the Java runtime.
*
+ * @uses javax.management.remote.JMXConnectorProvider
+ * @uses javax.management.remote.JMXConnectorServerProvider
+ *
* @moduleGraph
* @since 9
*/
@@ -43,25 +46,30 @@
exports javax.management.relation;
exports javax.management.remote;
exports javax.management.timer;
+
exports com.sun.jmx.remote.internal to
- java.management.rmi,
- jdk.management.agent;
+ java.management.rmi,
+ jdk.management.agent;
exports com.sun.jmx.remote.security to
- java.management.rmi,
- jdk.management.agent;
- exports com.sun.jmx.remote.util to java.management.rmi;
+ java.management.rmi,
+ jdk.management.agent;
+ exports com.sun.jmx.remote.util to
+ java.management.rmi;
exports sun.management to
jdk.jconsole,
jdk.management,
jdk.management.agent;
- exports sun.management.counter to jdk.management.agent;
- exports sun.management.counter.perf to jdk.management.agent;
- exports sun.management.spi to jdk.management;
+ exports sun.management.counter to
+ jdk.management.agent;
+ exports sun.management.counter.perf to
+ jdk.management.agent;
+ exports sun.management.spi to
+ jdk.management;
uses javax.management.remote.JMXConnectorProvider;
uses javax.management.remote.JMXConnectorServerProvider;
uses sun.management.spi.PlatformMBeanProvider;
- provides javax.security.auth.spi.LoginModule
- with com.sun.jmx.remote.security.FileLoginModule;
+ provides javax.security.auth.spi.LoginModule with
+ com.sun.jmx.remote.security.FileLoginModule;
}
--- a/jdk/src/java.management/share/classes/sun/management/MemoryPoolImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryPoolImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, 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
@@ -304,8 +304,7 @@
getCount());
}
void triggerAction() {
- // Should not reach here
- throw new AssertionError("Should not reach here");
+ // do nothing
}
void clearAction() {
// do nothing
@@ -332,8 +331,7 @@
gcSensor.getCount());
}
void triggerAction() {
- // Should not reach here
- throw new AssertionError("Should not reach here");
+ // do nothing
}
void clearAction() {
// do nothing
--- a/jdk/src/java.management/share/specs/JVM-MANAGEMENT-MIB.mib Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3266 +0,0 @@
---
---
---
--- 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
--- under the terms of the GNU General Public License version 2 only, as
--- published by the Free Software Foundation. Oracle designates this
--- particular file as subject to the "Classpath" exception as provided
--- by Oracle in the LICENSE file that accompanied this code.
---
--- This code is distributed in the hope that it will be useful, but WITHOUT
--- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
--- version 2 for more details (a copy is included in the LICENSE file that
--- accompanied this code).
---
--- You should have received a copy of the GNU General Public License version
--- 2 along with this work; if not, write to the Free Software Foundation,
--- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
---
--- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
--- or visit www.oracle.com if you need additional information or have any
--- questions.
---
---
--- The JVM-MANAGEMENT-MIB Module
---
--- See jvmManagementMIB MODULE-IDENTITY for a description overview.
--- See conformance statements for mandatory objects
---
-
-JVM-MANAGEMENT-MIB DEFINITIONS ::= BEGIN
-
-IMPORTS
- MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, Counter32, Gauge32,
- Integer32, Counter64, enterprises
- FROM SNMPv2-SMI
- DisplayString, TEXTUAL-CONVENTION, RowPointer
- FROM SNMPv2-TC
- MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
- FROM SNMPv2-CONF;
-
--- Module Identity
-------------------
-
-jvmMgtMIB MODULE-IDENTITY
- LAST-UPDATED "200403041800Z"
- -- Format is "YYYYMMDDhhmmZ"
- ORGANIZATION "Sun Microsystems, Inc."
- CONTACT-INFO "Sun Microsystems, Inc.
- 4150 Network Circle
- Santa Clara, CA 95054
- 1-800-555-9SUN or
- 1-650-960-1300
- http://www.sun.com
- or contact your local support representative"
- DESCRIPTION
- "Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-
- This module defines the MIB that provides access to the
- Java[tm] Virtual Machine monitoring data.
- This module is derived from the Java[tm] programming language APIs
- described in the java.lang.management package of
- Java[tm] 2, Standard Edition, 5.0.
-
- See the Java programming language APIs of JSR 163 for
- 'Monitoring and Management of the Java[TM] Virtual Machine'
- for more details.
-
- Where the Java programming language API uses long, or int,
- the MIB often uses the corresponding unsigned quantity -
- which is closer to the object semantics.
-
- In those cases, it often happens that the -1 value that might
- be used by the API to indicate an unknown/unimplemented
- value cannot be used. Instead the MIB uses the value 0, which
- stricly speaking cannot be distinguished from a valid value.
- In many cases however, a running system will have non-zero
- values, so using 0 instead of -1 to indicate an unknown
- quantity does not lose any functionality.
- "
- REVISION "200403041800Z"
- -- Format is "YYYYMMDDhhmmZ"
- DESCRIPTION
- "
- JVM-MANAGEMENT-MIB - JSR 163 Final Release 1.0
- "
-
- ::= { standard jsr163(163) 1 }
-
-
--- Enterprise OIDs
-------------------
-
--- internet OBJECT IDENTIFIER ::= { iso(1) org(3) dod(6) 1 }
--- private OBJECT IDENTIFIER ::= { internet 4 }
--- enterprises OBJECT IDENTIFIER ::= { private 1 }
- sun OBJECT IDENTIFIER ::= { enterprises 42 }
- jmgt OBJECT IDENTIFIER ::= { sun products(2) 145 }
- -- experimental OBJECT IDENTIFIER ::= { jmgt 1 }
- standard OBJECT IDENTIFIER ::= { jmgt 3 }
-
-----------------------------------------------------------------------------
--- Textual Conventions
-----------------------
---
--- Note: Some of the TEXTUAL-CONVENTIONs defined in this module are
--- OCTET STRING with a 1023 size limitation (SIZE(0..1023)).
---
--- As per RFC2578, section 7.1.2. OCTET STRING:
---
--- "The OCTET STRING type represents arbitrary binary or textual data.
--- Although the SMI-specified size limitation for this type is 65535
--- octets, MIB designers should realize that there may be
--- implementation and interoperability limitations for sizes in
--- excess of 255 octets."
---
--- As a consequence an agent implementing this MIB may decide to
--- restrict this maximum size to a lesser value than 1023, provided that
--- it makes it clear in an AGENT-CAPABILITY statement.
---
-----------------------------------------------------------------------------
-
-JvmUnsigned64TC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "A non-negative 64-bit bit integer, without counter
- semantics."
- -- We have cloned the Unsigned64TC defined in RFC 2564 rather
- -- than importing it because the JVM-MANAGEMENT-MIB and the
- -- APPLICATION-MIB are not related.
- --
- REFERENCE "RFC 2564 - APPLICATION-MIB, Unsigned64TC."
- SYNTAX Counter64
-
-
-JvmJavaObjectNameTC ::= TEXTUAL-CONVENTION
- DISPLAY-HINT "255a"
- STATUS current
- DESCRIPTION
- "An Object Name, as implemented by the java.lang.management API,
- which identify a runtime Object (e.g. a Class Loader, a
- Memory Manager, etc...).
- The name is assumed to be unique in the scope of the object's
- class.
-
- This object syntax is equivalent to a DisplayString, but with a
- a 1023 bytes size limits (instead of 255 for a DisplayString).
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in this type.
- (1023 bytes max).
- "
- SYNTAX OCTET STRING (SIZE (0..1023))
-
-JvmPathElementTC ::= TEXTUAL-CONVENTION
- DISPLAY-HINT "255a"
- STATUS current
- DESCRIPTION
- "A file or directory element in a PATH/CLASSPATH/LIBRARY_PATH
- structure.
-
- This object syntax is equivalent to a DisplayString, but with a
- a 1023 bytes size limits (instead of 255 for a DisplayString).
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in this type.
- (1023 bytes max).
- "
- SYNTAX OCTET STRING (SIZE (0..1023))
-
-JvmArgValueTC ::= TEXTUAL-CONVENTION
- DISPLAY-HINT "255a"
- STATUS current
- DESCRIPTION
- "A string representing an input argument.
-
- This object syntax is equivalent to a DisplayString, but with a
- a 1023 bytes size limits (instead of 255 for a DisplayString).
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in this type.
- (1023 bytes max).
- "
- SYNTAX OCTET STRING (SIZE (0..1023))
-
-JvmVerboseLevelTC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "Defines whether the verbose flag for a feature is active.
- verbose: the flag is on.
- silent: the flag is off.
- "
- SYNTAX INTEGER { silent(1), verbose(2) }
-
-
-JvmImplSupportStateTC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "Defines whether a feature is supported or not.
- "
- SYNTAX INTEGER { unsupported(1), supported(2) }
-
-JvmImplOptFeatureStateTC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "Defines whether an optional feature is supported, enabled,
- or disabled.
-
- An optional feature can be:
-
- unsupported: The JVM does not support this feature.
- enabled : The JVM supports this feature, and it
- is enabled.
- disabled : The JVM supports this feature, and it
- is disabled.
-
- Only enabled(3) and disabled(4) may be supplied as values to a
- SET request. unsupported(1) can only be set internally by the
- agent.
- "
- SYNTAX INTEGER { unsupported(1), enabled(3), disabled(4) }
-
-JvmTimeMillis64TC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "An elapsed time, expressed in milli-seconds.
- This type is based on Counter64, but without its specific
- semantics.
- "
- SYNTAX Counter64
-
-JvmTimeNanos64TC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "An elapsed time, expressed in nano-seconds.
- This type is based on Counter64, but without its specific
- semantics.
- "
- SYNTAX Counter64
-
-JvmPositive32TC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "A positive Integer32. In Java that would be a number
- in [0..Integer.MAX_VALUE].
- "
- -- We use Integer32 (0..2147483647) rather than Unsigned32 because
- -- Unsigned32 (0..2147483647) because Unsigned32 is based on
- -- Gauge32 - which has a specific ASN.1 tag and a specific semantics.
- -- In principle you cannot use a Gauge32 as base type for an index
- -- in a table.
- -- Note also that Unsigned32 is (0..2^32-1)
- -- while Positive32 is (0..2^31-1)
- --
- SYNTAX Integer32 (0..2147483647)
-
-JvmManagedMemoryTypeTC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "
- Defines the type of memory contained in a memory pool.
- The pool may contain, heap memory or non-heap memory.
- "
- SYNTAX INTEGER { nonheap(1), heap(2) }
-
-
-JvmValidityStateTC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "
- Defines whether an object is still valid.
- "
- SYNTAX INTEGER { invalid(1), valid(2) }
-
-
-JvmThreadStateTC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "Defines the possible states of a thread running in the
- Java virtual machine. They are virtual machine thread states
- and do not reflect any operating system thread states.
-
- The first two bits: inNative(1) and suspended(2) can be
- combined together and with any other bits. The remaining
- bits 3-9, are mutually exclusive. Bits 10-16 are reserved
- for future evolution of this MIB.
-
- An agent MUST always return a thread state with one of the
- bits in the range 3-9 set to 1. The other(9) bit should only
- be set to 1 if new thread states which are mutally exclusive
- with bits 3-8 are defined. An implementation can define
- additional implementation dependant states and uses bits
- from bit 17.
-
- See java.lang.Thread.State,
- java.lang.management.ThreadInfo.
- "
- --
- -- Take care that in SNMP bits are numbered starting at 1, from
- -- left to right (1 is the highest bit). A bitmap defined by the
- -- BITS construct is thus a byte array where bit 1 is the highest bit
- -- of the first byte.
- --
- SYNTAX BITS { -- Bits 1-2 may be specified in any combination
- inNative(1),
- suspended(2),
-
- -- Bits 3-9 are mutually exclusive. Attempting to
- -- set more than a single bit to 1 will result in
- -- a returned error-status of inconsistentValue.
- newThread(3),
- runnable(4),
- blocked(5),
- terminated(6),
- waiting(7),
- timedWaiting(8),
- other(9)
- -- Bits 10-16 are reserved for future use by
- -- this MIB
- }
-
-
-JvmIndex64TC ::= TEXTUAL-CONVENTION
- STATUS current
- DESCRIPTION
- "A 64 bits string mapping an unsigned 64 bits integer value
- in big-endian ordering (i.e: 1 is encoded as 0x0000000000000001).
-
- This type can be used when an unsigned 64 bits integer needs
- to be used inside a table index.
- "
- SYNTAX OCTET STRING (SIZE(8))
-
-
--- OBJECT-TYPE OID tree
------------------------
-
-jvmMgtMIBObjects
- OBJECT IDENTIFIER ::= { jvmMgtMIB 1 }
-jvmMgtMIBNotifications
- OBJECT IDENTIFIER ::= { jvmMgtMIB 2 }
-jvmMgtMIBConformance
- OBJECT IDENTIFIER ::= { jvmMgtMIB 3 }
-
------------------------------------------------------------------------
---
--- The JVM Class Loading group
---
--- A collection of objects used to monitor Class Loading in the
--- Java Virtual Machine. These objects define the SNMP management
--- interface for the class loading system of the Java virtual machine.
---
--- This group only contains a few scalar object and no tables. The objects
--- from this group are mapped from the java.lang.management.ClassLoadingMXBean
--- interface.
---
--- See J2SE 5.0 API Specification,
--- java.lang.management.ClassLoadingMXBean
------------------------------------------------------------------------
-
--- Root OBJECT IDENTIFIER for ClassLoading group.
---
-jvmClassLoading OBJECT IDENTIFIER ::= { jvmMgtMIBObjects 1 }
-
--- The following objects are mapped from the ClassLoadingMXBean interface.
------------------------------------------------------------------------
-
-jvmClassesLoadedCount OBJECT-TYPE
- SYNTAX Gauge32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of classes currently loaded in the JVM.
-
- See java.lang.management.ClassLoadingMXBean.getLoadedClassCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ClassLoadingMXBean"
- ::= { jvmClassLoading 1 }
-
-jvmClassesTotalLoadedCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of classes that have been loaded since
- the JVM has started execution.
-
- See java.lang.management.ClassLoadingMXBean.
- getTotalLoadedClassCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ClassLoadingMXBean"
- ::= { jvmClassLoading 2 }
-
-jvmClassesUnloadedCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of classes that have been unloaded since
- the JVM has started execution.
-
- See java.lang.management.ClassLoadingMXBean.getUnloadedClassCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ClassLoadingMXBean"
- ::= { jvmClassLoading 3 }
-
-jvmClassesVerboseLevel OBJECT-TYPE
- SYNTAX JvmVerboseLevelTC
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "Enables or disables the verbose output for the class loading
- system. The verbose output information and the output stream
- to which the verbose information is emitted are implementation
- dependent. Typically, a Java virtual machine implementation
- prints a message each time a class file is loaded.
-
- verbose: if the verbose output is enabled.
- silent: otherwise.
-
- See java.lang.management.ClassLoadingMXBean.isVerbose(),
- java.lang.management.ClassLoadingMXBean.setVerbose()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ClassLoadingMXBean"
- DEFVAL { silent }
- ::= { jvmClassLoading 4 }
-
-
------------------------------------------------------------------------
---
--- The JVM Memory group
---
--- A collection of objects used to monitor memory management in the
--- Java Virtual Machine. These objects define management interface for
--- the memory system of the Java virtual machine.
---
--- Memory:
---
--- The memory system of the Java virtual machine manages the following
--- kinds of memory: heap, and non-heap. More information on these types
--- of memory can be obtained from the J2SE 5.0 API Specification,
--- java.lang.management.MemoryMXBean.
---
--- Memory Pools and Memory Managers:
---
--- Memory pools and memory managers are the abstract entities that monitor
--- and manage the memory system of the Java virtual machine.
---
--- Memory managers are represented by the jvmMemManagerTable, which contains
--- one row per Memory manager.
--- The garbage collector is one type of memory manager responsible for
--- reclaiming memory occupied by unreachable objects.
--- The jvmMemGCTable is an extension of the jvmMemManagerTable, which contains
--- the attribute specific to garbage collectors. A garbage collector entity
--- is thus represented by one row in the jvmMemManagerTable, and one
--- extension row in the jvmMemGCTable.
---
--- Memory Pools are represented by the jvmMemPoolTable, which contains one
--- row per memory pool. A Java virtual machine may create or remove
--- memory pools during execution. A memory pool can belong to either the
--- heap or the non-heap memory.
---
--- A memory manager is responsible for managing one or more memory pools.
--- A memory pool can be managed by more than one memory manager.
--- The jvmMemMgrRelPoolTable represents this managing/managed relationship.
---
--- A Java virtual machine may add or remove memory managers during execution.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryMXBean for
--- more information on memory types, memory managers, memory pools,
--- and the memory subsystem.
---
------------------------------------------------------------------------
-
--- Root OBJECT IDENTIFIER for the JVM Memory group.
---
-jvmMemory OBJECT IDENTIFIER ::= { jvmMgtMIBObjects 2 }
-
--- The following objects are mapped from the MemoryMXBean interface.
------------------------------------------------------------------------
-
-jvmMemoryPendingFinalCount OBJECT-TYPE
- SYNTAX Gauge32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The approximate number objects that are pending for finalization.
-
- See java.lang.management.MemoryMXBean.
- getObjectPendingFinalizationCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean"
- ::= { jvmMemory 1 }
-
-jvmMemoryGCVerboseLevel OBJECT-TYPE
- SYNTAX JvmVerboseLevelTC
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "Enables or disables verbose output for the memory system.
- The verbose output information and the output stream to which
- the verbose information is emitted are implementation dependent.
- Typically, a Java virtual machine implementation prints a
- message whenever it frees memory at garbage collection.
-
- verbose: if the verbose output is enabled,
- silent: otherwise.
-
- See java.lang.management.MemoryMXBean.isVerbose(),
- java.lang.management.MemoryMXBean.setVerbose()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean"
- ::= { jvmMemory 2 }
-
-jvmMemoryGCCall OBJECT-TYPE
- SYNTAX INTEGER { unsupported(1), supported(2), start(3),
- started(4), failed(5) }
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "This object makes it possible to remotelly trigger the
- Garbage Collector in the JVM.
-
- This object's syntax is an enumeration which defines:
-
- * Two state values, that can be returned from a GET request:
-
- unsupported(1): means that remote invocation of gc() is not
- supported by the SNMP agent.
- supported(2) : means that remote invocation of gc() is supported
- by the SNMP agent.
-
- * One action value, that can be provided in a SET request to
- trigger the garbage collector:
-
- start(3) : means that a manager wishes to trigger
- garbage collection.
-
- * Two result value, that will be returned in the response to a
- SET request when remote invocation of gc is supported
- by the SNMP agent:
-
- started(4) : means that garbage collection was
- successfully triggered. It does not mean
- however that the action was successfullly
- completed: gc might still be running when
- this value is returned.
- failed(5) : means that garbage collection couldn't be
- triggered.
-
- * If remote invocation is not supported by the SNMP agent, then
- unsupported(1) will always be returned as a result of either
- a GET request, or a SET request with start(3) as input value.
-
- * If a SET request with anything but start(3) is received, then
- the agent will return a wrongValue error.
-
- See java.lang.management.MemoryMXBean.gc()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean"
- ::= { jvmMemory 3 }
-
--- The object identifiers in the range jvmMemory.[4-9] are reserved for future
--- evolution of this MIB.
---
--- We use the range jvmMemory.[10..19] for objects related to global JVM
--- heap memory usage, as returned by
--- java.lang.management.MemoryMXBean.getHeapMemoryUsage().
--- Object identifiers in the range jvmMemory.[14..19] are not used but
--- reserved for future evolution of this MIB.
---
-jvmMemoryHeapInitSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total amount of memory (in bytes) that the Java virtual machine
- initially requests from the operating system for memory management
- for heap memory pools.
-
- See java.lang.management.MemoryMXBean.getHeapMemoryUsage().getInit()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 10 }
-
-
-jvmMemoryHeapUsed OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total amount of used memory (in bytes) from heap memory pools.
-
- See java.lang.management.MemoryMXBean.getHeapMemoryUsage().getUsed()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 11 }
-
-jvmMemoryHeapCommitted OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total amount of memory (in bytes) committed by heap memory pools.
-
- See java.lang.management.MemoryMXBean.getHeapMemoryUsage().
- getCommitted()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 12 }
-
-jvmMemoryHeapMaxSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total maximum size of memory (in bytes) for all heap memory pools.
-
- See java.lang.management.MemoryMXBean.getHeapMemoryUsage().getMax()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 13 }
-
--- We use the range jvmMemory.[20..29] for objects related to global JVM
--- heap memory usage, as returned by
--- lang.management.MemoryMXBean.getNonHeapMemoryUsage().
--- Object identifiers in the range jvmMemory.[24..29] are not used but are
--- reserved for future evolution of this MIB.
---
-jvmMemoryNonHeapInitSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total amount of memory (in bytes) that the Java virtual machine
- initially requests from the operating system for memory management
- for non heap memory pools.
-
- See java.lang.management.MemoryMXBean.getNonHeapMemoryUsage().getInit()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 20 }
-
-
-jvmMemoryNonHeapUsed OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total amount of used memory (in bytes) from non heap memory pools.
-
- See java.lang.management.MemoryMXBean.getNonHeapMemoryUsage().getUsed()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 21 }
-
-jvmMemoryNonHeapCommitted OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total amount of memory (in bytes) committed by non heap memory pools.
-
- See java.lang.management.MemoryMXBean.
- getNonHeapMemoryUsage().getCommitted()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 22 }
-
-jvmMemoryNonHeapMaxSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Total maximum size of memory (in bytes) for all non heap memory pools.
-
- See java.lang.management.MemoryMXBean.getNonHeapMemoryUsage().getMax()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemory 23 }
-
--- The object identifiers in the range jvmMemory.[30-99] are not used but are
--- reserved for future evolution of this MIB.
---
--- The JVM Memory Manager Table
---
--- The jvmMemManagerTable represent memory manager abstract entities.
--- The jvmMemManagerTable contains one row per memory manager. In
--- addition, those memory managers which are also garbage collectors have
--- an extension row in the jvmMemGCTable.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryMXBean for
--- a detailed description of the memory subsystem.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryManagerMXBean
--- for more information on memory managers.
---
------------------------------------------------------------------------
---
--- We use the range jvmMemory.[100..109] for objects related to memory
--- managers.
--- Object identifiers in the range jvmMemory.[102-109] are not used
--- but are reserved for future evolution of this MIB.
---
-jvmMemManagerTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmMemManagerEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The Memory Manager Table contains the whole list of Memory
- Managers as returned by ManagementFactory.getMemoryManagerMXBeans().
-
- When a MemoryManagerMXBean object is an instance of
- GarbageCollectorMXBean, then additional information specific to
- the GarbageCollectorMXBean class will be found in the
- jvmGCTable, at the same index.
-
- Relationships between MemoryManagers and MemoryPools are shown
- by the Memory Manager-Pool Relation table (jvmMemMgrPoolRelTable).
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryManagerMXBean"
- ::= { jvmMemory 100 }
-
-jvmMemManagerEntry OBJECT-TYPE
- SYNTAX JvmMemManagerEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "A jvmMemManagerEntry conceptual row represent an instance of the
- java.lang.management.MemoryManagerMXBean interface. If that instance
- is also an instance of java.lang.management.GarbageCollectorMXBean,
- then additional information will be found in the jvmGCTable, at the
- same index.
-
- Columnar objects in this table are mapped from attributes of
- the MemoryManagerMXBean interface.
-
- See java.lang.management.MemoryManagerMXBean
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryManagerMXBean"
- INDEX { jvmMemManagerIndex }
- ::= { jvmMemManagerTable 1 }
-
-JvmMemManagerEntry ::= SEQUENCE {
- jvmMemManagerIndex JvmPositive32TC,
- jvmMemManagerName JvmJavaObjectNameTC,
- jvmMemManagerState JvmValidityStateTC
-}
-
-jvmMemManagerIndex OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "An index opaquely computed by the agent and which uniquely
- identifies a Memory Manager.
-
- The jvmMemManagerIndex index is opaquely computed by the agent,
- from e.g the hash code of the MemoryManager (or MemoryManager name).
- The agent is responsible for allocating a free index when it needs
- one (e.g. if two objects have the same hash, then it may increment
- one of the values until the conflict is resolved). As a result a
- manager must not depend on the value of that index across,
- e.g. reboot of the agent, as this value is not guaranteed to
- stay identical after the agent restarts.
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryManagerMXBean"
- ::= { jvmMemManagerEntry 1 }
-
-jvmMemManagerName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The name of this memory manager, as returned by
- MemoryManagerMXBean.getName().
-
- See java.mangement.MemoryManagerMXBean.getName().
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryManagerMXBean"
- ::= { jvmMemManagerEntry 2 }
-
-jvmMemManagerState OBJECT-TYPE
- SYNTAX JvmValidityStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Indicates whether this memory manager is valid in the Java
- virtual machine. A memory manager becomes invalid once the
- Java virtual machine removes it from the memory system.
-
- See java.lang.management.MemoryManagerMXBean.isValid()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryManagerMXBean"
- ::= { jvmMemManagerEntry 3 }
-
-
--- The JVM Garbage Collector Table
---
--- The jvmMemGCTable is an extension of the jvmMemManagerTable.
--- It represents garbage collector abstract entities. A garbage collector
--- is a memory manager responsible for reclaiming memory occupied by
--- unreachable objects.
---
--- A garbage collector is thus represented by one row in the
--- jvmMemManagerTable, plus an extension row in the jvmMemGCTable.
--- The extension row in the jvmMemGCTable contains those attributes which
--- are specific to garbage collectors.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryMXBean for
--- a detailed description of the memory subsystem.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryManagerMXBean
--- for more information on memory managers, and
--- java.lang.management.GarbageCollectorMXBean for more information on
--- garbage collectors.
---
------------------------------------------------------------------------
-
-jvmMemGCTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmMemGCEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The Garbage Collector table provides additional information
- on those MemoryManagers which are also GarbageCollectors.
- This table extends the jvmMemManagerTable table. The index
- used in the jvmMemGCTable table is imported from the
- jvmMemManagerTable table. If a row from the jvmMemManagerTable
- table is deleted, and if it has an extension in the jvmMemGCTable
- table, then the extension row will also be deleted.
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.GarbageCollectorMXBean"
- ::= { jvmMemory 101 }
-
-jvmMemGCEntry OBJECT-TYPE
- SYNTAX JvmMemGCEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "Provide additional information on Garbage Collectors.
-
- Columnar objects in this table are mapped from the
- GarbageCollectorMXBean interface.
-
- See java.lang.management.GarbageCollectorMXBean
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.GarbageCollectorMXBean"
- INDEX { jvmMemManagerIndex }
- ::= {jvmMemGCTable 1 }
-
-JvmMemGCEntry ::= SEQUENCE {
- jvmMemGCCount Counter64,
- jvmMemGCTimeMs JvmTimeMillis64TC
-}
-
-jvmMemGCCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of collections that have occurred,
- as returned by GarbageCollectorMXBean.getCollectionCount().
-
- If garbage collection statistics are not available, this
- object is set to 0.
-
- See java.lang.management.GarbageCollectorMXBean.getCollectionCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.GarbageCollectorMXBean"
- ::= { jvmMemGCEntry 2 }
-
-jvmMemGCTimeMs OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The approximate accumulated collection elapsed time in
- milliseconds, since the Java virtual machine has started.
- This object is set to 0 if the collection elapsed time is
- undefined for this collector.
-
- See java.lang.management.GarbageCollectorMXBean.getCollectionTime()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.GarbageCollectorMXBean"
- DEFVAL { 0 }
- ::= { jvmMemGCEntry 3 }
-
--- The JVM Memory Pool Table
---
--- The jvmMemPoolTable represent memory pool abstract entities.
--- The jvmMemPoolTable contains one row per memory pool.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryMXBean for
--- a detailed description of the memory subsystem.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryPoolMXBean
--- for more information on memory pool.
---
------------------------------------------------------------------------
---
--- We use the range jvmMemory.[110..119] for objects related to memory pools.
--- Object identifiers in the range jvmMemory.[111-119] are not used but
--- are reserved for future evolution of this MIB.
---
-jvmMemPoolTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmMemPoolEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The Memory Pool Table contains the whole list of MemoryPools
- as returned by ManagementFactory.getMemoryPoolMXBeans().
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemory 110 }
-
-jvmMemPoolEntry OBJECT-TYPE
- SYNTAX JvmMemPoolEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "
- Represents a memory pool. The pool may contain heap memory or
- non-heap memory. A row in this table represents
- an instance of MemoryPoolMXBean.
-
- See java.lang.management.MemoryPoolMXBean
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- INDEX { jvmMemPoolIndex }
- ::= { jvmMemPoolTable 1 }
-
-JvmMemPoolEntry ::= SEQUENCE {
- jvmMemPoolIndex JvmPositive32TC,
- jvmMemPoolName JvmJavaObjectNameTC,
- jvmMemPoolType JvmManagedMemoryTypeTC,
- jvmMemPoolState JvmValidityStateTC,
- jvmMemPoolPeakReset JvmTimeMillis64TC,
-
- jvmMemPoolInitSize JvmUnsigned64TC,
- jvmMemPoolUsed JvmUnsigned64TC,
- jvmMemPoolCommitted JvmUnsigned64TC,
- jvmMemPoolMaxSize JvmUnsigned64TC,
-
- jvmMemPoolPeakUsed JvmUnsigned64TC,
- jvmMemPoolPeakCommitted JvmUnsigned64TC,
- jvmMemPoolPeakMaxSize JvmUnsigned64TC,
-
- jvmMemPoolCollectUsed JvmUnsigned64TC,
- jvmMemPoolCollectCommitted JvmUnsigned64TC,
- jvmMemPoolCollectMaxSize JvmUnsigned64TC,
-
- jvmMemPoolThreshold JvmUnsigned64TC,
- jvmMemPoolThreshdCount Counter64,
- jvmMemPoolThreshdSupport JvmImplSupportStateTC,
- jvmMemPoolCollectThreshold JvmUnsigned64TC,
- jvmMemPoolCollectThreshdCount Counter64,
- jvmMemPoolCollectThreshdSupport JvmImplSupportStateTC
-
-}
-
-jvmMemPoolIndex OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "An index value opaquely computed by the agent which uniquely
- identifies a row in the jvmMemPoolTable.
-
- The jvmMemPoolIndex index is opaquely computed by the agent,
- from e.g the hash code of the MemoryPool (or MemoryPool name).
- The agent is responsible for allocating a free index when it
- needs one (e.g. if two objects have the same hash, then it may
- increment one of the values until the conflict is resolved).
- As a result a manager must not depend on the value of that
- index across, e.g. reboot of the agent, as this value is not
- guaranteed to stay identical after the agent restarts.
- "
- ::= { jvmMemPoolEntry 1 }
-
-jvmMemPoolName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The name of this memory pool, as returned by
- MemoryPoolMXBean.getName().
-
- See java.lang.management.MemoryPoolMXBean.getName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 2 }
-
-jvmMemPoolType OBJECT-TYPE
- SYNTAX JvmManagedMemoryTypeTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The type of memory managed in this pool. This pool may be used for
- heap memory or non-heap memory.
-
- See java.lang.management.MemoryPoolMXBean.getMemoryType()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 3 }
-
-jvmMemPoolState OBJECT-TYPE
- SYNTAX JvmValidityStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Indicates whether this memory pool is valid in the Java
- virtual machine. A memory pool becomes invalid once the
- Java virtual machine removes it from the memory system.
-
- See java.lang.management.MemoryPoolMXBean.isValid()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 4 }
-
-jvmMemPoolPeakReset OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "
- This object indicates the last time - in milliseconds - at which
- the peak memory usage statistic of this memory pool was reset
- to the current memory usage. This corresponds to a time stamp
- as returned by java.lang.System.currentTimeMillis();
-
- Setting this object to a time earlier than its current time value
- has no effect. Setting this object to a time later than its current
- time value causes the peak memory usage statistic of this memory
- pool to be reset to the current memory usage. The new value of this
- object will be the time at which the reset operation is triggered.
-
- There could be a delay between the time at which the reset operation
- is triggered and the time at which the actual resetting happens, so
- this value is only indicative.
-
- See java.lang.management.MemoryPoolMXBean.resetPeakUsage()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 5 }
-
-
--- The object identifier arcs in the range jvmMemPoolEntry.[6-9] are
--- reserved for future evolution of this MIB.
---
--- We use the range jvmMemPoolEntry.[10..19] for objects related to this
--- pool memory usage, as returned by
--- java.lang.management.MemoryPoolMXBean.getUsage().
--- Object identifiers in the range jvmMemPoolEntry.[14..19] are not
--- used but are reserved for future evolution of this MIB.
---
-jvmMemPoolInitSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Initial size of this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getUsage().getInit()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 10 }
-
-
-jvmMemPoolUsed OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Amount of used memory in this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getUsage().getUsed()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 11 }
-
-jvmMemPoolCommitted OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Amount of committed memory in this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getUsage().getCommitted()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 12 }
-
-jvmMemPoolMaxSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Maximal size of this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getUsage().getMax()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 13 }
-
--- We use the range jvmMemPoolEntry.[20..29] for objects related to
--- this pool peak memory usage, as returned by
--- java.lang.management.MemoryPoolMXBean.getPeakUsage().
--- The object identifier arc jvmMemPoolEntry.20 which would have been
--- used for the initial size is not used because the notion of initial
--- size in the context of peak usage is meaningless.
--- Therefore, we start numbering objects at 21.
--- Object identifiers in the range jvmMemPoolEntry.[24..29] are not
--- used but are reserved for future evolution of this MIB.
---
-jvmMemPoolPeakUsed OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Amount of used memory in this memory pool when the peak usage
- was reached.
-
- See java.lang.management.MemoryPoolMXBean.getPeakUsage().getUsed()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 21 }
-
-jvmMemPoolPeakCommitted OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Amount of committed memory in this memory pool when the peak usage
- was reached.
-
- See java.lang.management.MemoryPoolMXBean.getPeakUsage().getCommitted()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 22 }
-
-jvmMemPoolPeakMaxSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- Maximal size of this memory pool when the peak usage
- was reached.
-
- See java.lang.management.MemoryPoolMXBean.getPeakUsage().getMax()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 23 }
-
--- We use the range jvmMemPoolEntry.[30..39] for objects related to this
--- pool collection memory usage, as returned by
--- java.lang.management.MemoryPoolMXBean.getCollectionUsage().
--- The object identifier arc jvmMemPoolEntry.30 which would have been used
--- for the initial size is not used because the notion of initial size in the
--- context of collection usage is meaningless.
--- Therefore, we start numbering objects at 31.
--- Object identifiers in the range jvmMemPoolEntry.[34..39] are not used
--- but are reserved for future evolution of this MIB.
---
-jvmMemPoolCollectUsed OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- The amount of used memory at the most recent time that the
- Java virtual machine has expended effort in recycling unused objects
- in this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getCollectionUsage().getUsed()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 31 }
-
-jvmMemPoolCollectCommitted OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- The amount of committed memory at the most recent time that the
- Java virtual machine has expended effort in recycling unused objects
- in this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getCollectionUsage().
- getCommitted()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 32 }
-
-jvmMemPoolCollectMaxSize OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "
- The value of the maximum amount of memory at the most recent time
- that the Java virtual machine has expended effort in recycling
- unused objects in this memory pool.
-
- See java.lang.management.MemoryPoolMXBean.getCollectionUsage().getMax()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryUsage"
- ::= { jvmMemPoolEntry 33 }
-
--- Object identifiers in the range jvmMemPoolEntry.[40-109] are reserved
--- for future evolution of this MIB.
---
--- We use the range jvmMemPoolEntry.[110..119] for objects related to this
--- pool memory usage thresholds (range jvmMemPoolEntry.[10..19] was used for
--- this pool memory usage).
--- Object identifier arcs in the range jvmMemPoolEntry.[113..119] are not
--- used but are reserved for future evolution of this MIB.
---
-jvmMemPoolThreshold OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "The threshold value for the memory usage of this memory pool,
- in bytes. A zero value (0) indicates that no threshold value is
- configured.
- When the amount of used memory crosses over this threshold
- value the JVM will trigger a usage memory threshold exceeded
- notification, and the jvmMemPoolThreshdCount increases.
-
- If memory usage threshold is not supported, then this object, if
- implemented, will always be equals to 0. In that case, attempting
- to set this object will trigger an inconsistentValue error.
-
- See also jvmMemPoolThreshdSupport.
-
- See java.lang.management.MemoryPoolMXBean.getUsageThreshold(),
- java.lang.management.MemoryPoolMXBean.setUsageThreshold(long),
- java.lang.management.MemoryPoolMXBean.getUsageThresholdCount(),
- java.lang.management.MemoryPoolMXBean.isUsageThresholdSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- DEFVAL { 0 }
- ::= { jvmMemPoolEntry 110 }
-
-jvmMemPoolThreshdCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of times that the memory usage has crossed
- the usage threshold, as detected by the Java virtual machine.
-
- If memory usage threshold is not supported, then this object, if
- implemented, will always be equals to 0.
-
- See also jvmMemPoolThresholdSupport.
-
- See java.lang.management.MemoryPoolMXBean.getUsageThresholdCount(),
- java.lang.management.MemoryPoolMXBean.isUsageThresholdSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 111 }
-
-jvmMemPoolThreshdSupport OBJECT-TYPE
- SYNTAX JvmImplSupportStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Tells whether this memory pool supports usage threshold.
-
- See java.lang.management.MemoryPoolMXBean.isUsageThresholdSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 112 }
-
--- Object identifiers in the range jvmMemPoolEntry.[120-129] are reserved
--- for future evolution of this MIB.
---
--- We use the range jvmMemPoolEntry.[130..139] for objects related to
--- this pool memory collection usage thresholds (range
--- jvmMemPoolEntry.[30..39] was used for this pool collection memory usage).
--- Object identifiers in the range jvmMemPoolEntry.[133..139] are not used
--- but are reserved for future evolution of this MIB.
---
-jvmMemPoolCollectThreshold OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- UNITS "bytes"
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "The threshold value for the collection usage of this memory pool,
- in bytes. A zero value (0) indicates that no threshold value is
- configured.
- When the amount of used memory crosses over this threshold
- value the JVM will trigger a collection memory threshold exceeded
- notification, and the jvmMemPoolCollectThreshdCount increases.
-
- If collection usage threshold is not supported, then this object, if
- implemented, will always be equals to 0. In that case, attempting
- to set this object will trigger an inconsistentValue error.
-
- See also jvmMemPoolCollectThreshdSupport.
-
- See java.lang.management.MemoryPoolMXBean.
- getCollectionUsageThreshold(),
- java.lang.management.MemoryPoolMXBean.
- setCollectionUsageThreshold(long),
- java.lang.management.MemoryPoolMXBean.
- isCollectionUsageThresholdSupported(),
- java.lang.management.MemoryPoolMXBean.
- getCollectionUsageThresholdCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- DEFVAL { 0 }
- ::= { jvmMemPoolEntry 131 }
-
-jvmMemPoolCollectThreshdCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of times that the memory usage has crossed
- the collection usage threshold, as detected by the Java virtual
- machine.
-
- If memory usage threshold is not supported, then this object, if
- implemented, will always be equals to 0.
-
- See also jvmMemPoolCollectThreshdSupport.
-
- See java.lang.management.MemoryPoolMXBean.
- getCollectionUsageThresholdCount(),
- java.lang.management.MemoryPoolMXBean.
- isCollectionUsageThresholdSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 132 }
-
-jvmMemPoolCollectThreshdSupport OBJECT-TYPE
- SYNTAX JvmImplSupportStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Tells whether this memory pool supports collection usage threshold.
-
- See java.lang.management.MemoryPoolMXBean.
- isCollectionUsageThresholdSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemPoolEntry 133 }
-
--- The JVM Memory Manager-Pool Relation Table
------------------------------------------------------------------------
--- The JVM Memory Pool Table
---
--- The jvmMemPoolTable represent memory pool abstract entities.
--- The jvmMemPoolTable contains one row per memory pool.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryMXBean for
--- a detailed description of the memory subsystem.
---
--- See J2SE 5.0 API Specification, java.lang.management.MemoryPoolMXBean
--- for more information on memory pool.
---
------------------------------------------------------------------------
---
--- We use the range jvmMemory.[110..119] for objects related to memory pools.
--- Object identifier arcs in the range jvmMemory.[111-119] are not used
--- but are reserved for future evolution of this MIB.
---
-
-jvmMemMgrPoolRelTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmMemMgrPoolRelEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The Memory Manager-Pool Relation Table shows the
- Memory Manager / Memory Pool relations, as returned by
- MemoryPoolMXBean.getMemoryManagerNames() and
- MemoryManagerMXBean.getMemoryPoolNames().
- This table imports the indexes from the jvmMemManagerTable table
- and jvmMemPoolTable table. The jvmMemMgrRelManagerName and
- jvmMemMgrRelPoolName objects are not actually necessary since
- the indexes are self-sufficient to express the relationship -
- but the names will make the table more understandable when displayed
- in a management console.
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryManagerMXBean"
- ::= { jvmMemory 120 }
-
-jvmMemMgrPoolRelEntry OBJECT-TYPE
- SYNTAX JvmMemMgrPoolRelEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "A row in this table indicates that the Memory Manager identified
- by jvmMemManagerIndex manages the Memory Pool identified by
- jvmMemPoolIndex. Note that a pool may be managed by several
- memory managers, and a memory manager can manage several
- memory pool.
-
- See java.lang.management.MemoryManagerMXBean.getMemoryPoolNames(),
- java.lang.management.MemoryPoolMXBean.getMemoryManagerNames()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean,
- java.lang.management.MemoryManagerMXBean"
- INDEX { jvmMemManagerIndex, jvmMemPoolIndex }
- ::= { jvmMemMgrPoolRelTable 1 }
-
-JvmMemMgrPoolRelEntry ::= SEQUENCE {
- jvmMemMgrRelManagerName JvmJavaObjectNameTC,
- jvmMemMgrRelPoolName JvmJavaObjectNameTC
-}
-
-jvmMemMgrRelManagerName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The name of the memory manager.
-
- See java.manangement.MemoryManagerMXBean.getName();
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryManagerMXBean"
- ::= { jvmMemMgrPoolRelEntry 2 }
-
-jvmMemMgrRelPoolName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The name of the memory pool.
-
- See java.manangement.MemoryPoolMXBean.getName();
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmMemMgrPoolRelEntry 3 }
-
-
------------------------------------------------------------------------
---
--- The JVM Thread group
---
--- A collection of objects used to monitor threads in the
--- Java Virtual Machine. These objects define the SNMP management
--- interface for the thread system of the Java virtual machine.
---
--- The jvmThreadInstanceTable represents the threads which are currently
--- alive in the system. The representation of a thread is derived from the
--- set of methods in the ThreadMXBean that return information about a
--- given thread.
---
--- See J2SE 5.0 API Specification, java.lang.management.ThreadMXBean for
--- a detailed description of the threading subsystem.
---
------------------------------------------------------------------------
-
---
------------------------------------------------------------------------
-
-jvmThreading OBJECT IDENTIFIER ::= { jvmMgtMIBObjects 3 }
-
--- The following objects are mapped from the ThreadMXBean interface.
------------------------------------------------------------------------
-
-jvmThreadCount OBJECT-TYPE
- SYNTAX Gauge32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The current number of live threads.
-
- See java.lang.management.ThreadMXBean.getThreadCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 1 }
-
-jvmThreadDaemonCount OBJECT-TYPE
- SYNTAX Gauge32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The current number of daemon threads.
-
- See java.lang.management.ThreadMXBean.getDaemonThreadCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 2 }
-
-jvmThreadPeakCount OBJECT-TYPE
- SYNTAX Counter32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The peak thread count since the execution of the application.
-
- See java.lang.management.ThreadMXBean.getPeakThreadCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 3 }
-
-jvmThreadTotalStartedCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of threads created and started since the Java
- Virtual Machine started.
-
- See java.lang.management.ThreadMXBean.getTotalStartedThreadCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 4 }
-
-jvmThreadContentionMonitoring OBJECT-TYPE
- SYNTAX JvmImplOptFeatureStateTC
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "The state of the Thread Contention Monitoring feature.
- This feature can be:
-
- unsupported: The JVM does not support Thread Contention Monitoring.
- enabled : The JVM supports Thread Contention Monitoring, and it
- is enabled.
- disabled : The JVM supports Thread Contention Monitoring, and it
- is disabled.
-
- Only enabled(3) and disabled(4) may be supplied as values to a
- SET request. unsupported(1) can only be set internally by the
- agent.
-
- When the feature is unsupported(1), any attempt to change
- that value will fail: trying to set this object to
- enabled(3) or disabled(4) will result in an `inconsistentValue'
- error. Trying to set it to any other value will result in an
- `wrongValue' error.
-
- See java.lang.management.ThreadMXBean.
- isThreadContentionMonitoringSupported(),
- java.lang.management.ThreadMXBean.
- isThreadContentionMonitoringEnabled(),
- java.lang.management.ThreadMXBean.
- setThreadContentionMonitoringEnabled()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 5 }
-
-jvmThreadCpuTimeMonitoring OBJECT-TYPE
- SYNTAX JvmImplOptFeatureStateTC
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "The state of the Thread CPU Time Monitoring feature.
- This feature can be:
-
- unsupported: The JVM does not support Thread CPU Time Monitoring.
- enabled : The JVM supports Thread CPU Time Monitoring, and it
- is enabled.
- disabled : The JVM supports Thread CPU Time Monitoring, and it
- is disabled.
-
- Only enabled(3) and disabled(4) may be supplied as values to a
- SET request. unsupported(1) can only be set internally by the
- agent.
-
- When the feature is unsupported(1), any attempt to change
- that value will fail: trying to set this object to
- enabled(3) or disabled(4) will result in an `inconsistentValue'
- error. Trying to set it to any other value will result in an
- `wrongValue' error.
-
- See java.lang.management.ThreadMXBean.
- isThreadCpuTimeSupported(),
- java.lang.management.ThreadMXBean.
- isThreadCpuTimeEnabled(),
- java.lang.management.ThreadMXBean.
- setThreadCpuTimeEnabled()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 6 }
-
-jvmThreadPeakCountReset OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "
- This object indicates the last time - in milliseconds - at which
- the peak thread count was reset to the current thread count.
- This corresponds to a time stamp as returned by
- java.lang.System.currentTimeMillis().
-
- Setting this object to a time earlier than its current time value
- has no effect. Setting this object to a time later than its current
- time value causes the peak thread count statistic to be reset to
- the current thread count. The new value of this object will be
- the time at which the reset operation is triggered.
-
- There could be a delay between the time at which the reset operation
- is triggered and the time at which the actual resetting happens, so
- this value is only indicative.
-
- See java.lang.management.ThreadMXBean.resetPeakThreadCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 7 }
-
-
--- Object identifiers in the range jvmThreading.[8-10] are reserved
--- for future evolution of this MIB.
---
------------------------------------------------------------------------
--- The JVM Thread Instance Table
---
--- The jvmThreadInstanceTable represents the threads which are currently
--- alive in the system. The representation of a thread is derived from the
--- set of methods in the ThreadMXBean that return information about a
--- given thread.
---
--- See J2SE 5.0 API Specification, java.lang.management.ThreadMXBean for
--- a detailed description of the threading subsystem.
--- See also J2SE 5.0 API Specification, java.lang.management.ThreadInfo,
--- and java.lang.Thread
---
------------------------------------------------------------------------
-
-jvmThreadInstanceTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmThreadInstanceEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The Thread Instance Table is built from all the methods of
- ThreadMXBean that take a ThreadID as parameter.
-
- See java.lang.management.ThreadMXBean.getAllThreadIds()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreading 10 }
-
-jvmThreadInstanceEntry OBJECT-TYPE
- SYNTAX JvmThreadInstanceEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "A row in this table represents a live thread.
- Attributes in this row are built from all the methods of
- ThreadMXBean that take a ThreadID as parameter.
-
- See java.lang.management.ThreadMXBean
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- INDEX { jvmThreadInstIndex }
- ::= { jvmThreadInstanceTable 1 }
-
-JvmThreadInstanceEntry ::= SEQUENCE {
- jvmThreadInstIndex JvmIndex64TC,
- jvmThreadInstId JvmUnsigned64TC,
- jvmThreadInstState JvmThreadStateTC,
- jvmThreadInstBlockCount Counter64,
- jvmThreadInstBlockTimeMs JvmTimeMillis64TC,
- jvmThreadInstWaitCount Counter64,
- jvmThreadInstWaitTimeMs JvmTimeMillis64TC,
- jvmThreadInstCpuTimeNs JvmTimeNanos64TC,
- jvmThreadInstLockName JvmJavaObjectNameTC,
- jvmThreadInstLockOwnerPtr RowPointer,
- jvmThreadInstName JvmJavaObjectNameTC
-}
-
-jvmThreadInstIndex OBJECT-TYPE
- SYNTAX JvmIndex64TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "An index uniquely identifying a live thread, and directly
- derived from the value of jvmThreadInstId. The jvmThreadInstId
- cannot be used directly as index in the table, because integer
- indexes cannot exceed an unsigned 32 int.
-
- The jvmThreadInstIndex index is an 8 byte octet string as
- defined by the JvmIndex64TC TEXTUAL-CONVENTION. Its value is
- directly derived from the value of the corresponding ThreadID
- returned by jvmThreadInstId.
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean, java.lang.Thread"
- ::= { jvmThreadInstanceEntry 1 }
-
-jvmThreadInstId OBJECT-TYPE
- SYNTAX JvmUnsigned64TC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The thread ID, as returned by Thread.getId().
-
- See java.lang.management.ThreadMXBean.getThreadInfo(long,boolean).
- getThreadId()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean, java.lang.Thread"
- ::= { jvmThreadInstanceEntry 2 }
-
-jvmThreadInstState OBJECT-TYPE
- SYNTAX JvmThreadStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The state of this thread instance.
-
- See java.lang.management.ThreadMXBean.getThreadInfo(long,boolean).
- getThreadState()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreadInstanceEntry 3 }
-
-jvmThreadInstBlockCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of times that this thread has blocked to enter
- or re-enter a monitor..
-
- See java.lang.management.ThreadMXBean.getThreadInfo(long,boolean).
- getBlockedCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreadInstanceEntry 4 }
-
-jvmThreadInstBlockTimeMs OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The approximate accumulated elapsed time (in millisecond)
- that a thread has blocked to enter or re-enter a monitor since
- it has started - or since thread contention monitoring was
- enabled.
-
- This object is always set to 0 if thread contention monitoring
- is disabled or not supported.
-
- See java.lang.management.ThreadMXBean.getThreadInfo(long,boolean).
- getBlockedTime()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreadInstanceEntry 5 }
-
-jvmThreadInstWaitCount OBJECT-TYPE
- SYNTAX Counter64
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The total number of times that this thread has waited for
- notification.
-
- See java.lang.management.ThreadMXBean.getThreadInfo(long,boolean).
- getWaitedCount()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreadInstanceEntry 6 }
-
-jvmThreadInstWaitTimeMs OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The approximate accumulated elapsed time (in millisecond)
- that a thread has waited on a monitor through a
- java.lang.Object.wait method since it has started - or since
- thread contention monitoring wasenabled.
-
- This object is always set to 0 if thread contention monitoring
- is disabled or not supported.
-
- See java.lang.management.ThreadMXBean.getThreadInfo(long,boolean).
- getWaitedTime()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreadInstanceEntry 7 }
-
-jvmThreadInstCpuTimeNs OBJECT-TYPE
- SYNTAX JvmTimeNanos64TC
- UNITS "nanoseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The approximate accumulated CPU time (in nanosecond) for a thread
- since it has started - or since thread CPU time monitoring was
- enabled.
-
- If the thread of the specified ID is not alive or does not exist,
- or the CPU time measurement is disabled or not supported,
- this object is set to 0.
-
- See java.lang.management.ThreadMXBean.getThreadCpuTime(long),
- java.lang.management.ThreadMXBean.isThreadCpuTimeSupported(),
- java.lang.management.ThreadMXBean.isThreadCpuTimeEnabled()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean"
- ::= { jvmThreadInstanceEntry 8 }
-
-jvmThreadInstName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "This thread name - as returned by Thread.getThreadName().
-
- See java.lang.management.ThreadInfo.getThreadName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean,
- java.lang.management.ThreadInfo"
- ::= { jvmThreadInstanceEntry 9 }
-
-jvmThreadInstLockName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The string representation of the monitor lock that this thread
- is blocked to enter or waiting to be notified through the
- Object.wait method.
-
- See J2SE 5.0 API Specification,
- java.lang.management.ThreadInfo.getLockName()
- for more information on the format of this string.
-
- If this thread is not blocked then a zero-length string is returned.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the JvmJavaObjectNameTC
- (1023 bytes max).
-
- See java.lang.management.ThreadInfo.getLockName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean,
- java.lang.management.ThreadInfo"
- ::= { jvmThreadInstanceEntry 10 }
-
-jvmThreadInstLockOwnerPtr OBJECT-TYPE
- SYNTAX RowPointer
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "A pointer to the thread which owns the monitor of the
- object on which this thread instance is blocked.
- This object will point to jvmThreadInstId of the
- lock owner thread.
-
- If this thread is not blocked then 0.0 is returned.
-
- See java.lang.management.ThreadInfo.getLockOwnerId()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.ThreadMXBean,
- java.lang.management.ThreadInfo"
- ::= { jvmThreadInstanceEntry 11 }
-
------------------------------------------------------------------------
---
--- The JVM Runtime group
---
--- A collection of objects used to monitor the Java Virtual Machine
--- Runtime. These objects define the SNMP management interface for the
--- runtime system of the Java virtual machine.
---
--- The JVM Runtime group defines object mapped from the
--- java.lang.management.RuntimeMXBean interface.
---
--- See J2SE 5.0 API Specification, java.lang.management.RuntimeMXBean for
--- a detailed description of the runtime system.
---
------------------------------------------------------------------------
-
-jvmRuntime OBJECT IDENTIFIER ::= { jvmMgtMIBObjects 4 }
-
--- The following objects are mapped from the RuntimeMXBean interface.
------------------------------------------------------------------------
-
-jvmRTName OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The name representing the running Java virtual machine.
-
- Note that the SNMP agent may have to truncate the name returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 1 }
-
-jvmRTVMName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The Java virtual machine implementation name.
-
- See java.lang.management.RuntimeMXBean.getVmName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 2 }
-
-jvmRTVMVendor OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The Java virtual machine implementation vendor.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getVmVendor()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 3 }
-
-jvmRTVMVersion OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The Java virtual machine implementation version.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getVmVersion()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 4 }
-
-jvmRTSpecName OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The Java virtual machine specification name.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getSpecName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 5 }
-
-jvmRTSpecVendor OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The Java virtual machine specification vendor.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getSpecVendor()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 6 }
-
-jvmRTSpecVersion OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The Java virtual machine specification version.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getSpecVersion()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 7 }
-
-jvmRTManagementSpecVersion OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The version of the management specification for the Java virtual
- machine implementation.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.RuntimeMXBean.getManagementSpecVersion()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 8 }
-
-jvmRTBootClassPathSupport OBJECT-TYPE
- SYNTAX JvmImplSupportStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Indicates whether the Java virtual machine supports the
- boot class path mechanism used by the bootstrap class loader
- to search for class files.
-
- See java.lang.management.RuntimeMXBean.isBootClassPathSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 9 }
-
-jvmRTInputArgsCount OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of input arguments passed to the Java Virtual Machine.
-
- See java.lang.management.RuntimeMXBean.getInputArguments()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 10 }
-
-jvmRTUptimeMs OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Uptime of the Java virtual machine, in milliseconds. This is
- equivalent to ( System.currentTimeMillis() - jvmStartTimeMs ).
-
- See also jvmRTStartTimeMs.
-
- See java.lang.management.RuntimeMXBean.getUptime()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 11 }
-
-jvmRTStartTimeMs OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The approximate time when the Java virtual machine started, in
- milliseconds. This is a time stamp as returned by
- System.currentTimeMillis(). This time will not change unless
- the Java Virtual Machine is restarted.
-
- See also jvmRTUptimeMs.
-
- See java.lang.management.RuntimeMXBean.getStartTime()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 12 }
-
-
--- Object identifiers in the range jvmRuntime.[13-19] are reserved
--- for future evolution of this MIB.
---
------------------------------------------------------------------------
---
--- The JVM Input Argument Table
---
--- The jvmRTInputArgsTable contains one row per input argument given on
--- the Java command line.
---
--- See J2SE 5.0 API Specification,
--- java.lang.management.RuntimeMXBean.getInputArguments()
--- for more information.
------------------------------------------------------------------------
-
-jvmRTInputArgsTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmRTInputArgsEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The Input Argument Table lists the input arguments passed
- to the Java Virtual Machine.
-
- The jvmRTInputArgsIndex is the index of the argument in
- the array returned by RuntimeMXBean.getInputArguments().
-
- See java.lang.management.RuntimeMXBean.getInputArguments()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 20 }
-
-jvmRTInputArgsEntry OBJECT-TYPE
- SYNTAX JvmRTInputArgsEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "Represent an input argument passed to the Java Virtual Machine.
-
- See java.lang.management.RuntimeMXBean.getInputArguments()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- INDEX { jvmRTInputArgsIndex }
- ::= { jvmRTInputArgsTable 1 }
-
-JvmRTInputArgsEntry ::= SEQUENCE {
- jvmRTInputArgsIndex JvmPositive32TC,
- jvmRTInputArgsItem JvmArgValueTC
-}
-
-jvmRTInputArgsIndex OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The index of the input argument, as in the array returned
- by RuntimeMXBean.getInputArguments().
-
- See java.lang.management.RuntimeMXBean.getInputArguments()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTInputArgsEntry 1 }
-
-jvmRTInputArgsItem OBJECT-TYPE
- SYNTAX JvmArgValueTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "An input argument at index jvmRTInputArgsIndex, as in the array
- returned by RuntimeMXBean.getInputArguments().
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the JvmArgValueTC
- (1023 bytes max).
-
- See java.lang.management.RuntimeMXBean.getInputArguments()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTInputArgsEntry 2 }
-
-
------------------------------------------------------------------------
---
--- The JVM Boot Class Path Table
---
--- The jvmRTBootClassPathTable contains one row per path element in the
--- bootclasspath. This table may not be implemented (or may be empty) if
--- the bootclasspath feature is not supported by the underlying
--- implementation.
---
--- See J2SE 5.0 API Specification,
--- java.lang.management.RuntimeMXBean.getBootClassPath()
--- java.lang.management.RuntimeMXBean.isBootClassPathSupported()
--- for more information.
------------------------------------------------------------------------
-
-jvmRTBootClassPathTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmRTBootClassPathEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The boot class path that is used by the bootstrap class loader
- to search for a class file for loading.
-
- Note that the SNMP agent may have to truncate the bootclasspath
- elements contained in the string returned by the underlying API
- if it does not fit in the JvmPathElementTC (1023 bytes max).
-
- This table is not implemented (or empty) if jvmRTBootClassPathSupport
- is unsupported(1).
-
- See java.lang.management.RuntimeMXBean.getBootClassPath()
- java.lang.management.RuntimeMXBean.isBootClassPathSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 21 }
-
-jvmRTBootClassPathEntry OBJECT-TYPE
- SYNTAX JvmRTBootClassPathEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "Represent a path element in the Java Virtual Machine bootclasspath.
-
- See java.lang.management.RuntimeMXBean.getBootClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- INDEX { jvmRTBootClassPathIndex }
- ::= { jvmRTBootClassPathTable 1 }
-
-JvmRTBootClassPathEntry ::= SEQUENCE {
- jvmRTBootClassPathIndex JvmPositive32TC,
- jvmRTBootClassPathItem JvmPathElementTC
-}
-
-jvmRTBootClassPathIndex OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The index of the path element, as in the array obtained
- by splitting RuntimeMXBean.getBootClassPath() in its elementary path
- constituents.
-
- See java.lang.management.RuntimeMXBean.getBootClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTBootClassPathEntry 1 }
-
-jvmRTBootClassPathItem OBJECT-TYPE
- SYNTAX JvmPathElementTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "An path element at index jvmRTBootClassPathIndex, as in the
- array obtained by splitting RuntimeMXBean.getBootClassPath() in
- its elementary path constituents.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the JvmPathElementTC
- (1023 bytes max).
-
- See java.lang.management.RuntimeMXBean.getBootClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTBootClassPathEntry 2 }
-
------------------------------------------------------------------------
---
--- The JVM Class Path Table
---
--- The jvmRTClassPathTable contains one row per path element in the
--- classpath.
---
--- See J2SE 5.0 API Specification,
--- java.lang.management.RuntimeMXBean.getClassPath()
--- for more information.
------------------------------------------------------------------------
-
-jvmRTClassPathTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmRTClassPathEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The class path that is used by the system class loader
- to search for a class file.
-
- Note that the SNMP agent may have to truncate the classpath
- elements contained in the string returned by the underlying API
- if it does not fit in the JvmPathElementTC (1023 bytes max).
-
- See java.lang.management.RuntimeMXBean.getClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 22 }
-
-jvmRTClassPathEntry OBJECT-TYPE
- SYNTAX JvmRTClassPathEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "Represent a path element in the Java Virtual Machine classpath.
-
- See java.lang.management.RuntimeMXBean.getClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- INDEX { jvmRTClassPathIndex }
- ::= { jvmRTClassPathTable 1 }
-
-JvmRTClassPathEntry ::= SEQUENCE {
- jvmRTClassPathIndex JvmPositive32TC,
- jvmRTClassPathItem JvmPathElementTC
-}
-
-jvmRTClassPathIndex OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The index of the path element, as in the array obtained
- by splitting RuntimeMXBean.getClassPath() in its elementary
- path constituents.
-
- See java.lang.management.RuntimeMXBean.getClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTClassPathEntry 1 }
-
-jvmRTClassPathItem OBJECT-TYPE
- SYNTAX JvmPathElementTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "An path element at index jvmRTClassPathIndex, as in the array
- obtained by splitting RuntimeMXBean.getClassPath() in its elementary
- path constituents.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the JvmPathElementTC
- (1023 bytes max).
-
- See java.lang.management.RuntimeMXBean.getClassPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTClassPathEntry 2 }
-
------------------------------------------------------------------------
---
--- The JVM Library Path Table
---
--- The jvmRTLibraryPathTable contains one row per path element in the
--- librarypath.
---
--- See J2SE 5.0 API Specification,
--- java.lang.management.RuntimeMXBean.getLibraryPath()
--- for more information.
------------------------------------------------------------------------
-
-jvmRTLibraryPathTable OBJECT-TYPE
- SYNTAX SEQUENCE OF JvmRTLibraryPathEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The library path.
-
- Note that the SNMP agent may have to truncate the librarypath
- elements contained in the string returned by the underlying API
- if it does not fit in the JvmPathElementTC (1023 bytes max).
-
- See java.lang.management.RuntimeMXBean.getLibraryPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRuntime 23 }
-
-jvmRTLibraryPathEntry OBJECT-TYPE
- SYNTAX JvmRTLibraryPathEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "Represent a path element in the Java Virtual Machine librarypath.
-
- See java.lang.management.RuntimeMXBean.getLibraryPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- INDEX { jvmRTLibraryPathIndex }
- ::= { jvmRTLibraryPathTable 1 }
-
-JvmRTLibraryPathEntry ::= SEQUENCE {
- jvmRTLibraryPathIndex JvmPositive32TC,
- jvmRTLibraryPathItem JvmPathElementTC
-}
-
-jvmRTLibraryPathIndex OBJECT-TYPE
- SYNTAX JvmPositive32TC
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "The index of the path element, as in the array obtained
- by splitting RuntimeMXBean.getLibraryPath() in its elementary
- constituents.
-
- See java.lang.management.RuntimeMXBean.getLibraryPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTLibraryPathEntry 1 }
-
-jvmRTLibraryPathItem OBJECT-TYPE
- SYNTAX JvmPathElementTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "An path element at index jvmRTLibraryPathIndex, as in the array
- obtained by splitting RuntimeMXBean.getLibraryPath() in its elementary
- path constituents.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the JvmPathElementTC
- (1023 bytes max).
-
- See java.lang.management.RuntimeMXBean.getLibraryPath()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.RuntimeMXBean"
- ::= { jvmRTLibraryPathEntry 2 }
-
------------------------------------------------------------------------
---
--- The JVM Compilation group
---
--- A collection of objects used to monitor the Java Virtual Machine
--- Runtime Compiler (JIT). These objects define the SNMP management
--- interface for the compilation system of the Java virtual machine.
---
--- The JVM Compilation group defines object mapped from the
--- java.lang.management.CompilationMXBean interface.
---
--- See J2SE 5.0 API Specification, java.lang.management.CompilationMXBean for
--- a detailed description of the runtime system.
---
------------------------------------------------------------------------
-
-jvmCompilation OBJECT IDENTIFIER ::= { jvmMgtMIBObjects 5 }
-
--- The following objects are mapped from the CompilationMXBean interface.
------------------------------------------------------------------------
-
-jvmJITCompilerName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The name of the Just-in-time (JIT) compiler.
-
- See java.lang.management.CompilationMXBean.getName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.CompilationMXBean"
- ::= { jvmCompilation 1 }
-
-jvmJITCompilerTimeMs OBJECT-TYPE
- SYNTAX JvmTimeMillis64TC
- UNITS "milliseconds"
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Gets the approximate accumulated elapsed time (in milliseconds)
- spent in compilation since the Java virtual machine has started.
- If multiple threads are used for compilation, this value is
- the summation of the approximate time that each thread
- spent in compilation.
-
- If compiler time monitoring is not supported, then this object
- remains set to 0.
-
- See java.lang.management.CompilationMXBean.getTotalCompilationTime()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.CompilationMXBean"
- ::= { jvmCompilation 2 }
-
-
-jvmJITCompilerTimeMonitoring OBJECT-TYPE
- SYNTAX JvmImplSupportStateTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Indicates whether the Java virtual machine supports
- compilation time monitoring.
-
- See java.lang.management.CompilationMXBean.
- isCompilationTimeMonitoringSupported()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.CompilationMXBean"
- ::= { jvmCompilation 3 }
-
------------------------------------------------------------------------
---
--- The JVM Operating System group
---
--- A collection of objects used to monitor some resource of the
--- Operating System the Java Virtual Machine is running on. These objects
--- define the SNMP management interface offered by the Java virtual machine
--- for the operating system on which it is running.
---
--- The JVM Operating System group defines object mapped from the
--- java.lang.management.OperatingSystemMXBean interface.
---
--- See J2SE 5.0 API Specification, java.lang.management.OperatingSystemMXBean
--- for a detailed description of the operating system.
---
------------------------------------------------------------------------
-
-jvmOS OBJECT IDENTIFIER ::= { jvmMgtMIBObjects 6 }
-
--- The following objects are mapped from the OperatingSystemMXBean interface.
------------------------------------------------------------------------
-
-jvmOSName OBJECT-TYPE
- SYNTAX JvmJavaObjectNameTC
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The operating system name.
-
- See java.lang.management.OperatingSystemMXBean.getName()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.OperatingSystemMXBean"
- ::= { jvmOS 1 }
-
-jvmOSArch OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The operating system architecture.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.OperatingSystemMXBean.getArch()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.OperatingSystemMXBean"
- ::= { jvmOS 2 }
-
-jvmOSVersion OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The operating system version.
-
- Note that the SNMP agent may have to truncate the string returned
- by the underlying API if it does not fit in the DisplayString
- (255 bytes max).
-
- See java.lang.management.OperatingSystemMXBean.getVersion()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.OperatingSystemMXBean"
- ::= { jvmOS 3 }
-
-jvmOSProcessorCount OBJECT-TYPE
-
- SYNTAX Integer32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The number of processors available to the Java virtual machine.
-
- See java.lang.management.OperatingSystemMXBean.getAvailableProcessors()
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.OperatingSystemMXBean"
- ::= { jvmOS 4 }
-
---
--- NOTIFICATIONS
---
------------------------------------------------------------------------
-
---
--- Low Memory Notifications
---
-
-jvmMgtMIBMemoryNotifs OBJECT IDENTIFIER ::= { jvmMgtMIBNotifications 2 }
-jvmMgtMIBLowMemoryNotifs OBJECT IDENTIFIER ::= { jvmMgtMIBMemoryNotifs 1 }
-
-jvmLowMemoryPrefix OBJECT IDENTIFIER
- ::= { jvmMgtMIBLowMemoryNotifs 0 }
-
--- Not used at this time, but reserved for future evolution of this MIB:
---
--- jvmLowMemoryData OBJECT IDENTIFIER
--- ::= { jvmMgtMIBLowMemoryNotifs 1 }
---
-
-jvmLowMemoryPoolUsageNotif NOTIFICATION-TYPE
- OBJECTS { jvmMemPoolName, jvmMemPoolUsed, jvmMemPoolThreshdCount }
- STATUS current
- DESCRIPTION
- "This notification is sent when the memory usage threshold of
- a memory pool is exceeded.
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryNotification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmLowMemoryPrefix 1 }
-
-jvmLowMemoryPoolCollectNotif NOTIFICATION-TYPE
- OBJECTS { jvmMemPoolName, jvmMemPoolCollectUsed,
- jvmMemPoolCollectThreshdCount }
- STATUS current
- DESCRIPTION
- "This notification is sent when the collection memory usage
- threshold of a memory pool is exceeded.
- "
- REFERENCE "J2SE 5.0 API Specification,
- java.lang.management.MemoryNotification,
- java.lang.management.MemoryPoolMXBean"
- ::= { jvmLowMemoryPrefix 2 }
-
---
--- Conformance Section
---
------------------------------------------------------------------------
-
--- conformance information
-
-jvmMgtMIBCompliances
- OBJECT IDENTIFIER ::= { jvmMgtMIBConformance 1 }
-jvmMgtMIBGroups
- OBJECT IDENTIFIER ::= { jvmMgtMIBConformance 2 }
-
-
--- compliance statements
-
-jvmManagementCompliance MODULE-COMPLIANCE
- STATUS current
- DESCRIPTION
- "The compliance statement for SNMP entities which
- implement this MIB."
- MODULE -- this module
- MANDATORY-GROUPS {
- jvmClassLoadingBasicGroup,
- jvmClassLoadingSetGroup,
- jvmMemoryBasicGroup,
- jvmMemoryHeapUsageGroup,
- jvmMemoryNonHeapUsageGroup,
- jvmMemorySetGroup,
- jvmMemManagerGroup,
- jvmMemGCGroup,
- jvmMemPoolBasicGroup,
- jvmMemPoolUsageGroup,
- jvmMemPoolPeakUsageGroup,
- jvmMemPoolCollectUsageGroup,
- jvmMemMgrPoolRelationGroup,
- jvmThreadBasicGroup,
- jvmThreadInstanceBasicGroup,
- jvmRuntimeBasicGroup,
- jvmOSGroup
- }
-
- -- optional/conditional groups
- GROUP jvmMemPoolMonitoringGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine does not support low memory detection in memory usage.
- "
- GROUP jvmMemPoolCollectMonitoringGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine does not support low memory detection in collection
- memory usage.
- "
- GROUP jvmLowMemoryUsageNotifGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine does not support low memory usage detection.
- "
- GROUP jvmLowMemoryCollectNotifGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine does not support low collection memory usage detection.
- "
- GROUP jvmThreadInstanceCpuGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine does not support CPU time measurement for other threads.
- "
- GROUP jvmThreadInstanceBlockGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine does not support thread contention monitoring.
- "
- GROUP jvmRuntimeBootCPGroup
- DESCRIPTION
- "This group may not be implemented if the underlying
- implementation does not support the bootclasspath feature.
- "
- GROUP jvmJITCompilerBasicGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine has no compilation system.
- "
- GROUP jvmJITCompilerTimeStatGroup
- DESCRIPTION
- "This group may not be implemented if the Java virtual
- machine has no compilation system, or does not support
- JIT Compiler time statistics.
- "
- ::= { jvmMgtMIBCompliances 1 }
-
-
--- units of conformance
-
-jvmClassLoadingGroups OBJECT IDENTIFIER ::= { jvmMgtMIBGroups 1 }
-
-jvmClassLoadingBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmClassesLoadedCount,
- jvmClassesTotalLoadedCount,
- jvmClassesUnloadedCount
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.ClassLoadingMXBean interface.
- "
- ::= { jvmClassLoadingGroups 1 }
-
-jvmClassLoadingSetGroup OBJECT-GROUP
- OBJECTS {
- jvmClassesVerboseLevel
- }
- STATUS current
- DESCRIPTION
- "A collection of writable scalar objects that are mapped from JSR 163
- java.lang.management.ClassLoadingMXBean interface, and make it possible
- to act on class loading. Accessing these objects may
- require special permissions - the agent implementation is
- responsible for puting in place the appropriate access control
- if needed.
- "
- ::= { jvmClassLoadingGroups 2 }
-
-jvmMemoryGroups OBJECT IDENTIFIER ::= { jvmMgtMIBGroups 2 }
-
-jvmMemoryBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmMemoryPendingFinalCount
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.MemoryManagerMXBean interface.
- "
- ::= { jvmMemoryGroups 1 }
-
-jvmMemoryHeapUsageGroup OBJECT-GROUP
- OBJECTS {
- jvmMemoryHeapInitSize,
- jvmMemoryHeapUsed,
- jvmMemoryHeapCommitted,
- jvmMemoryHeapMaxSize
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.MemoryMXBean.getHeapMemoryUsage().
- When several of these objects are requested within a single
- SNMP request, the agent must ensure that
- java.lang.management.MemoryPoolMXBean.getHeapMemoryUsage() is
- called only once, in order to guarantee that the set of
- values returned for these objects remain coherent and give
- a consistent snapshot of the heap memory usage made by
- Heap Memory Pools.
- "
- ::= { jvmMemoryGroups 2 }
-
-jvmMemoryNonHeapUsageGroup OBJECT-GROUP
- OBJECTS {
- jvmMemoryNonHeapInitSize,
- jvmMemoryNonHeapUsed,
- jvmMemoryNonHeapCommitted,
- jvmMemoryNonHeapMaxSize
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.MemoryMXBean.getNonHeapMemoryUsage().
- When several of these objects are requested within a single
- SNMP request, the agent must ensure that
- java.lang.management.MemoryPoolMXBean.getNonHeapMemoryUsage() is
- called only once, in order to guarantee that the set of
- values returned for these objects remain coherent and give
- a consistent snapshot of the non heap memory usage made by
- Non Heap Memory Pools.
- "
- ::= { jvmMemoryGroups 3 }
-
-jvmMemorySetGroup OBJECT-GROUP
- OBJECTS {
- jvmMemoryGCVerboseLevel,
- jvmMemoryGCCall
- }
- STATUS current
- DESCRIPTION
- "A collection of writable scalar objects that are mapped from JSR 163
- java.lang.management.MemoryMXBean interface, and make it possible
- to act on the Garbage Collector. Accessing these objects may
- require special permissions - the agent implementation is
- responsible for puting in place the appropriate access control
- if needed.
- "
- ::= { jvmMemoryGroups 4 }
-
-jvmMemManagerGroup OBJECT-GROUP
- OBJECTS {
- jvmMemManagerName,
- jvmMemManagerState
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.MemoryManagerMXBean interface.
- "
- ::= { jvmMemoryGroups 5 }
-
-jvmMemGCGroup OBJECT-GROUP
- OBJECTS {
- jvmMemGCCount,
- jvmMemGCTimeMs
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.GarbageCollectorMXBean interface, and are
- specific to GarbageCollector MXBeans.
- These objects are used to model the inheritence link between
- GarbageCollectorMXBean and its super interface - MemoryManagerMXBean.
- "
- ::= { jvmMemoryGroups 6 }
-
-jvmMemPoolGroups OBJECT IDENTIFIER ::= { jvmMemoryGroups 7 }
-
-jvmMemPoolBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmMemPoolName,
- jvmMemPoolType,
- jvmMemPoolState,
- jvmMemPoolPeakReset,
- jvmMemPoolThreshdSupport,
- jvmMemPoolCollectThreshdSupport
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.MemoryPoolMXBean interface.
- "
- ::= { jvmMemPoolGroups 1 }
-
-jvmMemPoolMonitoringGroup OBJECT-GROUP
- OBJECTS {
- jvmMemPoolThreshold,
- jvmMemPoolThreshdCount
- }
- STATUS current
- DESCRIPTION
- "Memory usage threshold objects mapped from
- JSR 163 java.lang.management.MemoryPoolMXBean interface, which makes
- it possible to configure low memory detection.
- Accessing this object may require special permissions - the agent
- implementation is responsible for puting in place the appropriate
- access control if needed.
- "
- ::= { jvmMemPoolGroups 2 }
-
-jvmMemPoolUsageGroup OBJECT-GROUP
- OBJECTS {
- jvmMemPoolInitSize,
- jvmMemPoolUsed,
- jvmMemPoolCommitted,
- jvmMemPoolMaxSize
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.MemoryPoolMXBean.getUsage().
- When several of these objects are requested within a single
- SNMP request, the agent must ensure that
- java.lang.management.MemoryPoolMXBean.getUsage() is
- called only once, in order to guarantee that the set of
- values returned for these objects remain coherent and give
- a consistent snapshot of the memory used by this Memory
- Pool.
- "
- ::= { jvmMemPoolGroups 3 }
-
-jvmMemPoolPeakUsageGroup OBJECT-GROUP
- OBJECTS {
- jvmMemPoolPeakUsed,
- jvmMemPoolPeakCommitted,
- jvmMemPoolPeakMaxSize
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.MemoryPoolMXBean.getPeakUsage().
- When several of these objects are requested within a single
- SNMP request, the agent must ensure that
- java.lang.management.MemoryPoolMXBean.getPeakUsage() is
- called only once, in order to guarantee that the set of
- values returned for these objects remain coherent and give
- a consistent snapshot of the peak memory usage made by
- this Memory Pool.
- "
- ::= { jvmMemPoolGroups 4 }
-
-jvmMemPoolCollectUsageGroup OBJECT-GROUP
- OBJECTS {
- jvmMemPoolCollectUsed,
- jvmMemPoolCollectCommitted,
- jvmMemPoolCollectMaxSize
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.MemoryPoolMXBean.getCollectionUsage().
- When several of these objects are requested within a single
- SNMP request, the agent must ensure that
- java.lang.management.MemoryPoolMXBean.getCollectionUsage() is
- called only once, in order to guarantee that the set of
- values returned for these objects remain coherent and give
- a consistent snapshot of the collection memory usage made by
- this Memory Pool.
- "
- ::= { jvmMemPoolGroups 5 }
-
-jvmMemPoolCollectMonitoringGroup OBJECT-GROUP
- OBJECTS {
- jvmMemPoolCollectThreshold,
- jvmMemPoolCollectThreshdCount
- }
- STATUS current
- DESCRIPTION
- "Memory collection usage threshold objects mapped from JSR 163
- java.lang.management.MemoryPoolMXBean interface, which makes
- it possible to configure low memory detection.
- Accessing this object may require special permissions - the agent
- implementation is responsible for putting in place the appropriate
- access control if needed.
- "
- ::= { jvmMemPoolGroups 6 }
-
-
-jvmMemMgrPoolRelationGroup OBJECT-GROUP
- OBJECTS {
- jvmMemMgrRelManagerName,
- jvmMemMgrRelPoolName
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.MemoryPoolMXBean and
- java.lang.management.MemoryManagerMXBean interface, and show the
- relationship between Memory Managers and Memory Pools.
- "
- ::= { jvmMemoryGroups 8 }
-
-jvmThreadGroups OBJECT IDENTIFIER ::= { jvmMgtMIBGroups 3 }
-
-jvmThreadBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmThreadCount,
- jvmThreadDaemonCount,
- jvmThreadPeakCount,
- jvmThreadTotalStartedCount,
- jvmThreadContentionMonitoring,
- jvmThreadCpuTimeMonitoring,
- jvmThreadPeakCountReset
- }
- STATUS current
- DESCRIPTION
- "A collection of scalar objects that are mapped from JSR 163
- java.lang.management.ThreadMXBean interface.
- "
- ::= { jvmThreadGroups 1 }
-
-jvmThreadInstanceGroups OBJECT IDENTIFIER ::= { jvmThreadGroups 2 }
-
-jvmThreadInstanceBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmThreadInstId,
- jvmThreadInstState,
- jvmThreadInstName,
- jvmThreadInstLockName,
- jvmThreadInstLockOwnerPtr
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.ThreadMXBean interface, and are
- relative to an instance of java.lang.Thread.
- "
- ::= { jvmThreadInstanceGroups 1}
-
-jvmThreadInstanceCpuGroup OBJECT-GROUP
- OBJECTS {
- jvmThreadInstCpuTimeNs
- }
- STATUS current
- DESCRIPTION
- "A columnar object mapped from JSR 163
- java.lang.management.ThreadMXBean interface which provides CPU
- time statistics about an instance of java.lang.Thread.
- "
- ::= { jvmThreadInstanceGroups 2 }
-
-
-jvmThreadInstanceBlockGroup OBJECT-GROUP
- OBJECTS {
- jvmThreadInstBlockCount,
- jvmThreadInstBlockTimeMs,
- jvmThreadInstWaitCount,
- jvmThreadInstWaitTimeMs
- }
- STATUS current
- DESCRIPTION
- "A collection of columnar objects that are mapped from JSR 163
- java.lang.management.ThreadMXBean interface, and which provide
- synchronization statistics about an instance of java.lang.Thread.
- "
- ::= { jvmThreadInstanceGroups 3 }
-
-
-jvmRuntimeGroups OBJECT IDENTIFIER ::= { jvmMgtMIBGroups 4 }
-
-jvmRuntimeBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmRTName,
- jvmRTVMName,
- jvmRTVMVendor,
- jvmRTVMVersion,
- jvmRTSpecName,
- jvmRTSpecVendor,
- jvmRTSpecVersion,
- jvmRTManagementSpecVersion,
- jvmRTUptimeMs,
- jvmRTStartTimeMs,
- jvmRTBootClassPathSupport,
- jvmRTInputArgsCount,
- jvmRTInputArgsItem,
- jvmRTClassPathItem,
- jvmRTLibraryPathItem
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.RuntimeMXBean interface.
- "
- ::= { jvmRuntimeGroups 1 }
-
-
-jvmRuntimeBootCPGroup OBJECT-GROUP
- OBJECTS {
- jvmRTBootClassPathItem
- }
- STATUS current
- DESCRIPTION
- "A columnar object that is mapped from JSR 163
- java.lang.management.RuntimeMXBean.getBootClassPath() interface,
- and provide information about bootclasspath elements.
- "
- ::= { jvmRuntimeGroups 2 }
-
-jvmJITCompilerGroups OBJECT IDENTIFIER ::= { jvmMgtMIBGroups 5 }
-
-jvmJITCompilerBasicGroup OBJECT-GROUP
- OBJECTS {
- jvmJITCompilerName,
- jvmJITCompilerTimeMonitoring
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.CompilationMXBean interface.
- "
- ::= { jvmJITCompilerGroups 1 }
-
-jvmJITCompilerTimeStatGroup OBJECT-GROUP
- OBJECTS {
- jvmJITCompilerTimeMs
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.CompilationMXBean interface and provide
- time statistic about the JIT Compiler.
- "
- ::= { jvmJITCompilerGroups 2 }
-
-jvmOSGroup OBJECT-GROUP
- OBJECTS {
- jvmOSName,
- jvmOSArch,
- jvmOSVersion,
- jvmOSProcessorCount
- }
- STATUS current
- DESCRIPTION
- "A collection of objects that are mapped from JSR 163
- java.lang.management.OperatingSystemMXBean interface.
- "
- ::= { jvmMgtMIBGroups 6 }
-
-jvmLowMemoryUsageNotifGroup NOTIFICATION-GROUP
- NOTIFICATIONS {
- jvmLowMemoryPoolUsageNotif
- }
- STATUS current
- DESCRIPTION
- "A collection of notifications emitted when low
- memory usage conditions are detected.
- "
- ::= { jvmMgtMIBGroups 7 }
-
-jvmLowMemoryCollectNotifGroup NOTIFICATION-GROUP
- NOTIFICATIONS {
- jvmLowMemoryPoolCollectNotif
- }
- STATUS current
- DESCRIPTION
- "A collection of notifications emitted when low
- collection memory usage conditions are detected.
- "
- ::= { jvmMgtMIBGroups 8 }
-
-END
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/EventSupport.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/EventSupport.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,6 +28,8 @@
import java.util.Hashtable;
import java.util.Vector;
import java.util.EventObject;
+import java.util.Iterator;
+import java.util.Map;
import javax.naming.*;
import javax.naming.event.*;
@@ -204,31 +206,35 @@
* Removes {@code l} from all notifiers in this context.
*/
synchronized void removeNamingListener(NamingListener l) {
- if (debug) System.err.println("EventSupport removing listener");
-
+ if (debug) {
+ System.err.println("EventSupport removing listener");
+ }
// Go through list of notifiers, remove 'l' from each.
// If 'l' is notifier's only listener, remove notifier too.
- for (NamingEventNotifier notifier : notifiers.values()) {
+ Iterator<NamingEventNotifier> iterator = notifiers.values().iterator();
+ while (iterator.hasNext()) {
+ NamingEventNotifier notifier = iterator.next();
if (notifier != null) {
- if (debug)
+ if (debug) {
System.err.println("EventSupport removing listener from notifier");
+ }
notifier.removeNamingListener(l);
if (!notifier.hasNamingListeners()) {
- if (debug)
+ if (debug) {
System.err.println("EventSupport stopping notifier");
+ }
notifier.stop();
- notifiers.remove(notifier.info);
+ iterator.remove();
}
}
}
-
// Remove from list of unsolicited notifier
- if (debug) System.err.println("EventSupport removing unsolicited: " +
- unsolicited);
+ if (debug) {
+ System.err.println("EventSupport removing unsolicited: " + unsolicited);
+ }
if (unsolicited != null) {
unsolicited.removeElement(l);
}
-
}
synchronized boolean hasUnsolicited() {
--- a/jdk/src/java.naming/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.naming/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -37,13 +37,17 @@
exports javax.naming.event;
exports javax.naming.ldap;
exports javax.naming.spi;
+
exports com.sun.jndi.toolkit.ctx to
jdk.naming.dns;
exports com.sun.jndi.toolkit.url to
jdk.naming.dns,
jdk.naming.rmi;
+
uses javax.naming.ldap.StartTlsResponse;
uses javax.naming.spi.InitialContextFactory;
- provides java.security.Provider with sun.security.provider.certpath.ldap.JdkLDAP;
+
+ provides java.security.Provider with
+ sun.security.provider.certpath.ldap.JdkLDAP;
}
--- a/jdk/src/java.prefs/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.prefs/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,8 @@
/**
* Defines the Preferences API.
*
+ * @uses java.util.prefs.PreferencesFactory
+ *
* @moduleGraph
* @since 9
*/
@@ -33,6 +35,6 @@
requires java.xml;
exports java.util.prefs;
+
uses java.util.prefs.PreferencesFactory;
}
-
--- a/jdk/src/java.rmi/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.rmi/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,21 @@
/**
* Defines the Remote Method Invocation (RMI) API.
*
+ * <p> The JDK implementation of this module includes
+ * the <em>{@index rmiregistry rmiregistry tool}</em> tool to start a remote
+ * object registry, and the <em>{@index rmid rmid tool}</em> tool to start
+ * the activation system daemon.
+ *
+ * <p>
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:</dt>
+ * <dd> {@extLink rmiregistry_tool_reference rmiregistry},
+ * {@extLink rmid_tool_reference rmid}
+ * </dd>
+ * </dl>
+ *
+ * @uses java.rmi.server.RMIClassLoaderSpi
+ *
* @moduleGraph
* @since 9
*/
@@ -38,6 +53,7 @@
exports java.rmi.registry;
exports java.rmi.server;
exports javax.rmi.ssl;
+
// com.sun.rmi.rmid contains permissions classes that must be
// accessible to the security manager at initialization time
exports com.sun.rmi.rmid to java.base;
@@ -51,5 +67,6 @@
java.management.rmi,
jdk.management.agent,
jdk.jconsole;
+
uses java.rmi.server.RMIClassLoaderSpi;
}
--- a/jdk/src/java.scripting/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.scripting/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,11 +26,24 @@
/**
* Defines the Scripting API.
*
+ * <p> The JDK implementation of this module includes a language-independent
+ * command-line script shell, <em>{@index jrunscript jrunscript tool}</em>,
+ * that supports executing JavaScript and other languages if its corresponding
+ * script engine is installed.
+ *
+ * <p>
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd> {@extLink jrunscript_tool_reference jrunscript}</dd>
+ * </dl>
+ *
+ * @uses javax.script.ScriptEngineFactory
+ *
* @moduleGraph
* @since 9
*/
module java.scripting {
exports javax.script;
+
uses javax.script.ScriptEngineFactory;
}
-
--- a/jdk/src/java.se.ee/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.se.ee/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -32,8 +32,9 @@
* @moduleGraph
* @since 9
*/
-@SuppressWarnings({"deprecation",
- "removal"}) // java.corba and other modules
+// suppress warning for java.corba and other modules
+@SuppressWarnings({"deprecation", "removal"})
+@Deprecated(since="9", forRemoval=true)
module java.se.ee {
requires transitive java.se;
--- a/jdk/src/java.se/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.se/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -29,6 +29,15 @@
* The modules defining CORBA and Java EE APIs are not required by
* this module, but they are required by {@code java.se.ee}.
*
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Optional for Java SE Platform:</dt>
+ * <dd>
+ * <a href="../specs/jni/index.html">Java Native Interface (JNI)</a><br>
+ * <a href="../specs/jvmti.html">Java Virtual Machine Tool Interface (JVM TI)</a><br>
+ * <a href="../specs/jdwp/jdwp-spec.html">Java Debug Wire Protocol (JDWP)</a><br>
+ * </dd>
+ * </dl>
+ *
* @moduleGraph
* @since 9
*/
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -100,9 +100,9 @@
* <p>If the input name does not contain a realm, the default realm
* is used. The default realm can be specified either in a Kerberos
* configuration file or via the java.security.krb5.realm
- * system property. For more information, see
- * <a href="../../../../../technotes/guides/security/jgss/tutorials/index.html">
- * Kerberos Requirements</a>. Additionally, if a security manager is
+ * system property. For more information, see the
+ * {@extLink security_guide_jgss_tutorial Kerberos Requirements}.
+ * Additionally, if a security manager is
* installed, a {@link ServicePermission} must be granted and the service
* principal of the permission must minimally be inside the
* {@code KerberosPrincipal}'s realm. For example, if the result of
@@ -140,9 +140,9 @@
* <p>If the input name does not contain a realm, the default realm
* is used. The default realm can be specified either in a Kerberos
* configuration file or via the java.security.krb5.realm
- * system property. For more information, see
- * <a href="../../../../../technotes/guides/security/jgss/tutorials/index.html">
- * Kerberos Requirements</a>. Additionally, if a security manager is
+ * system property. For more information, see the
+ * {@extLink security_guide_jgss_tutorial Kerberos Requirements}.
+ * Additionally, if a security manager is
* installed, a {@link ServicePermission} must be granted and the service
* principal of the permission must minimally be inside the
* {@code KerberosPrincipal}'s realm. For example, if the result of
--- a/jdk/src/java.security.jgss/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.security.jgss/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -33,8 +33,10 @@
*/
module java.security.jgss {
requires java.naming;
+
exports javax.security.auth.kerberos;
exports org.ietf.jgss;
+
exports sun.security.jgss to
jdk.security.jgss;
exports sun.security.jgss.krb5 to
@@ -51,8 +53,9 @@
opens sun.net.www.protocol.http.spnego to
java.base;
- provides java.security.Provider with sun.security.jgss.SunProvider;
- provides sun.security.ssl.ClientKeyExchangeService
- with sun.security.krb5.internal.ssl.Krb5KeyExchangeService;
+ provides java.security.Provider with
+ sun.security.jgss.SunProvider;
+ provides sun.security.ssl.ClientKeyExchangeService with
+ sun.security.krb5.internal.ssl.Krb5KeyExchangeService;
}
--- a/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html Thu Aug 24 16:24:44 2017 +0200
@@ -100,7 +100,8 @@
<h2>Related Documentation</h2>
<p>
For an online tutorial on using Java GSS-API, please see
-<a href="../../../../technotes/guides/security/jgss/tutorials/index.html">Introduction to JAAS and Java GSS-API</a>.
+{@extLink security_guide_jgss_tutorial
+Introduction to JAAS and Java GSS-API}.
</p>
<!--
--- a/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -280,8 +280,9 @@
* Creates a {@code SaslClient} using the parameters supplied.
*
* This method uses the
-<a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#Provider">JCA Security Provider Framework</a>, described in the
- * "Java Cryptography Architecture API Specification & Reference", for
+ * {@extLink security_guide_jca JCA Security Provider Framework},
+ * described in the
+ * "Java Cryptography Architecture (JCA) Reference Guide", for
* locating and selecting a {@code SaslClient} implementation.
*
* First, it
@@ -429,10 +430,10 @@
* Creates a {@code SaslServer} for the specified mechanism.
*
* This method uses the
-<a href="{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#Provider">JCA Security Provider Framework</a>,
+ * {@extLink security_guide_jca JCA Security Provider Framework},
* described in the
- * "Java Cryptography Architecture API Specification & Reference", for
- * locating and selecting a {@code SaslServer} implementation.
+ * "Java Cryptography Architecture (JCA) Reference Guide", for
+ * locating and selecting a {@code SaslClient} implementation.
*
* First, it
* obtains an ordered list of {@code SaslServerFactory} instances from
--- a/jdk/src/java.security.sasl/share/classes/javax/security/sasl/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -95,8 +95,8 @@
* <h2>Related Documentation</h2>
*
* Please refer to the
- * <a href="../../../../technotes/guides/security/sasl/sasl-refguide.html">Java
- * SASL Programming Guide</a> for information on how to use this API.
+ * {@extLink security_guide_sasl Java SASL Programming Guide}
+ * for information on how to use this API.
*
* @since 1.5
*/
--- a/jdk/src/java.security.sasl/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.security.sasl/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -37,8 +37,11 @@
requires java.logging;
exports javax.security.sasl;
+
exports com.sun.security.sasl.util to
jdk.security.jgss;
- provides java.security.Provider with com.sun.security.sasl.Provider;
+
+ provides java.security.Provider with
+ com.sun.security.sasl.Provider;
}
--- a/jdk/src/java.smartcardio/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.smartcardio/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,6 +31,8 @@
*/
module java.smartcardio {
exports javax.smartcardio;
- provides java.security.Provider with sun.security.smartcardio.SunPCSC;
+
+ provides java.security.Provider with
+ sun.security.smartcardio.SunPCSC;
}
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html Thu Aug 24 16:24:44 2017 +0200
@@ -38,10 +38,7 @@
The standard classes and interfaces that a third party vendor has to
use in its implementation of a synchronization provider. These classes and
-interfaces are referred to as the Service Provider Interface (SPI). A vendor may
-have its implementation included on the JDBC web page that lists available
-<code>SyncProvider</code> implementations by sending email to <code>jdbc@sun.com</code>.
-Doing this helps make developers aware of the implementation. To make it possible
+interfaces are referred to as the Service Provider Interface (SPI). To make it possible
for a <code>RowSet</code> object to use an implementation, the vendor must register
it with the <code>SyncFactory</code> singleton. (See the class comment for
<code>SyncProvider</code> for a full explanation of the registration process and
@@ -108,19 +105,14 @@
<P>
The lowest level of synchronization is simply writing any changes made to the
<code>RowSet</code> object to its underlying data source. The writer does
-nothing to check for conflicts.
+nothing to check for conflicts.
If there is a conflict and the data
source values are overwritten, the changes other parties have made by to the data
-source are lost.
+source are lost.
<P>
-The <code>RIXMLProvider</code> implementation uses the lowest level
+The <code>RIXMLProvider</code> implementation uses the lowest level
of synchronization and just writes <code>RowSet</code> changes to the data source.
-This is true because typically XML data sources do not enable transaction
-techniques for maintaining the integrity of data. However, specific standards
-groups have considered offering XML-based synchronization. For details, see
-<PRE>
- <a href="http://www.syncml.org">http://www.syncml.org</a>
-</PRE>
+
<P>
For the next level up, the
writer checks to see if there are any conflicts, and if there are,
@@ -141,7 +133,7 @@
It is a requirement that all disconnected <code>RowSet</code> objects
(<code>CachedRowSet</code>, <code>FilteredRowSet</code>, <code>JoinRowSet</code>,
and <code>WebRowSet</code> objects) obtain their <code>SyncProvider</code> objects
-from the <code>SyncFactory</code> mechanism.
+from the <code>SyncFactory</code> mechanism.
<P>
The reference implementation (RI) provides two synchronization providers.
<UL>
@@ -164,7 +156,7 @@
<code>RIXMLProvider</code> implementation does no checking at all for
conflicts and simply writes any updated data in the
<code>WebRowSet</code> object to the underlying data source.
- <code>WebRowSet</code> objects use this provider when they are
+ <code>WebRowSet</code> objects use this provider when they are
dealing with XML data.
</UL>
@@ -198,9 +190,7 @@
<p>
Vendors may develop a <code>SyncProvider</code> implementation with any one of the possible
levels of synchronization, thus giving <code>RowSet</code> objects a choice of
-synchronization mechanisms. A vendor can make its implementation available by
-registering the fully qualified class name with Oracle Corporation at
-<code>jdbc@sun.com</code>. This process is discussed in further detail below.
+synchronization mechanisms.
<h3><a id="arch">2.0 Service Provider Interface Architecture</a></h3>
<b>2.1 Overview</b>
@@ -274,7 +264,7 @@
A compliant <code>SyncProvider</code> implementation that is fully pluggable
into the <code>SyncFactory</code> <b>must</b> extend and implement all
abstract methods in the <a href="SyncProvider.html"><code>SyncProvider</code></a>
-class. In addition, an implementation <b>must</b> determine the
+class. In addition, an implementation <b>must</b> determine the
grade, locking and updatable view capabilities defined in the
<code>SyncProvider</code> class definition. One or more of the
<code>SyncProvider</code> description criteria <b>must</b> be supported. It
@@ -405,7 +395,7 @@
case: SyncProvider.GRADE_LOCK_WHEN_MODIFIED
// A pessimistic synchronization grade
break;
- case: SyncProvider.GRADE_NONE
+ case: SyncProvider.GRADE_NONE
// No synchronization with the originating data source provided
break;
}
@@ -413,7 +403,7 @@
switch (sync.getDataSourcLock() {
case: SyncProvider.DATASOURCE_DB_LOCK
// A lock is placed on the entire datasource that is used by the
- // <code>RowSet</code> object
+ // <code>RowSet</code> object
break;
case: SyncProvider.DATASOURCE_NO_LOCK
@@ -490,14 +480,11 @@
<h3><a id="relspec">5.0 Related Specifications</a></h3>
<ul>
<li><a href="http://docs.oracle.com/javase/jndi/tutorial/index.html">JNDI</a>
-<li><a href="{@docRoot}/../technotes/guides/logging/index.html">Java Logging
+<li><a href="{@docRoot}/java/util/logging/package-summary.html">Java Logging
APIs</a>
</ul>
<h3><a id="reldocs">6.0 Related Documentation</a></h3>
<ul>
-<li><a href="{@docRoot}/../technotes/tools/index.html#basic">System
-properties</a>
-<li>Resource Files
<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/">DataSource for JDBC
Connections</a>
</ul>
--- a/jdk/src/java.sql.rowset/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.sql.rowset/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,8 @@
/**
* Defines the JDBC RowSet API.
*
+ * @uses javax.sql.rowset.RowSetFactory
+ *
* @moduleGraph
* @since 9
*/
@@ -37,6 +39,6 @@
exports javax.sql.rowset;
exports javax.sql.rowset.serial;
exports javax.sql.rowset.spi;
+
uses javax.sql.rowset.RowSetFactory;
}
-
--- a/jdk/src/java.sql/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.sql/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,8 @@
/**
* Defines the JDBC API.
*
+ * @uses java.sql.Driver
+ *
* @moduleGraph
* @since 9
*/
@@ -36,6 +38,6 @@
exports java.sql;
exports javax.sql;
exports javax.transaction.xa;
+
uses java.sql.Driver;
}
-
--- a/jdk/src/java.transaction/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.transaction/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -35,6 +35,7 @@
@Deprecated(since="9", forRemoval=true)
module java.transaction {
requires transitive java.rmi;
+
exports javax.transaction;
}
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Thu Aug 24 16:24:44 2017 +0200
@@ -69,11 +69,10 @@
* <code>TransformService</code> implementations that support the DOM
* mechanism type must abide by the DOM interoperability requirements defined
* in the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM%20Mechanism%20Requirements">
- * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of standard
- * mechanism types.
+ * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
+ * of the API overview. See the
+ * {@extLink security_guide_xmldsig_provider Service Providers} section of
+ * the API overview for a list of standard mechanism types.
* <p>
* Once a <code>TransformService</code> has been created, it can be used
* to process <code>Transform</code> or <code>CanonicalizationMethod</code>
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -66,11 +66,10 @@
*
* <p>The objects that this factory produces will be based
* on DOM and abide by the DOM interoperability requirements as defined in the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#DOM%20Mechanism%20Requirements">
- * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of standard
- * mechanism types.
+ * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
+ * of the API overview. See the
+ * {@extLink security_guide_xmldsig_provider Service Providers} section of
+ * the API overview for a list of standard mechanism types.
*
* <p><code>XMLSignatureFactory</code> implementations are registered and loaded
* using the {@link java.security.Provider} mechanism.
@@ -181,9 +180,8 @@
* {@link Security#getProviders() Security.getProviders()}.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a
- * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of
+ * representation. See the {@extLink security_guide_xmldsig_provider
+ * Service Providers} section of the API overview for a list of
* standard mechanism types.
* @return a new <code>XMLSignatureFactory</code>
* @throws NullPointerException if <code>mechanismType</code> is
@@ -227,9 +225,8 @@
* provider list.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a
- * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of
+ * representation. See the {@extLink security_guide_xmldsig_provider
+ * Service Providers} section of the API overview for a list of
* standard mechanism types.
* @param provider the <code>Provider</code> object
* @return a new <code>XMLSignatureFactory</code>
@@ -279,9 +276,8 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a
- * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of
+ * representation. See the {@extLink security_guide_xmldsig_provider
+ * Service Providers} section of the API overview for a list of
* standard mechanism types.
* @param provider the string name of the provider
* @return a new <code>XMLSignatureFactory</code>
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -61,11 +61,11 @@
*
* <p>The objects that this factory produces will be based
* on DOM and abide by the DOM interoperability requirements as defined in the
- * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#DOM%20Mechanism%20Requirements">
- * DOM Mechanism Requirements</a> section of the API overview. See the
- * <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of standard
- * mechanism types.
+ * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
+ * of the API overview. See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names</a> document
+ * for more information.
*
* <p><code>KeyInfoFactory</code> implementations are registered and loaded
* using the {@link java.security.Provider} mechanism.
@@ -137,10 +137,10 @@
* {@link Security#getProviders() Security.getProviders()}.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a
- * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of
- * standard mechanism types.
+ * representation. See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names</a> document
+ * for more information.
* @return a new <code>KeyInfoFactory</code>
* @throws NullPointerException if <code>mechanismType</code> is
* <code>null</code>
@@ -182,10 +182,10 @@
* provider list.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a
- * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of
- * standard mechanism types.
+ * representation. See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names</a> document
+ * for more information.
* @param provider the <code>Provider</code> object
* @return a new <code>KeyInfoFactory</code>
* @throws NullPointerException if <code>mechanismType</code> or
@@ -233,10 +233,10 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a
- * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
- * Service Providers</a> section of the API overview for a list of
- * standard mechanism types.
+ * representation. See the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names</a> document
+ * for more information.
* @param provider the string name of the provider
* @return a new <code>KeyInfoFactory</code>
* @throws NoSuchProviderException if the specified provider is not
--- a/jdk/src/java.xml.crypto/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -30,8 +30,9 @@
* @since 9
*/
module java.xml.crypto {
+ requires java.logging;
+
requires transitive java.xml;
- requires java.logging;
exports javax.xml.crypto;
exports javax.xml.crypto.dom;
@@ -39,6 +40,8 @@
exports javax.xml.crypto.dsig.dom;
exports javax.xml.crypto.dsig.keyinfo;
exports javax.xml.crypto.dsig.spec;
- provides java.security.Provider with org.jcp.xml.dsig.internal.dom.XMLDSigRI;
+
+ provides java.security.Provider with
+ org.jcp.xml.dsig.internal.dom.XMLDSigRI;
}
--- a/jdk/src/jdk.accessibility/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.accessibility/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,6 +31,7 @@
*/
module jdk.accessibility {
requires transitive java.desktop;
+
exports com.sun.java.accessibility.util;
}
--- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java Thu Aug 24 16:24:44 2017 +0200
@@ -59,9 +59,9 @@
* {@link java.lang.instrument} for a detailed description on how these agents
* are loaded and started). The {@link #loadAgentLibrary loadAgentLibrary} and
* {@link #loadAgentPath loadAgentPath} methods are used to load agents that
- * are deployed either in a dynamic library or statically linked into the VM and make use of the <a
- * href="../../../../../../../../technotes/guides/jvmti/index.html">JVM Tools
- * Interface</a>. </p>
+ * are deployed either in a dynamic library or statically linked into the VM and
+ * make use of the <a href="{@docRoot}/../specs/jvmti.html">JVM Tools Interface</a>.
+ * </p>
*
* <p> In addition to loading agents a VirtualMachine provides read access to the
* {@link java.lang.System#getProperties() system properties} in the target VM.
@@ -289,8 +289,8 @@
/**
* Loads an agent library.
*
- * <p> A <a href="../../../../../../../../technotes/guides/jvmti/index.html">JVM
- * TI</a> client is called an <i>agent</i>. It is developed in a native language.
+ * <p> A <a href="{@docRoot}/../specs/jvmti.html">JVM TI</a>
+ * client is called an <i>agent</i>. It is developed in a native language.
* A JVM TI agent is deployed in a platform specific manner but it is typically the
* platform equivalent of a dynamic library. Alternatively, it may be statically linked into the VM.
* This method causes the given agent library to be loaded into the target
@@ -298,8 +298,8 @@
* It then causes the target VM to invoke the {@code Agent_OnAttach} function
* or, for a statically linked agent named 'L', the {@code Agent_OnAttach_L} function
* as specified in the
- * <a href="../../../../../../../../technotes/guides/jvmti/index.html"> JVM Tools
- * Interface</a> specification. Note that the {@code Agent_OnAttach[_L]}
+ * <a href="{@docRoot}/../specs/jvmti.html">JVM Tools Interface</a> specification.
+ * Note that the {@code Agent_OnAttach[_L]}
* function is invoked even if the agent library was loaded prior to invoking
* this method.
*
@@ -380,8 +380,8 @@
/**
* Load a native agent library by full pathname.
*
- * <p> A <a href="../../../../../../../../technotes/guides/jvmti/index.html">JVM
- * TI</a> client is called an <i>agent</i>. It is developed in a native language.
+ * <p> A <a href="{@docRoot}/../specs/jvmti.html">JVM TI</a>
+ * client is called an <i>agent</i>. It is developed in a native language.
* A JVM TI agent is deployed in a platform specific manner but it is typically the
* platform equivalent of a dynamic library. Alternatively, the native
* library specified by the agentPath parameter may be statically
@@ -397,8 +397,7 @@
* It then causes the target VM to invoke the {@code Agent_OnAttach}
* function or, for a statically linked agent named 'L', the
* {@code Agent_OnAttach_L} function as specified in the
- * <a href="../../../../../../../../technotes/guides/jvmti/index.html"> JVM Tools
- * Interface</a> specification.
+ * <a href="{@docRoot}/../specs/jvmti.html">JVM Tools Interface</a> specification.
* Note that the {@code Agent_OnAttach[_L]}
* function is invoked even if the agent library was loaded prior to invoking
* this method.
@@ -611,9 +610,9 @@
* way as on the command line, you need to specify at least the
* {@code com.sun.management.jmxremote.port} property.
*
- * <p> See the online documentation for <a
- * href="../../../../../../../../technotes/guides/management/agent.html">
- * Monitoring and Management Using JMX Technology</a> for further details.
+ * <p> See the online documentation for
+ * {@extLink monitoring_and_management_using_jmx_technology
+ * Monitoring and Management Using JMX Technology} for further details.
*
* @param agentProperties
* A Properties object containing the configuration properties
@@ -642,9 +641,9 @@
/**
* Starts the local JMX management agent in the target virtual machine.
*
- * <p> See the online documentation for <a
- * href="../../../../../../../../technotes/guides/management/agent.html">
- * Monitoring and Management Using JMX Technology</a> for further details.
+ * <p> See the online documentation for
+ * {@extLink monitoring_and_management_using_jmx_technology
+ * Monitoring and Management Using JMX Technology} for further details.
*
* @return The String representation of the local connector's service address.
* The value can be parsed by the
--- a/jdk/src/jdk.attach/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.attach/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,8 @@
/**
* Defines the attach API.
*
+ * @uses com.sun.tools.attach.spi.AttachProvider
+ *
* @moduleGraph
* @since 9
*/
@@ -34,9 +36,12 @@
exports com.sun.tools.attach;
exports com.sun.tools.attach.spi;
+
exports sun.tools.attach to
jdk.jcmd;
+
uses com.sun.tools.attach.spi.AttachProvider;
- provides com.sun.tools.attach.spi.AttachProvider with sun.tools.attach.AttachProviderImpl;
+
+ provides com.sun.tools.attach.spi.AttachProvider with
+ sun.tools.attach.AttachProviderImpl;
}
-
--- a/jdk/src/jdk.charsets/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.charsets/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,14 +24,15 @@
*/
/**
- * {@link java.nio.charset.Charset Charset} provider for the charsets that
+ * Provides {@link java.nio.charset.Charset charsets} that
* are not in {@code java.base} (mostly double byte and IBM charsets).
*
+ * @provides java.nio.charset.spi.CharsetProvider
+ *
* @moduleGraph
* @since 9
*/
module jdk.charsets {
- provides java.nio.charset.spi.CharsetProvider
- with sun.nio.cs.ext.ExtendedCharsets;
+ provides java.nio.charset.spi.CharsetProvider with
+ sun.nio.cs.ext.ExtendedCharsets;
}
-
--- a/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,9 @@
*/
/**
- * The SunPKCS11 security provider.
+ * Provides the implementation of the SunPKCS11 security provider.
+ *
+ * @provides java.security.Provider
*
* @moduleGraph
* @since 9
@@ -32,6 +34,6 @@
module jdk.crypto.cryptoki {
// Depends on SunEC provider for EC related functionality
requires jdk.crypto.ec;
+
provides java.security.Provider with sun.security.pkcs11.SunPKCS11;
}
-
--- a/jdk/src/jdk.crypto.ec/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.crypto.ec/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,9 @@
*/
/**
- * The SunEC security provider.
+ * Provides the implementation of the SunEC security provider.
+ *
+ * @provides java.security.Provider
*
* @moduleGraph
* @since 9
@@ -32,4 +34,3 @@
module jdk.crypto.ec {
provides java.security.Provider with sun.security.ec.SunEC;
}
-
--- a/jdk/src/jdk.crypto.ec/share/legal/ecc.md Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.crypto.ec/share/legal/ecc.md Thu Aug 24 16:24:44 2017 +0200
@@ -1,7 +1,6 @@
## Mozilla Elliptic Curve Cryptography (ECC)
### Mozilla ECC Notice
-<pre>
This notice is provided with respect to Elliptic Curve Cryptography,
which is included with JRE, JDK, and OpenJDK.
@@ -10,7 +9,7 @@
of the Elliptic Curve Cryptography library in source
form with the JDK and OpenJDK source distributions, and as object code in
the JRE & JDK runtimes.
-
+<pre>
In the case of the JRE & JDK runtimes, the terms of the Oracle license do
NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
following license, separately from Oracle's JDK & JRE. If you do not wish to
@@ -22,6 +21,54 @@
</pre>
+### Written Offer for Source Code
+<pre>
+
+For third party technology that you receive from Oracle in binary form
+which is licensed under an open source license that gives you the right
+to receive the source code for that binary, you can obtain a copy of
+the applicable source code from this page:
+ http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/jdk.crypto.ec/share/native/libsunec/impl
+
+If the source code for the technology was not provided to you with the
+binary, you can also receive a copy of the source code on physical
+media by submitting a written request to:
+
+ Oracle America, Inc.
+ Attn: Associate General Counsel,
+ Development and Engineering Legal
+ 500 Oracle Parkway, 10th Floor
+ Redwood Shores, CA 94065
+
+Or, you may send an email to Oracle using the form at:
+
+http://www.oracle.com/goto/opensourcecode/request
+
+Your request should include:
+
+ - The name of the component or binary file(s) for which you are requesting the source code
+
+ - The name and version number of the Oracle product containing the binary
+
+ - The date you received the Oracle product
+
+ - Your name
+
+ - Your company name (if applicable)
+
+ - Your return mailing address and email and
+
+ - A telephone number in the event we need to reach you.
+
+We may charge you a fee to cover the cost of physical media and processing.
+Your request must be sent (i) within three (3) years of the date you
+received the Oracle product that included the component or binary
+file(s) that are the subject of your request, or (ii) in the case of
+code licensed under the GPL v3, for as long as Oracle offers spare
+parts or customer support for that product model.
+
+</pre>
+
### LGPL 2.1
<pre>
--- a/jdk/src/jdk.crypto.mscapi/windows/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.crypto.mscapi/windows/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,8 +24,9 @@
*/
/**
- * The SunMSCAPI security provider.
+ * Provides the implementation of the SunMSCAPI security provider.
*
+ * @provides java.security.Provider
* @moduleGraph
* @since 9
*/
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,8 +24,9 @@
*/
/**
- * The OracleUCrypto security provider.
+ * Provides the implementation of the OracleUCrypto security provider.
*
+ * @provides java.security.Provider
* @moduleGraph
* @since 9
*/
--- a/jdk/src/jdk.editpad/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.editpad/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,14 +24,15 @@
*/
/**
- * Implementation of the edit pad service.
+ * Provides the implementation of the edit pad service used by {@link jdk.jshell}.
*
* @moduleGraph
* @since 9
*/
module jdk.editpad {
+ requires java.desktop;
requires jdk.internal.ed;
- requires java.desktop;
- provides jdk.internal.editor.spi.BuildInEditorProvider
- with jdk.editpad.EditPadProvider;
+
+ provides jdk.internal.editor.spi.BuildInEditorProvider with
+ jdk.editpad.EditPadProvider;
}
--- a/jdk/src/jdk.httpserver/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.httpserver/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,6 +26,8 @@
/**
* Defines the JDK-specific API for HTTP server.
*
+ * @uses com.sun.net.httpserver.spi.HttpServerProvider
+ *
* @moduleGraph
* @since 9
*/
@@ -33,6 +35,6 @@
exports com.sun.net.httpserver;
exports com.sun.net.httpserver.spi;
+
uses com.sun.net.httpserver.spi.HttpServerProvider;
}
-
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,11 +46,13 @@
final AsyncSSLDelegate sslDelegate;
final PlainHttpConnection plainConnection;
+ final String serverName;
AsyncSSLConnection(InetSocketAddress addr, HttpClientImpl client, String[] ap) {
super(addr, client);
plainConnection = new PlainHttpConnection(addr, client);
- sslDelegate = new AsyncSSLDelegate(plainConnection, client, ap);
+ serverName = Utils.getServerName(addr);
+ sslDelegate = new AsyncSSLDelegate(plainConnection, client, ap, serverName);
}
@Override
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLDelegate.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLDelegate.java Thu Aug 24 16:24:44 2017 +0200
@@ -108,6 +108,7 @@
final SSLParameters sslParameters;
final HttpConnection lowerOutput;
final HttpClientImpl client;
+ final String serverName;
// should be volatile to provide proper synchronization(visibility) action
volatile Consumer<ByteBufferReference> asyncReceiver;
volatile Consumer<Throwable> errorHandler;
@@ -121,9 +122,10 @@
// alpn[] may be null. upcall is callback which receives incoming decoded bytes off socket
- AsyncSSLDelegate(HttpConnection lowerOutput, HttpClientImpl client, String[] alpn)
+ AsyncSSLDelegate(HttpConnection lowerOutput, HttpClientImpl client, String[] alpn, String sname)
{
SSLContext context = client.sslContext();
+ this.serverName = sname;
engine = context.createSSLEngine();
engine.setUseClientMode(true);
SSLParameters sslp = client.sslParameters()
@@ -135,6 +137,10 @@
} else {
Log.logSSL("AsyncSSLDelegate: no applications set!");
}
+ if (serverName != null) {
+ SNIHostName sn = new SNIHostName(serverName);
+ sslParameters.setServerNames(List.of(sn));
+ }
logParams(sslParameters);
engine.setSSLParameters(sslParameters);
this.lowerOutput = lowerOutput;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Thu Aug 24 16:24:44 2017 +0200
@@ -266,7 +266,6 @@
throws IOException, InterruptedException
{
establishExchange(connection);
- exchImpl.setClientForRequest(requestProcessor);
if (request.expectContinue()) {
Log.logTrace("Sending Expect: 100-Continue");
request.addSystemHeader("Expect", "100-Continue");
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ExchangeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ExchangeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,7 +26,6 @@
package jdk.incubator.http;
import java.io.IOException;
-import jdk.incubator.http.RequestProcessors.ProcessorBase;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import jdk.incubator.http.internal.common.MinimalFuture;
@@ -50,11 +49,8 @@
final Exchange<T> exchange;
ExchangeImpl(Exchange<T> e) {
+ // e == null means a http/2 pushed stream
this.exchange = e;
- if (e != null) {
- // e == null means a http/2 pushed stream, therefore no request
- setClientForRequest(e.requestProcessor);
- }
}
final Exchange<T> getExchange() {
@@ -134,22 +130,6 @@
boolean returnConnectionToPool,
Executor executor);
- // Builtin processors need access to HttpClientImpl
- final void setClientForResponse(HttpResponse.BodyProcessor<T> proc) {
- if (proc instanceof ResponseProcessors.AbstractProcessor) {
- ResponseProcessors.AbstractProcessor<T> abProc =
- (ResponseProcessors.AbstractProcessor<T>)proc;
- abProc.setClient(exchange.client());
- }
- }
-
- final void setClientForRequest(HttpRequest.BodyProcessor proc) {
- if (proc instanceof ProcessorBase) {
- ProcessorBase abProc = (ProcessorBase)proc;
- abProc.setClient(exchange.client());
- }
- }
-
/**
* Async version of getResponse. Completes before body is read.
*/
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Thu Aug 24 16:24:44 2017 +0200
@@ -96,7 +96,6 @@
{
BodyProcessor<T> processor = handler.apply(response.responseCode(),
response.responseHeaders());
- setClientForResponse(processor);
CompletableFuture<T> bodyCF = response.readBody(processor,
returnConnectionToPool,
this::executeInline);
@@ -122,7 +121,6 @@
{
BodyProcessor<T> processor = handler.apply(response.responseCode(),
response.responseHeaders());
- setClientForResponse(processor);
CompletableFuture<T> bodyCF = response.readBody(processor,
returnConnectionToPool,
executor);
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Request.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Request.java Thu Aug 24 16:24:44 2017 +0200
@@ -33,7 +33,6 @@
import java.util.Set;
import java.net.InetSocketAddress;
import jdk.incubator.http.HttpConnection.Mode;
-import jdk.incubator.http.RequestProcessors.ProcessorBase;
import java.nio.charset.StandardCharsets;
import static java.nio.charset.StandardCharsets.US_ASCII;
import java.util.concurrent.CompletableFuture;
@@ -274,9 +273,7 @@
setFinished();
}
- class StreamSubscriber extends ProcessorBase
- implements Flow.Subscriber<ByteBuffer>
- {
+ class StreamSubscriber implements Flow.Subscriber<ByteBuffer> {
volatile Flow.Subscription subscription;
volatile boolean includeHeaders;
@@ -361,13 +358,11 @@
throws IOException
{
StreamSubscriber subscriber = new StreamSubscriber(includeHeaders);
- subscriber.setClient(client);
requestProc.subscribe(subscriber);
waitForCompletion();
}
- class FixedContentSubscriber extends ProcessorBase
- implements Flow.Subscriber<ByteBuffer>
+ class FixedContentSubscriber implements Flow.Subscriber<ByteBuffer>
{
volatile Flow.Subscription subscription;
volatile boolean includeHeaders;
@@ -451,7 +446,6 @@
return;
}
FixedContentSubscriber subscriber = new FixedContentSubscriber(includeHeaders);
- subscriber.setClient(client);
requestProc.subscribe(subscriber);
waitForCompletion();
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http2Connection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http2Connection.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -111,47 +111,56 @@
*/
- // A small class that allows to control the state of
- // the connection preface. This is just a thin wrapper
- // over a CountDownLatch.
- private final class PrefaceController {
+ // A small class that allows to control frames with respect to the state of
+ // the connection preface. Any data received before the connection
+ // preface is sent will be buffered.
+ private final class FramesController {
volatile boolean prefaceSent;
- private final CountDownLatch latch = new CountDownLatch(1);
+ volatile List<ByteBufferReference> pending;
- // This method returns immediately if the preface is sent,
- // and blocks until the preface is sent if not.
- // In the common case this where the preface is already sent
- // this will cost not more than a volatile read.
- void waitUntilPrefaceSent() {
+ boolean processReceivedData(FramesDecoder decoder, ByteBufferReference buf)
+ throws IOException
+ {
+ // if preface is not sent, buffers data in the pending list
if (!prefaceSent) {
- try {
- // If the preface is not sent then await on the latch
- Log.logTrace("Waiting until connection preface is sent");
- latch.await();
- Log.logTrace("Preface sent: resuming reading");
- assert prefaceSent;
- } catch (InterruptedException e) {
- String msg = Utils.stackTrace(e);
- Log.logTrace(msg);
- shutdown(e);
+ synchronized (this) {
+ if (!prefaceSent) {
+ if (pending == null) pending = new ArrayList<>();
+ pending.add(buf);
+ return false;
+ }
}
}
+
+ // Preface is sent. Checks for pending data and flush it.
+ // We rely on this method being called from within the readlock,
+ // so we know that no other thread could execute this method
+ // concurrently while we're here.
+ // This ensures that later incoming buffers will not
+ // be processed before we have flushed the pending queue.
+ // No additional synchronization is therefore necessary here.
+ List<ByteBufferReference> pending = this.pending;
+ this.pending = null;
+ if (pending != null) {
+ // flush pending data
+ for (ByteBufferReference b : pending) {
+ decoder.decode(b);
+ }
+ }
+
+ // push the received buffer to the frames decoder.
+ decoder.decode(buf);
+ return true;
}
// Mark that the connection preface is sent
void markPrefaceSent() {
assert !prefaceSent;
- prefaceSent = true;
- // Release the latch. If asyncReceive was scheduled it will
- // be waiting for the release and will be woken up by this
- // call. If not, then the semaphore will no longer be used after
- // this.
- latch.countDown();
+ synchronized (this) {
+ prefaceSent = true;
+ }
}
- boolean isPrefaceSent() {
- return prefaceSent;
- }
}
volatile boolean closed;
@@ -176,7 +185,7 @@
* Each of this connection's Streams MUST use this controller.
*/
private final WindowController windowController = new WindowController();
- private final PrefaceController prefaceController = new PrefaceController();
+ private final FramesController framesController = new FramesController();
final WindowUpdateSender windowUpdater;
static final int DEFAULT_FRAME_SIZE = 16 * 1024;
@@ -409,11 +418,11 @@
// SettingsFrame sent by the server) before the connection
// preface is fully sent might result in the server
// sending a GOAWAY frame with 'invalid_preface'.
- prefaceController.waitUntilPrefaceSent();
synchronized (readlock) {
- assert prefaceController.isPrefaceSent();
try {
- framesDecoder.decode(buffer);
+ // the readlock ensures that the order of incoming buffers
+ // is preserved.
+ framesController.processReceivedData(framesDecoder, buffer);
} catch (Throwable e) {
String msg = Utils.stackTrace(e);
Log.logTrace(msg);
@@ -646,7 +655,8 @@
Log.logFrames(sf, "OUT");
// send preface bytes and SettingsFrame together
connection.write(ref.get());
-
+ // mark preface sent.
+ framesController.markPrefaceSent();
Log.logTrace("PREFACE_BYTES sent");
Log.logTrace("Settings Frame sent");
@@ -654,8 +664,10 @@
// minus the initial 64 K specified in protocol
final int len = client2.client().getReceiveBufferSize() - (64 * 1024 - 1);
windowUpdater.sendWindowUpdate(len);
+ // there will be an ACK to the windows update - which should
+ // cause any pending data stored before the preface was sent to be
+ // flushed (see PrefaceController).
Log.logTrace("finished sending connection preface");
- prefaceController.markPrefaceSent();
}
/**
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -344,7 +344,13 @@
c.configureBlocking(false);
SelectionKey key = c.keyFor(selector);
SelectorAttachment sa;
- if (key == null) {
+ if (key == null || !key.isValid()) {
+ if (key != null) {
+ // key is canceled.
+ // invoke selectNow() to purge it
+ // before registering the new event.
+ selector.selectNow();
+ }
sa = new SelectorAttachment(c, selector);
} else {
sa = (SelectorAttachment) key.attachment();
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -58,7 +58,8 @@
* Creates an HttpRequestImpl from the given builder.
*/
public HttpRequestImpl(HttpRequestBuilderImpl builder) {
- this.method = builder.method();
+ String method = builder.method();
+ this.method = method == null? "GET" : method;
this.userHeaders = ImmutableHeaders.of(builder.headers().map(), ALLOWED_HEADERS);
this.systemHeaders = new HttpHeadersImpl();
this.uri = builder.uri();
@@ -77,7 +78,8 @@
* Creates an HttpRequestImpl from the given request.
*/
public HttpRequestImpl(HttpRequest request) {
- this.method = request.method();
+ String method = request.method();
+ this.method = method == null? "GET" : method;
this.userHeaders = request.headers();
if (request instanceof HttpRequestImpl) {
this.systemHeaders = ((HttpRequestImpl) request).systemHeaders;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -62,6 +62,7 @@
private volatile Consumer<ByteBufferReference> asyncReceiver;
private volatile Consumer<Throwable> errorReceiver;
private volatile Supplier<ByteBufferReference> readBufferSupplier;
+ private boolean asyncReading;
private final AsyncWriteQueue asyncOutputQ = new AsyncWriteQueue(this::asyncOutput);
@@ -70,6 +71,9 @@
@Override
public void startReading() {
try {
+ synchronized(reading) {
+ asyncReading = true;
+ }
client.registerEvent(new ReadEvent());
} catch (IOException e) {
shutdown();
@@ -78,6 +82,9 @@
@Override
public void stopAsyncReading() {
+ synchronized(reading) {
+ asyncReading = false;
+ }
client.cancelRegistration(chan);
}
@@ -279,7 +286,7 @@
void asyncRead() {
synchronized (reading) {
try {
- while (true) {
+ while (asyncReading) {
ByteBufferReference buf = readBufferSupplier.get();
int n = chan.read(buf.get());
if (n == -1) {
@@ -325,7 +332,7 @@
return -1;
}
Utils.flipToMark(buf, mark);
- String s = "Receive (" + n + " bytes) ";
+ // String s = "Receive (" + n + " bytes) ";
//debugPrint(s, buf);
return n;
}
@@ -393,6 +400,10 @@
shutdown();
}
+ @Override
+ public String toString() {
+ return super.toString() + "/" + chan;
+ }
}
// used in blocking channels only
@@ -422,6 +433,11 @@
public void abort() {
close();
}
+
+ @Override
+ public String toString() {
+ return super.toString() + "/" + chan;
+ }
}
@Override
@@ -447,7 +463,8 @@
CompletableFuture<Void> whenReceivingResponse() {
CompletableFuture<Void> cf = new MinimalFuture<>();
try {
- client.registerEvent(new ReceiveResponseEvent(cf));
+ ReceiveResponseEvent evt = new ReceiveResponseEvent(cf);
+ client.registerEvent(evt);
} catch (IOException e) {
cf.completeExceptionally(e);
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/RequestProcessors.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/RequestProcessors.java Thu Aug 24 16:24:44 2017 +0200
@@ -38,29 +38,14 @@
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
-import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Flow;
import java.util.function.Supplier;
import jdk.incubator.http.internal.common.Utils;
class RequestProcessors {
- // common base class for Publisher and Subscribers used here
- abstract static class ProcessorBase {
- HttpClientImpl client;
- synchronized void setClient(HttpClientImpl client) {
- this.client = client;
- }
-
- synchronized HttpClientImpl getClient() {
- return client;
- }
- }
-
- static class ByteArrayProcessor extends ProcessorBase
- implements HttpRequest.BodyProcessor
- {
+ static class ByteArrayProcessor implements HttpRequest.BodyProcessor {
private volatile Flow.Publisher<ByteBuffer> delegate;
private final int length;
private final byte[] content;
@@ -105,9 +90,7 @@
}
// This implementation has lots of room for improvement.
- static class IterableProcessor extends ProcessorBase
- implements HttpRequest.BodyProcessor
- {
+ static class IterableProcessor implements HttpRequest.BodyProcessor {
private volatile Flow.Publisher<ByteBuffer> delegate;
private final Iterable<byte[]> content;
private volatile long contentLength;
@@ -202,8 +185,7 @@
}
}
- static class EmptyProcessor extends ProcessorBase implements HttpRequest.BodyProcessor
- {
+ static class EmptyProcessor implements HttpRequest.BodyProcessor {
PseudoPublisher<ByteBuffer> delegate = new PseudoPublisher<>();
@Override
@@ -303,9 +285,7 @@
}
- static class InputStreamProcessor extends ProcessorBase
- implements HttpRequest.BodyProcessor
- {
+ static class InputStreamProcessor implements HttpRequest.BodyProcessor {
private final Supplier<? extends InputStream> streamSupplier;
private Flow.Publisher<ByteBuffer> delegate;
@@ -315,11 +295,7 @@
@Override
public synchronized void subscribe(Flow.Subscriber<? super ByteBuffer> subscriber) {
- if (!(subscriber instanceof ProcessorBase)) {
- throw new UnsupportedOperationException();
- }
- ProcessorBase base = (ProcessorBase)subscriber;
- HttpClientImpl client = base.getClient();
+
InputStream is = streamSupplier.get();
if (is == null) {
throw new UncheckedIOException(new IOException("no inputstream supplied"));
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseHeaders.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseHeaders.java Thu Aug 24 16:24:44 2017 +0200
@@ -154,14 +154,12 @@
String k = key.toLowerCase(Locale.US);
cookedHeaders.merge(k, newValues,
(v1, v2) -> {
- if (v1 == null) {
- ArrayList<String> newV = new ArrayList<>();
- newV.addAll(v2);
- return newV;
- } else {
- v1.addAll(v2);
- return v1;
+ ArrayList<String> newV = new ArrayList<>();
+ if (v1 != null) {
+ newV.addAll(v1);
}
+ newV.addAll(v2);
+ return newV;
});
}
return cookedHeaders;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseProcessors.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseProcessors.java Thu Aug 24 16:24:44 2017 +0200
@@ -51,21 +51,7 @@
class ResponseProcessors {
- abstract static class AbstractProcessor<T>
- implements HttpResponse.BodyProcessor<T>
- {
- HttpClientImpl client;
-
- synchronized void setClient(HttpClientImpl client) {
- this.client = client;
- }
-
- synchronized HttpClientImpl getClient() {
- return client;
- }
- }
-
- static class ConsumerProcessor extends AbstractProcessor<Void> {
+ static class ConsumerProcessor implements HttpResponse.BodyProcessor<Void> {
private final Consumer<Optional<byte[]>> consumer;
private Flow.Subscription subscription;
private final CompletableFuture<Void> result = new MinimalFuture<>();
@@ -106,7 +92,7 @@
}
- static class PathProcessor extends AbstractProcessor<Path> {
+ static class PathProcessor implements HttpResponse.BodyProcessor<Path> {
private final Path file;
private final CompletableFuture<Path> result = new MinimalFuture<>();
@@ -163,7 +149,7 @@
}
}
- static class ByteArrayProcessor<T> extends AbstractProcessor<T> {
+ static class ByteArrayProcessor<T> implements HttpResponse.BodyProcessor<T> {
private final Function<byte[], T> finisher;
private final CompletableFuture<T> result = new MinimalFuture<>();
private final List<ByteBuffer> received = new ArrayList<>();
@@ -301,7 +287,7 @@
/**
* Currently this consumes all of the data and ignores it
*/
- static class NullProcessor<T> extends AbstractProcessor<T> {
+ static class NullProcessor<T> implements HttpResponse.BodyProcessor<T> {
Flow.Subscription subscription;
final CompletableFuture<T> cf = new MinimalFuture<>();
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,13 +46,14 @@
PlainHttpConnection delegate;
SSLDelegate sslDelegate;
final String[] alpn;
+ final String serverName;
@Override
public CompletableFuture<Void> connectAsync() {
return delegate.connectAsync()
.thenCompose((Void v) ->
MinimalFuture.supply( () -> {
- this.sslDelegate = new SSLDelegate(delegate.channel(), client, alpn);
+ this.sslDelegate = new SSLDelegate(delegate.channel(), client, alpn, serverName);
return null;
}));
}
@@ -60,12 +61,13 @@
@Override
public void connect() throws IOException {
delegate.connect();
- this.sslDelegate = new SSLDelegate(delegate.channel(), client, alpn);
+ this.sslDelegate = new SSLDelegate(delegate.channel(), client, alpn, serverName);
}
SSLConnection(InetSocketAddress addr, HttpClientImpl client, String[] ap) {
super(addr, client);
this.alpn = ap;
+ this.serverName = Utils.getServerName(addr);
delegate = new PlainHttpConnection(addr, client);
}
@@ -77,8 +79,9 @@
super(c.address, c.client);
this.delegate = c.plainConnection;
AsyncSSLDelegate adel = c.sslDelegate;
- this.sslDelegate = new SSLDelegate(adel.engine, delegate.channel(), client);
+ this.sslDelegate = new SSLDelegate(adel.engine, delegate.channel(), client, adel.serverName);
this.alpn = adel.alpn;
+ this.serverName = adel.serverName;
}
@Override
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Thu Aug 24 16:24:44 2017 +0200
@@ -29,6 +29,7 @@
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
@@ -50,26 +51,33 @@
final SSLParameters sslParameters;
final SocketChannel chan;
final HttpClientImpl client;
+ final String serverName;
- SSLDelegate(SSLEngine eng, SocketChannel chan, HttpClientImpl client)
+ SSLDelegate(SSLEngine eng, SocketChannel chan, HttpClientImpl client, String sn)
{
this.engine = eng;
this.chan = chan;
this.client = client;
this.wrapper = new EngineWrapper(chan, engine);
this.sslParameters = engine.getSSLParameters();
+ this.serverName = sn;
}
// alpn[] may be null
- SSLDelegate(SocketChannel chan, HttpClientImpl client, String[] alpn)
+ SSLDelegate(SocketChannel chan, HttpClientImpl client, String[] alpn, String sn)
throws IOException
{
+ serverName = sn;
SSLContext context = client.sslContext();
engine = context.createSSLEngine();
engine.setUseClientMode(true);
SSLParameters sslp = client.sslParameters()
.orElseGet(context::getSupportedSSLParameters);
sslParameters = Utils.copySSLParameters(sslp);
+ if (sn != null) {
+ SNIHostName sni = new SNIHostName(sn);
+ sslParameters.setServerNames(List.of(sni));
+ }
if (alpn != null) {
sslParameters.setApplicationProtocols(alpn);
Log.logSSL("SSLDelegate: Setting application protocols: {0}" + Arrays.toString(alpn));
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -46,11 +46,12 @@
final PlainTunnelingConnection delegate;
protected SSLDelegate sslDelegate;
private volatile boolean connected;
+ final String serverName;
@Override
public void connect() throws IOException, InterruptedException {
delegate.connect();
- this.sslDelegate = new SSLDelegate(delegate.channel(), client, null);
+ this.sslDelegate = new SSLDelegate(delegate.channel(), client, null, serverName);
connected = true;
}
@@ -67,7 +68,7 @@
// can this block?
this.sslDelegate = new SSLDelegate(delegate.channel(),
client,
- null);
+ null, serverName);
connected = true;
} catch (IOException e) {
throw new UncheckedIOException(e);
@@ -80,6 +81,7 @@
InetSocketAddress proxy)
{
super(addr, client);
+ this.serverName = Utils.getServerName(addr);
delegate = new PlainTunnelingConnection(addr, proxy, client);
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java Thu Aug 24 16:24:44 2017 +0200
@@ -153,7 +153,6 @@
{
Log.logTrace("Reading body on stream {0}", streamid);
responseProcessor = handler.apply(responseCode, responseHeaders);
- setClientForResponse(responseProcessor);
publisher.subscribe(responseProcessor);
CompletableFuture<T> cf = receiveData(executor);
@@ -573,10 +572,7 @@
connection.putStream(this, streamid);
}
- class RequestSubscriber
- extends RequestProcessors.ProcessorBase
- implements Flow.Subscriber<ByteBuffer>
- {
+ class RequestSubscriber implements Flow.Subscriber<ByteBuffer> {
// can be < 0 if the actual length is not known.
private volatile long remainingContentLength;
private volatile Subscription subscription;
@@ -768,7 +764,6 @@
CompletableFuture<Void> sendBodyImpl() {
RequestSubscriber subscriber = new RequestSubscriber(requestContentLen);
- subscriber.setClient(client);
requestProcessor.subscribe(subscriber);
requestBodyCF.whenComplete((v,t) -> requestSent());
return requestBodyCF;
@@ -803,7 +798,9 @@
completeResponseExceptionally(e);
try {
// will send a RST_STREAM frame
- connection.resetStream(streamid, ResetFrame.CANCEL);
+ if (streamid != 0) {
+ connection.resetStream(streamid, ResetFrame.CANCEL);
+ }
} catch (IOException ex) {
Log.logError(ex);
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,6 +27,7 @@
import jdk.internal.misc.InnocuousThread;
import sun.net.NetProperties;
+import sun.net.util.IPAddressUtil;
import javax.net.ssl.SSLParameters;
import java.io.ByteArrayOutputStream;
@@ -35,6 +36,7 @@
import java.io.UncheckedIOException;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
+import java.net.InetSocketAddress;
import java.net.NetPermission;
import java.net.URI;
import java.net.URLPermission;
@@ -164,6 +166,22 @@
return !token.isEmpty();
}
+ /**
+ * If the address was created with a domain name, then return
+ * the domain name string. If created with a literal IP address
+ * then return null. We do this to avoid doing a reverse lookup
+ * Used to populate the TLS SNI parameter. So, SNI is only set
+ * when a domain name was supplied.
+ */
+ public static String getServerName(InetSocketAddress addr) {
+ String host = addr.getHostString();
+ if (IPAddressUtil.textToNumericFormatV4(host) != null)
+ return null;
+ if (IPAddressUtil.textToNumericFormatV6(host) != null)
+ return null;
+ return host;
+ }
+
/*
* Validates a RFC 7230 field-value.
*
--- a/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,7 +31,6 @@
* @since 9
*/
module jdk.incubator.httpclient {
- requires java.base;
exports jdk.incubator.http;
}
--- a/jdk/src/jdk.internal.ed/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.internal.ed/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,6 +31,11 @@
*/
module jdk.internal.ed {
- exports jdk.internal.editor.spi to jdk.editpad, jdk.jshell, jdk.scripting.nashorn.shell;
- exports jdk.internal.editor.external to jdk.jshell, jdk.scripting.nashorn.shell;
+ exports jdk.internal.editor.spi to
+ jdk.editpad,
+ jdk.jshell,
+ jdk.scripting.nashorn.shell;
+ exports jdk.internal.editor.external to
+ jdk.jshell,
+ jdk.scripting.nashorn.shell;
}
--- a/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -42,6 +42,7 @@
jdk.jstatd;
uses sun.jvmstat.monitor.MonitoredHostService;
+
provides sun.jvmstat.monitor.MonitoredHostService with
sun.jvmstat.perfdata.monitor.protocol.file.MonitoredHostFileService,
sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostLocalService;
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Thu Aug 24 16:24:44 2017 +0200
@@ -380,7 +380,10 @@
}
public void fullHistoryReplace(String source) {
- fullHistory.replace(source);
+ fullHistory.removeLast();
+ for (String line : source.split("\\R")) {
+ fullHistory.add(line);
+ }
}
private class NarrowingHistoryLine implements CharSequence {
--- a/jdk/src/jdk.jartool/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jartool/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,7 +25,21 @@
/**
* Defines tools for manipulating Java Archive (JAR) files,
- * including the jar and jarsigner tools.
+ * including the <em>{@index jar jar tool}</em> and
+ * <em>{@index jarsigner jarsigner tool}</em> tools.
+ *
+ * <p> This module provides the equivalent of command-line access to
+ * <em>jar</em> via the {@link java.util.spi.ToolProvider ToolProvider} SPI.
+ * Instances of the tool can be obtained by calling
+ * {@link java.util.spi.ToolProvider#findFirst ToolProvider.findFirst}
+ * or the {@link java.util.ServiceLoader service loader} with the name
+ * {@code "jar"}.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink jar_tool_reference jar},
+ * {@extLink jarsigner_tool_reference jarsigner}
+ * </dl>
*
* @moduleGraph
* @since 9
@@ -34,6 +48,6 @@
exports com.sun.jarsigner;
exports jdk.security.jarsigner;
- provides java.util.spi.ToolProvider with sun.tools.jar.JarToolProvider;
+ provides java.util.spi.ToolProvider with
+ sun.tools.jar.JarToolProvider;
}
-
--- a/jdk/src/jdk.jcmd/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jcmd/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,8 +24,20 @@
*/
/**
- * Defines tools for diagnostics and troubleshooting a JVM,
- * including the jcmd, jps, jstat and other diagnostics tools.
+ * Defines tools for diagnostics and troubleshooting a JVM
+ * such as the <em>{@index jcmd jcmd tool}</em>, <em>{@index jps jps tool}</em>,
+ * <em>{@index jstat jstat tool}</em> tools.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>
+ * {@extLink jcmd_tool_reference jcmd},
+ * {@extLink jinfo_tool_reference jinfo},
+ * {@extLink jmap_tool_reference jmap},
+ * {@extLink jps_tool_reference jps},
+ * {@extLink jstack_tool_reference jstack},
+ * {@extLink jstat_tool_reference jstat}
+ * </dl>
*
* @moduleGraph
* @since 9
--- a/jdk/src/jdk.jconsole/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jconsole/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,21 +24,32 @@
*/
/**
- * Defines the JMX graphical tool, jconsole, for monitoring and managing
- * a running application.
+ * Defines the JMX graphical tool, <em>{@index jconsole jconsole}</em>,
+ * for monitoring and managing a running application.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink jconsole_tool_reference jconsole},
+ * {@extLink using_jconsole Using JConsole}
+ * </dl>
+ *
+ * @uses com.sun.tools.jconsole.JConsolePlugin
*
* @moduleGraph
* @since 9
*/
module jdk.jconsole {
- requires transitive java.desktop;
- requires transitive java.management;
requires java.management.rmi;
requires java.rmi;
requires jdk.attach;
requires jdk.internal.jvmstat;
requires jdk.management;
requires jdk.management.agent;
+
+ requires transitive java.desktop;
+ requires transitive java.management;
+
exports com.sun.tools.jconsole;
+
uses com.sun.tools.jconsole.JConsolePlugin;
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/AbsentInformationException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/AbsentInformationException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -31,16 +31,15 @@
* @author Gordon Hirsch
* @since 1.3
*/
-public class AbsentInformationException extends Exception
-{
+public class AbsentInformationException extends Exception {
+
private static final long serialVersionUID = 4988939309582416373L;
- public AbsentInformationException()
- {
+
+ public AbsentInformationException() {
super();
}
- public AbsentInformationException(String s)
- {
+ public AbsentInformationException(String s) {
super(s);
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ArrayType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ArrayType.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 @@
package com.sun.jdi;
-import java.util.List;
-
/**
* Provides access to the class of an array and the type of
* its components in the target VM.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Bootstrap.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Bootstrap.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 +25,9 @@
package com.sun.jdi;
+import com.sun.jdi.connect.Connector;
+import com.sun.tools.jdi.VirtualMachineManagerImpl;
+
/**
* Initial class that provides access to the default implementation
* of JDI interfaces. A debugger application uses this class to access the
@@ -40,9 +43,8 @@
* Returns the virtual machine manager.
*
* <p> May throw an unspecified error if initialization of the
- * {@link com.sun.jdi.VirtualMachineManager} fails or if
- * the virtual machine manager is unable to locate or create
- * any {@link com.sun.jdi.connect.Connector Connectors}.
+ * {@link VirtualMachineManager} fails or if the virtual machine manager
+ * is unable to locate or create any {@link Connector Connectors}.
*
* @throws java.lang.SecurityException if a security manager has been
* installed and it denies {@link JDIPermission}
@@ -50,6 +52,6 @@
* permissions required by the implementation.
*/
static public synchronized VirtualMachineManager virtualMachineManager() {
- return com.sun.tools.jdi.VirtualMachineManagerImpl.virtualMachineManager();
+ return VirtualMachineManagerImpl.virtualMachineManager();
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotLoadedException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotLoadedException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -67,9 +67,10 @@
* @author Gordon Hirsch
* @since 1.3
*/
-public class ClassNotLoadedException extends Exception
-{
+public class ClassNotLoadedException extends Exception {
+
private static final long serialVersionUID = -6242978768444298722L;
+
private String className;
public ClassNotLoadedException(String className) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotPreparedException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassNotPreparedException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -33,14 +33,14 @@
* @since 1.3
*/
public class ClassNotPreparedException extends RuntimeException {
+
private static final long serialVersionUID = -6120698967144079642L;
- public ClassNotPreparedException()
- {
+
+ public ClassNotPreparedException() {
super();
}
- public ClassNotPreparedException(String s)
- {
+ public ClassNotPreparedException(String s) {
super(s);
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ClassType.java Thu Aug 24 16:24:44 2017 +0200
@@ -42,6 +42,7 @@
* @since 1.3
*/
public interface ClassType extends ReferenceType {
+
/**
* Gets the superclass of this class.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/IncompatibleThreadStateException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/IncompatibleThreadStateException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -33,6 +33,7 @@
* @since 1.3
*/
public class IncompatibleThreadStateException extends Exception {
+
private static final long serialVersionUID = 6199174323414551389L;
public IncompatibleThreadStateException() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InconsistentDebugInfoException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InconsistentDebugInfoException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,7 +35,9 @@
* @since 1.3
*/
public class InconsistentDebugInfoException extends RuntimeException {
+
private static final long serialVersionUID = 7964236415376861808L;
+
public InconsistentDebugInfoException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InterfaceType.java Thu Aug 24 16:24:44 2017 +0200
@@ -44,6 +44,7 @@
* @since 1.3
*/
public interface InterfaceType extends ReferenceType {
+
/**
* Gets the interfaces directly extended by this interface.
* The returned list contains only those interfaces this
@@ -187,11 +188,12 @@
* @since 1.8
*/
default Value invokeMethod(ThreadReference thread, Method method,
- List<? extends Value> arguments, int options)
+ List<? extends Value> arguments, int options)
throws InvalidTypeException,
- ClassNotLoadedException,
- IncompatibleThreadStateException,
- InvocationException {
+ ClassNotLoadedException,
+ IncompatibleThreadStateException,
+ InvocationException
+ {
throw new UnsupportedOperationException();
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InternalException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InternalException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,18 +33,20 @@
* @since 1.3
*/
public class InternalException extends RuntimeException {
- private static final long serialVersionUID = -9171606393104480607L;
- private int errorCode;
+
+ private static final long serialVersionUID = -9171606393104480607L;
+
+ private int errorCode;
- public InternalException() {
- super();
- this.errorCode = 0;
- }
+ public InternalException() {
+ super();
+ this.errorCode = 0;
+ }
- public InternalException(String s) {
- super(s);
- this.errorCode = 0;
- }
+ public InternalException(String s) {
+ super(s);
+ this.errorCode = 0;
+ }
public InternalException(int errorCode) {
super();
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidCodeIndexException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidCodeIndexException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -36,7 +36,9 @@
*/
@Deprecated
public class InvalidCodeIndexException extends RuntimeException {
+
private static final long serialVersionUID = 7416010225133747805L;
+
public InvalidCodeIndexException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidLineNumberException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidLineNumberException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -36,7 +36,9 @@
*/
@Deprecated
public class InvalidLineNumberException extends RuntimeException {
+
private static final long serialVersionUID = 4048709912372692875L;
+
public InvalidLineNumberException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidModuleException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidModuleException.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -33,6 +33,7 @@
* @since 9
*/
public class InvalidModuleException extends RuntimeException {
+
private static final long serialVersionUID = 7907359387320658039L;
/**
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidStackFrameException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidStackFrameException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -33,7 +33,9 @@
* @since 1.3
*/
public class InvalidStackFrameException extends RuntimeException {
+
private static final long serialVersionUID = -1919378296505827922L;
+
public InvalidStackFrameException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidTypeException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvalidTypeException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -33,6 +33,7 @@
* @since 1.3
*/
public class InvalidTypeException extends Exception {
+
private static final long serialVersionUID = 2256667231949650806L;
public InvalidTypeException() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvocationException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/InvocationException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -33,7 +33,9 @@
* @since 1.3
*/
public class InvocationException extends Exception {
+
private static final long serialVersionUID = 6066780907971918568L;
+
ObjectReference exception;
public InvocationException(ObjectReference exception) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/JDIPermission.java Thu Aug 24 16:24:44 2017 +0200
@@ -70,7 +70,7 @@
* @author Tim Bell
* @since 1.5
*
- * @see com.sun.jdi.Bootstrap
+ * @see Bootstrap
* @see java.security.BasicPermission
* @see java.security.Permission
* @see java.security.Permissions
@@ -80,7 +80,9 @@
*/
public final class JDIPermission extends java.security.BasicPermission {
+
private static final long serialVersionUID = -6988461416938786271L;
+
/**
* The {@code JDIPermission} class represents access rights to the
* {@code VirtualMachineManager}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Locatable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Locatable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 +34,7 @@
* @since 1.3
*/
public interface Locatable {
+
/**
* Returns the {@link Location} of this mirror, if there is
* executable code associated with it. Note that both Java™
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Location.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,7 +25,9 @@
package com.sun.jdi;
-import java.util.List;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.ExceptionEvent;
+import com.sun.jdi.request.EventRequestManager;
/**
* A point within the executing code of the target VM.
@@ -75,10 +77,10 @@
* returned as the default. To determine the available strata
* use {@link ReferenceType#availableStrata()}.
*
- * @see com.sun.jdi.request.EventRequestManager
+ * @see EventRequestManager
* @see StackFrame
- * @see com.sun.jdi.event.BreakpointEvent
- * @see com.sun.jdi.event.ExceptionEvent
+ * @see BreakpointEvent
+ * @see ExceptionEvent
* @see Locatable
*
* @author Robert Field
@@ -128,7 +130,6 @@
*/
String sourceName() throws AbsentInformationException;
-
/**
* Gets an identifing name for the source corresponding to
* this location. Interpretation of this string is the
@@ -154,8 +155,7 @@
*
* @since 1.4
*/
- String sourceName(String stratum)
- throws AbsentInformationException;
+ String sourceName(String stratum) throws AbsentInformationException;
/**
* Gets the path to the source corresponding to this
@@ -173,7 +173,6 @@
*/
String sourcePath() throws AbsentInformationException;
-
/**
* Gets the path to the source corresponding to this
* location. Interpretation of this string is the
@@ -206,8 +205,7 @@
*
* @since 1.4
*/
- String sourcePath(String stratum)
- throws AbsentInformationException;
+ String sourcePath(String stratum) throws AbsentInformationException;
/**
* Gets the line number of this Location.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Mirror.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Mirror.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 +25,8 @@
package com.sun.jdi;
+import com.sun.jdi.request.BreakpointRequest;
+
/**
* A proxy used by a debugger to examine or manipulate some entity
* in another virtual machine. Mirror is the root of the
@@ -33,10 +35,9 @@
* (for example, {@link IntegerValue}), types (for example,
* {@link ReferenceType}), dynamic application state (for example,
* {@link StackFrame}), and even debugger-specific constructs (for example,
- * {@link com.sun.jdi.request.BreakpointRequest}).
- * The {@link VirtualMachine} itself is also
- * considered a mirror, representing the composite state of the
- * target VM.
+ * {@link BreakpointRequest}).
+ * The {@link VirtualMachine} itself is also considered a mirror,
+ * representing the composite state of the target VM.
* <P>
* There is no guarantee that a particular entity in the target VM will map
* to a single instance of Mirror. Implementors are free to decide
@@ -44,9 +45,9 @@
* of this interface should always use <code>equals</code> to compare
* two mirrors for equality.
* <p>
- * Any method on a {@link com.sun.jdi.Mirror} that takes a <code>Mirror</code> as an
+ * Any method on a {@link Mirror} that takes a <code>Mirror</code> as an
* parameter directly or indirectly (e.g., as a element in a <code>List</code>) will
- * throw {@link com.sun.jdi.VMMismatchException} if the mirrors are from different
+ * throw {@link VMMismatchException} if the mirrors are from different
* virtual machines.
*
* @see VirtualMachine
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ModuleReference.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ModuleReference.java Thu Aug 24 16:24:44 2017 +0200
@@ -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,24 +25,24 @@
package com.sun.jdi;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.VMDisconnectEvent;
/**
* A module in the target VM.
* <p>
- * Any method on {@code ModuleReference} which directly or
- * indirectly takes {@code ModuleReference} as a parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * Any method on {@code ModuleReference} which directly or indirectly takes
+ * {@code ModuleReference} as a parameter may throw {@link VMDisconnectedException}
+ * if the target VM is disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* <p>
- * Any method on {@code ModuleReference} which directly or
- * indirectly takes {@code ModuleReference} as a parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * Any method on {@code ModuleReference} which directly or indirectly takes
+ * {@code ModuleReference} as a parameter may throw {@link VMOutOfMemoryException}
+ * if the target VM has run out of memory.
* <p>
* Any method on {@code ModuleReference} or which directly or indirectly takes
- * {@code ModuleReference} as a parameter may throw
- * {@link com.sun.jdi.InvalidModuleException} if the mirrored module
- * has been unloaded.
+ * {@code ModuleReference} as a parameter may throw {@link InvalidModuleException}
+ * if the mirrored module has been unloaded.
*
* Not all target virtual machines support this class.
* Use {@link VirtualMachine#canGetModuleInfo()}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/NativeMethodException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/NativeMethodException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,6 +35,7 @@
public class NativeMethodException extends RuntimeException {
private static final long serialVersionUID = 3924951669039469992L;
+
public NativeMethodException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectCollectedException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectCollectedException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -33,7 +33,9 @@
* @since 1.3
*/
public class ObjectCollectedException extends RuntimeException {
+
private static final long serialVersionUID = -1928428056197269588L;
+
public ObjectCollectedException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java Thu Aug 24 16:24:44 2017 +0200
@@ -28,26 +28,29 @@
import java.util.List;
import java.util.Map;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.VMDisconnectEvent;
+
/**
* An object that currently exists in the target VM. An ObjectReference
* mirrors only the object itself and is not specific to any
* {@link Field} or {@link LocalVariable} to which it is currently
- * assigned. An ObjectReference can
- * have 0 or more references from field(s) and/or variable(s).
+ * assigned. An ObjectReference can have 0 or more references from
+ * field(s) and/or variable(s).
* <p>
- * Any method on <code>ObjectReference</code> which directly or
- * indirectly takes <code>ObjectReference</code> as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * Any method on <code>ObjectReference</code> which directly or indirectly
+ * takes <code>ObjectReference</code> as a parameter may throw
+ * {@link VMDisconnectedException} if the target VM is disconnected and the
+ * {@link VMDisconnectEvent} has been or is available to be read from the
+ * {@link EventQueue}.
* <p>
- * Any method on <code>ObjectReference</code> which directly or
- * indirectly takes <code>ObjectReference</code> as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * Any method on <code>ObjectReference</code> which directly or indirectly
+ * takes <code>ObjectReference</code> as a parameter may throw
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
* <p>
- * Any method on <code>ObjectReference</code> or which directly or indirectly takes
- * <code>ObjectReference</code> as parameter may throw
- * {@link com.sun.jdi.ObjectCollectedException} if the mirrored object has been
+ * Any method on <code>ObjectReference</code> or which directly or indirectly
+ * takes <code>ObjectReference</code> as parameter may throw
+ * {@link ObjectCollectedException} if the mirrored object has been
* garbage collected.
*
* @author Robert Field
@@ -422,7 +425,6 @@
*/
List<ObjectReference> referringObjects(long maxReferrers);
-
/**
* Compares the specified Object with this ObjectReference for equality.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/PathSearchingVirtualMachine.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/PathSearchingVirtualMachine.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,6 +34,7 @@
* @since 1.3
*/
public interface PathSearchingVirtualMachine extends VirtualMachine {
+
/**
* Get the class path for this virtual machine.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ReferenceType.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ReferenceType.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 +28,9 @@
import java.util.List;
import java.util.Map;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.VMDisconnectEvent;
+
/**
* The type of an object in a target VM. ReferenceType encompasses
* classes, interfaces, and array types as defined in
@@ -55,17 +58,17 @@
* <p>
* Any method on <code>ReferenceType</code> which directly or
* indirectly takes <code>ReferenceType</code> as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* <p>
* Any method on <code>ReferenceType</code> which directly or
* indirectly takes <code>ReferenceType</code> as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
* <p>
* Any method on <code>ReferenceType</code> or which directly or indirectly takes
* <code>ReferenceType</code> as parameter may throw
- * {@link com.sun.jdi.ObjectCollectedException} if the mirrored type has been unloaded.
+ * {@link ObjectCollectedException} if the mirrored type has been unloaded.
*
* @see ObjectReference
* @see ObjectReference#referenceType
@@ -80,7 +83,6 @@
public interface ReferenceType
extends Type, Comparable<ReferenceType>, Accessible
{
-
/**
* Gets the fully qualified name of this type. The returned name
* is formatted as it might appear in a Java programming langauge
@@ -615,7 +617,7 @@
* @since 1.4
*/
List<Location> allLineLocations(String stratum, String sourceName)
- throws AbsentInformationException;
+ throws AbsentInformationException;
/**
* Returns a List containing all {@link Location} objects
@@ -685,7 +687,7 @@
List<Location> locationsOfLine(String stratum,
String sourceName,
int lineNumber)
- throws AbsentInformationException;
+ throws AbsentInformationException;
/**
* Return the available strata for this reference type.
@@ -777,7 +779,6 @@
*/
int majorVersion();
-
/**
* Returns the class minor version number, as defined in the class file format
* of the Java Virtual Machine Specification.
@@ -850,5 +851,4 @@
* @since 1.6
*/
byte[] constantPool();
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/StackFrame.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/StackFrame.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 +28,9 @@
import java.util.List;
import java.util.Map;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.VMDisconnectEvent;
+
/**
* The state of one method invocation on a thread's call stack.
* As a thread executes, stack frames are pushed and popped from
@@ -45,13 +48,13 @@
* <p>
* Any method on <code>StackFrame</code> which
* takes <code>StackFrame</code> as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* <p>
* Any method on <code>StackFrame</code> which
* takes <code>StackFrame</code> as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
* @author Robert Field
* @author Gordon Hirsch
@@ -235,5 +238,4 @@
* @since 1.6
*/
List<Value> getArgumentValues();
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/StringReference.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/StringReference.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -36,6 +36,7 @@
* @since 1.3
*/
public interface StringReference extends ObjectReference {
+
/**
* Returns the StringReference as a String. The returned string
* is the equivalent of the mirrored string, but is an entity in the
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,8 +24,11 @@
*/
package com.sun.jdi;
+
import java.util.List;
+import com.sun.jdi.event.EventSet;
+
/**
* A thread object from the target VM.
* A ThreadReference is an {@link ObjectReference} with additional
@@ -37,6 +40,7 @@
* @since 1.3
*/
public interface ThreadReference extends ObjectReference {
+
/** Thread status is unknown */
public final int THREAD_STATUS_UNKNOWN =-1;
/** Thread has completed execution */
@@ -82,6 +86,7 @@
* through {@link java.lang.Thread#resume}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
+ @SuppressWarnings("javadoc")
void suspend();
/**
@@ -92,7 +97,7 @@
* suspends on this thread is decremented. If it is decremented to 0,
* the thread will continue to execute.
* Note: the normal way to resume from an event related suspension is
- * via {@link com.sun.jdi.event.EventSet#resume}.
+ * via {@link EventSet#resume}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void resume();
@@ -115,6 +120,7 @@
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
* @see java.lang.Thread#stop(Throwable)
*/
+ @SuppressWarnings("javadoc")
void stop(ObjectReference throwable) throws InvalidTypeException;
/**
@@ -390,7 +396,6 @@
* @since 1.4 */
void popFrames(StackFrame frame) throws IncompatibleThreadStateException;
-
/**
* Force a method to return before it reaches a return
* statement.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMCannotBeModifiedException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMCannotBeModifiedException.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -33,7 +33,9 @@
* @since 1.5
*/
public class VMCannotBeModifiedException extends UnsupportedOperationException {
+
private static final long serialVersionUID = -4063879815130164009L;
+
public VMCannotBeModifiedException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMDisconnectedException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMDisconnectedException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -36,9 +36,11 @@
public class VMDisconnectedException extends RuntimeException {
private static final long serialVersionUID = 2892975269768351637L;
+
public VMDisconnectedException() {
super();
}
+
public VMDisconnectedException(String message) {
super(message);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMMismatchException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMMismatchException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,7 +34,9 @@
* @since 1.3
*/
public class VMMismatchException extends RuntimeException {
+
private static final long serialVersionUID = 289169358790459564L;
+
public VMMismatchException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMOutOfMemoryException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VMOutOfMemoryException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,7 +33,9 @@
* @since 1.3
*/
public class VMOutOfMemoryException extends RuntimeException {
+
private static final long serialVersionUID = 71504228548910686L;
+
public VMOutOfMemoryException() {
super();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/Value.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,6 +25,8 @@
package com.sun.jdi;
+import com.sun.jdi.event.ModificationWatchpointEvent;
+
/**
* The mirror for a value in the target VM.
* This interface is the root of a
@@ -33,11 +35,11 @@
* Some examples of where values may be accessed:
* <BLOCKQUOTE><TABLE><CAPTION style="display:none">layout</CAPTION>
* <TR>
- * <TD>{@link ObjectReference#getValue(com.sun.jdi.Field)
+ * <TD>{@link ObjectReference#getValue(Field)
* ObjectReference.getValue(Field)}
* <TD>- value of a field
* <TR>
- * <TD>{@link StackFrame#getValue(com.sun.jdi.LocalVariable)
+ * <TD>{@link StackFrame#getValue(LocalVariable)
* StackFrame.getValue(LocalVariable)}
* <TD>- value of a variable
* <TR>
@@ -45,7 +47,7 @@
* VirtualMachine.mirrorOf(double)}
* <TD>- created in the target VM by the JDI client
* <TR>
- * <TD>{@link com.sun.jdi.event.ModificationWatchpointEvent#valueToBe()
+ * <TD>{@link ModificationWatchpointEvent#valueToBe()
* ModificationWatchpointEvent.valueToBe()}
* <TD>- returned with an event
* </TABLE></BLOCKQUOTE>
@@ -170,6 +172,7 @@
*/
public interface Value extends Mirror {
+
/**
* Returns the run-time type of this value.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,13 +25,26 @@
package com.sun.jdi;
-import com.sun.jdi.event.EventQueue;
-import com.sun.jdi.ModuleReference;
-import com.sun.jdi.request.EventRequestManager;
-
import java.util.List;
import java.util.Map;
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.LaunchingConnector;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.MethodExitEvent;
+import com.sun.jdi.event.VMDisconnectEvent;
+import com.sun.jdi.event.VMStartEvent;
+import com.sun.jdi.request.BreakpointRequest;
+import com.sun.jdi.request.ClassPrepareRequest;
+import com.sun.jdi.request.EventRequestManager;
+import com.sun.jdi.request.MonitorContendedEnterRequest;
+import com.sun.jdi.request.MonitorContendedEnteredRequest;
+import com.sun.jdi.request.MonitorWaitRequest;
+import com.sun.jdi.request.MonitorWaitedRequest;
+import com.sun.jdi.request.VMDeathRequest;
+
/**
* A virtual machine targeted for debugging.
* More precisely, a {@link Mirror mirror} representing the
@@ -44,27 +57,27 @@
* are supported directly by this interface.
* <P>
* Instances of this interface are created by instances of
- * {@link com.sun.jdi.connect.Connector}. For example,
- * an {@link com.sun.jdi.connect.AttachingConnector AttachingConnector}
+ * {@link Connector}. For example,
+ * an {@link AttachingConnector AttachingConnector}
* attaches to a target VM and returns its virtual machine mirror.
* A Connector will typically create a VirtualMachine by invoking
* the VirtualMachineManager's {@link
- * com.sun.jdi.VirtualMachineManager#createVirtualMachine(Connection)}
+ * VirtualMachineManager#createVirtualMachine(Connection)}
* createVirtualMachine(Connection) method.
* <p>
* Note that a target VM launched by a launching connector is not
- * guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
+ * guaranteed to be stable until after the {@link VMStartEvent} has been
* received.
* <p>
* Any method on <code>VirtualMachine</code> which
* takes <code>VirtualMachine</code> as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* <p>
* Any method on <code>VirtualMachine</code> which
* takes <code>VirtualMachine</code> as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
* @author Robert Field
* @author Gordon Hirsch
@@ -431,12 +444,10 @@
/**
* Returns the {@link java.lang.Process} object for this
- * virtual machine if launched
- * by a {@link com.sun.jdi.connect.LaunchingConnector}
+ * virtual machine if launched by a {@link LaunchingConnector}
*
* @return the {@link java.lang.Process} object for this virtual
- * machine, or null if it was not launched by a
- * {@link com.sun.jdi.connect.LaunchingConnector}.
+ * machine, or null if it was not launched by a {@link LaunchingConnector}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
@@ -552,7 +563,7 @@
/**
* Determines if the target VM supports filtering
* events by specific instance object. For example,
- * see {@link com.sun.jdi.request.BreakpointRequest#addInstanceFilter}.
+ * see {@link BreakpointRequest#addInstanceFilter}.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
@@ -621,8 +632,8 @@
/**
* Determines if the target VM supports the creation of
- * {@link com.sun.jdi.request.VMDeathRequest}s.
- * @see com.sun.jdi.request.EventRequestManager#createVMDeathRequest
+ * {@link VMDeathRequest}s.
+ * @see EventRequestManager#createVMDeathRequest
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
@@ -634,8 +645,8 @@
/**
* Determines if the target VM supports the inclusion of return values
* in
- * {@link com.sun.jdi.event.MethodExitEvent}s.
- * @see com.sun.jdi.request.EventRequestManager#createMethodExitRequest
+ * {@link MethodExitEvent}s.
+ * @see EventRequestManager#createMethodExitRequest
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
@@ -659,12 +670,11 @@
*/
boolean canGetInstanceInfo();
-
/**
* Determines if the target VM supports the filtering of
* class prepare events by source name.
*
- * see {@link com.sun.jdi.request.ClassPrepareRequest#addSourceNameFilter}.
+ * see {@link ClassPrepareRequest#addSourceNameFilter}.
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
@@ -700,14 +710,14 @@
/**
* Determines if the target VM supports the creation of
- * {@link com.sun.jdi.request.MonitorContendedEnterRequest}s.
- * {@link com.sun.jdi.request.MonitorContendedEnteredRequest}s.
- * {@link com.sun.jdi.request.MonitorWaitRequest}s.
- * {@link com.sun.jdi.request.MonitorWaitedRequest}s.
- * @see com.sun.jdi.request.EventRequestManager#createMonitorContendedEnterRequest
- * @see com.sun.jdi.request.EventRequestManager#createMonitorContendedEnteredRequest
- * @see com.sun.jdi.request.EventRequestManager#createMonitorWaitRequest
- * @see com.sun.jdi.request.EventRequestManager#createMonitorWaitedRequest
+ * {@link MonitorContendedEnterRequest}s.
+ * {@link MonitorContendedEnteredRequest}s.
+ * {@link MonitorWaitRequest}s.
+ * {@link MonitorWaitedRequest}s.
+ * @see EventRequestManager#createMonitorContendedEnterRequest
+ * @see EventRequestManager#createMonitorContendedEnteredRequest
+ * @see EventRequestManager#createMonitorWaitRequest
+ * @see EventRequestManager#createMonitorWaitedRequest
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
@@ -720,7 +730,7 @@
/**
* Determines if the target VM supports getting which
* frame has acquired a monitor.
- * @see com.sun.jdi.ThreadReference#ownedMonitorsAndFrames
+ * @see ThreadReference#ownedMonitorsAndFrames
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachineManager.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,10 +25,18 @@
package com.sun.jdi;
-import com.sun.jdi.connect.*;
+import java.io.IOException;
+import java.util.List;
+
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.LaunchingConnector;
+import com.sun.jdi.connect.ListeningConnector;
+import com.sun.jdi.connect.Transport;
import com.sun.jdi.connect.spi.Connection;
-import java.util.List;
-import java.io.IOException;
+import com.sun.jdi.connect.spi.TransportService;
+import com.sun.jdi.event.VMDisconnectEvent;
+import com.sun.jdi.event.VMStartEvent;
/**
* A manager of connections to target virtual machines. The
@@ -41,14 +49,14 @@
* mirror for available target VMs.
* <p>
* Connections can be made using one of several different
- * {@link com.sun.jdi.connect.Connector} objects. Each connector encapsulates
+ * {@link Connector} objects. Each connector encapsulates
* a different way of connecting the debugger with a target VM.
* <p>
* The VirtualMachineManager supports many different scenarios for
* connecting a debugger to a virtual machine. Four examples
* are presented in the table below. The
* examples use the command line syntax in Sun's implementation.
- * Some {@link com.sun.jdi.connect.Connector} implementations may require slightly
+ * Some {@link Connector} implementations may require slightly
* different handling than presented below.
*
* <TABLE BORDER="1" style="width:75%">
@@ -59,8 +67,7 @@
* <TR>
* <TD>Debugger launches target VM (simplest, most-common scenario)</TD>
*
- * <TD>Debugger calls the
- * {@link com.sun.jdi.connect.LaunchingConnector#launch(java.util.Map)}
+ * <TD>Debugger calls the {@link LaunchingConnector#launch(java.util.Map)}
* method of the default connector, obtained with {@link #defaultConnector}. The
* target VM is launched, and a connection between that VM and the
* debugger is established. A {@link VirtualMachine} mirror is returned.
@@ -71,8 +78,7 @@
* {@link #launchingConnectors} with desired characteristics
* (for example, transport type, etc.).
* <LI>
- * Debugger calls the
- * {@link com.sun.jdi.connect.LaunchingConnector#launch(java.util.Map)}
+ * Debugger calls the {@link LaunchingConnector#launch(java.util.Map)}
* method of the selected connector. The
* target VM is launched, and a connection between that VM and the
* debugger is established. A {@link VirtualMachine} mirror is returned.
@@ -96,11 +102,10 @@
* the name "xxx".
* <LI>
* Debugger presents the default connector parameters (obtained through
- * {@link com.sun.jdi.connect.Connector#defaultArguments()}) to the end user,
- * allowing the user to
+ * {@link Connector#defaultArguments()}) to the end user, allowing the user to
* fill in the transport-specific address generated by the target VM.
* <LI>
- * Debugger calls the {@link com.sun.jdi.connect.AttachingConnector#attach(java.util.Map)} method
+ * Debugger calls the {@link AttachingConnector#attach(java.util.Map)} method
* of the selected to attach to the target VM. A {@link VirtualMachine}
* mirror is returned.
* </UL>
@@ -116,13 +121,13 @@
* the list returned by {@link #listeningConnectors} for one or more
* transports.</LI>
* <LI>
- * Debugger calls the {@link com.sun.jdi.connect.ListeningConnector#startListening(java.util.Map)} method for each selected
+ * Debugger calls the {@link ListeningConnector#startListening(java.util.Map)} method for each selected
* connector. For each call, a transport-specific address string is
* generated and returned. The debugger makes the transport names and
* corresponding address strings available to the end user.
* <LI>
* Debugger calls
- * {@link com.sun.jdi.connect.ListeningConnector#accept(java.util.Map)}
+ * {@link ListeningConnector#accept(java.util.Map)}
* for each selected connector to wait for
* a target VM to connect.</LI>
* <LI>
@@ -131,10 +136,10 @@
* where "xxx" the transport for one of the connectors selected by the
* the debugger and "yyy"
* is the address generated by
- * {@link com.sun.jdi.connect.ListeningConnector#accept(java.util.Map)} for that
+ * {@link ListeningConnector#accept(java.util.Map)} for that
* transport.</LI>
* <LI>
- * Debugger's call to {@link com.sun.jdi.connect.ListeningConnector#accept(java.util.Map)} returns
+ * Debugger's call to {@link ListeningConnector#accept(java.util.Map)} returns
* a {@link VirtualMachine} mirror.</LI>
* </UL>
* </TD>
@@ -166,12 +171,12 @@
* the name "xxx".
* <LI>
* Debugger changes the default connector parameters (obtained through
- * {@link com.sun.jdi.connect.Connector#defaultArguments()}) to specify
+ * {@link Connector#defaultArguments()}) to specify
* the transport specific address at which the VM is listenig. Optionally,
* other connector arguments can be presented to the user.
* <LI>
* Debugger calls the
- * {@link com.sun.jdi.connect.AttachingConnector#attach(java.util.Map)} method
+ * {@link AttachingConnector#attach(java.util.Map)} method
* of the selected to attach to the target VM. A {@link VirtualMachine}
* mirror is returned.
* </UL>
@@ -181,7 +186,7 @@
*
* <p> Connectors are created at start-up time. That is, they
* are created the first time that {@link
- * com.sun.jdi.Bootstrap#virtualMachineManager()} is invoked.
+ * Bootstrap#virtualMachineManager()} is invoked.
* The list of all Connectors created at start-up time can be
* obtained from the VirtualMachineManager by invoking the
* {@link #allConnectors allConnectors} method.
@@ -189,23 +194,23 @@
* <p> Connectors are created at start-up time if they are
* installed on the platform. In addition, Connectors are created
* automatically by the VirtualMachineManager to encapsulate any
- * {@link com.sun.jdi.connect.spi.TransportService} implementations
+ * {@link TransportService} implementations
* that are installed on the platform. These two mechanisms for
* creating Connectors are described here.
*
* <p> A Connector is installed on the platform if it is installed
* in a jar file that is visible to the defining class loader of
- * the {@link com.sun.jdi.connect.Connector} type,
+ * the {@link Connector} type,
* and that jar file contains a provider configuration file named
- * {@code com.sun.jdi.connect.Connector} in the resource directory
+ * {@code Connector} in the resource directory
* {@code META-INF/services}, and the provider configuration file
* lists the full-qualified class name of the Connector
* implementation. A Connector is a class that implements the
- * {@link com.sun.jdi.connect.Connector Connector} interface. More
+ * {@link Connector Connector} interface. More
* appropriately the class implements one of the specific Connector
- * types, namely {@link com.sun.jdi.connect.AttachingConnector
- * AttachingConnector}, {@link com.sun.jdi.connect.ListeningConnector
- * ListeningConnector}, or {@link com.sun.jdi.connect.LaunchingConnector
+ * types, namely {@link AttachingConnector
+ * AttachingConnector}, {@link ListeningConnector
+ * ListeningConnector}, or {@link LaunchingConnector
* LaunchingConnector}. The format of the provider configuration file
* is one fully-qualified class name per line. Space and tab characters
* surrounding each class, as well as blank lines are ignored. The
@@ -221,40 +226,37 @@
*
* <p> In addition to Connectors installed on the platform the
* VirtualMachineManager will also create Connectors to encapsulate
- * any {@link com.sun.jdi.connect.spi.TransportService} implementations
+ * any {@link TransportService} implementations
* that are installed on the platform. A TransportService is
* installed on the platform if it installed in a jar file that is
* visible to the defining class loader for the
- * {@link com.sun.jdi.connect.spi.TransportService} type, and that jar
+ * {@link TransportService} type, and that jar
* file contains a provider configuration file named
- * {@code com.sun.jdi.connect.spi.TransportService} in the resource
+ * {@code TransportService} in the resource
* directory {@code META-INF/services}, and the provider
* configuration file lists the full-qualified class name of the
* TransportService implementation. A TransportService is a concrete
- * sub-class of {@link com.sun.jdi.connect.spi.TransportService
+ * sub-class of {@link TransportService
* TransportService}. The format of the provider configuration file
* is the same as the provider configuration file for Connectors
* except that each class listed must be the fully-qualified class
* name of a class that implements the TransportService interface.
*
* <p> For each TransportService installed on the platform, the
- * VirtualMachineManager creates a corresponding
- * {@link com.sun.jdi.connect.AttachingConnector} and
- * {@link com.sun.jdi.connect.ListeningConnector}. These
- * Connectors are created to encapsulate a {@link
- * com.sun.jdi.connect.Transport Transport} that in turn
- * encapsulates the TransportService.
+ * VirtualMachineManager creates a corresponding {@link AttachingConnector} and
+ * {@link ListeningConnector}. These Connectors are created to encapsulate a
+ * {@link Transport Transport} that in turn encapsulates the TransportService.
* The AttachingConnector will be named based on the name of the
* transport service concatenated with the string {@code Attach}.
* For example, if the transport service {@link
- * com.sun.jdi.connect.spi.TransportService#name() name()} method
+ * TransportService#name() name()} method
* returns {@code telepathic} then the AttachingConnector will
* be named {@code telepathicAttach}. Similiarly the ListeningConnector
* will be named with the string {@code Listen} tagged onto the
* name of the transport service. The {@link
- * com.sun.jdi.connect.Connector#description() description()} method
+ * Connector#description() description()} method
* of both the AttachingConnector, and the ListeningConnector, will
- * delegate to the {@link com.sun.jdi.connect.spi.TransportService#description()
+ * delegate to the {@link TransportService#description()
* description()} method of the underlying transport service. Both
* the AttachingConnector and the ListeningConnector will have two
* Connector {@link com.sun.jdi.connect.Connector.Argument Arguments}.
@@ -268,7 +270,7 @@
* timeout or accept timeout.
*
* <p> Initialization of the virtual machine manager will fail, that is
- * {@link com.sun.jdi.Bootstrap#virtualMachineManager()} will throw an
+ * {@link Bootstrap#virtualMachineManager()} will throw an
* error if the virtual machine manager is unable to create any
* connectors.
*
@@ -282,45 +284,44 @@
* be used as the launching connector when selection of a
* connector with specific characteristics is unnecessary.
*
- * @return the default {@link com.sun.jdi.connect.LaunchingConnector}
+ * @return the default {@link LaunchingConnector}
*/
LaunchingConnector defaultConnector();
/**
- * Returns the list of known {@link com.sun.jdi.connect.LaunchingConnector} objects.
+ * Returns the list of known {@link LaunchingConnector} objects.
* Any of the returned objects can be used to launch a new target
* VM and immediately create a {@link VirtualMachine} mirror for it.
*
- * Note that a target VM launched by a launching connector is not
- * guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
- * received.
- * @return a list of {@link com.sun.jdi.connect.LaunchingConnector} objects.
+ * Note that a target VM launched by a launching connector is not guaranteed
+ * to be stable until after the {@link VMStartEvent} has been received.
+ * @return a list of {@link LaunchingConnector} objects.
*/
List<LaunchingConnector> launchingConnectors();
/**
- * Returns the list of known {@link com.sun.jdi.connect.AttachingConnector} objects.
+ * Returns the list of known {@link AttachingConnector} objects.
* Any of the returned objects can be used to attach to an existing target
* VM and create a {@link VirtualMachine} mirror for it.
*
- * @return a list of {@link com.sun.jdi.connect.AttachingConnector} objects.
+ * @return a list of {@link AttachingConnector} objects.
*/
List<AttachingConnector> attachingConnectors();
/**
- * Returns the list of known {@link com.sun.jdi.connect.ListeningConnector} objects.
+ * Returns the list of known {@link ListeningConnector} objects.
* Any of the returned objects can be used to listen for a
* connection initiated by a target VM
* and create a {@link VirtualMachine} mirror for it.
*
- * @return a list of {@link com.sun.jdi.connect.ListeningConnector} objects.
+ * @return a list of {@link ListeningConnector} objects.
*/
List<ListeningConnector> listeningConnectors();
/**
- * Returns the list of all known {@link com.sun.jdi.connect.Connector} objects.
+ * Returns the list of all known {@link Connector} objects.
*
- * @return a list of {@link com.sun.jdi.connect.Connector} objects.
+ * @return a list of {@link Connector} objects.
*/
List<Connector> allConnectors();
@@ -332,7 +333,7 @@
* target VMs to which this manager has initiated a connection.
* A target VM will remain in this list
* until the VM is disconnected.
- * {@link com.sun.jdi.event.VMDisconnectEvent} is placed in the event queue
+ * {@link VMDisconnectEvent} is placed in the event queue
* after the VM is removed from the list.
*
* @return a list of {@link VirtualMachine} objects, each mirroring
@@ -364,9 +365,9 @@
* Create a virtual machine mirror for a target VM.
*
* <p> Creates a virtual machine mirror for a target VM
- * for which a {@link com.sun.jdi.connect.spi.Connection Connection}
+ * for which a {@link Connection Connection}
* already exists. A Connection is created when a {@link
- * com.sun.jdi.connect.Connector Connector} establishes
+ * Connector Connector} establishes
* a connection and successfully handshakes with a target VM.
* A Connector can then use this method to create a virtual machine
* mirror to represent the composite state of the target VM.
@@ -374,9 +375,9 @@
* <p> The {@code process} argument specifies the
* {@link java.lang.Process} object for the taget VM. It may be
* specified as {@code null}. If the target VM is launched
- * by a {@link com.sun.jdi.connect.LaunchingConnector
+ * by a {@link LaunchingConnector
* LaunchingConnector} the {@code process} argument should be
- * specified, otherwise calling {@link com.sun.jdi.VirtualMachine#process()}
+ * specified, otherwise calling {@link VirtualMachine#process()}
* on the created virtual machine will return {@code null}.
*
* <p> This method exists so that Connectors may create
@@ -400,8 +401,8 @@
* @throws IllegalStateException
* if the connection is not open
*
- * @see com.sun.jdi.connect.spi.Connection#isOpen()
- * @see com.sun.jdi.VirtualMachine#process()
+ * @see Connection#isOpen()
+ * @see VirtualMachine#process()
*
* @since 1.5
*/
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/AttachingConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,10 @@
package com.sun.jdi.connect;
-import com.sun.jdi.VirtualMachine;
+import java.io.IOException;
import java.util.Map;
-import java.io.IOException;
+
+import com.sun.jdi.VirtualMachine;
/**
* A connector which attaches to a previously running target VM.
@@ -36,6 +37,7 @@
* @since 1.3
*/
public interface AttachingConnector extends Connector {
+
/**
* Attaches to a running application and returns a
* mirror of its VM.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Connector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Connector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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 @@
package com.sun.jdi.connect;
-import java.util.Map;
+import java.io.Serializable;
import java.util.List;
-import java.io.Serializable;
+import java.util.Map;
/**
* A method of connection between a debugger and a target VM.
@@ -46,6 +46,7 @@
* @since 1.3
*/
public interface Connector {
+
/**
* Returns a short identifier for the connector. Connector implementors
* should follow similar naming conventions as are used with packages
@@ -82,7 +83,7 @@
* @return the map associating argument names with argument
* information and default value.
*/
- Map<String,Connector.Argument> defaultArguments();
+ Map<String, Connector.Argument> defaultArguments();
/**
* Specification for and value of a Connector argument.
@@ -92,6 +93,7 @@
* or {@link Connector.SelectedArgument}.
*/
public interface Argument extends Serializable {
+
/**
* Returns a short, unique identifier for the argument.
* Not intended for exposure to end-user.
@@ -157,6 +159,7 @@
* by the localized versions of the strings "true" and "false".
*/
public interface BooleanArgument extends Argument {
+
/**
* Sets the value of the argument.
*/
@@ -197,6 +200,7 @@
* by their corresponding strings.
*/
public interface IntegerArgument extends Argument {
+
/**
* Sets the value of the argument.
* The value should be checked with {@link #isValid(int)}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/IllegalConnectorArgumentsException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 +39,7 @@
public class IllegalConnectorArgumentsException extends Exception {
private static final long serialVersionUID = -3042212603611350941L;
+
List<String> names;
/**
@@ -48,8 +49,7 @@
* @param s the detailed message.
* @param name the name of the invalid or inconsistent argument.
*/
- public IllegalConnectorArgumentsException(String s,
- String name) {
+ public IllegalConnectorArgumentsException(String s, String name) {
super(s);
names = new ArrayList<String>(1);
names.add(name);
@@ -65,7 +65,6 @@
*/
public IllegalConnectorArgumentsException(String s, List<String> names) {
super(s);
-
this.names = new ArrayList<String>(names);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/LaunchingConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/LaunchingConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 @@
package com.sun.jdi.connect;
-import com.sun.jdi.VirtualMachine;
+import java.io.IOException;
import java.util.Map;
-import java.io.IOException;
+
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.VMStartEvent;
/**
* A connector which can launch a target VM before connecting to it.
@@ -36,6 +38,7 @@
* @since 1.3
*/
public interface LaunchingConnector extends Connector {
+
/**
* Launches an application and connects to its VM. Properties
* of the launch (possibly including options,
@@ -47,14 +50,14 @@
* Argument map values can be changed, but map entries should not be
* added or deleted.
* <p>A target VM launched by a launching connector is not
- * guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
+ * guaranteed to be stable until after the {@link VMStartEvent} has been
* received.
* <p>
* <b>Important note:</b> If a target VM is launched through this
* funcctions, its output and error streams must be read as it
* executes. These streams are available through the
* {@link java.lang.Process Process} object returned by
- * {@link com.sun.jdi.VirtualMachine#process}. If the streams are not periodically
+ * {@link VirtualMachine#process}. If the streams are not periodically
* read, the target VM will stop executing when the buffers for these
* streams are filled.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/ListeningConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,9 @@
package com.sun.jdi.connect;
+import java.io.IOException;
import java.util.Map;
-import java.io.IOException;
+
import com.sun.jdi.VirtualMachine;
/**
@@ -36,6 +37,7 @@
* @since 1.3
*/
public interface ListeningConnector extends Connector {
+
/**
* Indicates whether this listening connector supports multiple
* connections for a single argument map. If so, a call to
@@ -96,7 +98,6 @@
void stopListening(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException;
-
/**
* Waits for a target VM to attach to this connector.
*
@@ -113,5 +114,4 @@
*/
VirtualMachine accept(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException;
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Transport.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Transport.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,24 +25,24 @@
package com.sun.jdi.connect;
-import com.sun.jdi.connect.spi.TransportService; // for javadoc
+import com.sun.jdi.connect.spi.TransportService;
/**
* A method of communication between a debugger and a target VM.
*
* <p> A Transport represents the transport mechanism used by a
- * {@link com.sun.jdi.connect.Connector Connector} to establish a
- * connection with a target VM. It consists of a name which is obtained
- * by invoking the {@link #name} method. Furthermore, a Transport
- * encapsulates a {@link com.sun.jdi.connect.spi.TransportService
- * TransportService} which is the underlying service used
- * to establish connections and exchange Java Debug Wire Protocol
- * (JDWP) packets with a target VM.
+ * {@link Connector Connector} to establish a connection with a
+ * target VM. It consists of a name which is obtained by invoking
+ * the {@link #name} method. Furthermore, a Transport encapsulates a
+ * {@link TransportService TransportService} which is the underlying
+ * service used to establish connections and exchange
+ * Java Debug Wire Protocol (JDWP) packets with a target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
public interface Transport {
+
/**
* Returns a short identifier for the transport.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/TransportTimeoutException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/TransportTimeoutException.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -25,6 +25,8 @@
package com.sun.jdi.connect;
+import com.sun.jdi.connect.spi.TransportService;
+
/**
* This exception may be thrown as a result of a timeout
* when attaching to a target VM, or waiting to accept a
@@ -39,23 +41,23 @@
* exception may be thrown if the connector supports a
* timeout connector argument when accepting.
*
- * <p> In addition, for developers creating {@link
- * com.sun.jdi.connect.spi.TransportService TransportService}
- * implementations this exception is thrown when
- * {@link com.sun.jdi.connect.spi.TransportService#attach attach}
- * times out when establishing a connection to a target VM,
- * or {@link com.sun.jdi.connect.spi.TransportService#accept
- * accept} times out while waiting for a target VM to connect. </p>
+ * <p> In addition, for developers creating {@link TransportService
+ * TransportService} implementations this exception is thrown when
+ * {@link TransportService#attach attach} times out when establishing a
+ * connection to a target VM, or {@link TransportService#accept accept}
+ * times out while waiting for a target VM to connect. </p>
*
* @see AttachingConnector#attach
* @see ListeningConnector#accept
- * @see com.sun.jdi.connect.spi.TransportService#attach
- * @see com.sun.jdi.connect.spi.TransportService#accept
+ * @see TransportService#attach
+ * @see TransportService#accept
*
* @since 1.5
*/
public class TransportTimeoutException extends java.io.IOException {
+
private static final long serialVersionUID = 4107035242623365074L;
+
/**
* Constructs a {@code TransportTimeoutException} with no detail
* message.
@@ -63,7 +65,6 @@
public TransportTimeoutException() {
}
-
/**
* Constructs a {@code TransportTimeoutException} with the
* specified detail message.
@@ -73,5 +74,4 @@
public TransportTimeoutException(String message) {
super(message);
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/VMStartException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/VMStartException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -37,6 +37,7 @@
public class VMStartException extends Exception {
private static final long serialVersionUID = 6408644824640801020L;
+
Process process;
public VMStartException(Process process) {
@@ -44,8 +45,7 @@
this.process = process;
}
- public VMStartException(String message,
- Process process) {
+ public VMStartException(String message, Process process) {
super(message);
this.process = process;
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/ClosedConnectionException.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -46,7 +46,9 @@
* @since 1.5
*/
public class ClosedConnectionException extends java.io.IOException {
+
private static final long serialVersionUID = 3877032124297204774L;
+
/**
* Constructs a {@code ClosedConnectionException} with no detail
* message.
@@ -63,5 +65,4 @@
public ClosedConnectionException(String message) {
super(message);
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/Connection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/Connection.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -32,14 +32,13 @@
*
* <p> A Connection represents a bi-directional communication channel
* between a debugger and a target VM. A Connection is created when
- * {@link com.sun.jdi.connect.spi.TransportService TransportService}
- * establishes a connection and successfully handshakes with a target
- * VM. A TransportService implementation provides a reliable
- * JDWP packet transportation service and consequently a Connection
- * provides a reliable flow of JDWP packets between the debugger
- * and the target VM. A Connection is stream oriented, that is, the
- * JDWP packets written to a connection are read by the target VM
- * in the order in which they were written. Similiarly packets written
+ * {@link TransportService TransportService} establishes a connection
+ * and successfully handshakes with a target VM. A TransportService
+ * implementation provides a reliable JDWP packet transportation service
+ * and consequently a Connection provides a reliable flow of JDWP packets
+ * between the debugger and the target VM. A Connection is stream oriented,
+ * that is, the JDWP packets written to a connection are read by the target VM
+ * in the order in which they were written. Similarly packets written
* to a Connection by the target VM are read by the debugger in the
* order in which they were written.
*
@@ -55,7 +54,6 @@
*
* @since 1.5
*/
-
public abstract class Connection {
/**
@@ -82,7 +80,7 @@
* thrown. The first byte of the packet is stored in element
* {@code 0} of the byte array, the second in element {@code 1},
* and so on. The bytes in the byte array are laid out as per the
- * <a href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
+ * <a href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* JDWP specification</a>. That is, all fields in the packet
* are in big endian order as per the JDWP specification.
*
@@ -119,7 +117,7 @@
*
* <p> The byte array provided to this method should be laid out
* as per the <a
- * href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
+ * href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* JDWP specification</a>. That is, all fields in the packet
* are in big endian order. The first byte, that is element
* {@code pkt[0]}, is the first byte of the {@code length} field.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/spi/TransportService.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -26,6 +26,8 @@
package com.sun.jdi.connect.spi;
import java.io.IOException;
+
+import com.sun.jdi.connect.Transport;
import com.sun.jdi.connect.TransportTimeoutException;
/**
@@ -35,15 +37,15 @@
* <p> A transport service is a concrete subclass of this class
* that has a zero-argument constructor and implements the abstract
* methods specified below. It is the underlying service
- * used by a {@link com.sun.jdi.connect.Transport} for
- * connections between a debugger and a target VM.
+ * used by a {@link Transport} for connections between a debugger
+ * and a target VM.
*
* <p> A transport service is used to establish a connection
* between a debugger and a target VM, and to transport Java
* Debug Wire Protocol (JDWP) packets over an underlying
* communication protocol. In essence a transport service
* implementation binds JDWP (as specified in the
- * <a href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
+ * <a href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* JDWP specification</a>) to an underlying communication
* protocol. A transport service implementation provides
* a reliable JDWP packet transportation service. JDWP
@@ -76,7 +78,6 @@
*
* @since 1.5
*/
-
public abstract class TransportService {
/**
@@ -108,7 +109,6 @@
*/
public abstract boolean supportsMultipleConnections();
-
/**
* Tell whether or not this transport service supports a timeout
* when attaching to a target VM.
@@ -144,7 +144,6 @@
* @see #accept(TransportService.ListenKey,long,long)
*/
public abstract boolean supportsHandshakeTimeout();
-
}
/**
@@ -166,7 +165,7 @@
* is followed by a handshake to ensure that the connection is
* to a target VM. The handshake involves the exchange
* of a string <i>JDWP-Handshake</i> as specified in the <a
- * href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
+ * href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* Java Debug Wire Protocol</a> specification.
*
* @param address
@@ -315,7 +314,7 @@
* connection is indeed to a target VM. The handshake involves
* the exchange of a string <i>JDWP-Handshake</i> as specified
* in the <a
- * href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
+ * href="{@docRoot}/../specs/jdwp/jdwp-spec.html">
* Java Debug Wire Protocol</a> specification.
*
* @param listenKey
@@ -373,5 +372,4 @@
*/
public abstract Connection accept(ListenKey listenKey, long acceptTimeout,
long handshakeTimeout) throws IOException;
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a field access in the target VM. Field modifications
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/BreakpointEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/BreakpointEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,24 +25,20 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
-
-import java.util.List;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.BreakpointRequest;
/**
* Notification of a breakpoint in the target VM.
- * The breakpoint event
- * is generated before the code at its location is executed.
- * When a location
- * is reached which satisfies a currently enabled
- * {@link com.sun.jdi.request.BreakpointRequest breakpoint request},
- * an {@link EventSet event set}
- * containing an instance of this class will be added
- * to the VM's event queue.
+ *
+ * The breakpoint event is generated before the code at its location
+ * is executed. When a location is reached which satisfies a currently enabled
+ * {@link BreakpointRequest breakpoint request}, an {@link EventSet event set}
+ * containing an instance of this class will be added to the VM's event queue.
*
* @see EventQueue
* @see VirtualMachine
- * @see com.sun.jdi.request.BreakpointRequest
+ * @see BreakpointRequest
*
* @author Robert Field
* @since 1.3
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassPrepareEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassPrepareEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,12 +25,15 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
/**
* Notification of a class prepare in the target VM. See the JVM
* specification for a definition of class preparation. Class prepare
- * events are not generated for primtiive classes (for example,
+ * events are not generated for primitive classes (for example,
* java.lang.Integer.TYPE).
*
* @see EventQueue
@@ -40,6 +43,7 @@
* @since 1.3
*/
public interface ClassPrepareEvent extends Event {
+
/**
* Returns the thread in which this event has occurred.
* <p>
@@ -51,7 +55,7 @@
* If the event was generated by a debugger system thread, the
* value returned by this method is null, and if the requested
* suspend policy for the event was
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD},
+ * {@link EventRequest#SUSPEND_EVENT_THREAD},
* all threads will be suspended instead, and the
* {@link EventSet#suspendPolicy} will reflect this change.
* <p>
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ClassUnloadEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a class unload in the target VM.
@@ -40,6 +40,7 @@
* @since 1.3
*/
public interface ClassUnloadEvent extends Event {
+
/**
* Returns the name of the class that has been unloaded.
*/
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/Event.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/Event.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.VirtualMachine;
import com.sun.jdi.request.EventRequest;
/**
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventIterator.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventIterator.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
-
import java.util.Iterator;
/**
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventQueue.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventQueue.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,28 +25,29 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
/**
* Manager of incoming debugger events for a target VM.
* Events are always grouped in {@link EventSet}s.
* EventSets generated by the debugger back end can be read
* here. There is one instance of EventQueue assigned to a particular
- * {@link com.sun.jdi.VirtualMachine VirtualMachine}.
+ * {@link VirtualMachine VirtualMachine}.
* <P>
* Some events cause the suspension of the target VM - event requests
* ({@link com.sun.jdi.request}) with a
- * {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
- * of {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}
- * or {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD
- * SUSPEND_EVENT_THREAD} and sometimes
- * {@link VMStartEvent}.
+ * {@link EventRequest#suspendPolicy() suspend policy}
+ * of {@link EventRequest#SUSPEND_ALL SUSPEND_ALL}
+ * or {@link EventRequest#SUSPEND_EVENT_THREAD
+ * SUSPEND_EVENT_THREAD} and sometimes {@link VMStartEvent}.
* If these suspensions are not resumed the target VM will hang.
* Thus, it is always good policy to
- * {@link #remove() remove()} every EventSet from the
- * event queue until an EventSet containing a
- * {@link VMDisconnectEvent} is read.
- * Unless {@link com.sun.jdi.VirtualMachine#resume() resume} is
+ * {@link #remove() remove()} every EventSet from the event queue until
+ * an EventSet containing a {@link VMDisconnectEvent} is read.
+ * Unless {@link VirtualMachine#resume() resume} is
* being handled in another way, each EventSet should invoke
* {@link EventSet#resume()}.
*
@@ -56,18 +57,16 @@
* @author Robert Field
* @since 1.3
*/
-
public interface EventQueue extends Mirror {
/**
* Waits forever for the next available event.
*
* @return the next {@link EventSet}.
- * @throws InterruptedException if any thread has interrupted
- * this thread.
- * @throws com.sun.jdi.VMDisconnectedException if the connection
- * to the target VM is no longer available. Note this will always
- * be preceded by a {@link com.sun.jdi.event.VMDisconnectEvent}.
+ * @throws InterruptedException if any thread has interrupted this thread.
+ * @throws VMDisconnectedException if the connection
+ * to the target VM is no longer available. Note this will always
+ * be preceded by a {@link VMDisconnectEvent}.
*/
EventSet remove() throws InterruptedException;
@@ -78,9 +77,9 @@
* @return the next {@link EventSet}, or null if there is a timeout.
* @throws InterruptedException if any thread has interrupted
* this thread.
- * @throws com.sun.jdi.VMDisconnectedException if the connection
- * to the target VM is no longer available. Note this will always
- * be preceded by a {@link com.sun.jdi.event.VMDisconnectEvent}.
+ * @throws VMDisconnectedException if the connection
+ * to the target VM is no longer available. Note this will always
+ * be preceded by a {@link VMDisconnectEvent}.
* @throws IllegalArgumentException if the timeout argument
* contains an illegal value.
*/
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventSet.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventSet.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,19 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import java.util.Set;
-import java.util.Set;
+import com.sun.jdi.Location;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.BreakpointRequest;
+import com.sun.jdi.request.EventRequest;
/**
* Several {@link Event} objects may be created at a given time by
* the target {@link VirtualMachine}. For example, there may be
- * more than one {@link com.sun.jdi.request.BreakpointRequest}
- * for a given {@link Location}
+ * more than one {@link BreakpointRequest} for a given {@link Location}
* or you might single step to the same location as a
* BreakpointRequest. These {@link Event} objects are delivered
* together as an EventSet. For uniformity, an EventSet is always used
@@ -125,18 +129,15 @@
* @author Robert Field
* @since 1.3
*/
-
public interface EventSet extends Mirror, Set<Event> {
/**
* Returns the policy used to suspend threads in the target VM
* for this event set. This policy is selected from the suspend
* policies for each event's request; the target VM chooses the
- * policy which suspends the most threads. The target VM
- * suspends threads according to that policy
- * and that policy is returned here. See
- * {@link com.sun.jdi.request.EventRequest} for the possible
- * policy values.
+ * policy which suspends the most threads. The target VM suspends
+ * threads according to that policy and that policy is returned here.
+ * See {@link EventRequest} for the possible policy values.
* <p>
* In rare cases, the suspend policy may differ from the requested
* value if a {@link ClassPrepareEvent} has occurred in a
@@ -144,9 +145,9 @@
* for details.
*
* @return the suspendPolicy which is either
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL},
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} or
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE SUSPEND_NONE}.
+ * {@link EventRequest#SUSPEND_ALL SUSPEND_ALL},
+ * {@link EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} or
+ * {@link EventRequest#SUSPEND_NONE SUSPEND_NONE}.
*/
int suspendPolicy();
@@ -157,13 +158,11 @@
/**
* Resumes threads suspended by this event set. If the {@link #suspendPolicy}
- * is {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL}, a call
- * to this method is equivalent to
- * {@link com.sun.jdi.VirtualMachine#resume}. If the
- * suspend policy is
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD},
+ * is {@link EventRequest#SUSPEND_ALL}, a call to this method is equivalent to
+ * {@link VirtualMachine#resume}. If the suspend policy is
+ * {@link EventRequest#SUSPEND_EVENT_THREAD},
* a call to this method is equivalent to
- * {@link com.sun.jdi.ThreadReference#resume} for the event thread.
+ * {@link ThreadReference#resume} for the event thread.
* Otherwise, a call to this method is a no-op.
*/
void resume();
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ExceptionEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ExceptionEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,12 +25,14 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Location;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.request.ExceptionRequest;
/**
* Notification of an exception in the target VM. When an exception
* is thrown which satisfies a currently enabled
- * {@link com.sun.jdi.request.ExceptionRequest exception request},
+ * {@link ExceptionRequest exception request},
* an {@link EventSet event set}
* containing an instance of this class will be added
* to the VM's event queue.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/LocatableEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/LocatableEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,10 +25,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
-
-import java.util.List;
-
+import com.sun.jdi.Locatable;
+import com.sun.jdi.ThreadReference;
/**
* Abstract superinterface of events which have both location
* and thread.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodEntryEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodEntryEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Method;
/**
* Notification of a method invocation in the target VM. This event
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodExitEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MethodExitEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,10 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectCollectedException;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a method return in the target VM. This event
@@ -68,6 +71,5 @@
*
* @since 1.6
*/
-
public Value returnValue();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ModificationWatchpointEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,9 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.ModificationWatchpointRequest;
/**
* Notification of a field modification in the
@@ -33,7 +35,7 @@
*
* @see EventQueue
* @see VirtualMachine
- * @see com.sun.jdi.request.ModificationWatchpointRequest
+ * @see ModificationWatchpointRequest
*
* @author Robert Field
* @since 1.3
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnterEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
*
@@ -54,5 +55,5 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
+ public ObjectReference monitor();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorContendedEnteredEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
*
@@ -53,6 +54,5 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
-
+ public ObjectReference monitor();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
* Notification that a thread in the target VM is about to
@@ -52,12 +53,12 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
+ public ObjectReference monitor();
/**
* Returns the number of millisecond the thread will wait.
*
* @return a {@code jlong} containing monitor wait time in milliseconds.
*/
- public long timeout();
+ public long timeout();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/MonitorWaitedEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
/**
* Notification that a thread in the target VM has finished
@@ -52,14 +53,12 @@
*
* @return an {@link ObjectReference} for the monitor.
*/
- public ObjectReference monitor();
+ public ObjectReference monitor();
/**
* Returns whether the wait has timed out or been interrupted.
*
* @return {@code true} if the wait is timed out.
*/
- public boolean timedout();
-
-
+ public boolean timedout();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/StepEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/StepEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,22 +25,20 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.request.StepRequest;
/**
* Notification of step completion in the target VM.
- * The step event
- * is generated immediately before the code at its location is executed;
- * thus, if the step is entering a new method (as might occur with
- * {@link com.sun.jdi.request.StepRequest#STEP_INTO StepRequest.STEP_INTO})
+ * The step event is generated immediately before the code at its location
+ * is executed. Thus, if the step is entering a new method (as might occur
+ * with {@link StepRequest#STEP_INTO StepRequest.STEP_INTO})
* the location of the event is the first instruction of the method.
* When a step leaves a method, the location of the event will be the
* first instruction after the call in the calling method; note that
* this location may not be at a line boundary, even if
- * {@link com.sun.jdi.request.StepRequest#STEP_LINE StepRequest.STEP_LINE}
- * was used.
+ * {@link StepRequest#STEP_LINE StepRequest.STEP_LINE} was used.
*
- * @see com.sun.jdi.request.StepRequest
+ * @see StepRequest
* @see EventQueue
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadDeathEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadDeathEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a completed thread in the target VM. The
@@ -46,6 +47,7 @@
* @since 1.3
*/
public interface ThreadDeathEvent extends Event {
+
/**
* Returns the thread which is terminating.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadStartEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/ThreadStartEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a new running thread in the target VM.
@@ -53,6 +54,7 @@
* @since 1.3
*/
public interface ThreadStartEvent extends Event {
+
/**
* Returns the thread which has started.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDeathEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDeathEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,43 +25,41 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
+import com.sun.jdi.request.EventRequestManager;
+import com.sun.jdi.request.VMDeathRequest;
/**
* Notification of target VM termination.
* This event occurs if the target VM terminates before the
* VM disconnects ({@link VMDisconnectEvent}).
- * Thus, this event will NOT occur if
- * external forces terminate the connection (e.g. a crash)
- * or if the connection is intentionally terminated with
- * {@link com.sun.jdi.VirtualMachine#dispose()
- * VirtualMachine.dispose()}
+ * Thus, this event will NOT occur if external forces terminate
+ * the connection (e.g. a crash) or if the connection is intentionally
+ * terminated with {@link VirtualMachine#dispose() VirtualMachine.dispose()}
* <P>
- * On VM termination, a single unsolicited VMDeathEvent
- * will always be sent with a
- * {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
- * of {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE SUSPEND_NONE}.
+ * On VM termination, a single unsolicited VMDeathEvent will always be sent with a
+ * {@link EventRequest#suspendPolicy() suspend policy}
+ * of {@link EventRequest#SUSPEND_NONE SUSPEND_NONE}.
* Additional VMDeathEvents will be sent in the same event set if they are
- * requested with a
- * {@link com.sun.jdi.request.VMDeathRequest VMDeathRequest}.
+ * requested with a {@link VMDeathRequest VMDeathRequest}.
* <P>
* The VM is still intact and can be queried at the point this
* event was initiated but immediately thereafter it is not
* considered intact and cannot be queried.
* Note: If the enclosing {@link EventSet} has a
- * {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
- * other than
- * {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}
+ * {@link EventRequest#suspendPolicy() suspend policy} other than
+ * {@link EventRequest#SUSPEND_ALL SUSPEND_ALL}
* the initiating point may be long past.
* <P>
* All VMDeathEvents will be in a single {@link EventSet},
- * no other events will be in the event set. A resume
+ * no other events will be in the event set. A resume
* must occur to continue execution after any event set which
* performs suspensions - in this case to allow proper shutdown.
*
* @see VMDisconnectEvent
- * @see com.sun.jdi.request.EventRequestManager#createVMDeathRequest
- * @see com.sun.jdi.request.VMDeathRequest
+ * @see EventRequestManager#createVMDeathRequest
+ * @see VMDeathRequest
* @see EventQueue
* @see VirtualMachine
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDisconnectEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMDisconnectEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,14 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.EventRequest;
/**
* Notification of disconnection from target VM.
* May be caused by normal termination of a VM,
* VM termination by uncaught exception or other error,
- * debugger action (
- * {@link VirtualMachine#dispose} or
+ * debugger action ({@link VirtualMachine#dispose} or
* {@link VirtualMachine#exit}) or by external events
* (for example, target process termination by the
* operating system, transport termination, etc).
@@ -41,9 +41,9 @@
* will be preceded by a {@link VMDeathEvent}.
* <p>
* This event is always sent.
- * There is no corresponding {@link com.sun.jdi.request.EventRequest}.
+ * There is no corresponding {@link EventRequest}.
* The enclosing singleton {@link EventSet} always has a
- * suspend policy of {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE}.
+ * suspend policy of {@link EventRequest#SUSPEND_NONE}.
*
* @see VMDeathEvent
* @see EventQueue
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMStartEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/VMStartEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,8 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of initialization of a target VM. This event is
@@ -44,6 +45,7 @@
* @since 1.3
*/
public interface VMStartEvent extends Event {
+
/**
* Returns the initial thread of the VM which has started.
*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/WatchpointEvent.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/WatchpointEvent.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 @@
package com.sun.jdi.event;
-import com.sun.jdi.*;
+import com.sun.jdi.Field;
+import com.sun.jdi.ObjectCollectedException;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
/**
* Notification of a field triggered event encountered by a thread in the
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/AccessWatchpointRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,9 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.AccessWatchpointEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Request for notification when the contents of a field are accessed
@@ -36,20 +38,19 @@
* GetStatic<Type>Field</code>).
* Access by JDI does not trigger this event.
* When an enabled AccessWatchpointRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.AccessWatchpointEvent AccessWatchpointEvent} will be placed
- * on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing an
+ * {@link AccessWatchpointEvent AccessWatchpointEvent} will be placed
+ * on the {@link EventQueue EventQueue}.
* The collection of existing ExceptionRequests is
* managed by the {@link EventRequestManager}
- * The collection of existing
- * watchpoints is
+ * The collection of existing watchpoints is
* managed by the {@link EventRequestManager}.
* <p>
* Note that the modification
* of a Field is not considered an access.
*
* @see ModificationWatchpointRequest
- * @see com.sun.jdi.event.EventQueue
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/BreakpointRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/BreakpointRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,22 +25,29 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.Locatable;
+import com.sun.jdi.Location;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Identifies a {@link Location} in the target VM at which
* execution should be stopped. When an enabled BreakpointRequest is
* satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.BreakpointEvent BreakpointEvent}
+ * {@link EventSet event set} containing an
+ * {@link BreakpointEvent BreakpointEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue} and
+ * {@link EventQueue EventQueue} and
* the application is interrupted. The collection of existing breakpoints is
* managed by the {@link EventRequestManager}
*
* @see Location
- * @see com.sun.jdi.event.BreakpointEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see BreakpointEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassPrepareRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassPrepareRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,23 +25,27 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.ClassPrepareEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Request for notification when a class is prepared in the target VM.
* When an enabled ClassPrepareRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ClassPrepareEvent ClassPrepareEvent}
+ * {@link EventSet event set} containing a
+ * {@link ClassPrepareEvent ClassPrepareEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventQueue EventQueue}.
* The collection of existing ClassPrepareRequests is
* managed by the {@link EventRequestManager}
* <p>
* Class preparation is defined in the Java Virtual Machine
* Specification.
*
- * @see com.sun.jdi.event.ClassPrepareEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ClassPrepareEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassUnloadRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ClassUnloadRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,22 +25,24 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.ClassUnloadEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
/**
* Request for notification when a class is unloaded in the target VM.
* When an enabled ClassUnloadRequest is satisfied, a
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.ClassUnloadEvent ClassUnloadEvent} will
- * be placed on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing an
+ * {@link ClassUnloadEvent ClassUnloadEvent} will
+ * be placed on the {@link EventQueue EventQueue}.
* The collection of existing ClassUnloadRequests is
* managed by the {@link EventRequestManager}
* <p>
* Refer to the Java Virtual Machine Specification for more information
* on class unloading.
*
- * @see com.sun.jdi.event.ClassUnloadEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ClassUnloadEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/DuplicateRequestException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/DuplicateRequestException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -32,6 +32,7 @@
* @since 1.3
*/
public class DuplicateRequestException extends RuntimeException {
+
private static final long serialVersionUID = -3719784920313411060L;
public DuplicateRequestException() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,22 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VMOutOfMemoryException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.VMDisconnectEvent;
/**
* Represents a request for notification of an event. Examples include
* {@link BreakpointRequest} and {@link ExceptionRequest}.
* When an event occurs for which an enabled request is present,
- * an {@link com.sun.jdi.event.EventSet EventSet} will
- * be placed on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * an {@link EventSet EventSet} will
+ * be placed on the {@link EventQueue EventQueue}.
* The collection of existing event requests is
* managed by the {@link EventRequestManager}.
* <p>
@@ -63,16 +71,16 @@
* <p>
* Any method on {@code EventRequest} which
* takes {@code EventRequest} as an parameter may throw
- * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
- * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
- * available to be read from the {@link com.sun.jdi.event.EventQueue}.
+ * {@link VMDisconnectedException} if the target VM is
+ * disconnected and the {@link VMDisconnectEvent} has been or is
+ * available to be read from the {@link EventQueue}.
* <p>
* Any method on {@code EventRequest} which
* takes {@code EventRequest} as an parameter may throw
- * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
+ * {@link VMOutOfMemoryException} if the target VM has run out of memory.
*
- * @see com.sun.jdi.event.BreakpointEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see BreakpointEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
@@ -159,8 +167,8 @@
* <p>
* Thread suspensions through events have the same functionality
* as explicitly requested suspensions. See
- * {@link com.sun.jdi.ThreadReference#suspend} and
- * {@link com.sun.jdi.VirtualMachine#suspend} for details.
+ * {@link ThreadReference#suspend} and
+ * {@link VirtualMachine#suspend} for details.
*
* @param policy the selected suspend policy.
* @throws InvalidRequestStateException if this request is currently
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,19 +25,30 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import java.util.List;
-import java.util.List;
+import com.sun.jdi.Field;
+import com.sun.jdi.Location;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.NativeMethodException;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.Event;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ExceptionEvent;
+import com.sun.jdi.event.VMDeathEvent;
/**
* Manages the creation and deletion of {@link EventRequest}s. A single
- * implementor of this interface exists in a particuar VM and
+ * implementor of this interface exists in a particular VM and
* is accessed through {@link VirtualMachine#eventRequestManager()}
*
* @see EventRequest
- * @see com.sun.jdi.event.Event
+ * @see Event
* @see BreakpointRequest
- * @see com.sun.jdi.event.BreakpointEvent
+ * @see BreakpointEvent
* @see VirtualMachine
*
* @author Robert Field
@@ -97,7 +108,7 @@
* or both can be selected. Note, however, that
* at the time an exception is thrown, it is not always
* possible to determine whether it is truly caught. See
- * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
+ * {@link ExceptionEvent#catchLocation} for
* details.
* @param refType If non-null, specifies that exceptions which are
* instances of refType will be reported. Note: this
@@ -217,19 +228,19 @@
* <p>
* The returned request will control stepping only in the specified
* {@code thread}; all other threads will be unaffected.
- * A {@code size} value of {@link com.sun.jdi.request.StepRequest#STEP_MIN} will generate a
+ * A {@code size} value of {@link StepRequest#STEP_MIN} will generate a
* step event each time the code index changes. It represents the
* smallest step size available and often maps to the instruction
* level.
- * A {@code size} value of {@link com.sun.jdi.request.StepRequest#STEP_LINE} will generate a
+ * A {@code size} value of {@link StepRequest#STEP_LINE} will generate a
* step event each time the source line changes unless line number information is not available,
* in which case a STEP_MIN will be done instead. For example, no line number information is
* available during the execution of a method that has been rendered obsolete by
- * by a {@link com.sun.jdi.VirtualMachine#redefineClasses} operation.
- * A {@code depth} value of {@link com.sun.jdi.request.StepRequest#STEP_INTO} will generate
+ * by a {@link VirtualMachine#redefineClasses} operation.
+ * A {@code depth} value of {@link StepRequest#STEP_INTO} will generate
* step events in any called methods. A {@code depth} value
- * of {@link com.sun.jdi.request.StepRequest#STEP_OVER} restricts step events to the current frame
- * or caller frames. A {@code depth} value of {@link com.sun.jdi.request.StepRequest#STEP_OUT}
+ * of {@link StepRequest#STEP_OVER} restricts step events to the current frame
+ * or caller frames. A {@code depth} value of {@link StepRequest#STEP_OUT}
* restricts step events to caller frames only. All depth
* restrictions are relative to the call stack immediately before the
* step takes place.
@@ -327,7 +338,7 @@
* activate this event request.
* <P>
* This request (if enabled) will cause a
- * {@link com.sun.jdi.event.VMDeathEvent}
+ * {@link VMDeathEvent}
* to be sent on termination of the target VM.
* <P>
* A VMDeathRequest with a suspend policy of
@@ -338,8 +349,8 @@
* events before VM death. If all event processing is being
* done in the same thread as event sets are being read,
* enabling the request is all that is needed since the VM
- * will be suspended until the {@link com.sun.jdi.event.EventSet}
- * containing the {@link com.sun.jdi.event.VMDeathEvent}
+ * will be suspended until the {@link EventSet}
+ * containing the {@link VMDeathEvent}
* is resumed.
* <P>
* Not all target virtual machines support this operation.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ExceptionRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ExceptionRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,19 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ExceptionEvent;
/**
* Request for notification when an exception occurs in the target VM.
* When an enabled ExceptionRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing an
- * {@link com.sun.jdi.event.ExceptionEvent ExceptionEvent} will be placed
- * on the {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing an
+ * {@link ExceptionEvent ExceptionEvent} will be placed
+ * on the {@link EventQueue EventQueue}.
* The collection of existing ExceptionRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.ExceptionEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ExceptionEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
@@ -60,7 +66,7 @@
* <p>
* Note that at the time an exception is thrown, it is not always
* possible to determine whether it is truly caught. See
- * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
+ * {@link ExceptionEvent#catchLocation} for
* details.
* @return
* boolean true if caught exceptions will be reported, false
@@ -74,7 +80,7 @@
* <p>
* Note that at the time an exception is thrown, it is not always
* possible to determine whether it is truly uncaught. See
- * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
+ * {@link ExceptionEvent#catchLocation} for
* details.
* @return
* boolean true if caught exceptions will be reported, false
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/InvalidRequestStateException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/InvalidRequestStateException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -36,14 +36,14 @@
* @since 1.3
*/
public class InvalidRequestStateException extends RuntimeException {
+
private static final long serialVersionUID = -3774632428543322148L;
- public InvalidRequestStateException()
- {
+
+ public InvalidRequestStateException() {
super();
}
- public InvalidRequestStateException(String s)
- {
+ public InvalidRequestStateException(String s) {
super(s);
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodEntryRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodEntryRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,20 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MethodEntryEvent;
/**
* Request for notification when a method is invoked in the target VM.
* When an enabled MethodEntryRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MethodEntryEvent MethodEntryEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MethodEntryEvent MethodEntryEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MethodEntryRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MethodEntryEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MethodEntryEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodExitRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MethodExitRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,20 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MethodExitEvent;
/**
* Request for notification when a method returns in the target VM.
* When an enabled MethodExitRequest is hit, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MethodExitEvent MethodExitEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MethodExitEvent MethodExitEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MethodExitRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MethodExitEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MethodExitEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ModificationWatchpointRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,9 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ModificationWatchpointEvent;
/**
* Request for notification when a field is set.
@@ -37,19 +39,16 @@
* Setting a field to a value which is the same as the previous value
* still triggers this event.
* Modification by JDI does not trigger this event.
- * When an enabled
- * ModificationWatchpointRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ModificationWatchpointEvent ModificationWatchpointEvent}
- * will be placed on
- * the {@link com.sun.jdi.event.EventQueue EventQueue}.
- * The collection of existing
- * watchpoints is
+ * When an enabled ModificationWatchpointRequest is satisfied, an
+ * {@link EventSet event set} containing a
+ * {@link ModificationWatchpointEvent ModificationWatchpointEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
+ * The collection of existing watchpoints is
* managed by the {@link EventRequestManager}.
*
- * @see com.sun.jdi.event.ModificationWatchpointEvent
+ * @see ModificationWatchpointEvent
* @see AccessWatchpointRequest
- * @see com.sun.jdi.event.EventQueue
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnterRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorContendedEnterEvent;
/**
* Request for notification of a thread in the target VM
* attempting to enter a monitor already acquired by another thread.
* When an enabled MonitorContededEnterRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorContendedEnterEvent MonitorContendedEnterEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorContendedEnterEvent MonitorContendedEnterEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorContendedEnterEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorContendedEnterEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorContendedEnterEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorContendedEnteredRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorContendedEnteredEvent;
/**
* Request for notification of a thread in the target VM entering a monitor
* after waiting for it to be released by another thread.
* When an enabled MonitorContededEnteredRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorContendedEnteredEvent MonitorContendedEnteredEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorContendedEnteredEvent MonitorContendedEnteredEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorContendedEnteredEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorContendedEnteredEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorContendedEnteredEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorWaitEvent;
/**
* Request for notification when a thread in the target VM is about to
* wait on a monitor object. That is, a thread is entering Object.wait().
* When an enabled MonitorWaitRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorWaitEvent MonitorWaitEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorWaitEvent MonitorWaitEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorWaitEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorWaitEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorWaitEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/MonitorWaitedRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,21 +25,26 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.MonitorWaitedEvent;
/**
* Request for notification when a thread in the target VM has finished waiting on
* a monitor object. That is, a thread is leaving Object.wait(). "
* When an enabled MonitorWaitedRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.MonitorWaitedEvent MonitorWaitedEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link MonitorWaitedEvent MonitorWaitedEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing MonitorWaitedEvents is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.MonitorWaitedEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see MonitorWaitedEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Swamy Venkataramanappa
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/StepRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/StepRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,19 +25,25 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.StepEvent;
/**
* Request for notification when a step occurs in the target VM.
* When an enabled StepRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.StepEvent StepEvent} will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link StepEvent StepEvent} will be placed on the
+ * {@link EventQueue EventQueue}.
* The collection of existing StepRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.StepEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see StepEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadDeathRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadDeathRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,20 +25,23 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ThreadDeathEvent;
/**
* Request for notification when a thread terminates in the target VM.
* When an enabled ThreadDeathRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ThreadDeathEvent ThreadDeathEvent}
+ * {@link EventSet event set} containing a
+ * {@link ThreadDeathEvent ThreadDeathEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventQueue EventQueue}.
* The collection of existing ThreadDeathRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.ThreadDeathEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ThreadDeathEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadStartRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/ThreadStartRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,20 +25,23 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ThreadStartEvent;
/**
* Request for notification when a thread starts execution in the target VM.
* When an enabled ThreadStartRequest is hit, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.ThreadStartEvent ThreadStartEvent}
+ * {@link EventSet event set} containing a
+ * {@link ThreadStartEvent ThreadStartEvent}
* will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventQueue EventQueue}.
* The collection of existing ThreadStartRequests is
* managed by the {@link EventRequestManager}
*
- * @see com.sun.jdi.event.ThreadStartEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see ThreadStartEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/VMDeathRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/VMDeathRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, 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
@@ -25,15 +25,16 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.event.EventQueue;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.VMDeathEvent;
/**
* Request for notification when the target VM terminates.
* When an enabled VMDeathRequest is satisfied, an
- * {@link com.sun.jdi.event.EventSet event set} containing a
- * {@link com.sun.jdi.event.VMDeathEvent VMDeathEvent}
- * will be placed on the
- * {@link com.sun.jdi.event.EventQueue EventQueue}.
+ * {@link EventSet event set} containing a
+ * {@link VMDeathEvent VMDeathEvent}
+ * will be placed on the {@link EventQueue EventQueue}.
* The collection of existing VMDeathRequests is
* managed by the {@link EventRequestManager}
* <P>
@@ -49,13 +50,12 @@
* to be alive (e.g. event processing). Note: the
* unsolicited VMDeathEvent will still be sent.
*
- * @see com.sun.jdi.event.VMDeathEvent
- * @see com.sun.jdi.event.EventQueue
+ * @see VMDeathEvent
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
* @since 1.4
*/
public interface VMDeathRequest extends EventRequest {
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/WatchpointRequest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/request/WatchpointRequest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,19 @@
package com.sun.jdi.request;
-import com.sun.jdi.*;
+import com.sun.jdi.Field;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.EventQueue;
/**
* Identifies a {@link Field} in the target VM being watched.
*
* @see AccessWatchpointRequest
* @see ModificationWatchpointRequest
- * @see com.sun.jdi.event.EventQueue
+ * @see EventQueue
* @see EventRequestManager
*
* @author Robert Field
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/AbstractLauncher.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/AbstractLauncher.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,26 +25,34 @@
package com.sun.tools.jdi;
-import com.sun.tools.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
-import com.sun.jdi.*;
-
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-
-abstract class AbstractLauncher extends ConnectorImpl implements LaunchingConnector {
+import com.sun.jdi.Bootstrap;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.VirtualMachineManager;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.LaunchingConnector;
+import com.sun.jdi.connect.VMStartException;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.connect.spi.TransportService;
+
+abstract class AbstractLauncher extends ConnectorImpl
+ implements LaunchingConnector
+{
abstract public VirtualMachine
- launch(Map<String,? extends Connector.Argument> arguments)
- throws IOException,
- IllegalConnectorArgumentsException,
- VMStartException;
+ launch(Map<String, ? extends Connector.Argument> arguments)
+ throws IOException, IllegalConnectorArgumentsException,
+ VMStartException;
+
abstract public String name();
+
abstract public String description();
ThreadGroup grp;
@@ -70,7 +78,7 @@
true);
String quoted = null;
String pending = null;
- List<String> tokenList = new ArrayList<String>();
+ List<String> tokenList = new ArrayList<>();
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (quoted != null) {
@@ -146,6 +154,7 @@
* one launch.
*/
private class Helper {
+ @SuppressWarnings("unused")
private final String address;
private TransportService.ListenKey listenKey;
private TransportService ts;
@@ -228,8 +237,7 @@
}
Thread monitorTarget() {
- Thread thread = new Thread(grp,
- "launched target monitor") {
+ Thread thread = new Thread(grp, "launched target monitor") {
public void run() {
try {
process.waitFor();
@@ -248,8 +256,7 @@
}
Thread acceptConnection() {
- Thread thread = new Thread(grp,
- "connection acceptor") {
+ Thread thread = new Thread(grp, "connection acceptor") {
public void run() {
try {
Connection connection = ts.accept(listenKey, 0, 0);
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,20 +25,24 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
+
+import com.sun.jdi.ArrayReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Method;
+import com.sun.jdi.Type;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
public class ArrayReferenceImpl extends ObjectReferenceImpl
implements ArrayReference
{
int length = -1;
- ArrayReferenceImpl(VirtualMachine aVm,long aRef) {
- super(aVm,aRef);
+ ArrayReferenceImpl(VirtualMachine aVm, long aRef) {
+ super(aVm, aRef);
}
protected ClassTypeImpl invokableReferenceType(Method method) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,23 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
-import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.sun.jdi.ArrayReference;
+import com.sun.jdi.ArrayType;
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.Method;
+import com.sun.jdi.PrimitiveType;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
+
public class ArrayTypeImpl extends ReferenceTypeImpl
implements ArrayType
{
@@ -68,7 +77,7 @@
}
public List<Method> allMethods() {
- return new ArrayList<Method>(0); // arrays don't have methods
+ return new ArrayList<>(0); // arrays don't have methods
}
/*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BaseLineInfo.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BaseLineInfo.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 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
@@ -25,10 +25,12 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.AbsentInformationException;
class BaseLineInfo implements LineInfo {
+
private final int lineNumber;
+
private final ReferenceTypeImpl declaringType;
BaseLineInfo(int lineNumber,
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,13 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.BooleanType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class BooleanTypeImpl extends PrimitiveTypeImpl implements BooleanType {
+
BooleanTypeImpl(VirtualMachine vm) {
super(vm);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,22 +25,24 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.BooleanValue;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class BooleanValueImpl extends PrimitiveValueImpl
- implements BooleanValue {
+ implements BooleanValue
+{
private boolean value;
- BooleanValueImpl(VirtualMachine aVm,boolean aValue) {
+ BooleanValueImpl(VirtualMachine aVm, boolean aValue) {
super(aVm);
-
value = aValue;
}
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof BooleanValue)) {
- return (value == ((BooleanValue)obj).value())
- && super.equals(obj);
+ return (value == ((BooleanValue)obj).value()) &&
+ super.equals(obj);
} else {
return false;
}
@@ -66,31 +68,31 @@
}
public byte byteValue() {
- return(byte)((value)?1:0);
+ return (byte)(value ? 1 : 0);
}
public char charValue() {
- return(char)((value)?1:0);
+ return (char)(value ? 1 : 0);
}
public short shortValue() {
- return(short)((value)?1:0);
+ return (short)(value ? 1 : 0);
}
public int intValue() {
- return (value)?1:0;
+ return (value ? 1 : 0);
}
public long longValue() {
- return(long)((value)?1:0);
+ return (value ? 1 : 0);
}
public float floatValue() {
- return(float)((value)?1.0:0.0);
+ return (float)(value ? 1.0 : 0.0);
}
public double doubleValue() {
- return (value)?1.0:0.0;
+ return (value ? 1.0 : 0.0);
}
public String toString() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ByteTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ByteTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.ByteType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class ByteTypeImpl extends PrimitiveTypeImpl implements ByteType {
+
ByteTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.BYTE);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ByteValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ByteValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,18 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.ByteValue;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class ByteValueImpl extends PrimitiveValueImpl
- implements ByteValue {
+ implements ByteValue
+{
private byte value;
- ByteValueImpl(VirtualMachine aVm,byte aValue) {
+ ByteValueImpl(VirtualMachine aVm, byte aValue) {
super(aVm);
-
value = aValue;
}
@@ -58,7 +61,6 @@
return value() - other;
}
-
public Type type() {
return vm.theByteType();
}
@@ -68,7 +70,7 @@
}
public boolean booleanValue() {
- return(value == 0)?false:true;
+ return (value == 0 ? false : true);
}
public byte byteValue() {
@@ -76,27 +78,27 @@
}
public char charValue() {
- return(char)value;
+ return (char)value;
}
public short shortValue() {
- return(short)value;
+ return value;
}
public int intValue() {
- return(int)value;
+ return value;
}
public long longValue() {
- return(long)value;
+ return value;
}
public float floatValue() {
- return(float)value;
+ return value;
}
public double doubleValue() {
- return(double)value;
+ return value;
}
char checkedCharValue() throws InvalidTypeException {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CharTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CharTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.CharType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class CharTypeImpl extends PrimitiveTypeImpl implements CharType {
+
CharTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.CHAR);
}
@@ -40,5 +43,4 @@
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedCharValue());
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CharValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CharValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,18 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.CharValue;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class CharValueImpl extends PrimitiveValueImpl
- implements CharValue {
+ implements CharValue
+{
private char value;
- CharValueImpl(VirtualMachine aVm,char aValue) {
+ CharValueImpl(VirtualMachine aVm, char aValue) {
super(aVm);
-
value = aValue;
}
@@ -67,11 +70,11 @@
}
public boolean booleanValue() {
- return(value == 0)?false:true;
+ return (value == 0 ? false : true);
}
public byte byteValue() {
- return(byte)value;
+ return (byte)value;
}
public char charValue() {
@@ -79,23 +82,23 @@
}
public short shortValue() {
- return(short)value;
+ return (short)value;
}
public int intValue() {
- return(int)value;
+ return value;
}
public long longValue() {
- return(long)value;
+ return value;
}
public float floatValue() {
- return(float)value;
+ return value;
}
public double doubleValue() {
- return(double)value;
+ return value;
}
public String toString() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,12 +25,20 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
- implements ClassLoaderReference, VMListener {
-
+ implements ClassLoaderReference
+{
// This is cached only while the VM is suspended
private static class Cache extends ObjectReferenceImpl.Cache {
List<ReferenceType> visibleClasses = null;
@@ -50,7 +58,7 @@
}
public List<ReferenceType> definedClasses() {
- ArrayList<ReferenceType> definedClasses = new ArrayList<ReferenceType>();
+ ArrayList<ReferenceType> definedClasses = new ArrayList<>();
for (ReferenceType type : vm.allClasses()) {
if (type.isPrepared() &&
equals(type.classLoader())) {
@@ -72,7 +80,7 @@
JDWP.ClassLoaderReference.VisibleClasses.ClassInfo[]
jdwpClasses = JDWP.ClassLoaderReference.VisibleClasses.
process(vm, this).classes;
- classes = new ArrayList<ReferenceType>(jdwpClasses.length);
+ classes = new ArrayList<>(jdwpClasses.length);
for (int i = 0; i < jdwpClasses.length; ++i) {
classes.add(vm.referenceType(jdwpClasses[i].typeID,
jdwpClasses[i].refTypeTag));
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassObjectReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassObjectReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,11 +25,13 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import java.util.*;
+import com.sun.jdi.ClassObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.VirtualMachine;
public class ClassObjectReferenceImpl extends ObjectReferenceImpl
- implements ClassObjectReference {
+ implements ClassObjectReference
+{
private ReferenceType reflectedType;
ClassObjectReferenceImpl(VirtualMachine vm, long ref) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,12 +25,25 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.util.ArrayList;
+import java.util.List;
-import java.util.*;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.Field;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
final public class ClassTypeImpl extends InvokableTypeImpl
- implements ClassType
+ implements ClassType
{
private static class IResult implements InvocationResult {
final private JDWP.ClassType.InvokeMethod rslt;
@@ -52,15 +65,14 @@
private boolean cachedSuperclass = false;
private ClassType superclass = null;
- private int lastLine = -1;
private List<InterfaceType> interfaces = null;
- protected ClassTypeImpl(VirtualMachine aVm,long aRef) {
+ protected ClassTypeImpl(VirtualMachine aVm, long aRef) {
super(aVm, aRef);
}
public ClassType superclass() {
- if(!cachedSuperclass) {
+ if (!cachedSuperclass) {
ClassTypeImpl sup = null;
try {
sup = JDWP.ClassType.Superclass.
@@ -97,7 +109,7 @@
}
public List<ClassType> subclasses() {
- List<ClassType> subs = new ArrayList<ClassType>();
+ List<ClassType> subs = new ArrayList<>();
for (ReferenceType refType : vm.allClasses()) {
if (refType instanceof ClassType) {
ClassType clazz = (ClassType)refType;
@@ -162,9 +174,9 @@
}
PacketStream sendNewInstanceCommand(final ThreadReferenceImpl thread,
- final MethodImpl method,
- final ValueImpl[] args,
- final int options) {
+ final MethodImpl method,
+ final ValueImpl[] args,
+ final int options) {
CommandSender sender =
new CommandSender() {
public PacketStream send() {
@@ -232,18 +244,18 @@
}
public Method concreteMethodByName(String name, String signature) {
- Method method = null;
- for (Method candidate : visibleMethods()) {
- if (candidate.name().equals(name) &&
- candidate.signature().equals(signature) &&
- !candidate.isAbstract()) {
+ Method method = null;
+ for (Method candidate : visibleMethods()) {
+ if (candidate.name().equals(name) &&
+ candidate.signature().equals(signature) &&
+ !candidate.isAbstract()) {
- method = candidate;
- break;
- }
- }
- return method;
- }
+ method = candidate;
+ break;
+ }
+ }
+ return method;
+ }
void validateConstructorInvocation(Method method)
throws InvalidTypeException,
@@ -264,7 +276,6 @@
}
}
-
public String toString() {
return "class " + name() + " (" + loaderString() + ")";
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CommandSender.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CommandSender.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,6 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import java.util.EventListener;
-
interface CommandSender {
PacketStream send();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,16 +25,20 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.lang.ref.SoftReference;
+
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.LocalVariable;
+import com.sun.jdi.Location;
+import com.sun.jdi.VirtualMachine;
+import com.sun.tools.jdi.JDWP.Method.VariableTable;
+import com.sun.tools.jdi.JDWP.Method.VariableTableWithGeneric;
/**
* Represents methods with method bodies.
@@ -47,9 +51,9 @@
* A subset of the line number info that is softly cached
*/
static private class SoftLocationXRefs {
- final String stratumID; // The stratum of this information
- final Map<Integer, List<Location>> lineMapper; // Maps line number to location(s)
- final List<Location> lineLocations; // List of locations ordered by code index
+ final String stratumID; // The stratum of this information
+ final Map<Integer, List<Location>> lineMapper; // Maps line number to location(s)
+ final List<Location> lineLocations; // List of locations ordered by code index
/*
* Note: these do not necessarily correspond to
@@ -57,15 +61,16 @@
* in the lineLocations list. Use these only for bounds
* checking and with lineMapper.
*/
+ @SuppressWarnings("unused")
final int lowestLine;
+ @SuppressWarnings("unused")
final int highestLine;
- SoftLocationXRefs(String stratumID, Map<Integer, List<Location>> lineMapper, List<Location> lineLocations,
- int lowestLine, int highestLine) {
+ SoftLocationXRefs(String stratumID, Map<Integer, List<Location>> lineMapper,
+ List<Location> lineLocations, int lowestLine, int highestLine) {
this.stratumID = stratumID;
this.lineMapper = Collections.unmodifiableMap(lineMapper);
- this.lineLocations =
- Collections.unmodifiableList(lineLocations);
+ this.lineLocations = Collections.unmodifiableList(lineLocations);
this.lowestLine = lowestLine;
this.highestLine = highestLine;
}
@@ -82,13 +87,11 @@
private int argSlotCount = -1;
ConcreteMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
- long ref,
- String name, String signature,
- String genericSignature, int modifiers) {
-
+ long ref, String name, String signature,
+ String genericSignature, int modifiers)
+ {
// The generic signature is set when this is created
- super(vm, declaringType, ref, name, signature,
- genericSignature, modifiers);
+ super(vm, declaringType, ref, name, signature, genericSignature, modifiers);
}
public Location location() {
@@ -99,14 +102,14 @@
}
List<Location> sourceNameFilter(List<Location> list,
- SDE.Stratum stratum,
- String sourceName)
+ SDE.Stratum stratum,
+ String sourceName)
throws AbsentInformationException {
if (sourceName == null) {
return list;
} else {
/* needs sourceName filteration */
- List<Location> locs = new ArrayList<Location>();
+ List<Location> locs = new ArrayList<>();
for (Location loc : list) {
if (((LocationImpl)loc).sourceName(stratum).equals(sourceName)) {
locs.add(loc);
@@ -117,7 +120,7 @@
}
List<Location> allLineLocations(SDE.Stratum stratum,
- String sourceName)
+ String sourceName)
throws AbsentInformationException {
List<Location> lineLocations = getLocations(stratum).lineLocations;
@@ -126,12 +129,12 @@
}
return Collections.unmodifiableList(
- sourceNameFilter(lineLocations, stratum, sourceName));
+ sourceNameFilter(lineLocations, stratum, sourceName));
}
List<Location> locationsOfLine(SDE.Stratum stratum,
- String sourceName,
- int lineNumber)
+ String sourceName,
+ int lineNumber)
throws AbsentInformationException {
SoftLocationXRefs info = getLocations(stratum);
@@ -146,13 +149,12 @@
List<Location> list = info.lineMapper.get(lineNumber);
if (list == null) {
- list = new ArrayList<Location>(0);
+ list = new ArrayList<>(0);
}
return Collections.unmodifiableList(
- sourceNameFilter(list, stratum, sourceName));
+ sourceNameFilter(list, stratum, sourceName));
}
-
public Location locationOfCodeIndex(long codeIndex) {
if (firstIndex == -1) {
getBaseLocations();
@@ -168,7 +170,6 @@
return new LocationImpl(virtualMachine(), this, codeIndex);
}
-
LineInfo codeIndexToLineInfo(SDE.Stratum stratum,
long codeIndex) {
if (firstIndex == -1) {
@@ -179,8 +180,7 @@
* Check for invalid code index.
*/
if (codeIndex < firstIndex || codeIndex > lastIndex) {
- throw new InternalError(
- "Location with invalid code index");
+ throw new InternalError("Location with invalid code index");
}
List<Location> lineLocations = getLocations(stratum).lineLocations;
@@ -212,7 +212,6 @@
return bestMatch.getLineInfo(stratum);
}
-
public List<LocalVariable> variables() throws AbsentInformationException {
return getVariables();
}
@@ -220,7 +219,7 @@
public List<LocalVariable> variablesByName(String name) throws AbsentInformationException {
List<LocalVariable> variables = getVariables();
- List<LocalVariable> retList = new ArrayList<LocalVariable>(2);
+ List<LocalVariable> retList = new ArrayList<>(2);
Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) {
LocalVariable variable = iter.next();
@@ -234,7 +233,7 @@
public List<LocalVariable> arguments() throws AbsentInformationException {
List<LocalVariable> variables = getVariables();
- List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size());
+ List<LocalVariable> retList = new ArrayList<>(variables.size());
Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) {
LocalVariable variable = iter.next();
@@ -255,7 +254,7 @@
} catch (JDWPException exc) {
throw exc.toJDIException();
}
- bytecodesRef = new SoftReference<byte[]>(bytecodes);
+ bytecodesRef = new SoftReference<>(bytecodes);
}
/*
* Arrays are always modifiable, so it is a little unsafe
@@ -285,19 +284,17 @@
}
List<Location> lineLocations = new ArrayList<Location>();
- Map<Integer, List<Location>> lineMapper = new HashMap<Integer, List<Location>>();
+ Map<Integer, List<Location>> lineMapper = new HashMap<>();
int lowestLine = -1;
int highestLine = -1;
SDE.LineStratum lastLineStratum = null;
- SDE.Stratum baseStratum =
- declaringType.stratum(SDE.BASE_STRATUM_NAME);
+ SDE.Stratum baseStratum = declaringType.stratum(SDE.BASE_STRATUM_NAME);
Iterator<Location> it = getBaseLocations().lineLocations.iterator();
while(it.hasNext()) {
LocationImpl loc = (LocationImpl)it.next();
int baseLineNumber = loc.lineNumber(baseStratum);
SDE.LineStratum lineStratum =
- stratum.lineStratum(declaringType,
- baseLineNumber);
+ stratum.lineStratum(declaringType, baseLineNumber);
if (lineStratum == null) {
// location not mapped in this stratum
@@ -320,10 +317,10 @@
}
loc.addStratumLineInfo(
- new StratumLineInfo(stratumID,
- lineNumber,
- lineStratum.sourceName(),
- lineStratum.sourcePath()));
+ new StratumLineInfo(stratumID,
+ lineNumber,
+ lineStratum.sourceName(),
+ lineStratum.sourcePath()));
// Add to the location list
lineLocations.add(loc);
@@ -339,10 +336,9 @@
}
}
- info = new SoftLocationXRefs(stratumID,
- lineMapper, lineLocations,
- lowestLine, highestLine);
- softOtherLocationXRefsRef = new SoftReference<SoftLocationXRefs>(info);
+ info = new SoftLocationXRefs(stratumID, lineMapper, lineLocations,
+ lowestLine, highestLine);
+ softOtherLocationXRefsRef = new SoftReference<>(info);
return info;
}
@@ -366,8 +362,8 @@
int count = lntab.lines.length;
- List<Location> lineLocations = new ArrayList<Location>(count);
- Map<Integer, List<Location>>lineMapper = new HashMap<Integer, List<Location>>();
+ List<Location> lineLocations = new ArrayList<>(count);
+ Map<Integer, List<Location>>lineMapper = new HashMap<>();
int lowestLine = -1;
int highestLine = -1;
for (int i = 0; i < count; i++) {
@@ -402,7 +398,7 @@
Integer key = lineNumber;
List<Location> mappedLocs = lineMapper.get(key);
if (mappedLocs == null) {
- mappedLocs = new ArrayList<Location>(1);
+ mappedLocs = new ArrayList<>(1);
lineMapper.put(key, mappedLocs);
}
mappedLocs.add(loc);
@@ -431,8 +427,8 @@
}
info = new SoftLocationXRefs(SDE.BASE_STRATUM_NAME,
- lineMapper, lineLocations,
- lowestLine, highestLine);
+ lineMapper, lineLocations,
+ lowestLine, highestLine);
softBaseLocationXRefsRef = new SoftReference<SoftLocationXRefs>(info);
return info;
}
@@ -454,7 +450,7 @@
// Get the number of slots used by argument variables
argSlotCount = vartab.argCnt;
int count = vartab.slots.length;
- List<LocalVariable> variables = new ArrayList<LocalVariable>(count);
+ List<LocalVariable> variables = new ArrayList<>(count);
for (int i=0; i<count; i++) {
JDWP.Method.VariableTable.SlotInfo si = vartab.slots[i];
@@ -533,13 +529,13 @@
}
List<LocalVariable> variables = (variablesRef == null) ? null :
- variablesRef.get();
+ variablesRef.get();
if (variables != null) {
return variables;
}
variables = getVariables1();
variables = Collections.unmodifiableList(variables);
- variablesRef = new SoftReference<List<LocalVariable>>(variables);
+ variablesRef = new SoftReference<>(variables);
return variables;
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ConnectorImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ConnectorImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,28 +25,30 @@
package com.sun.tools.jdi;
-import com.sun.tools.jdi.*;
-import com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.InternalException;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Map;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Map;
import java.util.ResourceBundle;
-import java.io.Serializable;
+
+import com.sun.jdi.InternalException;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.LaunchingConnector;
abstract class ConnectorImpl implements Connector {
- Map<String,Argument> defaultArguments = new java.util.LinkedHashMap<String,Argument>();
+
+ Map<String, Argument> defaultArguments = new LinkedHashMap<>();
// Used by BooleanArgument
static String trueString = null;
static String falseString;
public Map<String,Argument> defaultArguments() {
- Map<String,Argument> defaults = new java.util.LinkedHashMap<String,Argument>();
+ Map<String,Argument> defaults = new LinkedHashMap<>();
Collection<Argument> values = defaultArguments.values();
Iterator<Argument> iter = values.iterator();
@@ -145,7 +147,7 @@
}
@SuppressWarnings("serial") // JDK implementation class
- abstract class ArgumentImpl implements Connector.Argument, Cloneable, Serializable {
+ abstract class ArgumentImpl implements Connector.Argument, Cloneable {
private String name;
private String label;
private String description;
@@ -153,8 +155,7 @@
private boolean mustSpecify;
ArgumentImpl(String name, String label, String description,
- String value,
- boolean mustSpecify) {
+ String value, boolean mustSpecify) {
this.name = name;
this.label = label;
this.description = description;
@@ -312,7 +313,7 @@
}
try {
return isValid(Integer.decode(value).intValue());
- } catch(NumberFormatException exc) {
+ } catch (NumberFormatException exc) {
return false;
}
}
@@ -378,11 +379,10 @@
}
class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
- implements Connector.StringArgument {
+ implements Connector.StringArgument {
private static final long serialVersionUID = 7500484902692107464L;
StringArgumentImpl(String name, String label, String description,
- String value,
- boolean mustSpecify) {
+ String value, boolean mustSpecify) {
super(name, label, description, value, mustSpecify);
}
@@ -404,7 +404,7 @@
String value,
boolean mustSpecify, List<String> choices) {
super(name, label, description, value, mustSpecify);
- this.choices = Collections.unmodifiableList(new ArrayList<String>(choices));
+ this.choices = Collections.unmodifiableList(new ArrayList<>(choices));
}
/**
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/DoubleTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/DoubleTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.DoubleType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class DoubleTypeImpl extends PrimitiveTypeImpl implements DoubleType {
+
DoubleTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.DOUBLE);
}
@@ -40,5 +43,4 @@
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedDoubleValue());
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/DoubleValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/DoubleValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.DoubleValue;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class DoubleValueImpl extends PrimitiveValueImpl
implements DoubleValue {
private double value;
- DoubleValueImpl(VirtualMachine aVm,double aValue) {
+ DoubleValueImpl(VirtualMachine aVm, double aValue) {
super(aVm);
-
value = aValue;
}
@@ -73,31 +75,31 @@
}
public boolean booleanValue() {
- return(value == 0.0)?false:true;
+ return (value == 0.0 ? false : true);
}
public byte byteValue() {
- return(byte)value;
+ return (byte)value;
}
public char charValue() {
- return(char)value;
+ return (char)value;
}
public short shortValue() {
- return(short)value;
+ return (short)value;
}
public int intValue() {
- return(int)value;
+ return (int)value;
}
public long longValue() {
- return(long)value;
+ return (long)value;
}
public float floatValue() {
- return(float)value;
+ return (float)value;
}
public double doubleValue() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,19 +25,20 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.util.LinkedList;
+
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VirtualMachine;
import com.sun.jdi.event.EventQueue;
import com.sun.jdi.event.EventSet;
-import java.util.*;
-
public class EventQueueImpl extends MirrorImpl implements EventQueue {
/*
* Note this is not a synchronized list. Iteration/update should be
* protected through the 'this' monitor.
*/
- LinkedList<EventSet> eventSets = new LinkedList<EventSet>();
+ LinkedList<EventSet> eventSets = new LinkedList<>();
TargetVM target;
boolean closed = false;
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 +25,41 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import com.sun.jdi.request.*;
-import com.sun.tools.jdi.JDWP;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
-import java.util.*;
+import com.sun.jdi.Field;
+import com.sun.jdi.Location;
+import com.sun.jdi.NativeMethodException;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.request.AccessWatchpointRequest;
+import com.sun.jdi.request.BreakpointRequest;
+import com.sun.jdi.request.ClassPrepareRequest;
+import com.sun.jdi.request.ClassUnloadRequest;
+import com.sun.jdi.request.DuplicateRequestException;
+import com.sun.jdi.request.EventRequest;
+import com.sun.jdi.request.EventRequestManager;
+import com.sun.jdi.request.ExceptionRequest;
+import com.sun.jdi.request.InvalidRequestStateException;
+import com.sun.jdi.request.MethodEntryRequest;
+import com.sun.jdi.request.MethodExitRequest;
+import com.sun.jdi.request.ModificationWatchpointRequest;
+import com.sun.jdi.request.MonitorContendedEnterRequest;
+import com.sun.jdi.request.MonitorContendedEnteredRequest;
+import com.sun.jdi.request.MonitorWaitRequest;
+import com.sun.jdi.request.MonitorWaitedRequest;
+import com.sun.jdi.request.StepRequest;
+import com.sun.jdi.request.ThreadDeathRequest;
+import com.sun.jdi.request.ThreadStartRequest;
+import com.sun.jdi.request.VMDeathRequest;
+import com.sun.jdi.request.WatchpointRequest;
/**
* This interface is used to create and remove Breakpoints, Watchpoints,
@@ -41,7 +71,7 @@
// and List[] requestLists. The generic array is not supported.
@SuppressWarnings({"unchecked", "rawtypes"})
class EventRequestManagerImpl extends MirrorImpl
- implements EventRequestManager
+ implements EventRequestManager
{
private final List<? extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0;
@@ -102,7 +132,6 @@
super(EventRequestManagerImpl.this.vm);
}
-
/*
* Override superclass back to default equality
*/
@@ -222,7 +251,7 @@
*/
private Map<Object, Object> getProperties() {
if (clientProperties == null) {
- clientProperties = new HashMap<Object, Object>(2);
+ clientProperties = new HashMap<>(2);
}
return clientProperties;
}
@@ -340,7 +369,7 @@
}
class ClassPrepareRequestImpl extends ClassVisibleEventRequestImpl
- implements ClassPrepareRequest {
+ implements ClassPrepareRequest {
ClassPrepareRequestImpl() {
requestList().add(this);
}
@@ -371,7 +400,7 @@
}
class ClassUnloadRequestImpl extends ClassVisibleEventRequestImpl
- implements ClassUnloadRequest {
+ implements ClassUnloadRequest {
ClassUnloadRequestImpl() {
requestList().add(this);
}
@@ -386,7 +415,7 @@
}
class ExceptionRequestImpl extends ClassVisibleEventRequestImpl
- implements ExceptionRequest {
+ implements ExceptionRequest {
ReferenceType exception = null;
boolean caught = true;
boolean uncaught = true;
@@ -431,7 +460,7 @@
}
class MethodEntryRequestImpl extends ClassVisibleEventRequestImpl
- implements MethodEntryRequest {
+ implements MethodEntryRequest {
MethodEntryRequestImpl() {
requestList().add(this);
}
@@ -446,7 +475,7 @@
}
class MethodExitRequestImpl extends ClassVisibleEventRequestImpl
- implements MethodExitRequest {
+ implements MethodExitRequest {
MethodExitRequestImpl() {
if (methodExitEventCmd == 0) {
/*
@@ -478,7 +507,7 @@
}
class MonitorContendedEnterRequestImpl extends ClassVisibleEventRequestImpl
- implements MonitorContendedEnterRequest {
+ implements MonitorContendedEnterRequest {
MonitorContendedEnterRequestImpl() {
requestList().add(this);
}
@@ -493,7 +522,7 @@
}
class MonitorContendedEnteredRequestImpl extends ClassVisibleEventRequestImpl
- implements MonitorContendedEnteredRequest {
+ implements MonitorContendedEnteredRequest {
MonitorContendedEnteredRequestImpl() {
requestList().add(this);
}
@@ -523,7 +552,7 @@
}
class MonitorWaitedRequestImpl extends ClassVisibleEventRequestImpl
- implements MonitorWaitedRequest {
+ implements MonitorWaitedRequest {
MonitorWaitedRequestImpl() {
requestList().add(this);
}
@@ -538,7 +567,7 @@
}
class StepRequestImpl extends ClassVisibleEventRequestImpl
- implements StepRequest {
+ implements StepRequest {
ThreadReferenceImpl thread;
int size;
int depth;
@@ -620,7 +649,7 @@
}
class ThreadDeathRequestImpl extends ThreadVisibleEventRequestImpl
- implements ThreadDeathRequest {
+ implements ThreadDeathRequest {
ThreadDeathRequestImpl() {
requestList().add(this);
}
@@ -635,7 +664,7 @@
}
class ThreadStartRequestImpl extends ThreadVisibleEventRequestImpl
- implements ThreadStartRequest {
+ implements ThreadStartRequest {
ThreadStartRequestImpl() {
requestList().add(this);
}
@@ -650,7 +679,7 @@
}
abstract class WatchpointRequestImpl extends ClassVisibleEventRequestImpl
- implements WatchpointRequest {
+ implements WatchpointRequest {
final Field field;
WatchpointRequestImpl(Field field) {
@@ -667,7 +696,7 @@
}
class AccessWatchpointRequestImpl extends WatchpointRequestImpl
- implements AccessWatchpointRequest {
+ implements AccessWatchpointRequest {
AccessWatchpointRequestImpl(Field field) {
super(field);
requestList().add(this);
@@ -683,7 +712,7 @@
}
class ModificationWatchpointRequestImpl extends WatchpointRequestImpl
- implements ModificationWatchpointRequest {
+ implements ModificationWatchpointRequest {
ModificationWatchpointRequestImpl(Field field) {
super(field);
requestList().add(this);
@@ -699,7 +728,7 @@
}
class VMDeathRequestImpl extends EventRequestImpl
- implements VMDeathRequest {
+ implements VMDeathRequest {
VMDeathRequestImpl() {
requestList().add(this);
}
@@ -908,8 +937,7 @@
}
public List<MethodExitRequest> methodExitRequests() {
- return (List<MethodExitRequest>)unmodifiableRequestList(
- EventRequestManagerImpl.methodExitEventCmd);
+ return (List<MethodExitRequest>)unmodifiableRequestList(EventRequestManagerImpl.methodExitEventCmd);
}
public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() {
@@ -951,9 +979,7 @@
return null;
}
- private List<? extends EventRequest> requestList(int eventCmd) {
+ private List<? extends EventRequest> requestList(int eventCmd) {
return requestLists[eventCmd];
}
-
}
-
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 +25,48 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import com.sun.jdi.event.*;
-import com.sun.jdi.request.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Spliterator;
+import java.util.Spliterators;
-import java.util.*;
+import com.sun.jdi.Field;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.Locatable;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.AccessWatchpointEvent;
+import com.sun.jdi.event.BreakpointEvent;
+import com.sun.jdi.event.ClassPrepareEvent;
+import com.sun.jdi.event.ClassUnloadEvent;
+import com.sun.jdi.event.Event;
+import com.sun.jdi.event.EventIterator;
+import com.sun.jdi.event.EventSet;
+import com.sun.jdi.event.ExceptionEvent;
+import com.sun.jdi.event.MethodEntryEvent;
+import com.sun.jdi.event.MethodExitEvent;
+import com.sun.jdi.event.ModificationWatchpointEvent;
+import com.sun.jdi.event.MonitorContendedEnterEvent;
+import com.sun.jdi.event.MonitorContendedEnteredEvent;
+import com.sun.jdi.event.MonitorWaitEvent;
+import com.sun.jdi.event.MonitorWaitedEvent;
+import com.sun.jdi.event.StepEvent;
+import com.sun.jdi.event.ThreadDeathEvent;
+import com.sun.jdi.event.ThreadStartEvent;
+import com.sun.jdi.event.VMDeathEvent;
+import com.sun.jdi.event.VMDisconnectEvent;
+import com.sun.jdi.event.VMStartEvent;
+import com.sun.jdi.event.WatchpointEvent;
+import com.sun.jdi.request.EventRequest;
+
enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT};
/*
@@ -186,7 +223,7 @@
}
abstract class LocatableEventImpl extends ThreadedEventImpl
- implements Locatable {
+ implements Locatable {
private Location location;
LocatableEventImpl(JDWP.Event.Composite.Events.EventsCommon evt,
@@ -215,7 +252,7 @@
}
class BreakpointEventImpl extends LocatableEventImpl
- implements BreakpointEvent {
+ implements BreakpointEvent {
BreakpointEventImpl(JDWP.Event.Composite.Events.Breakpoint evt) {
super(evt, evt.requestID, evt.thread, evt.location);
}
@@ -236,7 +273,7 @@
}
class MethodEntryEventImpl extends LocatableEventImpl
- implements MethodEntryEvent {
+ implements MethodEntryEvent {
MethodEntryEventImpl(JDWP.Event.Composite.Events.MethodEntry evt) {
super(evt, evt.requestID, evt.thread, evt.location);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FieldImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FieldImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,16 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.Field;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class FieldImpl extends TypeComponentImpl
implements Field, ValueContainer {
FieldImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
- long ref,
- String name, String signature,
+ long ref, String name, String signature,
String genericSignature, int modifiers) {
super(vm, declaringType, ref, name, signature,
genericSignature, modifiers);
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FloatTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FloatTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.FloatType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class FloatTypeImpl extends PrimitiveTypeImpl implements FloatType {
+
FloatTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.FLOAT);
}
@@ -40,5 +43,4 @@
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedFloatValue());
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FloatValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FloatValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.FloatValue;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class FloatValueImpl extends PrimitiveValueImpl
implements FloatValue {
private float value;
- FloatValueImpl(VirtualMachine aVm,float aValue) {
+ FloatValueImpl(VirtualMachine aVm, float aValue) {
super(aVm);
-
value = aValue;
}
@@ -73,27 +75,27 @@
}
public boolean booleanValue() {
- return(value == 0.0)?false:true;
+ return (value == 0.0 ? false : true);
}
public byte byteValue() {
- return(byte)value;
+ return (byte)value;
}
public char charValue() {
- return(char)value;
+ return (char)value;
}
public short shortValue() {
- return(short)value;
+ return (short)value;
}
public int intValue() {
- return(int)value;
+ return (int)value;
}
public long longValue() {
- return(long)value;
+ return (long)value;
}
public float floatValue() {
@@ -101,7 +103,7 @@
}
public double doubleValue() {
- return(double)value;
+ return value;
}
byte checkedByteValue() throws InvalidTypeException {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -30,8 +30,12 @@
import com.sun.jdi.Bootstrap;
import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.connect.spi.TransportService;
/*
* An AttachingConnector to attach to a running VM using any
@@ -60,11 +64,11 @@
{
transportService = ts;
transport = new Transport() {
- public String name() {
- // delegate name to the transport service
- return transportService.name();
- }
- };
+ public String name() {
+ // delegate name to the transport service
+ return transportService.name();
+ }
+ };
if (addAddressArgument) {
addStringArgument(
@@ -75,7 +79,6 @@
true);
}
-
addIntegerArgument(
ARG_TIMEOUT,
getString("generic_attaching.timeout.label"),
@@ -122,8 +125,7 @@
* of the target VM is specified by the <code>address</code> connector
* argument.
*/
- public VirtualMachine
- attach(Map<String,? extends Connector.Argument> args)
+ public VirtualMachine attach(Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException
{
String address = argument(ARG_ADDRESS, args).value();
@@ -141,5 +143,4 @@
public Transport transport() {
return transport;
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericListeningConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericListeningConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, 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
@@ -25,15 +25,19 @@
package com.sun.tools.jdi;
-import java.util.Map;
+import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.ArrayList;
-import java.io.IOException;
+import java.util.Map;
import com.sun.jdi.Bootstrap;
import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.ListeningConnector;
+import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.connect.spi.TransportService;
/*
* A ListeningConnector to listen for connections from target VM
@@ -81,7 +85,7 @@
false,
0, Integer.MAX_VALUE);
- listenMap = new HashMap<Map<String,? extends Connector.Argument>,TransportService.ListenKey>(10);
+ listenMap = new HashMap<Map<String, ? extends Connector.Argument>, TransportService.ListenKey>(10);
}
/**
@@ -107,7 +111,7 @@
TransportService.ListenKey listener = listenMap.get(args);
if (listener != null) {
throw new IllegalConnectorArgumentsException("Already listening",
- new ArrayList<String>(args.keySet()));
+ new ArrayList<>(args.keySet()));
}
listener = transportService.startListening(address);
@@ -116,27 +120,27 @@
}
public String
- startListening(Map<String,? extends Connector.Argument> args)
+ startListening(Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException
{
String address = argument(ARG_ADDRESS, args).value();
return startListening(address, args);
}
- public void stopListening(Map<String,? extends Connector.Argument> args)
+ public void stopListening(Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException
{
TransportService.ListenKey listener = listenMap.get(args);
if (listener == null) {
throw new IllegalConnectorArgumentsException("Not listening",
- new ArrayList<String>(args.keySet()));
+ new ArrayList<>(args.keySet()));
}
transportService.stopListening(listener);
listenMap.remove(args);
}
public VirtualMachine
- accept(Map<String,? extends Connector.Argument> args)
+ accept(Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException
{
String ts = argument(ARG_TIMEOUT, args).value();
@@ -179,5 +183,4 @@
public Transport transport() {
return transport;
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/IntegerTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/IntegerTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.IntegerType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class IntegerTypeImpl extends PrimitiveTypeImpl implements IntegerType {
+
IntegerTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.INT);
}
@@ -40,5 +43,4 @@
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedIntValue());
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/IntegerValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/IntegerValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,15 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.IntegerValue;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class IntegerValueImpl extends PrimitiveValueImpl
implements IntegerValue {
private int value;
- IntegerValueImpl(VirtualMachine aVm,int aValue) {
+ IntegerValueImpl(VirtualMachine aVm, int aValue) {
super(aVm);
-
value = aValue;
}
@@ -67,19 +69,19 @@
}
public boolean booleanValue() {
- return(value == 0)?false:true;
+ return (value == 0 ? false : true);
}
public byte byteValue() {
- return(byte)value;
+ return (byte)value;
}
public char charValue() {
- return(char)value;
+ return (char)value;
}
public short shortValue() {
- return(short)value;
+ return (short)value;
}
public int intValue() {
@@ -87,15 +89,15 @@
}
public long longValue() {
- return(long)value;
+ return value;
}
public float floatValue() {
- return(float)value;
+ return value;
}
public double doubleValue() {
- return(double)value;
+ return value;
}
byte checkedByteValue() throws InvalidTypeException {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,13 +25,16 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
-import java.util.List;
+import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Set;
-import java.lang.ref.SoftReference;
+import java.util.List;
+
+import com.sun.jdi.ClassType;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.VirtualMachine;
final public class InterfaceTypeImpl extends InvokableTypeImpl
implements InterfaceType {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InternalEventHandler.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InternalEventHandler.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,17 +25,24 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import com.sun.jdi.event.*;
-import java.util.*;
+import com.sun.jdi.ClassNotPreparedException;
+import com.sun.jdi.InconsistentDebugInfoException;
+import com.sun.jdi.ObjectCollectedException;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VMOutOfMemoryException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.event.ClassPrepareEvent;
+import com.sun.jdi.event.ClassUnloadEvent;
+import com.sun.jdi.event.Event;
+import com.sun.jdi.event.EventIterator;
+import com.sun.jdi.event.EventSet;
public class InternalEventHandler implements Runnable
{
EventQueueImpl queue;
VirtualMachineImpl vm;
- InternalEventHandler(VirtualMachineImpl vm, EventQueueImpl queue)
- {
+ InternalEventHandler(VirtualMachineImpl vm, EventQueueImpl queue) {
this.vm = vm;
this.queue = queue;
Thread thread = new Thread(vm.threadGroupForJDI(), this,
@@ -73,7 +80,6 @@
cpEvent.referenceType().name());
}
}
-
}
/*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +25,12 @@
package com.sun.tools.jdi;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.ClassType;
import com.sun.jdi.IncompatibleThreadStateException;
@@ -34,18 +40,15 @@
import com.sun.jdi.Method;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VMCannotBeModifiedException;
import com.sun.jdi.Value;
import com.sun.jdi.VirtualMachine;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* A supertype for ReferenceTypes allowing method invocations
*/
abstract class InvokableTypeImpl extends ReferenceTypeImpl {
+
/**
* The invocation result wrapper
* It is necessary because both ClassType and InterfaceType
@@ -74,7 +77,7 @@
* a member of this type, if the size of the argument list
* does not match the number of declared arguments for the method, or
* if the method is not static or is a static initializer.
- * @throws {@link InvalidTypeException} if any argument in the
+ * @throws InvalidTypeException if any argument in the
* argument list is not assignable to the corresponding method argument
* type.
* @throws ClassNotLoadedException if any argument type has not yet been loaded
@@ -240,7 +243,7 @@
* Cache the values of args when TRACE_SENDS is enabled, for later printing.
* If not cached, printing causes a remote call while synchronized, and deadlock.
*/
- if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {
+ if ((vm.traceFlags & VirtualMachine.TRACE_SENDS) != 0) {
for (ValueImpl arg: args) {
arg.toString();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/JDWPException.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/JDWPException.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,10 +24,20 @@
*/
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+
+import com.sun.jdi.ClassNotPreparedException;
+import com.sun.jdi.InconsistentDebugInfoException;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidModuleException;
+import com.sun.jdi.InvalidStackFrameException;
+import com.sun.jdi.ObjectCollectedException;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VMOutOfMemoryException;
class JDWPException extends Exception {
+
private static final long serialVersionUID = -6321344442751299874L;
+
short errorCode;
JDWPException(short errorCode) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/JNITypeParser.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/JNITypeParser.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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 @@
package com.sun.tools.jdi;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
public class JNITypeParser {
@@ -112,7 +112,7 @@
private synchronized List<String> signatureList() {
if (signatureList == null) {
- signatureList = new ArrayList<String>(10);
+ signatureList = new ArrayList<>(10);
String elem;
currentIndex = 0;
@@ -131,7 +131,7 @@
private synchronized List<String> typeNameList() {
if (typeNameList == null) {
- typeNameList = new ArrayList<String>(10);
+ typeNameList = new ArrayList<>(10);
String elem;
currentIndex = 0;
@@ -235,7 +235,6 @@
default:
throw new IllegalArgumentException(
"Invalid JNI signature character '" + key + "'");
-
}
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LineInfo.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LineInfo.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 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
@@ -25,7 +25,7 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.AbsentInformationException;
interface LineInfo {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocalVariableImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocalVariableImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,7 +24,16 @@
*/
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.LocalVariable;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class LocalVariableImpl extends MirrorImpl
implements LocalVariable, ValueContainer
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocationImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocationImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
-import java.util.*;
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.VirtualMachine;
public class LocationImpl extends MirrorImpl implements Location {
private final ReferenceTypeImpl declaringType;
@@ -37,10 +39,8 @@
private LineInfo baseLineInfo = null;
private LineInfo otherLineInfo = null;
- LocationImpl(VirtualMachine vm,
- Method method, long codeIndex) {
+ LocationImpl(VirtualMachine vm, Method method, long codeIndex) {
super(vm);
-
this.method = method;
this.codeIndex = method.isNative()? -1 : codeIndex;
this.declaringType = (ReferenceTypeImpl)method.declaringType();
@@ -123,8 +123,7 @@
/* compute the line info */
MethodImpl methodImpl = (MethodImpl)method();
- lineInfo = methodImpl.codeIndexToLineInfo(stratum,
- codeIndex());
+ lineInfo = methodImpl.codeIndexToLineInfo(stratum, codeIndex());
/* cache it */
addBaseLineInfo(lineInfo);
@@ -142,8 +141,7 @@
/* check if there is cached info to use */
lineInfo = otherLineInfo; // copy because of concurrency
- if (lineInfo != null &&
- stratum.id().equals(lineInfo.liStratum())) {
+ if (lineInfo != null && stratum.id().equals(lineInfo.liStratum())) {
return lineInfo;
}
@@ -159,8 +157,7 @@
} else {
/* find best match */
MethodImpl methodImpl = (MethodImpl)method();
- lineInfo = methodImpl.codeIndexToLineInfo(stratum,
- codeIndex());
+ lineInfo = methodImpl.codeIndexToLineInfo(stratum, codeIndex());
}
/* cache it */
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LockObject.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LockObject.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,11 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
/**
* This class is used by the back end to do thread synchronization.
* We don't want to use java.lang.Object(s) for two reasons: we can't
* filter them out, and this class should use less heap.
*/
-public class LockObject
-{
+public class LockObject {
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LongTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LongTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.LongType;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public class LongTypeImpl extends PrimitiveTypeImpl implements LongType {
+
LongTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.LONG);
}
@@ -40,5 +43,4 @@
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedLongValue());
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LongValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LongValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.LongValue;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class LongValueImpl extends PrimitiveValueImpl
implements LongValue {
private long value;
- LongValueImpl(VirtualMachine aVm,long aValue) {
+ LongValueImpl(VirtualMachine aVm, long aValue) {
super(aVm);
-
value = aValue;
}
@@ -73,23 +75,23 @@
}
public boolean booleanValue() {
- return(value == 0)?false:true;
+ return (value == 0 ? false : true);
}
public byte byteValue() {
- return(byte)value;
+ return (byte)value;
}
public char charValue() {
- return(char)value;
+ return (char)value;
}
public short shortValue() {
- return(short)value;
+ return (short)value;
}
public int intValue() {
- return(int)value;
+ return (int)value;
}
public long longValue() {
@@ -97,11 +99,11 @@
}
public float floatValue() {
- return(float)value;
+ return value;
}
public double doubleValue() {
- return(double)value;
+ return value;
}
byte checkedByteValue() throws InvalidTypeException {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,30 +25,39 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import java.util.ArrayList;
import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Comparator;
+
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ArrayReference;
+import com.sun.jdi.ArrayType;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.Type;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
public abstract class MethodImpl extends TypeComponentImpl
- implements Method {
+ implements Method
+{
private JNITypeParser signatureParser;
+
abstract int argSlotCount() throws AbsentInformationException;
abstract List<Location> allLineLocations(SDE.Stratum stratum,
- String sourceName)
- throws AbsentInformationException;
+ String sourceName)
+ throws AbsentInformationException;
abstract List<Location> locationsOfLine(SDE.Stratum stratum,
- String sourceName,
- int lineNumber)
- throws AbsentInformationException;
+ String sourceName,
+ int lineNumber)
+ throws AbsentInformationException;
MethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
- long ref,
- String name, String signature,
+ long ref, String name, String signature,
String genericSignature, int modifiers) {
super(vm, declaringType, ref, name, signature,
genericSignature, modifiers);
@@ -62,8 +71,7 @@
String signature,
String genericSignature,
int modifiers) {
- if ((modifiers &
- (VMModifiers.NATIVE | VMModifiers.ABSTRACT)) != 0) {
+ if ((modifiers & (VMModifiers.NATIVE | VMModifiers.ABSTRACT)) != 0) {
return new NonConcreteMethodImpl(vm, declaringType, ref,
name, signature,
genericSignature,
@@ -92,27 +100,26 @@
}
public final List<Location> allLineLocations()
- throws AbsentInformationException {
+ throws AbsentInformationException {
return allLineLocations(vm.getDefaultStratum(), null);
}
public List<Location> allLineLocations(String stratumID,
- String sourceName)
- throws AbsentInformationException {
- return allLineLocations(declaringType.stratum(stratumID),
- sourceName);
+ String sourceName)
+ throws AbsentInformationException {
+ return allLineLocations(declaringType.stratum(stratumID), sourceName);
}
public final List<Location> locationsOfLine(int lineNumber)
- throws AbsentInformationException {
+ throws AbsentInformationException {
return locationsOfLine(vm.getDefaultStratum(),
null, lineNumber);
}
public List<Location> locationsOfLine(String stratumID,
- String sourceName,
- int lineNumber)
- throws AbsentInformationException {
+ String sourceName,
+ int lineNumber)
+ throws AbsentInformationException {
return locationsOfLine(declaringType.stratum(stratumID),
sourceName, lineNumber);
}
@@ -122,8 +129,7 @@
if (stratum.isJava()) {
return new BaseLineInfo(-1, declaringType);
} else {
- return new StratumLineInfo(stratum.id(), -1,
- null, null);
+ return new StratumLineInfo(stratum.id(), -1, null, null);
}
}
@@ -164,7 +170,7 @@
public List<Type> argumentTypes() throws ClassNotLoadedException {
int size = argumentSignatures().size();
- ArrayList<Type> types = new ArrayList<Type>(size);
+ List<Type> types = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
Type type = argumentType(i);
types.add(type);
@@ -177,8 +183,7 @@
ReferenceTypeImpl declaringType = (ReferenceTypeImpl)declaringType();
int rc = declaringType.compareTo(method.declaringType());
if (rc == 0) {
- rc = declaringType.indexOf(this) -
- declaringType.indexOf(method);
+ rc = declaringType.indexOf(this) - declaringType.indexOf(method);
}
return rc;
}
@@ -227,7 +232,6 @@
}
}
-
/*
* A container class for the return value to allow
* proper type-checking.
@@ -300,7 +304,6 @@
throws ClassNotLoadedException, InvalidTypeException {
List<Type> paramTypes = this.argumentTypes();
ArrayType lastParamType = (ArrayType)paramTypes.get(paramTypes.size() - 1);
- Type componentType = lastParamType.componentType();
int argCount = arguments.size();
int paramCount = paramTypes.size();
if (argCount < paramCount - 1) {
@@ -365,7 +368,7 @@
List<Value> validateAndPrepareArgumentsForInvoke(List<? extends Value> origArguments)
throws ClassNotLoadedException, InvalidTypeException {
- List<Value> arguments = new ArrayList<Value>(origArguments);
+ List<Value> arguments = new ArrayList<>(origArguments);
if (isVarArgs()) {
handleVarArgs(arguments);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MirrorImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MirrorImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,10 +25,13 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
import java.util.Collection;
import java.util.Iterator;
+import com.sun.jdi.Mirror;
+import com.sun.jdi.VMMismatchException;
+import com.sun.jdi.VirtualMachine;
+
abstract class MirrorImpl extends Object implements Mirror {
protected VirtualMachineImpl vm;
@@ -92,6 +95,7 @@
}
}
}
+
/**
* Allow null mirrors.
* Throw VMMismatchException on wrong VM.
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ModuleReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ModuleReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -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,9 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ModuleReference;
+import com.sun.jdi.VirtualMachine;
class ModuleReferenceImpl extends ObjectReferenceImpl implements ModuleReference {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,12 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidStackFrameException;
+import com.sun.jdi.MonitorInfo;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
public class MonitorInfoImpl extends MirrorImpl
implements MonitorInfo, ThreadListener {
@@ -37,7 +42,7 @@
ObjectReference monitor;
ThreadReference thread;
- int stack_depth;
+ int stack_depth;
MonitorInfoImpl(VirtualMachine vm, ObjectReference mon,
ThreadReferenceImpl thread, int dpth) {
@@ -48,7 +53,6 @@
thread.addListener(this);
}
-
/*
* ThreadListener implementation
* Must be synchronized since we must protect against
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/NonConcreteMethodImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/NonConcreteMethodImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,15 +25,14 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Collections;
+
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.LocalVariable;
+import com.sun.jdi.Location;
+import com.sun.jdi.VirtualMachine;
/**
* Represents non-concrete (that is, native or abstract) methods.
@@ -45,10 +44,9 @@
NonConcreteMethodImpl(VirtualMachine vm,
ReferenceTypeImpl declaringType,
- long ref,
- String name, String signature,
- String genericSignature, int modifiers) {
-
+ long ref, String name, String signature,
+ String genericSignature, int modifiers)
+ {
// The generic signature is set when this is created
super(vm, declaringType, ref, name, signature,
genericSignature, modifiers);
@@ -65,25 +63,25 @@
}
public List<Location> allLineLocations(String stratumID,
- String sourceName) {
- return new ArrayList<Location>(0);
+ String sourceName) {
+ return new ArrayList<>(0);
}
public List<Location> allLineLocations(SDE.Stratum stratum,
- String sourceName) {
- return new ArrayList<Location>(0);
+ String sourceName) {
+ return new ArrayList<>(0);
}
public List<Location> locationsOfLine(String stratumID,
- String sourceName,
- int lineNumber) {
- return new ArrayList<Location>(0);
+ String sourceName,
+ int lineNumber) {
+ return new ArrayList<>(0);
}
public List<Location> locationsOfLine(SDE.Stratum stratum,
- String sourceName,
- int lineNumber) {
- return new ArrayList<Location>(0);
+ String sourceName,
+ int lineNumber) {
+ return new ArrayList<>(0);
}
public Location locationOfCodeIndex(long codeIndex) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,31 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
-import java.util.*;
-import java.util.ArrayList;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.Field;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Type;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
public class ObjectReferenceImpl extends ValueImpl
- implements ObjectReference, VMListener {
-
+ implements ObjectReference, VMListener
+{
protected long ref;
private ReferenceType type = null;
private int gcDisableCount = 0;
@@ -161,7 +178,7 @@
}
public Value getValue(Field sig) {
- List<Field> list = new ArrayList<Field>(1);
+ List<Field> list = new ArrayList<>(1);
list.add(sig);
Map<Field, Value> map = getValues(list);
return map.get(sig);
@@ -170,12 +187,12 @@
public Map<Field,Value> getValues(List<? extends Field> theFields) {
validateMirrors(theFields);
- List<Field> staticFields = new ArrayList<Field>(0);
+ List<Field> staticFields = new ArrayList<>(0);
int size = theFields.size();
- List<Field> instanceFields = new ArrayList<Field>(size);
+ List<Field> instanceFields = new ArrayList<>(size);
- for (int i=0; i<size; i++) {
- Field field = (Field)theFields.get(i);
+ for (int i = 0; i < size; i++) {
+ Field field = theFields.get(i);
// Make sure the field is valid
((ReferenceTypeImpl)referenceType()).validateFieldAccess(field);
@@ -299,9 +316,6 @@
void validateClassMethodInvocation(Method method, int options)
throws InvalidTypeException,
InvocationException {
-
- ClassTypeImpl clazz = invokableReferenceType(method);
-
/*
* Method must be a non-constructor
*/
@@ -317,30 +331,6 @@
throw new IllegalArgumentException("Abstract method");
}
}
-
- /*
- * Get the class containing the method that will be invoked.
- * This class is needed only for proper validation of the
- * method argument types.
- */
- ClassTypeImpl invokedClass;
- if (isNonVirtual(options)) {
- // No overrides in non-virtual invokes
- invokedClass = clazz;
- } else {
- /*
- * For virtual invokes, find any override of the method.
- * Since we are looking for a method with a real body, we
- * don't need to bother with interfaces/abstract methods.
- */
- Method invoker = clazz.concreteMethodByName(method.name(),
- method.signature());
- // invoker is supposed to be non-null under normal circumstances
- invokedClass = (ClassTypeImpl)invoker.declaringType();
- }
- /* The above code is left over from previous versions.
- * We haven't had time to divine the intent. jjh, 7/31/2003
- */
}
void validateIfaceMethodInvocation(Method method, int options)
@@ -620,7 +610,6 @@
}
}
-
public String toString() {
return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")";
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObsoleteMethodImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObsoleteMethodImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,20 +25,19 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.util.ArrayList;
+import java.util.List;
-import java.util.List;
-import java.util.ArrayList;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
/**
* Represents methods which have changed when the class was redefined.
*/
public class ObsoleteMethodImpl extends NonConcreteMethodImpl {
- private Location location = null;
-
- ObsoleteMethodImpl(VirtualMachine vm,
- ReferenceTypeImpl declaringType) {
+ ObsoleteMethodImpl(VirtualMachine vm, ReferenceTypeImpl declaringType) {
super(vm, declaringType, 0, "<obsolete>", "", null, 0);
}
@@ -55,11 +54,11 @@
}
public List<String> argumentTypeNames() {
- return new ArrayList<String>();
+ return new ArrayList<>();
}
public List<String> argumentSignatures() {
- return new ArrayList<String>();
+ return new ArrayList<>();
}
Type argumentType(int index) throws ClassNotLoadedException {
@@ -67,7 +66,6 @@
}
public List<Type> argumentTypes() throws ClassNotLoadedException {
- return new ArrayList<Type>();
+ return new ArrayList<>();
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/Packet.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/Packet.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,6 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
import java.io.IOException;
public class Packet extends Object {
@@ -116,15 +115,13 @@
return p;
}
- Packet()
- {
+ Packet() {
id = uniqID();
flags = NoFlags;
data = nullData;
}
- static synchronized private int uniqID()
- {
+ static synchronized private int uniqID() {
/*
* JDWP spec does not require this id to be sequential and
* increasing, but our implementation does. See
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PacketStream.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PacketStream.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,27 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import java.util.*;
import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.jdi.BooleanValue;
+import com.sun.jdi.ByteValue;
+import com.sun.jdi.CharValue;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.DoubleValue;
+import com.sun.jdi.Field;
+import com.sun.jdi.FloatValue;
+import com.sun.jdi.IntegerValue;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Location;
+import com.sun.jdi.LongValue;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.ShortValue;
+import com.sun.jdi.Value;
class PacketStream {
final VirtualMachineImpl vm;
@@ -292,8 +310,6 @@
}
}
-
-
/**
* Read byte represented as one bytes.
*/
@@ -407,9 +423,9 @@
case 8:
return readLong();
case 4:
- return (long)readInt();
+ return readInt();
case 2:
- return (long)readShort();
+ return readShort();
default:
throw new UnsupportedOperationException("JDWP: ID size not supported: " + size);
}
@@ -596,7 +612,7 @@
List<Value> readArrayRegion() {
byte typeKey = readByte();
int length = readInt();
- List<Value> list = new ArrayList<Value>(length);
+ List<Value> list = new ArrayList<>(length);
boolean gettingObjects = isObjectTag(typeKey);
for (int i = 0; i < length; i++) {
/*
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PrimitiveTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PrimitiveTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,10 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveType;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
abstract class PrimitiveTypeImpl extends TypeImpl implements PrimitiveType {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PrimitiveValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PrimitiveValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 +25,16 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.BooleanValue;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.VirtualMachine;
public abstract class PrimitiveValueImpl extends ValueImpl
- implements PrimitiveValue {
-
+ implements PrimitiveValue
+{
PrimitiveValueImpl(VirtualMachine aVm) {
super(aVm);
}
@@ -92,14 +97,14 @@
}
ValueImpl prepareForAssignmentTo(ValueContainer destination)
- throws InvalidTypeException {
-
+ throws InvalidTypeException
+ {
return convertForAssignmentTo(destination);
}
ValueImpl convertForAssignmentTo(ValueContainer destination)
- throws InvalidTypeException {
-
+ throws InvalidTypeException
+ {
/*
* TO DO: Centralize JNI signature knowledge
*/
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,14 +26,17 @@
package com.sun.tools.jdi;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.Properties;
import com.sun.jdi.Bootstrap;
import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.connect.spi.TransportService;
/*
* An AttachingConnector that connects to a debuggee by specifying the process
@@ -77,7 +80,6 @@
};
}
-
/**
* Attach to a target VM using the specified address and Connector arguments.
*/
@@ -162,5 +164,4 @@
}
return transport;
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,14 +25,18 @@
package com.sun.tools.jdi;
-import com.sun.tools.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
import com.sun.jdi.VirtualMachine;
-import java.util.Map;
-import java.io.IOException;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.VMStartException;
+import com.sun.jdi.connect.spi.TransportService;
-public class RawCommandLineLauncher extends AbstractLauncher implements LaunchingConnector {
+public class RawCommandLineLauncher extends AbstractLauncher {
static private final String ARG_COMMAND = "command";
static private final String ARG_ADDRESS = "address";
@@ -53,10 +57,9 @@
super();
try {
- @SuppressWarnings("deprecation")
- Object o =
- Class.forName("com.sun.tools.jdi.SharedMemoryTransportService").newInstance();
- transportService = (TransportService)o;
+ transportService = (TransportService)Class.
+ forName("com.sun.tools.jdi.SharedMemoryTransportService").
+ getDeclaredConstructor().newInstance();
transport = new Transport() {
public String name() {
return "dt_shmem";
@@ -65,7 +68,9 @@
} catch (ClassNotFoundException |
UnsatisfiedLinkError |
InstantiationException |
- IllegalAccessException x) {
+ InvocationTargetException |
+ IllegalAccessException |
+ NoSuchMethodException x) {
};
if (transportService == null) {
@@ -100,13 +105,12 @@
public VirtualMachine
- launch(Map<String,? extends Connector.Argument> arguments)
+ launch(Map<String, ? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException,
VMStartException
{
String command = argument(ARG_COMMAND, arguments).value();
String address = argument(ARG_ADDRESS, arguments).value();
-
String quote = argument(ARG_QUOTE, arguments).value();
if (quote.length() > 1) {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,13 +25,34 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.lang.ref.SoftReference;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
-import java.util.*;
-import java.lang.ref.SoftReference;
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassObjectReference;
+import com.sun.jdi.Field;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.Location;
+import com.sun.jdi.Method;
+import com.sun.jdi.ModuleReference;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.Type;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
-public abstract class ReferenceTypeImpl extends TypeImpl
-implements ReferenceType {
+public abstract class ReferenceTypeImpl extends TypeImpl implements ReferenceType {
protected long ref;
private String signature = null;
private String genericSignature = null;
@@ -52,14 +73,12 @@
private int status = 0;
private boolean isPrepared = false;
-
private boolean versionNumberGotten = false;
private int majorVersion;
private int minorVersion;
private boolean constantPoolInfoGotten = false;
private int constanPoolCount;
- private byte[] constantPoolBytes;
private SoftReference<byte[]> constantPoolBytesRef = null;
/* to mark a SourceFile request that returned a genuine JDWP.Error.ABSENT_INFORMATION */
@@ -72,7 +91,6 @@
private static final int INITIALIZED_OR_FAILED =
JDWP.ClassStatus.INITIALIZED | JDWP.ClassStatus.ERROR;
-
protected ReferenceTypeImpl(VirtualMachine aVm, long aRef) {
super(aVm);
ref = aRef;
@@ -209,8 +227,7 @@
// Does not need synchronization, since worst-case
// static info is fetched twice
try {
- classLoader = (ClassLoaderReference)
- JDWP.ReferenceType.ClassLoader.
+ classLoader = JDWP.ReferenceType.ClassLoader.
process(vm, this).classLoader;
isClassLoaderCached = true;
} catch (JDWPException exc) {
@@ -330,7 +347,7 @@
} catch (JDWPException exc) {
throw exc.toJDIException();
}
- fields = new ArrayList<Field>(jdwpFields.length);
+ fields = new ArrayList<>(jdwpFields.length);
for (int i=0; i<jdwpFields.length; i++) {
JDWP.ReferenceType.FieldsWithGeneric.FieldInfo fi
= jdwpFields[i];
@@ -349,7 +366,7 @@
} catch (JDWPException exc) {
throw exc.toJDIException();
}
- fields = new ArrayList<Field>(jdwpFields.length);
+ fields = new ArrayList<>(jdwpFields.length);
for (int i=0; i<jdwpFields.length; i++) {
JDWP.ReferenceType.Fields.FieldInfo fi = jdwpFields[i];
@@ -395,7 +412,7 @@
* hash map provides an efficient way to lookup visible fields
* by name, important for finding hidden or ambiguous fields.
*/
- List<Field> visibleList = new ArrayList<Field>();
+ List<Field> visibleList = new ArrayList<>();
Map<String, Field> visibleTable = new HashMap<String, Field>();
/* Track fields removed from above collection due to ambiguity */
@@ -416,7 +433,7 @@
* Insert fields from this type, removing any inherited fields they
* hide.
*/
- List<Field> retList = new ArrayList<Field>(fields());
+ List<Field> retList = new ArrayList<>(fields());
for (Field field : retList) {
Field hidden = visibleTable.get(field.name());
if (hidden != null) {
@@ -430,7 +447,7 @@
void addAllFields(List<Field> fieldList, Set<ReferenceType> typeSet) {
/* Continue the recursion only if this type is new */
if (!typeSet.contains(this)) {
- typeSet.add((ReferenceType)this);
+ typeSet.add(this);
/* Add local fields */
fieldList.addAll(fields());
@@ -445,7 +462,7 @@
}
}
public List<Field> allFields() {
- List<Field> fieldList = new ArrayList<Field>();
+ List<Field> fieldList = new ArrayList<>();
Set<ReferenceType> typeSet = new HashSet<ReferenceType>();
addAllFields(fieldList, typeSet);
return fieldList;
@@ -454,7 +471,7 @@
public Field fieldByName(String fieldName) {
List<Field> searchList = visibleFields();
- for (int i=0; i<searchList.size(); i++) {
+ for (int i = 0; i < searchList.size(); i++) {
Field f = searchList.get(i);
if (f.name().equals(fieldName)) {
@@ -478,8 +495,8 @@
} catch (JDWPException exc) {
throw exc.toJDIException();
}
- methods = new ArrayList<Method>(declared.length);
- for (int i=0; i<declared.length; i++) {
+ methods = new ArrayList<>(declared.length);
+ for (int i = 0; i < declared.length; i++) {
JDWP.ReferenceType.MethodsWithGeneric.MethodInfo
mi = declared[i];
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SDE.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SDE.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, 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
@@ -25,10 +25,9 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
-import java.util.*;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
class SDE {
private static final int INIT_SIZE_FILE = 3;
@@ -78,6 +77,7 @@
int jplsEnd;
int jplsLineInc;
int njplsStart;
+ @SuppressWarnings("unused")
int njplsEnd;
int fileId;
}
@@ -115,7 +115,7 @@
int fileIndexStart = stratumTable[sti].fileIndex;
/* one past end */
int fileIndexEnd = stratumTable[sti+1].fileIndex;
- List<String> result = new ArrayList<String>(fileIndexEnd - fileIndexStart);
+ List<String> result = new ArrayList<>(fileIndexEnd - fileIndexStart);
for (i = fileIndexStart; i < fileIndexEnd; ++i) {
result.add(fileTable[i].sourceName);
}
@@ -134,7 +134,7 @@
int fileIndexStart = stratumTable[sti].fileIndex;
/* one past end */
int fileIndexEnd = stratumTable[sti+1].fileIndex;
- List<String> result = new ArrayList<String>(fileIndexEnd - fileIndexStart);
+ List<String> result = new ArrayList<>(fileIndexEnd - fileIndexStart);
for (i = fileIndexStart; i < fileIndexEnd; ++i) {
result.add(fileTable[i].getSourcePath(refType));
}
@@ -370,7 +370,7 @@
}
List<String> availableStrata() {
- List<String> strata = new ArrayList<String>();
+ List<String> strata = new ArrayList<>();
for (int i = 0; i < (stratumIndex-1); ++i) {
StratumTableRecord rec = stratumTable[i];
@@ -470,7 +470,7 @@
}
void storeLine(int jplsStart, int jplsEnd, int jplsLineInc,
- int njplsStart, int njplsEnd, int fileId) {
+ int njplsStart, int njplsEnd, int fileId) {
assureLineTableSize();
lineTable[lineIndex].jplsStart = jplsStart;
lineTable[lineIndex].jplsEnd = jplsEnd;
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ShortTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ShortTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.PrimitiveValue;
+import com.sun.jdi.ShortType;
+import com.sun.jdi.VirtualMachine;
public class ShortTypeImpl extends PrimitiveTypeImpl implements ShortType {
+
ShortTypeImpl(VirtualMachine vm) {
super(vm);
}
-
public String signature() {
return String.valueOf((char)JDWP.Tag.SHORT);
}
@@ -40,5 +43,4 @@
PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
return vm.mirrorOf(((PrimitiveValueImpl)value).checkedShortValue());
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ShortValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ShortValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.ShortValue;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
public class ShortValueImpl extends PrimitiveValueImpl
implements ShortValue {
private short value;
- ShortValueImpl(VirtualMachine aVm,short aValue) {
+ ShortValueImpl(VirtualMachine aVm, short aValue) {
super(aVm);
-
value = aValue;
}
@@ -67,15 +69,15 @@
}
public boolean booleanValue() {
- return(value == 0)?false:true;
+ return (value == 0 ? false : true);
}
public byte byteValue() {
- return(byte)value;
+ return (byte)value;
}
public char charValue() {
- return(char)value;
+ return (char)value;
}
public short shortValue() {
@@ -83,19 +85,19 @@
}
public int intValue() {
- return(int)value;
+ return value;
}
public long longValue() {
- return(long)value;
+ return value;
}
public float floatValue() {
- return(float)value;
+ return value;
}
public double doubleValue() {
- return(double)value;
+ return value;
}
byte checkedByteValue() throws InvalidTypeException {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,14 +24,13 @@
*/
package com.sun.tools.jdi;
-import com.sun.jdi.VirtualMachine;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
+import java.io.IOException;
import java.util.Map;
-import java.util.HashMap;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
+
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.Transport;
/*
* An AttachingConnector that uses the SocketTransportService
@@ -66,7 +65,6 @@
return "dt_socket"; // for compatibility reasons
}
};
-
}
/*
@@ -74,7 +72,7 @@
* arguments and attach to the target VM.
*/
public VirtualMachine
- attach(Map<String,? extends Connector.Argument> arguments)
+ attach(Map<String, ? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException
{
String host = argument(ARG_HOST, arguments).value();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.jdi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import com.sun.jdi.connect.spi.ClosedConnectionException;
+import com.sun.jdi.connect.spi.Connection;
+
+/*
+ * The Connection returned by attach and accept is one of these
+ */
+class SocketConnection extends Connection {
+ private Socket socket;
+ private boolean closed = false;
+ private OutputStream socketOutput;
+ private InputStream socketInput;
+ private Object receiveLock = new Object();
+ private Object sendLock = new Object();
+ private Object closeLock = new Object();
+
+ SocketConnection(Socket socket) throws IOException {
+ this.socket = socket;
+ socket.setTcpNoDelay(true);
+ socketInput = socket.getInputStream();
+ socketOutput = socket.getOutputStream();
+ }
+
+ public void close() throws IOException {
+ synchronized (closeLock) {
+ if (closed) {
+ return;
+ }
+ socketOutput.close();
+ socketInput.close();
+ socket.close();
+ closed = true;
+ }
+ }
+
+ public boolean isOpen() {
+ synchronized (closeLock) {
+ return !closed;
+ }
+ }
+
+ public byte[] readPacket() throws IOException {
+ if (!isOpen()) {
+ throw new ClosedConnectionException("connection is closed");
+ }
+ synchronized (receiveLock) {
+ int b1,b2,b3,b4;
+
+ // length
+ try {
+ b1 = socketInput.read();
+ b2 = socketInput.read();
+ b3 = socketInput.read();
+ b4 = socketInput.read();
+ } catch (IOException ioe) {
+ if (!isOpen()) {
+ throw new ClosedConnectionException("connection is closed");
+ } else {
+ throw ioe;
+ }
+ }
+
+ // EOF
+ if (b1<0) {
+ return new byte[0];
+ }
+
+ if (b2<0 || b3<0 || b4<0) {
+ throw new IOException("protocol error - premature EOF");
+ }
+
+ int len = ((b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0));
+
+ if (len < 0) {
+ throw new IOException("protocol error - invalid length");
+ }
+
+ byte b[] = new byte[len];
+ b[0] = (byte)b1;
+ b[1] = (byte)b2;
+ b[2] = (byte)b3;
+ b[3] = (byte)b4;
+
+ int off = 4;
+ len -= off;
+
+ while (len > 0) {
+ int count;
+ try {
+ count = socketInput.read(b, off, len);
+ } catch (IOException ioe) {
+ if (!isOpen()) {
+ throw new ClosedConnectionException("connection is closed");
+ } else {
+ throw ioe;
+ }
+ }
+ if (count < 0) {
+ throw new IOException("protocol error - premature EOF");
+ }
+ len -= count;
+ off += count;
+ }
+
+ return b;
+ }
+ }
+
+ public void writePacket(byte b[]) throws IOException {
+ if (!isOpen()) {
+ throw new ClosedConnectionException("connection is closed");
+ }
+
+ /*
+ * Check the packet size
+ */
+ if (b.length < 11) {
+ throw new IllegalArgumentException("packet is insufficient size");
+ }
+ int b0 = b[0] & 0xff;
+ int b1 = b[1] & 0xff;
+ int b2 = b[2] & 0xff;
+ int b3 = b[3] & 0xff;
+ int len = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0));
+ if (len < 11) {
+ throw new IllegalArgumentException("packet is insufficient size");
+ }
+
+ /*
+ * Check that the byte array contains the complete packet
+ */
+ if (len > b.length) {
+ throw new IllegalArgumentException("length mis-match");
+ }
+
+ synchronized (sendLock) {
+ try {
+ /*
+ * Send the packet (ignoring any bytes that follow
+ * the packet in the byte array).
+ */
+ socketOutput.write(b, 0, len);
+ } catch (IOException ioe) {
+ if (!isOpen()) {
+ throw new ClosedConnectionException("connection is closed");
+ } else {
+ throw ioe;
+ }
+ }
+ }
+ }
+}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,14 +24,15 @@
*/
package com.sun.tools.jdi;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
+import java.io.IOException;
import java.util.Map;
-import java.util.HashMap;
-import java.io.IOException;
+
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.Transport;
/*
- * An ListeningConnector that uses the SocketTransportService
+ * A ListeningConnector that uses the SocketTransportService
*/
public class SocketListeningConnector extends GenericListeningConnector {
@@ -63,7 +64,6 @@
};
}
-
public String
startListening(Map<String,? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketTransportService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketTransportService.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,20 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
-import java.net.*;
-import java.io.*;
-import java.util.Map;
+import java.io.IOException;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.net.UnknownHostException;
import java.util.ResourceBundle;
+import com.sun.jdi.connect.TransportTimeoutException;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.connect.spi.TransportService;
+
/*
* A transport service based on a TCP connection between the
* debugger and debugee.
@@ -176,10 +182,25 @@
* Return the capabilities of this transport service
*/
public Capabilities capabilities() {
- return new SocketTransportServiceCapabilities();
+ return new TransportService.Capabilities() {
+ public boolean supportsMultipleConnections() {
+ return true;
+ }
+
+ public boolean supportsAttachTimeout() {
+ return true;
+ }
+
+ public boolean supportsAcceptTimeout() {
+ return true;
+ }
+
+ public boolean supportsHandshakeTimeout() {
+ return true;
+ }
+ };
}
-
/**
* Attach to the specified address with optional attach and handshake
* timeout.
@@ -217,7 +238,6 @@
"unable to parse port number in address");
}
-
// open TCP connection to VM
InetSocketAddress sa = new InetSocketAddress(host, port);
Socket s = new Socket();
@@ -363,177 +383,3 @@
return name();
}
}
-
-
-/*
- * The Connection returned by attach and accept is one of these
- */
-class SocketConnection extends Connection {
- private Socket socket;
- private boolean closed = false;
- private OutputStream socketOutput;
- private InputStream socketInput;
- private Object receiveLock = new Object();
- private Object sendLock = new Object();
- private Object closeLock = new Object();
-
- SocketConnection(Socket socket) throws IOException {
- this.socket = socket;
- socket.setTcpNoDelay(true);
- socketInput = socket.getInputStream();
- socketOutput = socket.getOutputStream();
- }
-
- public void close() throws IOException {
- synchronized (closeLock) {
- if (closed) {
- return;
- }
- socketOutput.close();
- socketInput.close();
- socket.close();
- closed = true;
- }
- }
-
- public boolean isOpen() {
- synchronized (closeLock) {
- return !closed;
- }
- }
-
- public byte[] readPacket() throws IOException {
- if (!isOpen()) {
- throw new ClosedConnectionException("connection is closed");
- }
- synchronized (receiveLock) {
- int b1,b2,b3,b4;
-
- // length
- try {
- b1 = socketInput.read();
- b2 = socketInput.read();
- b3 = socketInput.read();
- b4 = socketInput.read();
- } catch (IOException ioe) {
- if (!isOpen()) {
- throw new ClosedConnectionException("connection is closed");
- } else {
- throw ioe;
- }
- }
-
- // EOF
- if (b1<0) {
- return new byte[0];
- }
-
- if (b2<0 || b3<0 || b4<0) {
- throw new IOException("protocol error - premature EOF");
- }
-
- int len = ((b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0));
-
- if (len < 0) {
- throw new IOException("protocol error - invalid length");
- }
-
- byte b[] = new byte[len];
- b[0] = (byte)b1;
- b[1] = (byte)b2;
- b[2] = (byte)b3;
- b[3] = (byte)b4;
-
- int off = 4;
- len -= off;
-
- while (len > 0) {
- int count;
- try {
- count = socketInput.read(b, off, len);
- } catch (IOException ioe) {
- if (!isOpen()) {
- throw new ClosedConnectionException("connection is closed");
- } else {
- throw ioe;
- }
- }
- if (count < 0) {
- throw new IOException("protocol error - premature EOF");
- }
- len -= count;
- off += count;
- }
-
- return b;
- }
- }
-
- public void writePacket(byte b[]) throws IOException {
- if (!isOpen()) {
- throw new ClosedConnectionException("connection is closed");
- }
-
- /*
- * Check the packet size
- */
- if (b.length < 11) {
- throw new IllegalArgumentException("packet is insufficient size");
- }
- int b0 = b[0] & 0xff;
- int b1 = b[1] & 0xff;
- int b2 = b[2] & 0xff;
- int b3 = b[3] & 0xff;
- int len = ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0));
- if (len < 11) {
- throw new IllegalArgumentException("packet is insufficient size");
- }
-
- /*
- * Check that the byte array contains the complete packet
- */
- if (len > b.length) {
- throw new IllegalArgumentException("length mis-match");
- }
-
- synchronized (sendLock) {
- try {
- /*
- * Send the packet (ignoring any bytes that follow
- * the packet in the byte array).
- */
- socketOutput.write(b, 0, len);
- } catch (IOException ioe) {
- if (!isOpen()) {
- throw new ClosedConnectionException("connection is closed");
- } else {
- throw ioe;
- }
- }
- }
- }
-}
-
-
-/*
- * The capabilities of the socket transport service
- */
-class SocketTransportServiceCapabilities extends TransportService.Capabilities {
-
- public boolean supportsMultipleConnections() {
- return true;
- }
-
- public boolean supportsAttachTimeout() {
- return true;
- }
-
- public boolean supportsAcceptTimeout() {
- return true;
- }
-
- public boolean supportsHandshakeTimeout() {
- return true;
- }
-
-}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StackFrameImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StackFrameImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,15 +25,26 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Collections;
+
+import com.sun.jdi.AbsentInformationException;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidStackFrameException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.LocalVariable;
+import com.sun.jdi.Location;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
public class StackFrameImpl extends MirrorImpl
implements StackFrame, ThreadListener
@@ -157,7 +168,7 @@
private void createVisibleVariables() throws AbsentInformationException {
if (visibleVariables == null) {
List<LocalVariable> allVariables = location.method().variables();
- Map<String, LocalVariable> map = new HashMap<String, LocalVariable>(allVariables.size());
+ Map<String, LocalVariable> map = new HashMap<>(allVariables.size());
for (LocalVariable variable : allVariables) {
String name = variable.name();
@@ -180,7 +191,7 @@
public List<LocalVariable> visibleVariables() throws AbsentInformationException {
validateStackFrame();
createVisibleVariables();
- List<LocalVariable> mapAsList = new ArrayList<LocalVariable>(visibleVariables.values());
+ List<LocalVariable> mapAsList = new ArrayList<>(visibleVariables.values());
Collections.sort(mapAsList);
return mapAsList;
}
@@ -196,7 +207,7 @@
}
public Value getValue(LocalVariable variable) {
- List<LocalVariable> list = new ArrayList<LocalVariable>(1);
+ List<LocalVariable> list = new ArrayList<>(1);
list.add(variable);
return getValues(list).get(variable);
}
@@ -246,8 +257,8 @@
throw new InternalException(
"Wrong number of values returned from target VM");
}
- Map<LocalVariable, Value> map = new HashMap<LocalVariable, Value>(count);
- for (int i=0; i<count; ++i) {
+ Map<LocalVariable, Value> map = new HashMap<>(count);
+ for (int i = 0; i < count; ++i) {
LocalVariableImpl variable = (LocalVariableImpl)variables.get(i);
map.put(variable, values[i]);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StratumLineInfo.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StratumLineInfo.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 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
@@ -25,7 +25,7 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.AbsentInformationException;
class StratumLineInfo implements LineInfo {
private final String stratumID;
@@ -49,16 +49,14 @@
return lineNumber;
}
- public String liSourceName()
- throws AbsentInformationException {
+ public String liSourceName() throws AbsentInformationException {
if (sourceName == null) {
throw new AbsentInformationException();
}
return sourceName;
}
- public String liSourcePath()
- throws AbsentInformationException {
+ public String liSourcePath() throws AbsentInformationException {
if (sourcePath == null) {
throw new AbsentInformationException();
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StringReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StringReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,19 +25,21 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
public class StringReferenceImpl extends ObjectReferenceImpl
implements StringReference
{
private String value;
- StringReferenceImpl(VirtualMachine aVm,long aRef) {
- super(aVm,aRef);
+ StringReferenceImpl(VirtualMachine aVm, long aRef) {
+ super(aVm, aRef);
}
public String value() {
- if(value == null) {
+ if (value == null) {
// Does not need synchronization, since worst-case
// static info is fetched twice
try {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,17 +25,20 @@
package com.sun.tools.jdi;
-import com.sun.tools.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
-import com.sun.jdi.VirtualMachine;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;
-import java.util.HashMap;
import java.util.Random;
-import java.io.IOException;
-import java.io.File;
-public class SunCommandLineLauncher extends AbstractLauncher implements LaunchingConnector {
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.IllegalConnectorArgumentsException;
+import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.VMStartException;
+import com.sun.jdi.connect.spi.TransportService;
+
+public class SunCommandLineLauncher extends AbstractLauncher {
static private final String ARG_HOME = "home";
static private final String ARG_OPTIONS = "options";
@@ -64,10 +67,9 @@
* transport or the socket transport
*/
try {
- @SuppressWarnings("deprecation")
- Object o =
- Class.forName("com.sun.tools.jdi.SharedMemoryTransportService").newInstance();
- transportService = (TransportService)o;
+ transportService = (TransportService)Class.
+ forName("com.sun.tools.jdi.SharedMemoryTransportService").
+ getDeclaredConstructor().newInstance();
transport = new Transport() {
public String name() {
return "dt_shmem";
@@ -77,7 +79,9 @@
} catch (ClassNotFoundException |
UnsatisfiedLinkError |
InstantiationException |
- IllegalAccessException x) {
+ InvocationTargetException |
+ IllegalAccessException |
+ NoSuchMethodException x) {
};
if (transportService == null) {
transportService = new SocketTransportService();
@@ -139,7 +143,7 @@
}
public VirtualMachine
- launch(Map<String,? extends Connector.Argument> arguments)
+ launch(Map<String, ? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException,
VMStartException
{
@@ -237,6 +241,5 @@
public String description() {
return getString("sun.description");
-
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TargetVM.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TargetVM.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,18 +25,24 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import com.sun.jdi.event.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VirtualMachine;
import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.event.EventQueue;
import com.sun.jdi.event.EventSet;
-import java.util.*;
-import java.io.IOException;
-
public class TargetVM implements Runnable {
- private Map<String, Packet> waitingQueue = new HashMap<String, Packet>(32,0.75f);
+ private Map<String, Packet> waitingQueue = new HashMap<>(32,0.75f);
private boolean shouldListen = true;
- private List<EventQueue> eventQueues = Collections.synchronizedList(new ArrayList<EventQueue>(2));
+ private List<EventQueue> eventQueues = Collections.synchronizedList(new ArrayList<>(2));
private VirtualMachineImpl vm;
private Connection connection;
private Thread readerThread;
@@ -111,7 +117,7 @@
Packet p=null,p2;
String idString;
- while(shouldListen) {
+ while (shouldListen) {
boolean done = false;
try {
@@ -136,7 +142,7 @@
dumpPacket(p, false);
}
- if((p.flags & Packet.Reply) == 0) {
+ if ((p.flags & Packet.Reply) == 0) {
// It's a command
handleVMCommand(p);
} else {
@@ -154,7 +160,7 @@
waitingQueue.remove(idString);
}
- if(p2 == null) {
+ if (p2 == null) {
// Whoa! a reply without a sender. Problem.
// FIX ME! Need to post an error.
@@ -226,10 +232,7 @@
*/
protected void handleEventCmdSet(Packet p) {
EventSet eventSet = new EventSetImpl(vm, p);
-
- if (eventSet != null) {
- queueEventSet(eventSet);
- }
+ queueEventSet(eventSet);
}
private EventController eventController() {
@@ -371,5 +374,4 @@
}
}
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadAction.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadAction.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,15 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
import java.util.EventObject;
+import com.sun.jdi.ThreadReference;
+
/*
- * The name "action" is used to avoid confusion
- * with JDI events.
+ * The name "action" is used to avoid confusion with JDI events.
*/
class ThreadAction extends EventObject {
+
private static final long serialVersionUID = 5690763191100515283L;
+
// Event ids
/*static final int THREAD_SUSPENDED = 1;*/
static final int THREAD_RESUMABLE = 2;
@@ -44,9 +46,11 @@
super(thread);
this.id = id;
}
+
ThreadReference thread() {
return (ThreadReference)getSource();
}
+
int id() {
return id;
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 +25,15 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import java.util.*;
+import java.util.Arrays;
+import java.util.List;
+
+import com.sun.jdi.ThreadGroupReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
public class ThreadGroupReferenceImpl extends ObjectReferenceImpl
- implements ThreadGroupReference, VMListener
+ implements ThreadGroupReference
{
// Cached components that cannot change
String name;
@@ -45,8 +49,8 @@
return new Cache();
}
- ThreadGroupReferenceImpl(VirtualMachine aVm,long aRef) {
- super(aVm,aRef);
+ ThreadGroupReferenceImpl(VirtualMachine aVm, long aRef) {
+ super(aVm, aRef);
vm.state().addListener(this);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,13 +25,32 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.InvalidStackFrameException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Location;
+import com.sun.jdi.MonitorInfo;
+import com.sun.jdi.NativeMethodException;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
+import com.sun.jdi.ThreadGroupReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
import com.sun.jdi.request.BreakpointRequest;
-import java.util.*;
-import java.lang.ref.WeakReference;
public class ThreadReferenceImpl extends ObjectReferenceImpl
- implements ThreadReference, VMListener {
+ implements ThreadReference {
static final int SUSPEND_STATUS_SUSPENDED = 0x1;
static final int SUSPEND_STATUS_BREAK = 0x2;
@@ -113,11 +132,10 @@
}
// Listeners - synchronized on vm.state()
- private List<WeakReference<ThreadListener>> listeners = new ArrayList<WeakReference<ThreadListener>>();
-
+ private List<WeakReference<ThreadListener>> listeners = new ArrayList<>();
ThreadReferenceImpl(VirtualMachine aVm, long aRef) {
- super(aVm,aRef);
+ super(aVm, aRef);
resetLocalCache();
vm.state().addListener(this);
}
@@ -165,8 +183,7 @@
name = local.name;
}
if (name == null) {
- name = JDWP.ThreadReference.Name.process(vm, this)
- .threadName;
+ name = JDWP.ThreadReference.Name.process(vm, this).threadName;
if (local != null) {
local.name = name;
}
@@ -404,7 +421,7 @@
= JDWP.ThreadReference.Frames.
process(vm, this, start, length).frames;
int count = jdwpFrames.length;
- snapshot.frames = new ArrayList<StackFrame>(count);
+ snapshot.frames = new ArrayList<>(count);
for (int i = 0; i<count; i++) {
if (jdwpFrames[i].location == null) {
@@ -500,11 +517,9 @@
JDWP.ThreadReference.OwnedMonitorsStackDepthInfo.monitor[] minfo;
minfo = JDWP.ThreadReference.OwnedMonitorsStackDepthInfo.process(vm, this).owned;
- snapshot.ownedMonitorsInfo = new ArrayList<MonitorInfo>(minfo.length);
+ snapshot.ownedMonitorsInfo = new ArrayList<>(minfo.length);
for (int i=0; i < minfo.length; i++) {
- JDWP.ThreadReference.OwnedMonitorsStackDepthInfo.monitor mi =
- minfo[i];
MonitorInfo mon = new MonitorInfoImpl(vm, minfo[i].monitor, this, minfo[i].stack_depth);
snapshot.ownedMonitorsInfo.add(mon);
}
@@ -542,8 +557,8 @@
((StackFrameImpl)frame).pop();
}
- public void forceEarlyReturn(Value returnValue) throws InvalidTypeException,
- ClassNotLoadedException,
+ public void forceEarlyReturn(Value returnValue) throws InvalidTypeException,
+ ClassNotLoadedException,
IncompatibleThreadStateException {
if (!vm.canForceEarlyReturn()) {
throw new UnsupportedOperationException(
@@ -595,7 +610,7 @@
void addListener(ThreadListener listener) {
synchronized (vm.state()) {
- listeners.add(new WeakReference<ThreadListener>(listener));
+ listeners.add(new WeakReference<>(listener));
}
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TypeComponentImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TypeComponentImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
-import java.util.List;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.TypeComponent;
+import com.sun.jdi.VirtualMachine;
abstract public class TypeComponentImpl extends MirrorImpl
implements TypeComponent
@@ -40,8 +40,7 @@
private final int modifiers;
TypeComponentImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
- long ref,
- String name, String signature,
+ long ref, String name, String signature,
String genericSignature, int modifiers) {
// The generic signature is set when this is created.
super(vm);
@@ -89,9 +88,9 @@
}
public boolean isPackagePrivate() {
- return !isModifierSet(VMModifiers.PRIVATE
- | VMModifiers.PROTECTED
- | VMModifiers.PUBLIC);
+ return !isModifierSet(VMModifiers.PRIVATE |
+ VMModifiers.PROTECTED |
+ VMModifiers.PUBLIC);
}
public boolean isProtected() {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,14 +25,13 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
-public abstract class TypeImpl extends MirrorImpl implements Type
-{
+public abstract class TypeImpl extends MirrorImpl implements Type {
private String myName = null;
- TypeImpl(VirtualMachine vm)
- {
+ TypeImpl(VirtualMachine vm) {
super(vm);
}
@@ -49,8 +48,7 @@
public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof Type)) {
Type other = (Type)obj;
- return signature().equals(other.signature()) &&
- super.equals(obj);
+ return signature().equals(other.signature()) && super.equals(obj);
} else {
return false;
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMAction.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMAction.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,14 +25,17 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
import java.util.EventObject;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+
/*
* The name "action" is used to avoid confusion
* with JDI events.
*/
class VMAction extends EventObject {
+
private static final long serialVersionUID = -1701944679310296090L;
// Event ids
@@ -48,14 +51,16 @@
// For id = VM_NOT_SUSPENDED, if resumingThread != null, then it is
// the only thread that is being resumed.
- VMAction(VirtualMachine vm, ThreadReference resumingThread, int id) {
+ VMAction(VirtualMachine vm, ThreadReference resumingThread, int id) {
super(vm);
this.id = id;
this.resumingThread = resumingThread;
}
+
VirtualMachine vm() {
return (VirtualMachine)getSource();
}
+
int id() {
return id;
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMListener.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMListener.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,6 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
import java.util.EventListener;
interface VMListener extends EventListener {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMModifiers.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMModifiers.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,23 +25,20 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-
-public interface VMModifiers
-{
- int PUBLIC = 0x00000001; /* visible to everyone */
- int PRIVATE = 0x00000002; /* visible only to the defining class */
- int PROTECTED = 0x00000004; /* visible to subclasses */
- int STATIC = 0x00000008; /* instance variable is static */
- int FINAL = 0x00000010; /* no further subclassing, overriding */
- int SYNCHRONIZED = 0x00000020; /* wrap method call in monitor lock */
- int VOLATILE = 0x00000040; /* can cache in registers */
- int BRIDGE = 0x00000040; /* Bridge method generated by compiler */
- int TRANSIENT = 0x00000080; /* not persistant */
- int VARARGS = 0x00000080; /* Method accepts var. args*/
- int NATIVE = 0x00000100; /* implemented in C */
- int INTERFACE = 0x00000200; /* class is an interface */
- int ABSTRACT = 0x00000400; /* no definition provided */
+public interface VMModifiers {
+ int PUBLIC = 0x00000001; /* visible to everyone */
+ int PRIVATE = 0x00000002; /* visible only to the defining class */
+ int PROTECTED = 0x00000004; /* visible to subclasses */
+ int STATIC = 0x00000008; /* instance variable is static */
+ int FINAL = 0x00000010; /* no further subclassing, overriding */
+ int SYNCHRONIZED = 0x00000020; /* wrap method call in monitor lock */
+ int VOLATILE = 0x00000040; /* can cache in registers */
+ int BRIDGE = 0x00000040; /* Bridge method generated by compiler */
+ int TRANSIENT = 0x00000080; /* not persistant */
+ int VARARGS = 0x00000080; /* Method accepts var. args*/
+ int NATIVE = 0x00000100; /* implemented in C */
+ int INTERFACE = 0x00000200; /* class is an interface */
+ int ABSTRACT = 0x00000400; /* no definition provided */
int ENUM_CONSTANT = 0x00004000; /* enum constant field*/
- int SYNTHETIC = 0xf0000000; /* not in source code */
+ int SYNTHETIC = 0xf0000000; /* not in source code */
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,16 +25,21 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
-import java.lang.ref.WeakReference;
-import java.util.*;
+import com.sun.jdi.ThreadGroupReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
class VMState {
private final VirtualMachineImpl vm;
// Listeners
- private final List<WeakReference<VMListener>> listeners = new ArrayList<WeakReference<VMListener>>(); // synchronized (this)
+ private final List<WeakReference<VMListener>> listeners = new ArrayList<>(); // synchronized (this)
private boolean notifyingListeners = false; // synchronized (this)
/*
@@ -241,5 +246,4 @@
}
return groups;
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ValueContainer.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ValueContainer.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,8 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.Type;
/*
* This interface allows us to pass fields, variables, and
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,10 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
abstract class ValueImpl extends MirrorImpl implements Value {
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,20 +25,56 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+
+import com.sun.jdi.BooleanType;
+import com.sun.jdi.BooleanValue;
+import com.sun.jdi.ByteType;
+import com.sun.jdi.ByteValue;
+import com.sun.jdi.CharType;
+import com.sun.jdi.CharValue;
+import com.sun.jdi.ClassLoaderReference;
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.DoubleType;
+import com.sun.jdi.DoubleValue;
+import com.sun.jdi.FloatType;
+import com.sun.jdi.FloatValue;
+import com.sun.jdi.IntegerType;
+import com.sun.jdi.IntegerValue;
+import com.sun.jdi.InternalException;
+import com.sun.jdi.LongType;
+import com.sun.jdi.LongValue;
import com.sun.jdi.ModuleReference;
+import com.sun.jdi.PathSearchingVirtualMachine;
+import com.sun.jdi.PrimitiveType;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ShortType;
+import com.sun.jdi.ShortValue;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadGroupReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Type;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.VirtualMachineManager;
+import com.sun.jdi.VoidType;
+import com.sun.jdi.VoidValue;
import com.sun.jdi.connect.spi.Connection;
-import com.sun.jdi.request.EventRequestManager;
-import com.sun.jdi.request.EventRequest;
-import com.sun.jdi.request.BreakpointRequest;
import com.sun.jdi.event.EventQueue;
-
-import java.util.*;
-import java.text.MessageFormat;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
+import com.sun.jdi.request.BreakpointRequest;
+import com.sun.jdi.request.EventRequest;
+import com.sun.jdi.request.EventRequestManager;
class VirtualMachineImpl extends MirrorImpl
implements PathSearchingVirtualMachine, ThreadListener {
@@ -84,11 +120,11 @@
// ObjectReference cache
// "objectsByID" protected by "synchronized(this)".
- private final Map<Long, SoftObjectReference> objectsByID = new HashMap<Long, SoftObjectReference>();
- private final ReferenceQueue<ObjectReferenceImpl> referenceQueue = new ReferenceQueue<ObjectReferenceImpl>();
+ private final Map<Long, SoftObjectReference> objectsByID = new HashMap<>();
+ private final ReferenceQueue<ObjectReferenceImpl> referenceQueue = new ReferenceQueue<>();
static private final int DISPOSE_THRESHOLD = 50;
private final List<SoftObjectReference> batchedDisposeRequests =
- Collections.synchronizedList(new ArrayList<SoftObjectReference>(DISPOSE_THRESHOLD + 10));
+ Collections.synchronizedList(new ArrayList<>(DISPOSE_THRESHOLD + 10));
// These are cached once for the life of the VM
private JDWP.VirtualMachine.Version versionInfo;
@@ -296,13 +332,13 @@
}
ArrayList<ReferenceType> a;
synchronized (this) {
- a = new ArrayList<ReferenceType>(typesBySignature);
+ a = new ArrayList<>(typesBySignature);
}
return Collections.unmodifiableList(a);
}
public void
- redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes)
+ redefineClasses(Map<? extends ReferenceType, byte[]> classToBytes)
{
int cnt = classToBytes.size();
JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs =
@@ -313,7 +349,8 @@
}
Iterator<?> it = classToBytes.entrySet().iterator();
for (int i = 0; it.hasNext(); i++) {
- Map.Entry<?,?> entry = (Map.Entry)it.next();
+ @SuppressWarnings("rawtypes")
+ Map.Entry<?, ?> entry = (Map.Entry)it.next();
ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey();
validateMirror(refType);
defs[i] = new JDWP.VirtualMachine.RedefineClasses
@@ -330,44 +367,44 @@
switch (exc.errorCode()) {
case JDWP.Error.INVALID_CLASS_FORMAT :
throw new ClassFormatError(
- "class not in class file format");
+ "class not in class file format");
case JDWP.Error.CIRCULAR_CLASS_DEFINITION :
throw new ClassCircularityError(
- "circularity has been detected while initializing a class");
+ "circularity has been detected while initializing a class");
case JDWP.Error.FAILS_VERIFICATION :
throw new VerifyError(
- "verifier detected internal inconsistency or security problem");
+ "verifier detected internal inconsistency or security problem");
case JDWP.Error.UNSUPPORTED_VERSION :
throw new UnsupportedClassVersionError(
"version numbers of class are not supported");
case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED:
throw new UnsupportedOperationException(
- "add method not implemented");
+ "add method not implemented");
case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED :
throw new UnsupportedOperationException(
- "schema change not implemented");
+ "schema change not implemented");
case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED:
throw new UnsupportedOperationException(
- "hierarchy change not implemented");
+ "hierarchy change not implemented");
case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED :
throw new UnsupportedOperationException(
- "delete method not implemented");
+ "delete method not implemented");
case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED:
throw new UnsupportedOperationException(
- "changes to class modifiers not implemented");
+ "changes to class modifiers not implemented");
case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED :
throw new UnsupportedOperationException(
- "changes to method modifiers not implemented");
+ "changes to method modifiers not implemented");
case JDWP.Error.NAMES_DONT_MATCH :
throw new NoClassDefFoundError(
- "class names do not match");
+ "class names do not match");
default:
throw exc.toJDIException();
}
}
// Delete any record of the breakpoints
- List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>();
+ List<BreakpointRequest> toDelete = new ArrayList<>();
EventRequestManager erm = eventRequestManager();
it = erm.breakpointRequests().iterator();
while (it.hasNext()) {
@@ -523,8 +560,8 @@
public StringReference mirrorOf(String value) {
validateVM();
try {
- return (StringReference)JDWP.VirtualMachine.CreateString.
- process(vm, value).stringObject;
+ return JDWP.VirtualMachine.CreateString.
+ process(vm, value).stringObject;
} catch (JDWPException exc) {
throw exc.toJDIException();
}
@@ -621,26 +658,32 @@
validateVM();
return capabilities().canWatchFieldModification;
}
+
public boolean canWatchFieldAccess() {
validateVM();
return capabilities().canWatchFieldAccess;
}
+
public boolean canGetBytecodes() {
validateVM();
return capabilities().canGetBytecodes;
}
+
public boolean canGetSyntheticAttribute() {
validateVM();
return capabilities().canGetSyntheticAttribute;
}
+
public boolean canGetOwnedMonitorInfo() {
validateVM();
return capabilities().canGetOwnedMonitorInfo;
}
+
public boolean canGetCurrentContendedMonitor() {
validateVM();
return capabilities().canGetCurrentContendedMonitor;
}
+
public boolean canGetMonitorInfo() {
validateVM();
return capabilities().canGetMonitorInfo;
@@ -661,30 +704,36 @@
return hasNewCapabilities() &&
capabilitiesNew().canUseInstanceFilters;
}
+
public boolean canRedefineClasses() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canRedefineClasses;
}
+
public boolean canAddMethod() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canAddMethod;
}
+
public boolean canUnrestrictedlyRedefineClasses() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canUnrestrictedlyRedefineClasses;
}
+
public boolean canPopFrames() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canPopFrames;
}
+
public boolean canGetMethodReturnValues() {
return versionInfo().jdwpMajor > 1 ||
versionInfo().jdwpMinor >= 6;
}
+
public boolean canGetInstanceInfo() {
if (versionInfo().jdwpMajor > 1 ||
versionInfo().jdwpMinor >= 6) {
@@ -695,47 +744,57 @@
return false;
}
}
+
public boolean canUseSourceNameFilters() {
return versionInfo().jdwpMajor > 1 ||
versionInfo().jdwpMinor >= 6;
}
+
public boolean canForceEarlyReturn() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canForceEarlyReturn;
}
+
public boolean canBeModified() {
return true;
}
+
public boolean canGetSourceDebugExtension() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canGetSourceDebugExtension;
}
+
public boolean canGetClassFileVersion() {
return versionInfo().jdwpMajor > 1 ||
versionInfo().jdwpMinor >= 6;
}
+
public boolean canGetConstantPool() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canGetConstantPool;
}
+
public boolean canRequestVMDeathEvent() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canRequestVMDeathEvent;
}
+
public boolean canRequestMonitorEvents() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canRequestMonitorEvents;
}
+
public boolean canGetMonitorFrameInfo() {
validateVM();
return hasNewCapabilities() &&
capabilitiesNew().canGetMonitorFrameInfo;
}
+
public boolean canGetModuleInfo() {
validateVM();
return versionInfo().jdwpMajor >= 9;
@@ -761,8 +820,8 @@
}
private synchronized ReferenceTypeImpl addReferenceType(long id,
- int tag,
- String signature) {
+ int tag,
+ String signature) {
if (typesByID == null) {
initReferenceTypes();
}
@@ -824,9 +883,8 @@
vm.printTrace("Uncaching ReferenceType, sig=" + signature +
", id=" + type.ref());
}
-/* fix for 4359077 , don't break out. list is no longer sorted
- in the order we think
- */
+ // fix for 4359077, don't break out. list is no longer sorted
+ // in the order we think
}
}
@@ -841,26 +899,25 @@
private synchronized List<ReferenceType> findReferenceTypes(String signature) {
if (typesByID == null) {
- return new ArrayList<ReferenceType>(0);
+ return new ArrayList<>(0);
}
Iterator<ReferenceType> iter = typesBySignature.iterator();
- List<ReferenceType> list = new ArrayList<ReferenceType>();
+ List<ReferenceType> list = new ArrayList<>();
while (iter.hasNext()) {
ReferenceTypeImpl type = (ReferenceTypeImpl)iter.next();
int comp = signature.compareTo(type.signature());
if (comp == 0) {
list.add(type);
-/* fix for 4359077 , don't break out. list is no longer sorted
- in the order we think
- */
+ // fix for 4359077, don't break out. list is no longer sorted
+ // in the order we think
}
}
return list;
}
private void initReferenceTypes() {
- typesByID = new HashMap<Long, ReferenceType>(300);
- typesBySignature = new TreeSet<ReferenceType>();
+ typesByID = new HashMap<>(300);
+ typesBySignature = new TreeSet<>();
}
ReferenceTypeImpl referenceType(long ref, byte tag) {
@@ -879,8 +936,7 @@
return (ArrayTypeImpl)referenceType(ref, JDWP.TypeTag.ARRAY, null);
}
- ReferenceTypeImpl referenceType(long id, int tag,
- String signature) {
+ ReferenceTypeImpl referenceType(long id, int tag, String signature) {
if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
StringBuilder sb = new StringBuilder();
sb.append("Looking up ");
@@ -941,7 +997,7 @@
private synchronized ModuleReference addModule(long id) {
if (modulesByID == null) {
- modulesByID = new HashMap<Long, ModuleReference>(77);
+ modulesByID = new HashMap<>(77);
}
ModuleReference module = new ModuleReferenceImpl(vm, id);
modulesByID.put(id, module);
@@ -994,7 +1050,7 @@
}
int count = cinfos.length;
- List<ReferenceType> list = new ArrayList<ReferenceType>(count);
+ List<ReferenceType> list = new ArrayList<>(count);
// Hold lock during processing to improve performance
synchronized (this) {
@@ -1025,9 +1081,8 @@
if (!retrievedAllTypes) {
// Number of classes
int count = cinfos.length;
- for (int i=0; i<count; i++) {
- JDWP.VirtualMachine.AllClasses.ClassInfo ci =
- cinfos[i];
+ for (int i = 0; i < count; i++) {
+ JDWP.VirtualMachine.AllClasses.ClassInfo ci = cinfos[i];
ReferenceTypeImpl type = referenceType(ci.typeID,
ci.refTypeTag,
ci.signature);
@@ -1052,7 +1107,6 @@
* To save time (assuming the caller will be
* using then) we will get the generic sigs too.
*/
-
JDWP.VirtualMachine.AllClassesWithGeneric.ClassInfo[] cinfos;
try {
cinfos = JDWP.VirtualMachine.AllClassesWithGeneric.process(vm).classes;
@@ -1066,7 +1120,7 @@
if (!retrievedAllTypes) {
// Number of classes
int count = cinfos.length;
- for (int i=0; i<count; i++) {
+ for (int i = 0; i < count; i++) {
JDWP.VirtualMachine.AllClassesWithGeneric.ClassInfo ci =
cinfos[i];
ReferenceTypeImpl type = referenceType(ci.typeID,
@@ -1360,7 +1414,6 @@
}
synchronized void removeObjectMirror(ObjectReferenceImpl object) {
-
// Handle any queue elements that are not strongly reachable
processQueue();
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,25 +25,30 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.connect.spi.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.ResourceBundle;
-import java.io.IOException;
+import java.util.ServiceLoader;
-import java.util.ServiceLoader;
+import com.sun.jdi.JDIPermission;
+import com.sun.jdi.VMDisconnectedException;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.VirtualMachineManager;
+import com.sun.jdi.connect.AttachingConnector;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.LaunchingConnector;
+import com.sun.jdi.connect.ListeningConnector;
+import com.sun.jdi.connect.spi.Connection;
+import com.sun.jdi.connect.spi.TransportService;
/* Public for use by com.sun.jdi.Bootstrap */
public class VirtualMachineManagerImpl implements VirtualMachineManagerService {
- private List<Connector> connectors = new ArrayList<Connector>();
+ private List<Connector> connectors = new ArrayList<>();
private LaunchingConnector defaultConnector = null;
- private List<VirtualMachine> targets = new ArrayList<VirtualMachine>();
+ private List<VirtualMachine> targets = new ArrayList<>();
private final ThreadGroup mainGroupForJDI;
private ResourceBundle messages = null;
private int vmSequenceNumber = 0;
@@ -158,7 +163,6 @@
if (!found && launchers.size() > 0) {
setDefaultConnector(launchers.get(0));
}
-
}
public LaunchingConnector defaultConnector() {
@@ -173,7 +177,7 @@
}
public List<LaunchingConnector> launchingConnectors() {
- List<LaunchingConnector> launchingConnectors = new ArrayList<LaunchingConnector>(connectors.size());
+ List<LaunchingConnector> launchingConnectors = new ArrayList<>(connectors.size());
for (Connector connector: connectors) {
if (connector instanceof LaunchingConnector) {
launchingConnectors.add((LaunchingConnector)connector);
@@ -183,7 +187,7 @@
}
public List<AttachingConnector> attachingConnectors() {
- List<AttachingConnector> attachingConnectors = new ArrayList<AttachingConnector>(connectors.size());
+ List<AttachingConnector> attachingConnectors = new ArrayList<>(connectors.size());
for (Connector connector: connectors) {
if (connector instanceof AttachingConnector) {
attachingConnectors.add((AttachingConnector)connector);
@@ -193,7 +197,7 @@
}
public List<ListeningConnector> listeningConnectors() {
- List<ListeningConnector> listeningConnectors = new ArrayList<ListeningConnector>(connectors.size());
+ List<ListeningConnector> listeningConnectors = new ArrayList<>(connectors.size());
for (Connector connector: connectors) {
if (connector instanceof ListeningConnector) {
listeningConnectors.add((ListeningConnector)connector);
@@ -267,5 +271,4 @@
}
return messages.getString(key);
}
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerService.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,23 +25,23 @@
package com.sun.tools.jdi;
-import com.sun.jdi.connect.*;
-import com.sun.jdi.VirtualMachine;
import com.sun.jdi.VirtualMachineManager;
-import java.io.IOException;
+import com.sun.jdi.connect.Connector;
+import com.sun.jdi.connect.LaunchingConnector;
/**
* VirtualMachineManager SPI
*/
public interface VirtualMachineManagerService extends VirtualMachineManager {
+
/**
* Replaces the default connector.
*
+ * @param connector the new default connector
+ *
* @throws java.lang.IllegalArgumentException if the given
* connector is not a member of the list returned by
* {@link #launchingConnectors}
- *
- * @param connector the new default connector
*/
void setDefaultConnector(LaunchingConnector connector);
@@ -58,5 +58,4 @@
* @param connector the connector to be removed
*/
void removeConnector(Connector connector);
-
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VoidTypeImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VoidTypeImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,11 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.VoidType;
public class VoidTypeImpl extends TypeImpl implements VoidType {
+
VoidTypeImpl(VirtualMachine vm) {
super(vm);
}
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VoidValueImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VoidValueImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,10 @@
package com.sun.tools.jdi;
-import com.sun.jdi.*;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.Type;
+import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.VoidValue;
public class VoidValueImpl extends ValueImpl implements VoidValue {
@@ -49,7 +52,8 @@
}
ValueImpl prepareForAssignmentTo(ValueContainer destination)
- throws InvalidTypeException {
+ throws InvalidTypeException
+ {
if ("void".equals(destination.typeName())) {
return this;
}
--- a/jdk/src/jdk.jdi/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdi/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -39,14 +39,14 @@
* creation, etc. The ability to inspect a suspended thread's state, local
* variables, stack backtrace, etc.
* <p>
- * JDI is the highest-layer of the Java Platform Debugger Architecture (JPDA).
- * For more information on the Java Platform Debugger Architecture, see the <a
- * href="{@docRoot}/../../../../technotes/guides/jpda/index.html"> Java
- * Platform Debugger Architecture documentation</a> for this release and the <a
- * href="http://java.sun.com/products/jpda">Java Platform Debugger Architecture
- * website</a>.
- * <p style="font-size:larger">
- * <b>Global Exceptions:</b>
+ * JDI is the highest-layer of the
+ * <a href="{@docRoot}/../specs/jpda/jpda.html">
+ * Java Platform Debugger Architecture (JPDA)</a>.
+ * <p>
+ * This module includes a simple command-line debugger,
+ * <em>{@index jdb jdb tool}</em>.
+ *
+ * <h3>Global Exceptions</h3>
* <p>
* This section documents exceptions which apply to the entire API and are thus
* not documented on individual methods.
@@ -103,8 +103,21 @@
* unloaded.
* </blockquote>
*
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink jdb_tool_reference jdb}
+ * </dl>
+ *
+ * @provides com.sun.jdi.connect.Connector
+ *
+ * @uses com.sun.jdi.connect.Connector
+ * @uses com.sun.jdi.connect.spi.TransportService
+ *
* @moduleGraph
* @since 9
+ * @see <a href="{@docRoot}/../specs/jpda/jpda.html">
+ * Java Platform Debugger Architecture (JPDA)</a>
*/
module jdk.jdi {
requires jdk.attach;
@@ -127,4 +140,3 @@
com.sun.tools.jdi.SocketListeningConnector,
com.sun.tools.jdi.SunCommandLineLauncher;
}
-
--- a/jdk/src/jdk.jdwp.agent/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdwp.agent/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,11 +24,12 @@
*/
/**
- * Java Debug Wire Protocol.
+ * Provides the implementation of the Java Debug Wire Protocol (JDWP) agent.
*
* @moduleGraph
* @since 9
+ * @see <a href="../specs/jdwp/jdwp-spec.html">JDWP Specification</a>
+ * @see <a href="../specs/jdwp/jdwp-transport.html">JDWP Transport Specification</a>
*/
module jdk.jdwp.agent {
}
-
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c Thu Aug 24 16:24:44 2017 +0200
@@ -212,30 +212,6 @@
}
/*
- * Delete saved global references - if any - for:
- * - a potentially thrown Exception
- * - a returned refernce/array value
- * See invoker_doInvoke() and invoke* methods where global references
- * are being saved.
- */
-static void
-deletePotentiallySavedGlobalRefs(JNIEnv *env, InvokeRequest *request)
-{
- /* Delete potentially saved return value */
- if ((request->invokeType == INVOKE_CONSTRUCTOR) ||
- (returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT)) ||
- (returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY))) {
- if (request->returnValue.l != NULL) {
- tossGlobalRef(env, &(request->returnValue.l));
- }
- }
- /* Delete potentially saved exception */
- if (request->exception != NULL) {
- tossGlobalRef(env, &(request->exception));
- }
-}
-
-/*
* Delete global argument references from the request which got put there before a
* invoke request was carried out. See fillInvokeRequest().
*/
@@ -782,6 +758,7 @@
jint id;
InvokeRequest *request;
jboolean detached;
+ jboolean mustReleaseReturnValue = JNI_FALSE;
JDI_ASSERT(thread);
@@ -825,6 +802,13 @@
id = request->id;
exc = request->exception;
returnValue = request->returnValue;
+
+ /* Release return value and exception references, but delay the release
+ * until after the return packet was sent. */
+ mustReleaseReturnValue = request->invokeType == INVOKE_CONSTRUCTOR ||
+ returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT) ||
+ returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY);
+
}
/*
@@ -839,6 +823,12 @@
*/
deleteGlobalArgumentRefs(env, request);
+ /* From now on, do not access the request structure anymore
+ * for this request id, because once we give up the invokerLock it may
+ * be immediately reused by a new invoke request.
+ */
+ request = NULL;
+
/*
* Give up the lock before I/O operation
*/
@@ -859,7 +849,12 @@
*/
eventHandler_lock(); // for proper lock order
debugMonitorEnter(invokerLock);
- deletePotentiallySavedGlobalRefs(env, request);
+ if (mustReleaseReturnValue && returnValue.l != NULL) {
+ tossGlobalRef(env, &returnValue.l);
+ }
+ if (exc != NULL) {
+ tossGlobalRef(env, &exc);
+ }
debugMonitorExit(invokerLock);
eventHandler_unlock();
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java Thu Aug 24 16:24:44 2017 +0200
@@ -34,6 +34,10 @@
import java.lang.module.ModuleDescriptor.Provides;
import java.lang.module.ModuleDescriptor.Requires;
import java.lang.module.ModuleDescriptor.Version;
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReader;
+import java.lang.module.ModuleReference;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
@@ -41,13 +45,17 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.IntSupplier;
+import java.util.stream.Collectors;
import jdk.internal.module.Checks;
import jdk.internal.module.ClassFileAttributes;
import jdk.internal.module.ClassFileConstants;
+import jdk.internal.module.IllegalAccessMaps;
import jdk.internal.module.ModuleHashes;
import jdk.internal.module.ModuleInfo.Attributes;
import jdk.internal.module.ModuleInfoExtender;
@@ -601,6 +609,10 @@
// generate SystemModules::moduleResolutions
genModuleResolutionsMethod();
+ // generate SystemModules::concealedPackagesToOpen and
+ // SystemModules::exportedPackagesToOpen
+ genXXXPackagesToOpenMethods();
+
return cw;
}
@@ -733,6 +745,96 @@
mresmv.visitEnd();
}
+ /**
+ * Generate SystemModules::concealedPackagesToOpen and
+ * SystemModules::exportedPackagesToOpen methods.
+ */
+ private void genXXXPackagesToOpenMethods() {
+ List<ModuleDescriptor> descriptors = moduleInfos.stream()
+ .map(ModuleInfo::descriptor)
+ .collect(Collectors.toList());
+ ModuleFinder finder = finderOf(descriptors);
+ IllegalAccessMaps maps = IllegalAccessMaps.generate(finder);
+ generate("concealedPackagesToOpen", maps.concealedPackagesToOpen());
+ generate("exportedPackagesToOpen", maps.exportedPackagesToOpen());
+ }
+
+ /**
+ * Generate SystemModules:XXXPackagesToOpen
+ */
+ private void generate(String methodName, Map<String, Set<String>> map) {
+ // Map<String, Set<String>> XXXPackagesToOpen()
+ MethodVisitor mv = cw.visitMethod(ACC_PUBLIC+ACC_STATIC,
+ methodName,
+ "()Ljava/util/Map;",
+ "()Ljava/util/Map;",
+ null);
+ mv.visitCode();
+
+ // new Map$Entry[moduleCount]
+ pushInt(mv, map.size());
+ mv.visitTypeInsn(ANEWARRAY, "java/util/Map$Entry");
+
+ int index = 0;
+ for (Map.Entry<String, Set<String>> e : map.entrySet()) {
+ String moduleName = e.getKey();
+ Set<String> packages = e.getValue();
+ int packageCount = packages.size();
+
+ mv.visitInsn(DUP);
+ pushInt(mv, index);
+ mv.visitLdcInsn(moduleName);
+
+ // use Set.of(Object[]) when there are more than 2 packages
+ // use Set.of(Object) or Set.of(Object, Object) when fewer packages
+ if (packageCount > 2) {
+ pushInt(mv, packageCount);
+ mv.visitTypeInsn(ANEWARRAY, "java/lang/String");
+ int i = 0;
+ for (String pn : packages) {
+ mv.visitInsn(DUP);
+ pushInt(mv, i);
+ mv.visitLdcInsn(pn);
+ mv.visitInsn(AASTORE);
+ i++;
+ }
+ mv.visitMethodInsn(INVOKESTATIC,
+ "java/util/Set",
+ "of",
+ "([Ljava/lang/Object;)Ljava/util/Set;",
+ true);
+ } else {
+ StringBuilder sb = new StringBuilder("(");
+ for (String pn : packages) {
+ mv.visitLdcInsn(pn);
+ sb.append("Ljava/lang/Object;");
+ }
+ sb.append(")Ljava/util/Set;");
+ mv.visitMethodInsn(INVOKESTATIC,
+ "java/util/Set",
+ "of",
+ sb.toString(),
+ true);
+ }
+
+ String desc = "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map$Entry;";
+ mv.visitMethodInsn(INVOKESTATIC,
+ "java/util/Map",
+ "entry",
+ desc,
+ true);
+ mv.visitInsn(AASTORE);
+ index++;
+ }
+
+ // invoke Map.ofEntries(Map$Entry[])
+ mv.visitMethodInsn(INVOKESTATIC, "java/util/Map", "ofEntries",
+ "([Ljava/util/Map$Entry;)Ljava/util/Map;", true);
+ mv.visitInsn(ARETURN);
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+ }
+
public boolean isOverriddenClass(String path) {
return path.equals("/java.base/" + CLASSNAME + ".class");
}
@@ -1461,4 +1563,31 @@
}
}
}
+
+ static ModuleFinder finderOf(Iterable<ModuleDescriptor> descriptors) {
+ Map<String, ModuleReference> namesToReference = new HashMap<>();
+ for (ModuleDescriptor descriptor : descriptors) {
+ String name = descriptor.name();
+ URI uri = URI.create("module:/" + name);
+ ModuleReference mref = new ModuleReference(descriptor, uri) {
+ @Override
+ public ModuleReader open() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ namesToReference.putIfAbsent(name, mref);
+ }
+
+ return new ModuleFinder() {
+ @Override
+ public Optional<ModuleReference> find(String name) {
+ Objects.requireNonNull(name);
+ return Optional.ofNullable(namesToReference.get(name));
+ }
+ @Override
+ public Set<ModuleReference> findAll() {
+ return new HashSet<>(namesToReference.values());
+ }
+ };
+ }
}
--- a/jdk/src/jdk.jlink/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,31 @@
*/
/**
- * Defines the Java linker tool, jlink.
+ * Defines the <em>{@index jlink jlink tool}</em> tool for creating run-time
+ * images, the <em>{@index jmod jmod tool}</em> tool for creating and manipulating
+ * JMOD files, and the <em>{@index jimage jimage tool}</em> tool for inspecting
+ * the JDK implementation-specific container file for classes and resources.
+ *
+ * <p> This module provides the equivalent of command-line access to the
+ * <em>{@extLink jlink_tool_reference jlink}</em> and
+ * <em>{@extLink jmod_tool_reference jmod}</em> tools via the
+ * {@link java.util.spi.ToolProvider ToolProvider} SPI.
+ * Instances of the tools can be obtained by calling
+ * {@link java.util.spi.ToolProvider#findFirst ToolProvider.findFirst}
+ * or the {@link java.util.ServiceLoader service loader} with the name
+ * {@code "jlink"} or {@code "jmod"} as appropriate.
+ *
+ * <p> <em>{@extLink jimage_tool_reference jimage}</em> only exists
+ * as a command-line tool, and does not provide any direct API.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink jlink_tool_reference jlink},
+ * {@extLink jmod_tool_reference jmod},
+ * {@extLink jimage_tool_reference jimage}
+ * </dl>
+ *
+ * @provides java.util.spi.ToolProvider
*
* @moduleGraph
* @since 9
--- a/jdk/src/jdk.jsobject/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jsobject/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,6 +31,7 @@
*/
module jdk.jsobject {
requires java.desktop;
+
exports netscape.javascript;
uses jdk.internal.netscape.javascript.spi.JSObjectProvider;
--- a/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java Thu Aug 24 16:24:44 2017 +0200
@@ -151,7 +151,7 @@
* JavaScript engine or if applet is {@code null}
*
* @deprecated The Applet API is deprecated. See the
- * <a href="../../../../../../api/java/applet/package-summary.html">
+ * <a href="{@docRoot}/java/applet/package-summary.html">
* java.applet package documentation</a> for further information.
*/
--- a/jdk/src/jdk.jstatd/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.jstatd/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,8 +24,13 @@
*/
/**
- * Defines the tool for starting a daemon for the jstat tool to monitor
- * JVM statistics remotely.
+ * Defines the <em>{@index jstatd jstatd tool}</em> tool for starting a daemon
+ * for the jstat tool to monitor JVM statistics remotely.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink jstatd_tool_reference jstatd}
+ * </dl>
*
* @moduleGraph
* @since 9
@@ -37,5 +42,6 @@
// RMI needs to serialize types in this package
exports sun.jvmstat.monitor.remote to java.rmi;
- provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService;
+ provides sun.jvmstat.monitor.MonitoredHostService with
+ sun.jvmstat.perfdata.monitor.protocol.rmi.MonitoredHostRmiService;
}
--- a/jdk/src/jdk.localedata/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.localedata/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,7 @@
*/
/**
- * Locale data provider for locales other than {@linkplain java.util.Locale#US US locale}.
+ * Provides the locale data for locales other than {@linkplain java.util.Locale#US US locale}.
*
* @moduleGraph
* @since 9
--- a/jdk/src/jdk.management.agent/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.management.agent/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,12 @@
*/
/**
- * Define the JMX management agent.
+ * Defines the JMX management agent.
+ *
+ * <p> This module allows a Java Virtual Machine to be monitored and managed
+ * via JMX API. See more information from the
+ * {@extLink monitoring_and_management_using_jmx_technology
+ * Monitoring and Management Using JMX} guide.
*
* @moduleGraph
* @since 9
--- a/jdk/src/jdk.naming.dns/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.naming.dns/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,8 +24,9 @@
*/
/**
- * DNS Java Naming provider.
+ * Provides the implementation of the DNS Java Naming provider.
*
+ * @provides javax.naming.spi.InitialContextFactory
* @moduleGraph
* @since 9
*/
@@ -35,7 +36,6 @@
// temporary export until NamingManager.getURLContext uses services
exports com.sun.jndi.url.dns to java.naming;
- provides javax.naming.spi.InitialContextFactory
- with com.sun.jndi.dns.DnsContextFactory;
+ provides javax.naming.spi.InitialContextFactory with
+ com.sun.jndi.dns.DnsContextFactory;
}
-
--- a/jdk/src/jdk.naming.rmi/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.naming.rmi/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,19 +24,21 @@
*/
/**
- * RMI Java Naming provider.
+ * Provides the implementation of the RMI Java Naming provider.
*
+ * @provides javax.naming.spi.InitialContextFactory
* @moduleGraph
* @since 9
*/
module jdk.naming.rmi {
requires java.naming;
requires java.rmi;
- provides javax.naming.spi.InitialContextFactory
- with com.sun.jndi.rmi.registry.RegistryContextFactory;
// temporary export until NamingManager.getURLContext uses services
exports com.sun.jndi.url.rmi to java.naming;
exports com.sun.jndi.rmi.registry to java.rmi;
+
+ provides javax.naming.spi.InitialContextFactory with
+ com.sun.jndi.rmi.registry.RegistryContextFactory;
+
}
-
--- a/jdk/src/jdk.pack/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.pack/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,8 +25,15 @@
/**
* Defines tools for transforming a JAR file into a compressed pack200 file
- * and transforming a packed file into a JAR file, including the pack200,
- * and unpack200 tools.
+ * and transforming a packed file into a JAR file, including the
+ * <em>{@index pack200 pack200 tool}</em> and
+ * <em>{@index unpack200 unpack200 tool}</em> tools.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink pack200_tool_reference pack200},
+ * {@extLink unpack200_tool_reference unpack200}
+ * </dl>
*
* @moduleGraph
* @since 9
--- a/jdk/src/jdk.policytool/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.policytool/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,13 @@
*/
/**
- * GUI tool for managing policy files.
+ * Defines the GUI tool for managing policy files
+ * called <em>{@index policytool policytool}</em>.
+ *
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink policytool_tool_reference policytool}
+ * </dl>
*
* @since 9
* @deprecated
@@ -34,9 +40,8 @@
requires java.desktop;
requires java.logging;
requires java.management;
+ requires java.security.jgss;
requires java.sql;
requires jdk.net;
- requires java.security.jgss;
requires jdk.security.jgss;
}
-
--- a/jdk/src/jdk.rmic/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.rmic/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,10 +24,15 @@
*/
/**
- * Defines the rmic compiler for generating stubs and skeletons using
- * the Java Remote Method Protocol (JRMP) and
+ * Defines the <em>{@index rmic rmic}</em> compiler for generating stubs and
+ * skeletons using the Java Remote Method Protocol (JRMP) and
* stubs and tie class files (IIOP protocol) for remote objects.
*
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink rmic_tool_reference rmic}
+ * </dl>
+ *
* @moduleGraph
* @since 9
*/
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/callback/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/callback/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,4 +23,10 @@
* questions.
*/
+/**
+ * Provides an implementation of
+ * {@link javax.security.auth.callback.CallbackHandler}.
+ *
+ * @since 1.4
+ */
package com.sun.security.auth.callback;
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/login/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/login/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,4 +23,9 @@
* questions.
*/
+/**
+ * Provides an implementation of {@link javax.security.auth.login.Configuration}.
+ *
+ * @since 1.4
+ */
package com.sun.security.auth.login;
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,4 +23,9 @@
* questions.
*/
+/**
+ * Provides implementations of {@link javax.security.auth.spi.LoginModule}.
+ *
+ * @since 1.4
+ */
package com.sun.security.auth.module;
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,4 +23,9 @@
* questions.
*/
+/**
+ * Provides implementations of {@link java.security.Principal}.
+ *
+ * @since 1.4
+ */
package com.sun.security.auth;
--- a/jdk/src/jdk.security.auth/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.security.auth/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,15 +24,18 @@
*/
/**
- * Contains the implementation of the javax.security.auth.* interfaces and
- * various authentication modules.
+ * Provides implementations of the {@code javax.security.auth.*}
+ * interfaces and various authentication modules.
*
+ * @provides javax.security.auth.spi.LoginModule
* @moduleGraph
* @since 9
*/
module jdk.security.auth {
+
+ requires java.security.jgss;
+
requires transitive java.naming;
- requires java.security.jgss;
exports com.sun.security.auth;
exports com.sun.security.auth.callback;
@@ -47,4 +50,3 @@
com.sun.security.auth.module.LdapLoginModule,
com.sun.security.auth.module.NTLoginModule;
}
-
--- a/jdk/src/jdk.security.jgss/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.security.jgss/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -31,10 +31,14 @@
* @since 9
*/
module jdk.security.jgss {
- requires transitive java.security.jgss;
requires java.logging;
requires java.security.sasl;
+
+ requires transitive java.security.jgss;
+
exports com.sun.security.jgss;
- provides java.security.Provider with com.sun.security.sasl.gsskerb.JdkSASL;
+
+ provides java.security.Provider with
+ com.sun.security.sasl.gsskerb.JdkSASL;
}
--- a/jdk/src/jdk.unsupported/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.unsupported/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,9 +24,9 @@
*/
module jdk.unsupported {
+ exports com.sun.nio.file;
exports sun.misc;
exports sun.reflect;
- exports com.sun.nio.file;
opens sun.misc;
opens sun.reflect;
--- a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Aug 24 16:24:44 2017 +0200
@@ -813,8 +813,15 @@
/**
* Tells the VM to define a class, without security checks. By default, the
* class loader and protection domain come from the caller's class.
+ *
+ * @deprecated Use {@link java.lang.invoke.MethodHandles.Lookup#defineClass MethodHandles.Lookup#defineClass}
+ * to define a class to the same class loader and in the same runtime package
+ * and {@linkplain java.security.ProtectionDomain protection domain} of a
+ * given {@code Lookup}'s {@linkplain java.lang.invoke.MethodHandles.Lookup#lookupClass() lookup class}.
+ *
* @see java.lang.invoke.MethodHandles.Lookup#defineClass(byte[])
*/
+ @Deprecated(since="9", forRemoval=true)
@ForceInline
public Class<?> defineClass(String name, byte[] b, int off, int len,
ClassLoader loader,
--- a/jdk/src/jdk.zipfs/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,12 +24,19 @@
*/
/**
- * Zip file system provider.
+ * Provides the implementation of the zip file system provider.
*
+ * <p> The zip file system provider treats a zip or JAR file as a file system
+ * and provides the ability to manipulate the contents of the file.
+ * The zip file system provider can be created by
+ * {@link java.nio.file.FileSystems#newFileSystem
+ * FileSystems.newFileSystem} if installed.
+ *
+ * @provides java.nio.file.spi.FileSystemProvider
* @moduleGraph
* @since 9
*/
module jdk.zipfs {
- provides java.nio.file.spi.FileSystemProvider with jdk.nio.zipfs.ZipFileSystemProvider;
+ provides java.nio.file.spi.FileSystemProvider with
+ jdk.nio.zipfs.ZipFileSystemProvider;
}
-
--- a/jdk/test/ProblemList.txt Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/ProblemList.txt Thu Aug 24 16:24:44 2017 +0200
@@ -126,6 +126,8 @@
jdk/internal/misc/JavaLangAccess/NewUnsafeString.java 8176188 generic-all
+java/lang/String/nativeEncoding/StringPlatformChars.java 8182569 windows-all,solaris-all
+
############################################################################
# jdk_instrument
@@ -301,6 +303,8 @@
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-all
+com/sun/tools/attach/StartManagementAgent.java 8179700 generic-all
+
############################################################################
# jdk_other
--- a/jdk/test/TEST.groups Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/TEST.groups Thu Aug 24 16:24:44 2017 +0200
@@ -554,7 +554,6 @@
java/nio/charset/Charset/NIOCharsetAvailabilityTest.java \
java/nio/charset/Charset/RegisteredCharsets.java \
java/nio/charset/CharsetEncoder/Flush.java \
- java/nio/charset/coders/CheckSJISMappingProp.sh \
java/nio/charset/coders/ResetISO2022JP.java \
java/util/Locale/InternationalBAT.java \
java/util/Locale/LocaleProviders.sh \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jndi/ldap/RemoveNamingListenerTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2011, 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.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.nio.charset.StandardCharsets;
+import java.util.ConcurrentModificationException;
+import java.util.Hashtable;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.event.EventContext;
+import javax.naming.event.NamingEvent;
+import javax.naming.event.NamingExceptionEvent;
+import javax.naming.event.NamingListener;
+import javax.naming.event.ObjectChangeListener;
+
+/**
+ * @test
+ * @bug 8176192
+ * @summary Incorrect usage of Iterator in Java 8 In com.sun.jndi.ldap.
+ * EventSupport.removeNamingListener
+ * @modules java.naming
+ * @run main RemoveNamingListenerTest
+ */
+public class RemoveNamingListenerTest {
+
+ private static volatile Exception exception;
+
+ public static void main(String args[]) throws Exception {
+ // start the LDAP server
+ TestLDAPServer server = new TestLDAPServer();
+ server.start();
+
+ // Set up environment for creating initial context
+ Hashtable<String, Object> env = new Hashtable<>(3);
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+ env.put(Context.PROVIDER_URL, "ldap://localhost:" + server.getPort() + "/o=example");
+ env.put("com.sun.jndi.ldap.connect.timeout", "2000");
+ EventContext ctx = null;
+
+ try {
+ ctx = (EventContext) (new InitialContext(env).lookup(""));
+ String target = "cn=Vyom Tewari";
+
+ // Create listeners
+ NamingListener oneListener = new SampleListener();
+ NamingListener objListener = new SampleListener();
+ NamingListener subListener = new SampleListener();
+
+ // Register listeners using different scopes
+ ctx.addNamingListener(target, EventContext.ONELEVEL_SCOPE, oneListener);
+ ctx.addNamingListener(target, EventContext.OBJECT_SCOPE, objListener);
+ ctx.addNamingListener(target, EventContext.SUBTREE_SCOPE, subListener);
+
+ //remove a listener in different thread
+ Thread t = new Thread(new RemoveNamingListener(ctx, subListener));
+ t.start();
+ t.join();
+
+ if (exception != null) {
+ throw exception;
+ }
+ System.out.println("Test run OK!!!");
+ } finally {
+ if (ctx != null) {
+ ctx.close();
+ }
+ server.stopServer();
+ }
+ }
+
+ /**
+ * Helper thread that removes the naming listener.
+ */
+ static class RemoveNamingListener implements Runnable {
+
+ final EventContext ctx;
+ final NamingListener listener;
+
+ RemoveNamingListener(EventContext ctx, NamingListener listener) {
+ this.ctx = ctx;
+ this.listener = listener;
+ }
+
+ @Override
+ public void run() {
+ try {
+ ctx.removeNamingListener(listener);
+ } catch (NamingException | ConcurrentModificationException ex) {
+ exception = ex;
+ }
+ }
+ }
+
+ static class SampleListener implements ObjectChangeListener {
+
+ @Override
+ public void objectChanged(NamingEvent ne) {
+ //do nothing
+ }
+
+ @Override
+ public void namingExceptionThrown(NamingExceptionEvent nee) {
+ //do nothing
+ }
+ }
+}
+
+class TestLDAPServer extends Thread {
+
+ private final int LDAP_PORT;
+ private final ServerSocket serverSocket;
+ private volatile boolean isRunning;
+
+ TestLDAPServer() throws IOException {
+ serverSocket = new ServerSocket(0);
+ isRunning = true;
+ LDAP_PORT = serverSocket.getLocalPort();
+ setDaemon(true);
+ }
+
+ public int getPort() {
+ return LDAP_PORT;
+ }
+
+ public void stopServer() {
+ isRunning = false;
+ if (serverSocket != null && !serverSocket.isClosed()) {
+ try {
+ // this will cause ServerSocket.accept() to throw SocketException.
+ serverSocket.close();
+ } catch (IOException ignored) {
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ try {
+ while (isRunning) {
+ Socket clientSocket = serverSocket.accept();
+ Thread handler = new Thread(new LDAPServerHandler(clientSocket));
+ handler.setDaemon(true);
+ handler.start();
+ }
+ } catch (IOException iOException) {
+ //do not throw exception if server is not running.
+ if (isRunning) {
+ throw new RuntimeException(iOException);
+ }
+ } finally {
+ stopServer();
+ }
+ }
+}
+
+class LDAPServerHandler implements Runnable {
+
+ private final Socket clientSocket;
+
+ public LDAPServerHandler(final Socket clientSocket) {
+ this.clientSocket = clientSocket;
+ }
+
+ @Override
+ public void run() {
+ BufferedInputStream in = null;
+ PrintWriter out = null;
+ byte[] bindResponse = {0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00};
+ byte[] searchResponse = {0x30, 0x0C, 0x02, 0x01, 0x02, 0x65, 0x07, 0x0A, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00};
+ try {
+ in = new BufferedInputStream(clientSocket.getInputStream());
+ out = new PrintWriter(new OutputStreamWriter(
+ clientSocket.getOutputStream(), StandardCharsets.UTF_8), true);
+ while (true) {
+
+ // Read the LDAP BindRequest
+ while (in.read() != -1) {
+ in.skip(in.available());
+ break;
+ }
+
+ // Write an LDAP BindResponse
+ out.write(new String(bindResponse));
+ out.flush();
+
+ // Read the LDAP SearchRequest
+ while (in.read() != -1) {
+ in.skip(in.available());
+ break;
+ }
+
+ // Write an LDAP SearchResponse
+ out.write(new String(searchResponse));
+ out.flush();
+ }
+ } catch (IOException iOException) {
+ throw new RuntimeException(iOException);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ignored) {
+ }
+ }
+ if (out != null) {
+ out.close();
+ }
+ if (clientSocket != null) {
+ try {
+ clientSocket.close();
+ } catch (IOException ignored) {
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/net/httpserver/EchoHandler.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2005, 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.*;
+import java.util.concurrent.*;
+import java.util.logging.*;
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import javax.net.ssl.*;
+import com.sun.net.httpserver.*;
+
+/**
+ * Implements a basic static EchoHandler for an HTTP server
+ */
+public class EchoHandler implements HttpHandler {
+
+ byte[] read(InputStream is) throws IOException {
+ byte[] buf = new byte[1024];
+ byte[] result = new byte[0];
+
+ while (true) {
+ int n = is.read(buf);
+ if (n > 0) {
+ byte[] b1 = new byte[result.length + n];
+ System.arraycopy(result, 0, b1, 0, result.length);
+ System.arraycopy(buf, 0, b1, result.length, n);
+ result = b1;
+ } else if (n == -1) {
+ return result;
+ }
+ }
+ }
+
+ public void handle (HttpExchange t)
+ throws IOException
+ {
+ InputStream is = t.getRequestBody();
+ Headers map = t.getRequestHeaders();
+ String fixedrequest = map.getFirst ("XFixed");
+
+ // return the number of bytes received (no echo)
+ String summary = map.getFirst ("XSummary");
+ if (fixedrequest != null && summary == null) {
+ byte[] in = read(is);
+ t.sendResponseHeaders(200, in.length);
+ OutputStream os = t.getResponseBody();
+ os.write(in);
+ close(os);
+ close(is);
+ } else {
+ OutputStream os = t.getResponseBody();
+ byte[] buf = new byte[64 * 1024];
+ t.sendResponseHeaders(200, 0);
+ int n, count=0;;
+
+ while ((n = is.read(buf)) != -1) {
+ if (summary == null) {
+ os.write(buf, 0, n);
+ }
+ count += n;
+ }
+ if (summary != null) {
+ String s = Integer.toString(count);
+ os.write(s.getBytes());
+ }
+ close(os);
+ close(is);
+ }
+ }
+
+ protected void close(OutputStream os) throws IOException {
+ os.close();
+ }
+ protected void close(InputStream is) throws IOException {
+ is.close();
+ }
+}
--- a/jdk/test/com/sun/net/httpserver/FileServerHandler.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/com/sun/net/httpserver/FileServerHandler.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -31,210 +31,122 @@
import com.sun.net.httpserver.*;
/**
- * Implements a basic static content HTTP server
+ * Implements a basic static content HTTP file server handler
* which understands text/html, text/plain content types
*
* Must be given an abs pathname to the document root.
* Directory listings together with text + html files
* can be served.
*
- * File Server created on files sub-path
- *
- * Echo server created on echo sub-path
*/
public class FileServerHandler implements HttpHandler {
- public static void main (String[] args) throws Exception {
- if (args.length != 3) {
- System.out.println ("usage: java FileServerHandler rootDir port logfilename");
- System.exit(1);
- }
- Logger logger = Logger.getLogger("com.sun.net.httpserver");
- ConsoleHandler ch = new ConsoleHandler();
- logger.setLevel(Level.ALL);
- ch.setLevel(Level.ALL);
- logger.addHandler(ch);
+ String docroot;
+
+ public FileServerHandler (String docroot) {
+ this.docroot = docroot;
+ }
+
+ int invocation = 1;
+ public void handle (HttpExchange t)
+ throws IOException
+ {
+ InputStream is = t.getRequestBody();
+ Headers map = t.getRequestHeaders();
+ Headers rmap = t.getResponseHeaders();
+ URI uri = t.getRequestURI();
+ String path = uri.getPath();
- String rootDir = args[0];
- int port = Integer.parseInt (args[1]);
- String logfile = args[2];
- HttpServer server = HttpServer.create (new InetSocketAddress (port), 0);
- HttpHandler h = new FileServerHandler (rootDir);
- HttpHandler h1 = new EchoHandler ();
+ int x = 0;
+ while (is.read () != -1) x++;
+ is.close();
+ File f = new File (docroot, path);
+ if (!f.exists()) {
+ notfound (t, path);
+ return;
+ }
+ String fixedrequest = map.getFirst ("XFixed");
- HttpContext c = server.createContext ("/files", h);
- c.getFilters().add (new LogFilter (new File (logfile)));
- HttpContext c1 = server.createContext ("/echo", h1);
- c.getFilters().add (new LogFilter (new File (logfile)));
- c1.getFilters().add (new LogFilter (new File (logfile)));
- server.setExecutor (Executors.newCachedThreadPool());
- server.start ();
- }
-
- String docroot;
-
- FileServerHandler (String docroot) {
- this.docroot = docroot;
+ String method = t.getRequestMethod();
+ if (method.equals ("HEAD")) {
+ rmap.set ("Content-Length", Long.toString (f.length()));
+ t.sendResponseHeaders (200, -1);
+ t.close();
+ } else if (!method.equals("GET")) {
+ t.sendResponseHeaders (405, -1);
+ t.close();
+ return;
}
- int invocation = 1;
- public void handle (HttpExchange t)
- throws IOException
- {
- InputStream is = t.getRequestBody();
- Headers map = t.getRequestHeaders();
- Headers rmap = t.getResponseHeaders();
- URI uri = t.getRequestURI();
- String path = uri.getPath();
-
- int x = 0;
- while (is.read () != -1) x++;
- is.close();
- File f = new File (docroot, path);
- if (!f.exists()) {
- notfound (t, path);
- return;
- }
- String fixedrequest = map.getFirst ("XFixed");
-
- String method = t.getRequestMethod();
- if (method.equals ("HEAD")) {
- rmap.set ("Content-Length", Long.toString (f.length()));
- t.sendResponseHeaders (200, -1);
- t.close();
- } else if (!method.equals("GET")) {
- t.sendResponseHeaders (405, -1);
- t.close();
+ if (path.endsWith (".html") || path.endsWith (".htm")) {
+ rmap.set ("Content-Type", "text/html");
+ } else {
+ rmap.set ("Content-Type", "text/plain");
+ }
+ if (f.isDirectory()) {
+ if (!path.endsWith ("/")) {
+ moved (t);
return;
}
-
- if (path.endsWith (".html") || path.endsWith (".htm")) {
- rmap.set ("Content-Type", "text/html");
- } else {
- rmap.set ("Content-Type", "text/plain");
+ rmap.set ("Content-Type", "text/html");
+ t.sendResponseHeaders (200, 0);
+ String[] list = f.list();
+ OutputStream os = t.getResponseBody();
+ PrintStream p = new PrintStream (os);
+ p.println ("<h2>Directory listing for: " + path+ "</h2>");
+ p.println ("<ul>");
+ for (int i=0; i<list.length; i++) {
+ p.println ("<li><a href=\""+list[i]+"\">"+list[i]+"</a></li>");
}
- if (f.isDirectory()) {
- if (!path.endsWith ("/")) {
- moved (t);
- return;
- }
- rmap.set ("Content-Type", "text/html");
- t.sendResponseHeaders (200, 0);
- String[] list = f.list();
- OutputStream os = t.getResponseBody();
- PrintStream p = new PrintStream (os);
- p.println ("<h2>Directory listing for: " + path+ "</h2>");
- p.println ("<ul>");
- for (int i=0; i<list.length; i++) {
- p.println ("<li><a href=\""+list[i]+"\">"+list[i]+"</a></li>");
- }
- p.println ("</ul><p><hr>");
- p.flush();
- p.close();
+ p.println ("</ul><p><hr>");
+ p.flush();
+ p.close();
+ } else {
+ int clen;
+ if (fixedrequest != null) {
+ clen = (int) f.length();
} else {
- int clen;
- if (fixedrequest != null) {
- clen = (int) f.length();
- } else {
- clen = 0;
- }
- t.sendResponseHeaders (200, clen);
- OutputStream os = t.getResponseBody();
- FileInputStream fis = new FileInputStream (f);
- int count = 0;
- try {
+ clen = 0;
+ }
+ t.sendResponseHeaders (200, clen);
+ OutputStream os = t.getResponseBody();
+ FileInputStream fis = new FileInputStream (f);
+ int count = 0;
+ try {
byte[] buf = new byte [16 * 1024];
int len;
while ((len=fis.read (buf)) != -1) {
os.write (buf, 0, len);
count += len;
}
- } catch (IOException e) {
- e.printStackTrace();
- }
- fis.close();
- os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
}
- }
-
- void moved (HttpExchange t) throws IOException {
- Headers req = t.getRequestHeaders();
- Headers map = t.getResponseHeaders();
- URI uri = t.getRequestURI();
- String host = req.getFirst ("Host");
- String location = "http://"+host+uri.getPath() + "/";
- map.set ("Content-Type", "text/html");
- map.set ("Location", location);
- t.sendResponseHeaders (301, -1);
- t.close();
- }
-
- void notfound (HttpExchange t, String p) throws IOException {
- t.getResponseHeaders().set ("Content-Type", "text/html");
- t.sendResponseHeaders (404, 0);
- OutputStream os = t.getResponseBody();
- String s = "<h2>File not found</h2>";
- s = s + p + "<p>";
- os.write (s.getBytes());
+ fis.close();
os.close();
- t.close();
}
}
-class EchoHandler implements HttpHandler {
-
- byte[] read(InputStream is) throws IOException {
- byte[] buf = new byte[1024];
- byte[] result = new byte[0];
-
- while (true) {
- int n = is.read(buf);
- if (n > 0) {
- byte[] b1 = new byte[result.length + n];
- System.arraycopy(result, 0, b1, 0, result.length);
- System.arraycopy(buf, 0, b1, result.length, n);
- result = b1;
- } else if (n == -1) {
- return result;
- }
- }
+ void moved (HttpExchange t) throws IOException {
+ Headers req = t.getRequestHeaders();
+ Headers map = t.getResponseHeaders();
+ URI uri = t.getRequestURI();
+ String host = req.getFirst ("Host");
+ String location = "http://"+host+uri.getPath() + "/";
+ map.set ("Content-Type", "text/html");
+ map.set ("Location", location);
+ t.sendResponseHeaders (301, -1);
+ t.close();
}
- public void handle (HttpExchange t)
- throws IOException
- {
- InputStream is = t.getRequestBody();
- Headers map = t.getRequestHeaders();
- String fixedrequest = map.getFirst ("XFixed");
-
- // return the number of bytes received (no echo)
- String summary = map.getFirst ("XSummary");
- if (fixedrequest != null && summary == null) {
- byte[] in = read(is);
- t.sendResponseHeaders(200, in.length);
- OutputStream os = t.getResponseBody();
- os.write(in);
- os.close();
- is.close();
- } else {
- OutputStream os = t.getResponseBody();
- byte[] buf = new byte[64 * 1024];
- t.sendResponseHeaders(200, 0);
- int n, count=0;;
-
- while ((n = is.read(buf)) != -1) {
- if (summary == null) {
- os.write(buf, 0, n);
- }
- count += n;
- }
- if (summary != null) {
- String s = Integer.toString(count);
- os.write(s.getBytes());
- }
- os.close();
- is.close();
- }
+ void notfound (HttpExchange t, String p) throws IOException {
+ t.getResponseHeaders().set ("Content-Type", "text/html");
+ t.sendResponseHeaders (404, 0);
+ OutputStream os = t.getResponseBody();
+ String s = "<h2>File not found</h2>";
+ s = s + p + "<p>";
+ os.write (s.getBytes());
+ os.close();
+ t.close();
}
}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/net/httpserver/SimpleFileServer.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 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.*;
+import java.util.concurrent.*;
+import java.util.logging.*;
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import javax.net.ssl.*;
+import com.sun.net.httpserver.*;
+
+/**
+ * Implements a basic static content HTTP server
+ * which understands text/html, text/plain content types
+ *
+ * Must be given an abs pathname to the document root.
+ * Directory listings together with text + html files
+ * can be served.
+ *
+ * File Server created on files sub-path
+ *
+ * Echo server created on echo sub-path
+ */
+public class SimpleFileServer {
+
+ public static void main (String[] args) throws Exception {
+ if (args.length != 3) {
+ System.out.println ("usage: java FileServerHandler rootDir port logfilename");
+ System.exit(1);
+ }
+ Logger logger = Logger.getLogger("com.sun.net.httpserver");
+ ConsoleHandler ch = new ConsoleHandler();
+ logger.setLevel(Level.ALL);
+ ch.setLevel(Level.ALL);
+ logger.addHandler(ch);
+
+ String rootDir = args[0];
+ int port = Integer.parseInt (args[1]);
+ String logfile = args[2];
+ HttpServer server = HttpServer.create (new InetSocketAddress (port), 0);
+ HttpHandler h = new FileServerHandler (rootDir);
+ HttpHandler h1 = new EchoHandler ();
+
+ HttpContext c = server.createContext ("/files", h);
+ c.getFilters().add (new LogFilter (new File (logfile)));
+ HttpContext c1 = server.createContext ("/echo", h1);
+ c.getFilters().add (new LogFilter (new File (logfile)));
+ c1.getFilters().add (new LogFilter (new File (logfile)));
+ server.setExecutor (Executors.newCachedThreadPool());
+ server.start ();
+ }
+}
--- a/jdk/test/java/awt/List/ItemEventTest/ItemEventTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/awt/List/ItemEventTest/ItemEventTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,7 +24,7 @@
/*
* @test
* @key headful
- * @bug 8033936
+ * @bug 8033936 8172510
* @summary Verify that correct ItemEvent is received while selection &
* deselection of multi select List items.
*/
@@ -109,14 +109,16 @@
boolean isMac = osName.contains("Mac") || osName.contains("mac");
if(isMac) {
robot.keyPress(KeyEvent.VK_META);
+ robot.waitForIdle();
}
// First loop to select & Second loop to deselect the list items.
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < list.getItemCount(); ++i) {
robot.mouseMove(loc.x, loc.y + i * dY);
+ robot.waitForIdle();
robot.mousePress(InputEvent.BUTTON1_MASK);
- robot.delay(100);
+ robot.waitForIdle();
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.waitForIdle();
}
--- a/jdk/test/java/awt/image/MultiResolutionImageTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/awt/image/MultiResolutionImageTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -36,15 +36,15 @@
import java.awt.RenderingHints;
import java.awt.image.ImageObserver;
import javax.swing.JPanel;
-import jdk.testlibrary.Platform;
+import jdk.test.lib.Platform;
import java.awt.image.MultiResolutionImage;
/**
* @test @bug 8011059
* @author Alexander Scherbatiy
* @summary [macosx] Make JDK demos look perfect on retina displays
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.Platform
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
* @requires (os.family == "mac")
* @modules java.desktop/sun.awt
* java.desktop/sun.awt.image
--- a/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,6 +24,7 @@
/* @test
@bug 8167102
@summary PrintRequestAttributeSet breaks page size set using PageFormat
+ @ignore Exclude the test until 8167102 is resolved by a new reassessed fix
@run main/manual WrongPaperPrintingTest
*/
--- a/jdk/test/java/awt/xembed/server/RunTestXEmbed.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/awt/xembed/server/RunTestXEmbed.java Thu Aug 24 16:24:44 2017 +0200
@@ -28,9 +28,9 @@
* @summary Tests XEmbed server/client functionality
* @author Denis Mikhalkin: area=awt.xembed
* @requires (!(os.family=="mac") & !(os.family=="windows"))
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.desktop/sun.awt
- * @build jdk.testlibrary.Platform
+ * @build jdk.test.lib.Platform
* @compile JavaClient.java TesterClient.java TestXEmbedServer.java
* @run main/timeout=6000 RunTestXEmbed
*/
@@ -40,7 +40,7 @@
import java.util.logging.*;
import java.util.*;
import java.io.*;
-import jdk.testlibrary.Platform;
+import jdk.test.lib.Platform;
public class RunTestXEmbed extends TestXEmbedServer {
private static final Logger log = Logger.getLogger("test.xembed");
--- a/jdk/test/java/io/File/Basic.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/io/File/Basic.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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,13 +22,13 @@
*/
/* @test
- @bug 4165666 4203706 4288670 4290024
- @summary Basic heartbeat test for File methods that access the filesystem
-
- @build Basic Util
- @run shell basic.sh
+ * @bug 4165666 4203706 4288670 4290024
+ * @summary Basic heartbeat test for File methods that access the filesystem
+ * @build Basic Util
+ * @run main/othervm Basic
*/
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.File;
import java.io.PrintStream;
@@ -39,13 +39,13 @@
static PrintStream out = System.err;
- static File nonExistantFile = new File("x.Basic.non");
static File rwFile = new File("x.Basic.rw");
static File bigFile = new File("x.Basic.big");
static File roFile = new File("x.Basic.ro");
static File thisDir = new File(".");
static File dir = new File("x.Basic.dir");
- static File nonDir = new File("x.Basic.nonDir");
+ static File dir2 = new File("x.Basic.dir2");
+ static byte bytes[] = new byte[] {1, 2, 3, 4, 5, 6};
static void showBoolean(String what, boolean value) {
out.println(" " + what + ": " + value);
@@ -75,7 +75,6 @@
if (!f.canRead()) fail(f, "is not readable");
if (!Util.isPrivileged() && f.canWrite() != writeable)
fail(f, writeable ? "is not writeable" : "is writeable");
- int rwLen = 6;
if (f.length() != length) fail(f, "has wrong length");
}
@@ -83,16 +82,31 @@
throw new Exception(f + " " + why);
}
- public static void main(String[] args) throws Exception {
+ static void setup() throws Exception {
+ rwFile.delete();
+ bigFile.delete();
+ roFile.delete();
+ thisDir.delete();
+ dir.delete();
+ dir2.delete();
- show(nonExistantFile);
- if (nonExistantFile.exists()) fail(nonExistantFile, "exists");
+ try (FileOutputStream fos = new FileOutputStream(rwFile)) {
+ fos.write(bytes);
+ }
+
+ roFile.createNewFile();
+ roFile.setReadOnly();
+ }
+
+ public static void main(String[] args) throws Exception {
+ setup();
show(rwFile);
- testFile(rwFile, true, 6);
+ testFile(rwFile, true, bytes.length);
rwFile.delete();
- if (rwFile.exists())
+ if (rwFile.exists()) {
fail(rwFile, "could not delete");
+ }
show(roFile);
testFile(roFile, false, 0);
@@ -106,20 +120,21 @@
String[] fs = thisDir.list();
if (fs == null) fail(thisDir, "list() returned null");
out.print(" [" + fs.length + "]");
- for (int i = 0; i < fs.length; i++)
+ for (int i = 0; i < fs.length; i++) {
out.print(" " + fs[i]);
+ }
out.println();
if (fs.length == 0) fail(thisDir, "is empty");
- if (!nonExistantFile.createNewFile())
- fail(nonExistantFile, "could not create");
- nonExistantFile.deleteOnExit();
-
- if (!nonDir.mkdir())
- fail(nonDir, "could not create");
-
- if (!dir.renameTo(new File("x.Basic.dir2")))
+ if (!dir.mkdir() || !dir.exists() || !dir.isDirectory()) {
+ fail(dir, "could not create");
+ }
+ if (!dir.renameTo(dir2)) {
fail(dir, "failed to rename");
+ }
+ if (dir.exists() || !dir2.exists() || !dir2.isDirectory()) {
+ fail(dir, "not renamed");
+ }
if (System.getProperty("os.name").equals("SunOS")
&& System.getProperty("os.version").compareTo("5.6") >= 0) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/File/MacPath.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+/* @test
+ * @bug 7130915
+ * @summary Tests file path with nfc/nfd forms on MacOSX
+ * @requires (os.family == "mac")
+ * @library /test/lib
+ * @build jdk.test.lib.Asserts jdk.test.lib.process.ProcessTools MacPathTest
+ * @run main MacPath
+ */
+
+import java.util.Map;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.ProcessTools;
+
+public class MacPath {
+ public static void main(String args[]) throws Exception {
+ final ProcessBuilder pb =
+ ProcessTools.createJavaProcessBuilder(true, MacPathTest.class.getName());
+ final Map<String, String> env = pb.environment();
+ env.put("LC_ALL", "en_US.UTF-8");
+ Process p = ProcessTools.startProcess("Mac Path Test", pb);
+ Asserts.assertTrue(p.waitFor() == 0, "test failed!");
+ }
+}
--- a/jdk/test/java/io/File/MacPathTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/io/File/MacPathTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, 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
@@ -21,16 +21,10 @@
* questions.
*/
-/* @test
- * @bug 7130915
- * @summary Tests file path with nfc/nfd forms on MacOSX
- * @build MacPathTest
- * @run shell MacPathTest.sh
- */
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.text.Normalizer;
public class MacPathTest {
--- a/jdk/test/java/io/File/MacPathTest.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-OS=`uname -s`
-case "$OS" in
- Darwin ) ;;
- * )
- exit 0
- ;;
-esac
-
-if [ "x$TESTJAVA" = x ]; then
- TESTJAVA=$1; shift
- TESTCLASSES=.
-fi
-
-export LC_ALL=en_US.UTF-8 ;${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} MacPathTest
--- a/jdk/test/java/io/File/basic.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-
-if [ "x$TESTJAVA" = x ]; then
- TESTJAVA=$1; shift
- TESTCLASSES=.
-fi
-
-rm -rf x.Basic.*
-rm -f x.Basic.non
-printf "%s" "xyzzyN" > x.Basic.rw
-touch x.Basic.ro
-OS=`uname -s`
-case "$OS" in
- Windows_* | CYGWIN*)
- attrib +R x.Basic.ro
- ;;
- *)
- chmod ugo-w x.Basic.ro
- ;;
-esac
-mkdir x.Basic.dir
-if $TESTJAVA/bin/java ${TESTVMOPTS} $* -classpath "$TESTCLASSES" Basic; then
- [ -f x.Basic.rw ] && (echo "x.Basic.rw not deleted"; exit 1)
- ([ -d x.Basic.dir ] || [ \! -d x.Basic.dir2 ]) \
- && (echo "x.Basic.dir not renamed"; exit 1)
- [ \! -d x.Basic.nonDir ] && (echo "x.Basic.nonDir not created"; exit 1)
- [ -f x.Basic.non ] && (echo "x.Basic.non not deleted"; exit 1)
- exit 0
-else
- exit 1
-fi
--- a/jdk/test/java/io/FileOutputStream/FileOpen.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test
-# @bug 6364894
-# @run shell FileOpen.sh
-# @summary Test to ensure that opening of hidden Vs non-hidden,
-# read/write Vs read-only files for writing works as expected.
-
-
-# We use a TMP directory on a local disk because this test
-# requires that the file to be tested be present on the local disk,
-# not on a samba mounted drive or on a drive that is mapped.
-# The cmd 'attrib' works only on the local files.
-TMP="C:\TEMP"
-hfile=${TMP}"\random_file1.txt"
-ATTRIB=${SystemRoot}"\system32\attrib.exe"
-
-OS=`uname -s`
-case "$OS" in
- Windows_* )
- if [ ! -d ${TMP} ] ; then
- echo "Could not find the directory-" ${TMP} "- passing test"
- exit 0;
- fi
- ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}\\FileOpenPos.java
- ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}\\FileOpenNeg.java
-
- echo "Opening Writable Normal File.."
- ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenPos ${hfile}
-
- echo "Opening Writable Hidden File.."
- ${ATTRIB} +h ${hfile}
- ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenNeg ${hfile}
-
- echo "Opening Read-Only Normal File.."
- ${ATTRIB} -h ${hfile}
- ${ATTRIB} +r ${hfile}
- ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenNeg ${hfile}
-
- echo "Opening Read-Only Hidden File.."
- ${ATTRIB} +h ${hfile}
- ${TESTJAVA}/bin/java ${TESTVMOPTS} FileOpenNeg ${hfile}
-
- rm -f ${hfile}
- exit
- ;;
-
- * )
- echo "This test is not intended for this OS - passing test"
- exit 0
- ;;
-esac
--- a/jdk/test/java/io/FileOutputStream/FileOpenNeg.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-
-public class FileOpenNeg {
-
- public static void main( String[] args) throws Exception {
- boolean openForWrite = true;
-
- File f = new File(args[0]);
- try {
- FileOutputStream fs = new FileOutputStream(f);
- fs.write(1);
- fs.close();
- } catch( IOException e ) {
- System.out.println("Caught the Exception as expected");
- e.printStackTrace(System.out);
- openForWrite = false;
- }
- if (openForWrite && !f.canWrite()) {
- throw new Exception("Able to open READ-ONLY file for WRITING!");
- }
- }
-}
--- a/jdk/test/java/io/FileOutputStream/FileOpenPos.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-
-public class FileOpenPos {
-
- public static void main( String[] args)
- throws IOException {
- File f = new File(args[0]);
- FileOutputStream fs = new FileOutputStream(f);
- fs.write(1);
- fs.close();
- System.out.println("Can Write ?" + f.canWrite());
- System.out.println("The File was successfully opened");
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/FileOutputStream/FileOpenTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6364894
+ * @requires (os.family == "windows")
+ * @library /test/lib
+ * @build jdk.test.lib.Asserts
+ * @run main FileOpenTest
+ * @summary Test to ensure that opening of hidden Vs non-hidden,
+ * read/write Vs read-only files for writing works as expected.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.nio.file.Files;
+
+import static jdk.test.lib.Asserts.assertTrue;
+
+public class FileOpenTest {
+
+ private static File tmpFile;
+
+ public static void main(String args[]) throws Exception {
+ try {
+ tmpFile = File.createTempFile("FileOpenTest", "suffix");
+
+ // Opening Writable Normal File..
+ test(true);
+
+ // Opening Writable Hidden File..
+ Files.setAttribute(tmpFile.toPath(), "dos:hidden", true);
+ test(false);
+
+ // Opening Read-Only Hidden File..
+ Files.setAttribute(tmpFile.toPath(), "dos:hidden", false);
+ tmpFile.setReadOnly();
+ test(false);
+
+ // Opening Read-Only Normal File..
+ Files.setAttribute(tmpFile.toPath(), "dos:hidden", true);
+ test(false);
+ } finally {
+ tmpFile.delete();
+ }
+ }
+
+ private static void test(boolean writable) throws Exception {
+
+ try (FileOutputStream fs = new FileOutputStream(tmpFile)) {
+ fs.write(1);
+ assertTrue(writable, "Able to open READ-ONLY file for WRITING!");
+ assertTrue(tmpFile.canWrite(), "Able to open READ-ONLY file for WRITING!");
+ } catch(IOException e) {
+ assertTrue(!writable, "Unable to open non-READ-ONLY file for WRITING!");
+ System.out.println("Caught the Exception as expected");
+ e.printStackTrace(System.out);
+ }
+ }
+}
--- a/jdk/test/java/lang/ClassLoader/LibraryPathProperty.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ClassLoader/LibraryPathProperty.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,16 +27,16 @@
* @summary Unit test for internal ClassLoader#initializePath().
* Quoted entries should get unquoted on Windows.
* Empty entries should be replaced with dot.
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/java.lang:open
- * @build jdk.testlibrary.Platform
+ * @build jdk.test.lib.Platform
* @run main LibraryPathProperty
*/
import java.lang.reflect.Method;
import java.io.File;
import java.util.Arrays;
-import jdk.testlibrary.Platform;
+import jdk.test.lib.Platform;
public class LibraryPathProperty {
--- a/jdk/test/java/lang/ModuleLayer/BasicLayerTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ModuleLayer/BasicLayerTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1054,8 +1054,6 @@
/**
* Attempt to create a layer with a module containing a "java" package.
- * This should only be allowed when the module is defined to the platform
- * class loader.
*/
@Test(dataProvider = "javaPackages")
public void testLayerWithJavaPackage(String mn, String pn) {
@@ -1067,7 +1065,6 @@
.resolve(finder, ModuleFinder.of(), Set.of(mn));
assertTrue(cf.modules().size() == 1);
- ClassLoader pcl = ClassLoader.getPlatformClassLoader();
ClassLoader scl = ClassLoader.getSystemClassLoader();
try {
@@ -1084,15 +1081,6 @@
ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
assertTrue(false);
} catch (LayerInstantiationException e) { }
-
- // create layer with module defined to platform class loader
- ModuleLayer layer = ModuleLayer.boot().defineModules(cf, _mn -> pcl);
- Optional<Module> om = layer.findModule(mn);
- assertTrue(om.isPresent());
- Module foo = om.get();
- assertTrue(foo.getClassLoader() == pcl);
- assertTrue(foo.getPackages().size() == 1);
- assertTrue(foo.getPackages().iterator().next().equals(pn));
}
@@ -1101,8 +1089,7 @@
*/
@Test(expectedExceptions = { LayerInstantiationException.class })
public void testLayerWithBootLoader() {
- ModuleDescriptor descriptor = newBuilder("m1")
- .build();
+ ModuleDescriptor descriptor = newBuilder("m1").build();
ModuleFinder finder = ModuleUtils.finderOf(descriptor);
@@ -1116,6 +1103,25 @@
/**
+ * Attempt to create a layer with a module defined to the platform loader
+ */
+ @Test(expectedExceptions = { LayerInstantiationException.class })
+ public void testLayerWithPlatformLoader() {
+ ModuleDescriptor descriptor = newBuilder("m1").build();
+
+ ModuleFinder finder = ModuleUtils.finderOf(descriptor);
+
+ Configuration cf = ModuleLayer.boot()
+ .configuration()
+ .resolve(finder, ModuleFinder.of(), Set.of("m1"));
+ assertTrue(cf.modules().size() == 1);
+
+ ClassLoader cl = ClassLoader.getPlatformClassLoader();
+ ModuleLayer.boot().defineModules(cf, mn -> cl );
+ }
+
+
+ /**
* Parent of configuration != configuration of parent layer
*/
@Test(expectedExceptions = { IllegalArgumentException.class })
--- a/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -32,17 +32,21 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.UncheckedIOException;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
+import java.lang.module.ResolvedModule;
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.ServiceLoader;
@@ -64,7 +68,6 @@
@BeforeTest
public void setup() throws Exception {
-
// javac -d mods --module-source-path src src/**
assertTrue(CompilerUtils.compile(SRC_DIR, MODS_DIR,
"--module-source-path", SRC_DIR.toString()));
@@ -78,7 +81,6 @@
* m1 requires m2 and m3
*/
public void testWithOneLoader() throws Exception {
-
Configuration cf = resolve("m1");
ClassLoader scl = ClassLoader.getSystemClassLoader();
@@ -96,7 +98,6 @@
assertTrue(cl3 == cl1);
invoke(layer, "m1", "p.Main");
-
}
@@ -107,7 +108,6 @@
* m1 requires m2 and m3
*/
public void testWithManyLoaders() throws Exception {
-
Configuration cf = resolve("m1");
ClassLoader scl = ClassLoader.getSystemClassLoader();
@@ -128,7 +128,6 @@
assertTrue(cl3 != cl2);
invoke(layer, "m1", "p.Main");
-
}
@@ -142,7 +141,6 @@
* m4 provides S with ...
*/
public void testServicesWithOneLoader() throws Exception {
-
Configuration cf = resolveAndBind("m1");
ClassLoader scl = ClassLoader.getSystemClassLoader();
@@ -169,7 +167,6 @@
assertTrue(serviceType.isInstance(provider));
assertTrue(provider.getClass().getClassLoader() == cl1);
assertFalse(iter.hasNext());
-
}
@@ -183,7 +180,6 @@
* m4 provides S with ...
*/
public void testServicesWithManyLoaders() throws Exception {
-
Configuration cf = resolveAndBind("m1");
ClassLoader scl = ClassLoader.getSystemClassLoader();
@@ -221,7 +217,6 @@
assertTrue(provider.getClass().getClassLoader() == cl4);
assertFalse(iter.hasNext());
}
-
}
@@ -230,7 +225,6 @@
* to the given parent class loader.
*/
public void testDelegationToParent() throws Exception {
-
Configuration cf = resolve("m1");
ClassLoader parent = this.getClass().getClassLoader();
@@ -251,7 +245,6 @@
// many loader with boot loader as parent
layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, null);
testLoadFail(layer, cn);
-
}
@@ -263,7 +256,6 @@
* m2 exports p
*/
public void testOverlappingPackages() {
-
ModuleDescriptor descriptor1
= ModuleDescriptor.newModule("m1").exports("p").build();
@@ -285,7 +277,6 @@
// should be okay to have one module per class loader
ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, null);
checkLayer(layer, "m1", "m2");
-
}
@@ -297,7 +288,6 @@
* layer2: m3 reads m1, m4 reads m2
*/
public void testSplitDelegation() {
-
ModuleDescriptor descriptor1
= ModuleDescriptor.newModule("m1").exports("p").build();
@@ -333,7 +323,6 @@
// no split delegation when modules have their own class loader
ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null);
checkLayer(layer2, "m3", "m4");
-
}
@@ -346,7 +335,6 @@
* layer2: m1, m2, m4 => same loader
*/
public void testOverriding1() throws Exception {
-
Configuration cf1 = resolve("m1");
ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithOneLoader(cf1, null);
@@ -382,7 +370,6 @@
assertTrue(loader4.loadClass("p.Main").getClassLoader() == loader4);
assertTrue(loader4.loadClass("q.Hello").getClassLoader() == loader4);
assertTrue(loader4.loadClass("w.Hello").getClassLoader() == loader4);
-
}
@@ -395,7 +382,6 @@
* layer2: m1, m2, m3 => loader pool
*/
public void testOverriding2() throws Exception {
-
Configuration cf1 = resolve("m1");
ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null);
@@ -477,7 +463,6 @@
loader6.loadClass("q.Hello");
assertTrue(false);
} catch (ClassNotFoundException expected) { }
-
}
@@ -489,7 +474,6 @@
* layer2: m1, m3 => same loader
*/
public void testOverriding3() throws Exception {
-
Configuration cf1 = resolve("m1");
ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithOneLoader(cf1, null);
@@ -514,7 +498,6 @@
assertTrue(loader2.loadClass("p.Main").getClassLoader() == loader2);
assertTrue(loader2.loadClass("q.Hello").getClassLoader() == loader1);
assertTrue(loader2.loadClass("w.Hello").getClassLoader() == loader2);
-
}
@@ -526,7 +509,6 @@
* layer2: m1, m3 => loader pool
*/
public void testOverriding4() throws Exception {
-
Configuration cf1 = resolve("m1");
ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null);
@@ -566,49 +548,133 @@
assertTrue(loader4.loadClass("w.Hello").getClassLoader() == loader6);
assertTrue(loader6.loadClass("w.Hello").getClassLoader() == loader6);
-
}
/**
- * Basic test of resource loading with a class loader created by
- * Layer.defineModulesWithOneLoader.
+ * Basic test for locating resources with a class loader created by
+ * defineModulesWithOneLoader.
*/
- public void testResourcesOneLoader() throws Exception {
+ public void testResourcesWithOneLoader() throws Exception {
Configuration cf = resolve("m1");
ClassLoader scl = ClassLoader.getSystemClassLoader();
ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+
ClassLoader loader = layer.findLoader("m1");
- testResourceLoading(loader, "p/Main.class");
+ assertNotNull(loader);
+
+ // check that getResource and getResources are consistent
+ URL url1 = loader.getResource("module-info.class");
+ URL url2 = loader.getResources("module-info.class").nextElement();
+ assertEquals(url1.toURI(), url2.toURI());
+
+ // use getResources to find module-info.class resources
+ Enumeration<URL> urls = loader.getResources("module-info.class");
+ List<String> list = readModuleNames(urls);
+
+ // m1, m2, ... should be first (order not specified)
+ int count = cf.modules().size();
+ cf.modules().stream()
+ .map(ResolvedModule::name)
+ .forEach(mn -> assertTrue(list.indexOf(mn) < count));
+
+ // java.base should be after m1, m2, ...
+ assertTrue(list.indexOf("java.base") >= count);
+
+ // check resources(String)
+ List<String> list2 = loader.resources("module-info.class")
+ .map(this::readModuleName)
+ .collect(Collectors.toList());
+ assertEquals(list2, list);
+
+ // check nulls
+ try {
+ loader.getResource(null);
+ assertTrue(false);
+ } catch (NullPointerException e) { }
+ try {
+ loader.getResources(null);
+ assertTrue(false);
+ } catch (NullPointerException e) { }
+ try {
+ loader.resources(null);
+ assertTrue(false);
+ } catch (NullPointerException e) { }
}
/**
- * Basic test of resource loading with a class loader created by
- * Layer.defineModulesWithOneLoader.
+ * Basic test for locating resources with class loaders created by
+ * defineModulesWithManyLoaders.
*/
- public void testResourcesManyLoaders() throws Exception {
+ public void testResourcesWithManyLoaders() throws Exception {
Configuration cf = resolve("m1");
ClassLoader scl = ClassLoader.getSystemClassLoader();
ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl);
- ClassLoader loader = layer.findLoader("m1");
- testResourceLoading(loader, "p/Main.class");
+
+ for (Module m : layer.modules()) {
+ String name = m.getName();
+ ClassLoader loader = m.getClassLoader();
+ assertNotNull(loader);
+
+ // getResource should find the module-info.class for the module
+ URL url = loader.getResource("module-info.class");
+ assertEquals(readModuleName(url), name);
+
+ // list of modules names read from module-info.class
+ Enumeration<URL> urls = loader.getResources("module-info.class");
+ List<String> list = readModuleNames(urls);
+
+ // module should be the first element
+ assertTrue(list.indexOf(name) == 0);
+
+ // the module-info.class for the other modules in the layer
+ // should not be found
+ layer.modules().stream()
+ .map(Module::getName)
+ .filter(mn -> !mn.equals(name))
+ .forEach(mn -> assertTrue(list.indexOf(mn) < 0));
+
+ // java.base cannot be the first element
+ assertTrue(list.indexOf("java.base") > 0);
+
+ // check resources(String)
+ List<String> list2 = loader.resources("module-info.class")
+ .map(this::readModuleName)
+ .collect(Collectors.toList());
+ assertEquals(list2, list);
+
+ // check nulls
+ try {
+ loader.getResource(null);
+ assertTrue(false);
+ } catch (NullPointerException e) { }
+ try {
+ loader.getResources(null);
+ assertTrue(false);
+ } catch (NullPointerException e) { }
+ try {
+ loader.resources(null);
+ assertTrue(false);
+ } catch (NullPointerException e) { }
+ }
}
- /**
- * Test that a resource is located by a class loader.
- */
- private void testResourceLoading(ClassLoader loader, String name)
- throws IOException
- {
- URL url = loader.getResource(name);
- assertNotNull(url);
+ private List<String> readModuleNames(Enumeration<URL> e) {
+ List<String> list = new ArrayList<>();
+ while (e.hasMoreElements()) {
+ URL url = e.nextElement();
+ list.add(readModuleName(url));
+ }
+ return list;
+ }
- try (InputStream in = loader.getResourceAsStream(name)) {
- assertNotNull(in);
+ private String readModuleName(URL url) {
+ try (InputStream in = url.openStream()) {
+ ModuleDescriptor descriptor = ModuleDescriptor.read(in);
+ return descriptor.name();
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
}
-
- Enumeration<URL> urls = loader.getResources(name);
- assertTrue(urls.hasMoreElements());
}
--- a/jdk/test/java/lang/ModuleLayer/LayerControllerTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ModuleLayer/LayerControllerTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -59,11 +59,17 @@
.packages(Set.of("p2"))
.build();
- ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2);
+ ModuleDescriptor descriptor3
+ = ModuleDescriptor.newModule("m3")
+ .requires("java.base")
+ .packages(Set.of("p3"))
+ .build();
+
+ ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2, descriptor3);
ModuleLayer bootLayer = ModuleLayer.boot();
Configuration cf = bootLayer.configuration()
- .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2", "m3"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
@@ -72,9 +78,10 @@
ModuleLayer layer = controller.layer();
- assertTrue(layer.modules().size() == 2);
+ assertTrue(layer.modules().size() == 3);
assertTrue(layer.findModule("m1").isPresent());
assertTrue(layer.findModule("m2").isPresent());
+ assertTrue(layer.findModule("m3").isPresent());
return controller;
}
@@ -88,18 +95,34 @@
ModuleLayer layer = controller.layer();
Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new);
Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new);
+ Module m3 = layer.findModule("m3").orElseThrow(RuntimeException::new);
assertFalse(m1.canRead(m2));
+ assertFalse(m1.canRead(m3));
assertFalse(m1.isExported("p1"));
assertFalse(m1.isOpen("p1"));
assertFalse(m1.isExported("p1", m2));
+ assertFalse(m1.isExported("p1", m3));
assertFalse(m1.isOpen("p1", m2));
+ assertFalse(m1.isOpen("p1", m3));
assertFalse(m2.canRead(m1));
+ assertFalse(m2.canRead(m3));
assertFalse(m2.isExported("p2"));
assertFalse(m2.isOpen("p2"));
assertFalse(m2.isExported("p2", m1));
+ assertFalse(m2.isExported("p2", m3));
assertFalse(m2.isOpen("p2", m1));
+ assertFalse(m2.isOpen("p2", m3));
+
+ assertFalse(m3.canRead(m1));
+ assertFalse(m3.canRead(m2));
+ assertFalse(m3.isExported("p3"));
+ assertFalse(m3.isOpen("p3"));
+ assertFalse(m3.isExported("p3", m1));
+ assertFalse(m3.isExported("p3", m2));
+ assertFalse(m3.isOpen("p3", m1));
+ assertFalse(m3.isOpen("p3", m2));
// update m1 to read m2
assertTrue(controller.addReads(m1, m2) == controller);
@@ -111,19 +134,33 @@
assertTrue(m1.canRead(m2));
assertTrue(m1.canRead(m1));
- // update m1 to open p1 to m2
- assertTrue(controller.addOpens(m1, "p1", m2) == controller);
+ // update m1 to export p1 to m2
+ assertTrue(controller.addExports(m1, "p1", m2) == controller);
assertTrue(m1.isExported("p1", m2));
- assertTrue(m1.isOpen("p1", m2));
+ assertFalse(m1.isOpen("p1", m2));
assertFalse(m1.isExported("p1"));
assertFalse(m1.isOpen("p1"));
- // update m2 to open p2 to m1
- assertTrue(controller.addOpens(m2, "p2", m1) == controller);
- assertTrue(m2.isExported("p2", m1));
- assertTrue(m2.isOpen("p2", m1));
- assertFalse(m2.isExported("p2"));
- assertFalse(m2.isOpen("p2"));
+ // update m3 to open p3 to m1
+ assertTrue(controller.addExports(m3, "p3", m1) == controller);
+ assertTrue(m3.isExported("p3", m1));
+ assertFalse(m3.isOpen("p3", m1));
+ assertFalse(m3.isExported("p3"));
+ assertFalse(m3.isOpen("p3"));
+
+ // update m1 to open p1 to m3
+ assertTrue(controller.addOpens(m1, "p1", m3) == controller);
+ assertTrue(m1.isExported("p1", m3));
+ assertTrue(m1.isOpen("p1", m3));
+ assertFalse(m1.isExported("p1"));
+ assertFalse(m1.isOpen("p1"));
+
+ // update m3 to open p3 to m1
+ assertTrue(controller.addOpens(m3, "p3", m1) == controller);
+ assertTrue(m3.isExported("p3", m1));
+ assertTrue(m3.isOpen("p3", m1));
+ assertFalse(m3.isExported("p3"));
+ assertFalse(m3.isOpen("p3"));
}
/**
@@ -144,6 +181,18 @@
// java.base is not in layer
try {
+ controller.addExports(base, "java.lang", m2);
+ assertTrue(false);
+ } catch (IllegalArgumentException expected) { }
+
+ // m1 does not contain java.lang
+ try {
+ controller.addExports(m1, "java.lang", m2);
+ assertTrue(false);
+ } catch (IllegalArgumentException expected) { }
+
+ // java.base is not in layer
+ try {
controller.addOpens(base, "java.lang", m2);
assertTrue(false);
} catch (IllegalArgumentException expected) { }
@@ -177,6 +226,21 @@
} catch (NullPointerException expected) { }
try {
+ controller.addExports(null, "p1", m2);
+ assertTrue(false);
+ } catch (NullPointerException expected) { }
+
+ try {
+ controller.addExports(m1, null, m2);
+ assertTrue(false);
+ } catch (NullPointerException expected) { }
+
+ try {
+ controller.addExports(m1, "p1", null);
+ assertTrue(false);
+ } catch (NullPointerException expected) { }
+
+ try {
controller.addOpens(null, "p1", m2);
assertTrue(false);
} catch (NullPointerException expected) { }
--- a/jdk/test/java/lang/ModuleTests/AnnotationsTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ModuleTests/AnnotationsTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -62,6 +62,7 @@
public void testUnnamedModule() {
Module module = this.getClass().getModule();
assertTrue(module.getAnnotations().length == 0);
+ assertTrue(module.getDeclaredAnnotations().length == 0);
}
/**
@@ -88,6 +89,7 @@
Annotation[] a = module.getAnnotations();
assertTrue(a.length == 1);
assertTrue(a[0] instanceof Deprecated);
+ assertEquals(module.getDeclaredAnnotations(), a);
}
--- a/jdk/test/java/lang/ModuleTests/BasicModuleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ModuleTests/BasicModuleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -35,7 +35,7 @@
* @test
* @summary Basic test of java.lang.Module
* @modules java.desktop java.xml
- * @run testng BasicModuleTest
+ * @run testng/othervm --illegal-access=deny BasicModuleTest
*/
public class BasicModuleTest {
--- a/jdk/test/java/lang/ModuleTests/annotation/Basic.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ModuleTests/annotation/Basic.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -29,7 +29,7 @@
* @summary Basic test for annotations on modules
*/
-import java.util.Arrays;
+import java.lang.annotation.Annotation;
import p.annotation.Foo;
import p.annotation.Bar;
@@ -71,6 +71,28 @@
Baz baz = module.getAnnotation(Baz.class);
assertNotNull(baz);
String[] expected = { "one", "two", "three" };
- assertTrue(Arrays.equals(baz.value(), expected));
+ assertEquals(baz.value(), expected);
+ }
+
+ /**
+ * Test annotations with RUNTIME retention policy
+ */
+ @Test
+ public void testRuntimeAnnotations() {
+ Annotation[] a = module.getAnnotations();
+ assertEquals(a, module.getDeclaredAnnotations());
+ assertTrue(a.length == 2);
+ Bar bar;
+ Baz baz;
+ if (a[0] instanceof Bar) {
+ bar = (Bar)a[0];
+ baz = (Baz)a[1];
+ } else {
+ bar = (Bar)a[1];
+ baz = (Baz)a[0];
+ }
+ assertEquals(bar.value(), "bar");
+ String[] expected = { "one", "two", "three"};
+ assertEquals(baz.value(), expected);
}
}
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -40,15 +40,9 @@
/*
* @test
+ * @key intermittent
* @library /test/lib
- * @modules java.base/jdk.internal.misc
- * jdk.management
* @build jdk.test.lib.Utils
- * jdk.test.lib.Asserts
- * jdk.test.lib.JDKToolFinder
- * jdk.test.lib.JDKToolLauncher
- * jdk.test.lib.Platform
- * jdk.test.lib.process.*
* @run testng OnExitTest
* @summary Functions of Process.onExit and ProcessHandle.onExit
* @author Roger Riggs
@@ -250,10 +244,30 @@
}
Assert.assertNull(line, "waitpid didn't wait");
+ A.toHandle().onExit().thenAccept(p -> {
+ System.out.printf(" A.toHandle().onExit().A info: %s, now: %s%n",
+ p.info(), Instant.now());
+ });
+
+ A.onExit().thenAccept(p -> {
+ System.out.printf(" A.onExit().A info: %s, now: %s%n",
+ p.info(), Instant.now());
+ });
+
+ ProcessHandle.Info A_info = A.info();
+
A.sendAction("exit", 0L);
// Look for B to report that A has exited
do {
+ Instant start = Instant.now();
+ while (blines.isEmpty() && A.isAlive()) {
+ A_info = A.info(); // Spin
+ }
+ Instant end = Instant.now();
+ System.out.printf(" a.isAlive: %s, a.info: %s, @%s%n", A.isAlive(), A.info(),
+ Duration.between(start, end));
+
split = getSplitLine(blines);
} while (!"waitpid".equals(split[1]));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/String/nativeEncoding/StringPlatformChars.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+ /*
+ * @test
+ * @run main/othervm/native -Xcheck:jni StringPlatformChars
+ */
+import java.util.Arrays;
+
+public class StringPlatformChars {
+
+ private static final String JNU_ENCODING = System.getProperty("sun.jnu.encoding");
+
+ public static void main(String... args) throws Exception {
+ System.out.println("sun.jnu.encoding: " + JNU_ENCODING);
+ System.loadLibrary("stringPlatformChars");
+
+ // Test varying lengths, provoking different allocation paths
+ StringBuilder unicodeSb = new StringBuilder();
+ StringBuilder asciiSb = new StringBuilder();
+ StringBuilder latinSb = new StringBuilder();
+
+ for (int i = 0; i < 2000; i++) {
+ unicodeSb.append('\uFEFE');
+ testString(unicodeSb.toString());
+
+ asciiSb.append('x');
+ testString(asciiSb.toString());
+
+ latinSb.append('\u00FE');
+ testString(latinSb.toString());
+
+ testString(latinSb.toString() + asciiSb.toString() + unicodeSb.toString());
+ }
+
+ // Exhaustively test simple Strings made up of all possible chars:
+ for (char c = '\u0001'; c < Character.MAX_VALUE; c++) {
+ testString(String.valueOf(c));
+ }
+ // Special case: \u0000 is treated as end-of-string in the native code,
+ // so strings with it should be truncated:
+ if (getBytes("\u0000abcdef").length != 0 ||
+ getBytes("a\u0000bcdef").length != 1) {
+ System.out.println("Mismatching values for strings including \\u0000");
+ throw new AssertionError();
+ }
+ }
+
+ private static void testString(String s) throws Exception {
+ byte[] nativeBytes = getBytes(s);
+ byte[] stringBytes = s.getBytes(JNU_ENCODING);
+
+ if (!Arrays.equals(nativeBytes, stringBytes)) {
+ System.out.println("Mismatching values for: '" + s + "' " + Arrays.toString(s.chars().toArray()));
+ System.out.println("Native: " + Arrays.toString(nativeBytes));
+ System.out.println("String: " + Arrays.toString(stringBytes));
+ throw new AssertionError(s);
+ }
+
+ String javaNewS = new String(nativeBytes, JNU_ENCODING);
+ String nativeNewS = newString(nativeBytes);
+ if (!javaNewS.equals(nativeNewS)) {
+ System.out.println("New string via native doesn't match via java: '" + javaNewS + "' and '" + nativeNewS + "'");
+ throw new AssertionError(s);
+ }
+ }
+
+ static native byte[] getBytes(String string);
+
+ static native String newString(byte[] bytes);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/String/nativeEncoding/libstringPlatformChars.c Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "jni.h"
+#include "jni_util.h"
+
+JNIEXPORT jbyteArray JNICALL
+Java_StringPlatformChars_getBytes(JNIEnv *env, jclass unused, jstring value)
+{
+ const char* str;
+ int len;
+ jbyteArray bytes = NULL;
+
+ str = JNU_GetStringPlatformChars(env, value, NULL);
+ if (str == NULL) {
+ return NULL;
+ }
+ len = (int)strlen(str);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes != 0) {
+ jclass strClazz = JNU_ClassString(env);
+ if (strClazz == NULL) {
+ return NULL;
+ }
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte *)str);
+
+ return bytes;
+ }
+ return NULL;
+}
+
+JNIEXPORT jstring JNICALL
+Java_StringPlatformChars_newString(JNIEnv *env, jclass unused, jbyteArray bytes)
+{
+ char* str;
+ int len = (*env)->GetArrayLength(env, bytes);
+ int i;
+ jbyte* jbytes;
+
+ str = (char*)malloc(len + 1);
+ jbytes = (*env)->GetPrimitiveArrayCritical(env, bytes, NULL);
+ if (jbytes == NULL) {
+ return NULL;
+ }
+ for (i = 0; i < len; i++) {
+ str[i] = (char)jbytes[i];
+ }
+ str[len] = '\0';
+ (*env)->ReleasePrimitiveArrayCritical(env, bytes, (void*)jbytes, 0);
+
+ return JNU_NewStringPlatform(env, str);
+}
+
--- a/jdk/test/java/lang/System/OsVersionTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/System/OsVersionTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -20,8 +20,9 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
+import jdk.test.lib.Platform;
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.Platform;
import jdk.testlibrary.ProcessTools;
/*
@@ -29,7 +30,8 @@
* @bug 8132374
* @summary Check that the value of the os.version property is equal
* to the value of the corresponding OS provided tools.
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
+ * @build jdk.test.lib.Platform
* @run main OsVersionTest
* @author Volker Simonis
*/
--- a/jdk/test/java/lang/instrument/RedefineModuleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/instrument/RedefineModuleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -29,7 +29,7 @@
* java.base/jdk.internal.test.TestProviderImpl1
* java.base/jdk.internal.test.TestProviderImpl2
* @run shell MakeJAR3.sh RedefineModuleAgent
- * @run testng/othervm -javaagent:RedefineModuleAgent.jar RedefineModuleTest
+ * @run testng/othervm --illegal-access=deny -javaagent:RedefineModuleAgent.jar RedefineModuleTest
*/
import java.lang.TestProvider;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/management/MemoryPoolMXBean/LargeHeapThresholdTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6653214
+ * @requires os.simpleArch=="x64"
+ * @run main/othervm -Xmx3000M LargeHeapThresholdTest
+ * @summary MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes
+ *
+ * Large is >= 2 gigabytes
+ * This test tries to find memory pools with maximum allowable size of at
+ * least 2 gigabytes and set their usage thresholds to this value. If tested
+ * Java implementation is defective
+ * "java.lang.IllegalArgumentException: Invalid threshold value > max value of size_t"
+ * will be thrown.
+ * If no pool with maximum allowable size of at least 2 gigabytes exists
+ * the test passes. There is a good chance that such pool will exist if JVM
+ * is started with '-Xmx3000M' command line switch.
+ */
+
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.List;
+
+
+public class LargeHeapThresholdTest {
+
+ final static long TWO_G = ((long) Integer.MAX_VALUE + 1); // 2 gigabytes
+
+ public static void main(String[] args) {
+ List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
+ boolean verified = false;
+ for (MemoryPoolMXBean i : pools) {
+ if ((i.getUsage().getMax() >= TWO_G)
+ && i.isUsageThresholdSupported()) {
+ i.setUsageThreshold(TWO_G);
+ if(i.getUsageThreshold() != TWO_G)
+ throw new RuntimeException("Usage threshold for"
+ + " pool '" + i.getName() + "' is " + i.getUsageThreshold()
+ + " and not equal to 2GB");
+ verified = true;
+ }
+ }
+ System.out.println("Ability to use big heap thresholds has "
+ + (verified ? "" : "NOT ") + "been verified");
+ }
+}
--- a/jdk/test/java/lang/module/AutomaticModulesTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/module/AutomaticModulesTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -58,8 +58,8 @@
private static final Path USER_DIR
= Paths.get(System.getProperty("user.dir"));
- @DataProvider(name = "names")
- public Object[][] createNames() {
+ @DataProvider(name = "jarnames")
+ public Object[][] createJarNames() {
return new Object[][] {
// JAR file name module-name[/version]
@@ -100,7 +100,7 @@
}
// JAR file names that do not map to a legal module name
- @DataProvider(name = "badnames")
+ @DataProvider(name = "badjarnames")
public Object[][] createBadNames() {
return new Object[][]{
@@ -117,7 +117,7 @@
/**
* Test mapping of JAR file names to module names
*/
- @Test(dataProvider = "names")
+ @Test(dataProvider = "jarnames")
public void testNames(String fn, String mid) throws IOException {
String[] s = mid.split("/");
String mn = s[0];
@@ -146,11 +146,10 @@
}
}
-
/**
* Test impossible mapping of JAR files to modules names
*/
- @Test(dataProvider = "badnames", expectedExceptions = FindException.class)
+ @Test(dataProvider = "badjarnames", expectedExceptions = FindException.class)
public void testBadNames(String fn, String ignore) throws IOException {
Path dir = Files.createTempDirectory(USER_DIR, "mods");
Path jf = dir.resolve(fn);
@@ -163,6 +162,76 @@
}
+ @DataProvider(name = "modulenames")
+ public Object[][] createModuleNames() {
+ return new Object[][] {
+ { "foo", null },
+ { "foo", "1.0" },
+ { "foo.bar", null },
+ { "foo.bar", "1.0" },
+ { "class_", null },
+ { "class_", "1.0" },
+ };
+ }
+
+ @DataProvider(name = "badmodulenames")
+ public Object[][] createBadModuleNames() {
+ return new Object[][] {
+ { "", null },
+ { "", "1.0" },
+ { "666", null },
+ { "666", "1.0" },
+ { "foo.class", null },
+ { "foo.class", "1.0" },
+ };
+ }
+
+ /**
+ * Test JAR files with the Automatic-Module-Name attribute
+ */
+ @Test(dataProvider = "modulenames")
+ public void testAutomaticModuleNameAttribute(String name, String vs)
+ throws IOException
+ {
+ Manifest man = new Manifest();
+ Attributes attrs = man.getMainAttributes();
+ attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0.0");
+ attrs.put(new Attributes.Name("Automatic-Module-Name"), name);
+
+ Path dir = Files.createTempDirectory(USER_DIR, "mods");
+ String jar;
+ if (vs == null) {
+ jar = "m.jar";
+ } else {
+ jar = "m-" + vs + ".jar";
+ }
+ createDummyJarFile(dir.resolve(jar), man);
+
+ ModuleFinder finder = ModuleFinder.of(dir);
+
+ assertTrue(finder.findAll().size() == 1);
+ assertTrue(finder.find(name).isPresent());
+
+ ModuleReference mref = finder.find(name).get();
+ ModuleDescriptor descriptor = mref.descriptor();
+ assertEquals(descriptor.name(), name);
+ assertEquals(descriptor.version()
+ .map(ModuleDescriptor.Version::toString)
+ .orElse(null), vs);
+ }
+
+ /**
+ * Test JAR files with the Automatic-Module-Name attribute with a value
+ * that is not a legal module name.
+ */
+ @Test(dataProvider = "badmodulenames", expectedExceptions = FindException.class)
+ public void testBadAutomaticModuleNameAttribute(String name, String ignore)
+ throws IOException
+ {
+ // should throw FindException
+ testAutomaticModuleNameAttribute(name, null);
+ }
+
/**
* Test all packages are exported
*/
@@ -277,7 +346,6 @@
assertTrue(provides.providers().contains((provider)));
}
-
// META-INF/services files that don't map to legal service names
@DataProvider(name = "badservices")
public Object[][] createBadServices() {
@@ -310,7 +378,6 @@
assertTrue(descriptor.provides().isEmpty());
}
-
// META-INF/services configuration file entries that are not legal
@DataProvider(name = "badproviders")
public Object[][] createBadProviders() {
@@ -370,7 +437,6 @@
ModuleFinder.of(dir).findAll();
}
-
/**
* Test that a JAR file with a Main-Class attribute results
* in a module with a main class.
@@ -398,7 +464,6 @@
assertEquals(descriptor.mainClass().get(), mainClass);
}
-
// Main-Class files that do not map to a legal qualified type name
@DataProvider(name = "badmainclass")
public Object[][] createBadMainClass() {
@@ -450,7 +515,6 @@
assertFalse(descriptor.mainClass().isPresent());
}
-
/**
* Basic test of a configuration created with automatic modules.
* a requires b*
@@ -583,7 +647,6 @@
testReadAllBootModules(cf, "d"); // d reads all modules in boot layer
}
-
/**
* Basic test of a configuration created with automatic modules
* a requires b
@@ -662,7 +725,6 @@
testReadAllBootModules(cf, "d"); // d reads all modules in boot layer
}
-
/**
* Basic test to ensure that no automatic modules are resolved when
* an automatic module is not a root or required by other modules.
@@ -692,7 +754,6 @@
assertTrue(cf.findModule("m1").isPresent());
}
-
/**
* Basic test to ensure that if an automatic module is resolved then
* all observable automatic modules are resolved.
@@ -770,7 +831,6 @@
assertTrue(auto3.reads().contains(base));
}
-
/**
* Basic test of automatic modules in a child configuration. All automatic
* modules that are found with the before finder should be resolved. The
@@ -845,7 +905,6 @@
assertTrue(auto3.reads().contains(base));
}
-
/**
* Basic test of a configuration created with automatic modules
* a requires b* and c*
@@ -874,7 +933,6 @@
resolve(parent, finder, "a");
}
-
/**
* Basic test of a configuration created with automatic modules
* a contains p, requires b*
@@ -901,7 +959,6 @@
resolve(parent, finder, "a");
}
-
/**
* Basic test of layer containing automatic modules
*/
@@ -943,7 +1000,6 @@
testsReadsAll(c, layer);
}
-
/**
* Test miscellaneous methods.
*/
@@ -961,7 +1017,6 @@
assertFalse(m.modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC));
}
-
/**
* Invokes parent.resolve to resolve the given root modules.
*/
@@ -1055,7 +1110,7 @@
* in the resulting JAR file.
*/
static Path createDummyJarFile(Path jarfile, String... entries)
- throws IOException
+ throws IOException
{
return createDummyJarFile(jarfile, null, entries);
}
--- a/jdk/test/java/lang/reflect/AccessibleObject/CanAccessTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/reflect/AccessibleObject/CanAccessTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,7 +25,7 @@
* @test
* @build CanAccessTest
* @modules java.base/jdk.internal.misc:+open
- * @run testng CanAccessTest
+ * @run testng/othervm --illegal-access=deny CanAccessTest
* @summary Test AccessibleObject::canAccess method
*/
--- a/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -26,7 +26,7 @@
* @build ModuleSetAccessibleTest
* @modules java.base/java.lang:open
* java.base/jdk.internal.misc:+open
- * @run testng ModuleSetAccessibleTest
+ * @run testng/othervm --illegal-access=deny ModuleSetAccessibleTest
* @summary Test java.lang.reflect.AccessibleObject with modules
*/
--- a/jdk/test/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,7 +27,7 @@
* @modules java.base/java.lang:open
* java.base/jdk.internal.perf
* java.base/jdk.internal.misc:+open
- * @run testng TrySetAccessibleTest
+ * @run testng/othervm --illegal-access=deny TrySetAccessibleTest
* @summary Test AccessibleObject::trySetAccessible method
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/NetworkInterface/GetMacAddress.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8182672
+ * @summary Java 8u121 on Linux intermittently returns null for MAC address
+ */
+
+import java.net.NetworkInterface;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.Phaser;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class GetMacAddress implements Callable<Exception> {
+ static final int NUM_THREADS = 5;
+ static final int NUM_ITERS = 100;
+ static volatile boolean failed; // false
+
+ final String threadName;
+ final NetworkInterface ni;
+ final Phaser startingGate;
+
+ public GetMacAddress(NetworkInterface ni, String name, Phaser phaser) {
+ this.ni = ni;
+ this.threadName = name;
+ this.startingGate = phaser;
+ }
+
+ @Override
+ public Exception call() {
+ int count = 0;
+ startingGate.arriveAndAwaitAdvance();
+ try {
+ for (int i = 0; i < NUM_ITERS; i++) {
+ ni.getMTU();
+ byte[] addr = ni.getHardwareAddress();
+ if (addr == null) {
+ System.out.println(threadName + ". mac id is null");
+ failed = true;
+ }
+ count = count + 1;
+ if (count % 100 == 0) {
+ System.out.println(threadName + ". count is " + count);
+ }
+ }
+ } catch (Exception ex) {
+ System.out.println(threadName + ". Not expecting exception:" + ex.getMessage());
+ failed = true;
+ return ex;
+ }
+ return null;
+ }
+
+ static final Predicate<NetworkInterface> hasHardwareAddress = ni -> {
+ try {
+ if (ni.getHardwareAddress() == null) {
+ System.out.println("Not testing null addr: " + ni.getName());
+ return false;
+ }
+ } catch (Exception ex) {
+ System.out.println("Not testing: " + ni.getName() +
+ " " + ex.getMessage());
+ return false;
+ }
+ return true;
+ };
+
+ public static Stream<NetworkInterface> getNetworkInterfacesAsStream() throws Exception {
+ // JDK 9 and later
+ return NetworkInterface.networkInterfaces();
+ // pre JDK 9
+ //return Collections.list(NetworkInterface.getNetworkInterfaces()).stream();
+ }
+
+ public static void main(String[] args) throws Exception {
+ List<NetworkInterface> toTest = getNetworkInterfacesAsStream()
+ .filter(hasHardwareAddress)
+ .collect(Collectors.toList());
+
+ ExecutorService executor = Executors.newFixedThreadPool(NUM_THREADS);
+
+ for (NetworkInterface ni : toTest) {
+ Phaser startingGate = new Phaser(NUM_THREADS);
+ System.out.println("Testing: " + ni.getName());
+ List<Callable<Exception>> list = new ArrayList<>();
+ for (int i = 0; i < NUM_THREADS; i++)
+ list.add(new GetMacAddress(ni, ni.getName() + "-Thread-" + i, startingGate));
+ List<Future<Exception>> futures = executor.invokeAll(list);
+ for (Future<Exception> f : futures) {
+ if (f.get() != null)
+ f.get().printStackTrace(System.out);
+ }
+ if (failed)
+ break;
+ }
+ executor.shutdownNow();
+ if (!failed) {
+ System.out.println("PASSED - Finished all threads");
+ } else {
+ throw new RuntimeException("Failed");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/HttpEchoHandler.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,87 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.net.httpserver.*;
+import java.net.*;
+import jdk.incubator.http.*;
+import java.io.*;
+import java.util.concurrent.*;
+import javax.net.ssl.*;
+import java.nio.file.*;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+import jdk.testlibrary.SimpleSSLContext;
+import static jdk.incubator.http.HttpRequest.*;
+import static jdk.incubator.http.HttpResponse.*;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class HttpEchoHandler implements HttpHandler {
+ public HttpEchoHandler() {}
+
+ @Override
+ public void handle(HttpExchange t)
+ throws IOException {
+ try {
+ System.err.println("EchoHandler received request to " + t.getRequestURI());
+ InputStream is = t.getRequestBody();
+ Headers map = t.getRequestHeaders();
+ Headers map1 = t.getResponseHeaders();
+ map1.add("X-Hello", "world");
+ map1.add("X-Bye", "universe");
+ String fixedrequest = map.getFirst("XFixed");
+ File outfile = File.createTempFile("foo", "bar");
+ FileOutputStream fos = new FileOutputStream(outfile);
+ int count = (int) is.transferTo(fos);
+ is.close();
+ fos.close();
+ InputStream is1 = new FileInputStream(outfile);
+ OutputStream os = null;
+ // return the number of bytes received (no echo)
+ String summary = map.getFirst("XSummary");
+ if (fixedrequest != null && summary == null) {
+ t.sendResponseHeaders(200, count);
+ os = t.getResponseBody();
+ is1.transferTo(os);
+ } else {
+ t.sendResponseHeaders(200, 0);
+ os = t.getResponseBody();
+ is1.transferTo(os);
+
+ if (summary != null) {
+ String s = Integer.toString(count);
+ os.write(s.getBytes());
+ }
+ }
+ outfile.delete();
+ os.close();
+ is1.close();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new IOException(e);
+ }
+ }
+}
--- a/jdk/test/java/net/httpclient/LightWeightHttpServer.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/LightWeightHttpServer.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -23,8 +23,9 @@
/**
* library /lib/testlibrary/ /
- * build jdk.testlibrary.SimpleSSLContext ProxyServer EchoHandler
+ * build jdk.testlibrary.SimpleSSLContext ProxyServer
* compile ../../../com/sun/net/httpserver/LogFilter.java
+ * compile ../../../com/sun/net/httpserver/EchoHandler.java
* compile ../../../com/sun/net/httpserver/FileServerHandler.java
*/
import com.sun.net.httpserver.Headers;
--- a/jdk/test/java/net/httpclient/ManyRequests.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/ManyRequests.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -23,22 +23,30 @@
/*
* @test
- * @bug 8087112
+ * @bug 8087112 8180044
* @modules jdk.incubator.httpclient
* java.logging
* jdk.httpserver
* @library /lib/testlibrary/ /
- * @build jdk.testlibrary.SimpleSSLContext EchoHandler
+ * @build jdk.testlibrary.SimpleSSLContext
* @compile ../../../com/sun/net/httpserver/LogFilter.java
+ * @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
* @run main/othervm/timeout=40 -Djdk.httpclient.HttpClient.log=ssl ManyRequests
+ * @run main/othervm/timeout=40 -Dtest.insertDelay=true ManyRequests
+ * @run main/othervm/timeout=40 -Dtest.chunkSize=64 ManyRequests
+ * @run main/othervm/timeout=40 -Dtest.insertDelay=true -Dtest.chunkSize=64 ManyRequests
* @summary Send a large number of requests asynchronously
*/
+ // * @run main/othervm/timeout=40 -Djdk.httpclient.HttpClient.log=ssl ManyRequests
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsParameters;
import com.sun.net.httpserver.HttpsServer;
+import com.sun.net.httpserver.HttpExchange;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import jdk.incubator.http.HttpClient;
import jdk.incubator.http.HttpRequest;
import java.net.InetSocketAddress;
@@ -65,7 +73,10 @@
Logger logger = Logger.getLogger("com.sun.net.httpserver");
logger.setLevel(Level.ALL);
logger.info("TEST");
-
+ System.out.println("Sending " + REQUESTS
+ + " requests; delay=" + INSERT_DELAY
+ + ", chunks=" + CHUNK_SIZE
+ + ", XFixed=" + XFIXED);
SSLContext ctx = new SimpleSSLContext().get();
InetSocketAddress addr = new InetSocketAddress(0);
@@ -86,11 +97,36 @@
//static final int REQUESTS = 1000;
static final int REQUESTS = 20;
+ static final boolean INSERT_DELAY = Boolean.getBoolean("test.insertDelay");
+ static final int CHUNK_SIZE = Math.max(0,
+ Integer.parseInt(System.getProperty("test.chunkSize", "0")));
+ static final boolean XFIXED = Boolean.getBoolean("test.XFixed");
+
+ static class TestEchoHandler extends EchoHandler {
+ final Random rand = new Random();
+ @Override
+ public void handle(HttpExchange e) throws IOException {
+ System.out.println("Server: received " + e.getRequestURI());
+ super.handle(e);
+ }
+ protected void close(OutputStream os) throws IOException {
+ if (INSERT_DELAY) {
+ try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {}
+ }
+ super.close(os);
+ }
+ protected void close(InputStream is) throws IOException {
+ if (INSERT_DELAY) {
+ try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {}
+ }
+ super.close(is);
+ }
+ }
static void test(HttpsServer server, HttpClient client) throws Exception {
int port = server.getAddress().getPort();
- URI uri = new URI("https://127.0.0.1:" + port + "/foo/x");
- server.createContext("/foo", new EchoHandler());
+ URI baseURI = new URI("https://127.0.0.1:" + port + "/foo/x");
+ server.createContext("/foo", new TestEchoHandler());
server.start();
RequestLimiter limiter = new RequestLimiter(40);
@@ -99,24 +135,32 @@
HashMap<HttpRequest,byte[]> bodies = new HashMap<>();
for (int i=0; i<REQUESTS; i++) {
- byte[] buf = new byte[i+1]; // different size bodies
+ byte[] buf = new byte[(i+1)*CHUNK_SIZE+i+1]; // different size bodies
rand.nextBytes(buf);
+ URI uri = new URI(baseURI.toString() + String.valueOf(i+1));
HttpRequest r = HttpRequest.newBuilder(uri)
+ .header("XFixed", "true")
.POST(fromByteArray(buf))
.build();
bodies.put(r, buf);
results[i] =
limiter.whenOkToSend()
- .thenCompose((v) -> client.sendAsync(r, asByteArray()))
+ .thenCompose((v) -> {
+ System.out.println("Client: sendAsync: " + r.uri());
+ return client.sendAsync(r, asByteArray());
+ })
.thenCompose((resp) -> {
limiter.requestComplete();
if (resp.statusCode() != 200) {
String s = "Expected 200, got: " + resp.statusCode();
+ System.out.println(s + " from "
+ + resp.request().uri().getPath());
return completedWithIOException(s);
} else {
counter++;
- System.out.println("Result from " + counter);
+ System.out.println("Result (" + counter + ") from "
+ + resp.request().uri().getPath());
}
return CompletableFuture.completedStage(resp.body())
.thenApply((b) -> new Pair<>(resp, b));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/ManyRequests2.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8087112 8180044
+ * @modules jdk.incubator.httpclient
+ * java.logging
+ * jdk.httpserver
+ * @library /lib/testlibrary/ /
+ * @build jdk.testlibrary.SimpleSSLContext
+ * @compile ../../../com/sun/net/httpserver/LogFilter.java
+ * @compile ../../../com/sun/net/httpserver/EchoHandler.java
+ * @compile ../../../com/sun/net/httpserver/FileServerHandler.java
+ * @build ManyRequests ManyRequests2
+ * @run main/othervm/timeout=40 -Dtest.XFixed=true ManyRequests2
+ * @run main/othervm/timeout=40 -Dtest.XFixed=true -Dtest.insertDelay=true ManyRequests2
+ * @run main/othervm/timeout=40 -Dtest.XFixed=true -Dtest.chunkSize=64 ManyRequests2
+ * @run main/othervm/timeout=40 -Dtest.XFixed=true -Dtest.insertDelay=true -Dtest.chunkSize=64 ManyRequests2
+ * @summary Send a large number of requests asynchronously. The server echoes back using known content length.
+ */
+ // * @run main/othervm/timeout=40 -Djdk.httpclient.HttpClient.log=ssl ManyRequests
+
+public class ManyRequests2 {
+
+ public static void main(String[] args) throws Exception {
+ ManyRequests.main(args);
+ }
+}
--- a/jdk/test/java/net/httpclient/RequestBodyTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/RequestBodyTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -28,6 +28,7 @@
* jdk.httpserver
* @library /lib/testlibrary/ /test/lib
* @compile ../../../com/sun/net/httpserver/LogFilter.java
+ * @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
* @build jdk.test.lib.Platform
* @build jdk.test.lib.util.FileUtils
--- a/jdk/test/java/net/httpclient/SmokeTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/SmokeTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -23,13 +23,14 @@
/*
* @test
- * @bug 8087112
+ * @bug 8087112 8178699
* @modules jdk.incubator.httpclient
* java.logging
* jdk.httpserver
* @library /lib/testlibrary/ /
- * @build jdk.testlibrary.SimpleSSLContext ProxyServer EchoHandler
+ * @build jdk.testlibrary.SimpleSSLContext ProxyServer
* @compile ../../../com/sun/net/httpserver/LogFilter.java
+ * @compile ../../../com/sun/net/httpserver/EchoHandler.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
* @run main/othervm -Djdk.httpclient.HttpClient.log=errors,trace SmokeTest
*/
--- a/jdk/test/java/net/httpclient/http2/BasicTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/BasicTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8087112
+ * @key intermittent
* @library /lib/testlibrary server
* @build jdk.testlibrary.SimpleSSLContext
* @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
@@ -62,11 +63,11 @@
sslContext = sslct.get();
client = getClient();
httpServer = new Http2TestServer(false, 0, exec, sslContext);
- httpServer.addHandler(new EchoHandler(), "/");
+ httpServer.addHandler(new Http2EchoHandler(), "/");
httpPort = httpServer.getAddress().getPort();
httpsServer = new Http2TestServer(true, 0, exec, sslContext);
- httpsServer.addHandler(new EchoHandler(), "/");
+ httpsServer.addHandler(new Http2EchoHandler(), "/");
httpsPort = httpsServer.getAddress().getPort();
httpURIString = "http://127.0.0.1:" + httpPort + "/foo/";
--- a/jdk/test/java/net/httpclient/http2/ErrorTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/ErrorTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -83,7 +83,7 @@
0,
exec,
serverContext);
- httpsServer.addHandler(new EchoHandler(), "/");
+ httpsServer.addHandler(new Http2EchoHandler(), "/");
int httpsPort = httpsServer.getAddress().getPort();
String httpsURIString = "https://127.0.0.1:" + httpsPort + "/bar/";
--- a/jdk/test/java/net/httpclient/http2/FixedThreadPoolTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/FixedThreadPoolTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8087112
+ * @key intermittent
* @library /lib/testlibrary server
* @build jdk.testlibrary.SimpleSSLContext
* @modules jdk.incubator.httpclient/jdk.incubator.http.internal.common
@@ -62,11 +63,11 @@
sslContext = sslct.get();
client = getClient();
httpServer = new Http2TestServer(false, 0, exec, sslContext);
- httpServer.addHandler(new EchoHandler(), "/");
+ httpServer.addHandler(new Http2EchoHandler(), "/");
httpPort = httpServer.getAddress().getPort();
httpsServer = new Http2TestServer(true, 0, exec, sslContext);
- httpsServer.addHandler(new EchoHandler(), "/");
+ httpsServer.addHandler(new Http2EchoHandler(), "/");
httpsPort = httpsServer.getAddress().getPort();
httpURIString = "http://127.0.0.1:" + httpPort + "/foo/";
--- a/jdk/test/java/net/httpclient/http2/RedirectTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/RedirectTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, 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
@@ -79,7 +79,7 @@
httpServer.addHandler(new RedirectHandler(sup(altURIString1)), "/foo");
altServer.addHandler(new RedirectHandler(sup(altURIString2)), "/redir");
- altServer.addHandler(new EchoHandler(), "/redir/again");
+ altServer.addHandler(new Http2EchoHandler(), "/redir/again");
httpServer.start();
altServer.start();
--- a/jdk/test/java/net/httpclient/http2/TLSConnection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/TLSConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -65,7 +65,7 @@
Handler handler = new Handler();
- try (Http2TestServer server = new Http2TestServer(true, 0)) {
+ try (Http2TestServer server = new Http2TestServer("127.0.0.1", true, 0)) {
server.addHandler(handler, "/");
server.start();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/http2/server/Http2EchoHandler.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005, 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.io.*;
+import jdk.incubator.http.internal.common.HttpHeadersImpl;
+
+public class Http2EchoHandler implements Http2Handler {
+ public Http2EchoHandler() {}
+
+ @Override
+ public void handle(Http2TestExchange t)
+ throws IOException {
+ try {
+ System.err.println("EchoHandler received request to " + t.getRequestURI());
+ InputStream is = t.getRequestBody();
+ HttpHeadersImpl map = t.getRequestHeaders();
+ HttpHeadersImpl map1 = t.getResponseHeaders();
+ map1.addHeader("X-Hello", "world");
+ map1.addHeader("X-Bye", "universe");
+ String fixedrequest = map.firstValue("XFixed").orElse(null);
+ File outfile = File.createTempFile("foo", "bar");
+ //System.err.println ("QQQ = " + outfile.toString());
+ FileOutputStream fos = new FileOutputStream(outfile);
+ int count = (int) is.transferTo(fos);
+ System.err.printf("EchoHandler read %d bytes\n", count);
+ is.close();
+ fos.close();
+ InputStream is1 = new FileInputStream(outfile);
+ OutputStream os = null;
+ // return the number of bytes received (no echo)
+ String summary = map.firstValue("XSummary").orElse(null);
+ if (fixedrequest != null && summary == null) {
+ t.sendResponseHeaders(200, count);
+ os = t.getResponseBody();
+ int count1 = (int)is1.transferTo(os);
+ System.err.printf("EchoHandler wrote %d bytes\n", count1);
+ } else {
+ t.sendResponseHeaders(200, 0);
+ os = t.getResponseBody();
+ int count1 = (int)is1.transferTo(os);
+ System.err.printf("EchoHandler wrote %d bytes\n", count1);
+
+ if (summary != null) {
+ String s = Integer.toString(count);
+ os.write(s.getBytes());
+ }
+ }
+ outfile.delete();
+ os.close();
+ is1.close();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new IOException(e);
+ }
+ }
+}
--- a/jdk/test/java/net/httpclient/http2/server/Http2TestServer.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/server/Http2TestServer.java Thu Aug 24 16:24:44 2017 +0200
@@ -33,6 +33,7 @@
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SNIServerName;
/**
* Waits for incoming TCP connections from a client and establishes
@@ -48,6 +49,7 @@
volatile boolean stopping = false;
final Map<String,Http2Handler> handlers;
final SSLContext sslContext;
+ final String serverName;
final HashMap<InetSocketAddress,Http2TestServerConnection> connections;
private static ThreadFactory defaultThreadFac =
@@ -62,8 +64,12 @@
return Executors.newCachedThreadPool(defaultThreadFac);
}
+ public Http2TestServer(String serverName, boolean secure, int port) throws Exception {
+ this(serverName, secure, port, getDefaultExecutor(), null);
+ }
+
public Http2TestServer(boolean secure, int port) throws Exception {
- this(secure, port, getDefaultExecutor(), null);
+ this(null, secure, port, getDefaultExecutor(), null);
}
public InetSocketAddress getAddress() {
@@ -72,7 +78,19 @@
public Http2TestServer(boolean secure,
SSLContext context) throws Exception {
- this(secure, 0, null, context);
+ this(null, secure, 0, null, context);
+ }
+
+ public Http2TestServer(String serverName, boolean secure,
+ SSLContext context) throws Exception {
+ this(serverName, secure, 0, null, context);
+ }
+
+ public Http2TestServer(boolean secure,
+ int port,
+ ExecutorService exec,
+ SSLContext context) throws Exception {
+ this(null, secure, port, exec, context);
}
/**
@@ -80,17 +98,20 @@
* to know in advance whether incoming connections are plain TCP "h2c"
* or TLS "h2"/
*
+ * @param serverName SNI servername
* @param secure https or http
* @param port listen port
* @param exec executor service (cached thread pool is used if null)
* @param context the SSLContext used when secure is true
*/
- public Http2TestServer(boolean secure,
+ public Http2TestServer(String serverName,
+ boolean secure,
int port,
ExecutorService exec,
SSLContext context)
throws Exception
{
+ this.serverName = serverName;
if (secure) {
server = initSecure(port);
} else {
@@ -165,6 +186,10 @@
return se;
}
+ public String serverName() {
+ return serverName;
+ }
+
/**
* Starts a thread which waits for incoming connections.
*/
--- a/jdk/test/java/net/httpclient/http2/server/Http2TestServerConnection.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/net/httpclient/http2/server/Http2TestServerConnection.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,12 +25,13 @@
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.URI;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.SSLSocket;
+import java.net.InetAddress;
+import javax.net.ssl.*;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
@@ -79,6 +80,9 @@
final static byte[] clientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".getBytes();
Http2TestServerConnection(Http2TestServer server, Socket socket) throws IOException {
+ if (socket instanceof SSLSocket) {
+ handshake(server.serverName(), (SSLSocket)socket);
+ }
System.err.println("TestServer: New connection from " + socket);
this.server = server;
this.streams = Collections.synchronizedMap(new HashMap<>());
@@ -92,6 +96,42 @@
os = new BufferedOutputStream(socket.getOutputStream());
}
+ private static boolean compareIPAddrs(InetAddress addr1, String host) {
+ try {
+ InetAddress addr2 = InetAddress.getByName(host);
+ return addr1.equals(addr2);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ private static void handshake(String name, SSLSocket sock) throws IOException {
+ if (name == null) {
+ // no name set. No need to check
+ return;
+ } else if (name.equals("127.0.0.1")) {
+ name = "localhost";
+ }
+ final String fname = name;
+ final InetAddress addr1 = InetAddress.getByName(name);
+ SSLParameters params = sock.getSSLParameters();
+ SNIMatcher matcher = new SNIMatcher(StandardConstants.SNI_HOST_NAME) {
+ public boolean matches (SNIServerName n) {
+ String host = ((SNIHostName)n).getAsciiName();
+ if (host.equals("127.0.0.1"))
+ host = "localhost";
+ boolean cmp = host.equalsIgnoreCase(fname);
+ if (cmp)
+ return true;
+ return compareIPAddrs(addr1, host);
+ }
+ };
+ List<SNIMatcher> list = List.of(matcher);
+ params.setSNIMatchers(list);
+ sock.setSSLParameters(params);
+ sock.getSession(); // blocks until handshake done
+ }
+
void close() {
streams.forEach((i, q) -> {
q.close();
--- a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/CheckProvider.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/CheckProvider.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 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
@@ -21,6 +21,15 @@
* questions.
*/
+/*
+ * @test
+ * @summary Unit test for java.nio.channels.spi.AsynchronousChannelProvider
+ * @build Provider1 Provider2
+ * @run main/othervm CheckProvider Provider1
+ * @run main/othervm -Djava.nio.channels.spi.AsynchronousChannelProvider=Provider2
+ * CheckProvider Provider2
+ */
+
import java.nio.channels.spi.AsynchronousChannelProvider;
public class CheckProvider {
--- a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/Provider1.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/Provider1.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, 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
@@ -21,11 +21,13 @@
* questions.
*/
+import java.io.IOException;
+import java.nio.channels.AsynchronousChannelGroup;
+import java.nio.channels.AsynchronousServerSocketChannel;
+import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.spi.AsynchronousChannelProvider;
-import java.nio.channels.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
-import java.io.IOException;
public class Provider1 extends AsynchronousChannelProvider {
public Provider1() {
--- a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/Provider2.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/Provider2.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, 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
@@ -21,11 +21,13 @@
* questions.
*/
+import java.io.IOException;
+import java.nio.channels.AsynchronousChannelGroup;
+import java.nio.channels.AsynchronousServerSocketChannel;
+import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.spi.AsynchronousChannelProvider;
-import java.nio.channels.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
-import java.io.IOException;
public class Provider2 extends AsynchronousChannelProvider {
public Provider2() {
--- a/jdk/test/java/nio/channels/spi/AsynchronousChannelProvider/custom_provider.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Unit test for java.nio.channels.spi.AsynchronousChannelProvider
-# @build Provider1 Provider2 CheckProvider
-# @run shell custom_provider.sh
-
-# if TESTJAVA isn't set then we assume an interactive run.
-
-if [ -z "$TESTJAVA" ]; then
- TESTSRC=.
- TESTCLASSES=.
- JAVA=java
-else
- JAVA="${TESTJAVA}/bin/java"
-fi
-
-OS=`uname -s`
-case "$OS" in
- Windows_* | CYGWIN* )
- CLASSPATH="${TESTCLASSES};${TESTSRC}"
- ;;
- * )
- CLASSPATH=${TESTCLASSES}:${TESTSRC}
- ;;
-esac
-export CLASSPATH
-
-failures=0
-
-go() {
- echo ''
- $JAVA ${TESTVMOPTS} $1 $2 $3 2>&1
- if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-}
-
-# Run the tests
-
-go CheckProvider Provider1
-go -Djava.nio.channels.spi.AsynchronousChannelProvider=Provider2 CheckProvider \
- Provider2
-
-#
-# Results
-#
-echo ''
-if [ $failures -gt 0 ];
- then echo "$failures test(s) failed";
- else echo "All test(s) passed"; fi
-exit $failures
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/CloseTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/CloseTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 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
@@ -34,7 +34,9 @@
* peer has closed the connection) in less than 15 seconds.
*/
import java.nio.ByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.SocketChannel;
public class CloseTest {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoService.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, 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
@@ -55,10 +55,15 @@
* facilate testing that the channel is closed the "tcp nowait" service
* can close the connection after a given number of bytes.
*/
-import java.nio.*;
-import java.nio.channels.*;
import java.io.IOException;
-import java.net.*;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channel;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
public class EchoService {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, 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
@@ -35,10 +35,13 @@
* the packet is correctly echoed.
*
*/
-import java.net.*;
-import java.io.*;
+import java.io.IOException;
+import java.net.DatagramPacket;
import java.nio.ByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.SocketChannel;
import java.util.Random;
public class EchoTest {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 4673940 4930794
+ * @summary Unit tests for inetd feature
+ * @requires (os.family == "linux" | os.family == "solaris")
+ * @library /test/lib
+ * @build jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * StateTest StateTestService EchoTest EchoService CloseTest Launcher Util
+ * @run testng/othervm InheritedChannelTest
+ * @key intermittent
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static java.util.Arrays.asList;
+
+public class InheritedChannelTest {
+
+ private static final String TEST_SRC = System.getProperty("test.src");
+ private static final String TEST_CLASSES = System.getProperty("test.classes");
+ private static final Path POLICY_PASS = Paths.get(TEST_SRC, "java.policy.pass");
+ private static final Path POLICY_FAIL = Paths.get(TEST_SRC, "java.policy.fail");
+
+ private static final String OS = System.getProperty("os.name").toLowerCase();
+ private static final String OS_NAME = OS.startsWith("sunos") ? "solaris" : OS;
+
+ private static final String ARCH = System.getProperty("os.arch");
+ private static final String OS_ARCH = ARCH.equals("i386") ? "i586" : ARCH;
+
+ private static final Path LD_LIBRARY_PATH
+ = Paths.get(TEST_SRC, "lib", OS_NAME + "-" + OS_ARCH);
+
+ private static final Path LAUNCHERLIB = LD_LIBRARY_PATH.resolve("libLauncher.so");
+
+ @DataProvider
+ public Object[][] testCases() {
+ return new Object[][]{
+ { "StateTest", List.of(StateTest.class.getName()) },
+ { "EchoTest", List.of(EchoTest.class.getName()) },
+ { "CloseTest", List.of(CloseTest.class.getName()) },
+
+ // run StateTest with a SecurityManager set
+ // Note that the system properties are arguments to StateTest and not options.
+ // These system properties are passed to the launched service as options:
+ // java [-options] class [args...]
+ { "StateTest run with " + POLICY_PASS, List.of(StateTest.class.getName(),
+ "-Djava.security.manager",
+ "-Djava.security.policy="
+ + POLICY_PASS)
+ },
+ { "StateTest run with " + POLICY_FAIL, List.of(StateTest.class.getName(),
+ "-expectFail",
+ "-Djava.security.manager",
+ "-Djava.security.policy="
+ + POLICY_FAIL)
+ }
+ };
+ }
+
+ @Test(dataProvider = "testCases")
+ public void test(String desc, List<String> opts) throws Throwable {
+ if (!Files.exists(LAUNCHERLIB)) {
+ System.out.println("Cannot find " + LAUNCHERLIB
+ + " - library not available for this system");
+ return;
+ }
+ System.out.println("LD_LIBRARY_PATH=" + LD_LIBRARY_PATH);
+
+ List<String> args = new ArrayList<>();
+ args.add(JDKToolFinder.getJDKTool("java"));
+ args.addAll(asList(Utils.getTestJavaOpts()));
+ args.addAll(List.of("--add-opens", "java.base/java.io=ALL-UNNAMED",
+ "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED"));
+ args.addAll(opts);
+
+ ProcessBuilder pb = new ProcessBuilder(args);
+
+ Map<String, String> env = pb.environment();
+ env.put("CLASSPATH", TEST_CLASSES);
+ env.put("LD_LIBRARY_PATH", LD_LIBRARY_PATH.toString());
+
+ ProcessTools.executeCommand(pb)
+ .shouldHaveExitValue(0);
+ }
+}
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -25,9 +25,12 @@
* A Launcher to launch a java process with its standard input, output,
* and error streams connected to a socket.
*/
-import java.net.*;
-import java.nio.channels.*;
import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
public class Launcher {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 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
@@ -33,10 +33,14 @@
* socket state and replies back to this class via an out-of-band
* channel.
*/
-import java.io.*;
-import java.net.*;
+import java.io.IOException;
+import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
public class StateTest {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 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
@@ -37,11 +37,14 @@
* establishes a TCP connection to the port and sends a PASSED/FAILED
* message to indicate the test result.
*/
-import java.nio.*;
-import java.nio.channels.*;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channel;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
public class StateTestService {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Util.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 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
@@ -25,10 +25,12 @@
* A collection of utility methods used by the SelectorProvider.inheritedChannel
* unit tests.
*/
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
-import java.lang.reflect.*;
+import java.io.File;
+import java.io.FileDescriptor;
+import java.lang.reflect.Field;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
public class Util {
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4673940 4930794
-# @summary Unit tests for inetd feature
-#
-# @build StateTest StateTestService EchoTest EchoService CloseTest Launcher Util
-# @run shell run_tests.sh
-# @key intermittent
-
-os=`uname -s`
-
-if [ "$os" != "Linux" -a "$os" != "SunOS" ]; then
- echo "Test not designed to run on this operating system, skipping..."
- exit 0
-fi
-
-# if TESTJAVA isn't set then we assume an interactive run. So that it's
-# clear which version of 'java' is running we do a 'which java' and
-# a 'java -version'.
-
-if [ -z "$TESTJAVA" ]; then
- TESTSRC=`pwd`
- TESTCLASSES=`pwd`
- JAVA=java
- which $JAVA
- ${JAVA} -version
-else
- JAVA="${TESTJAVA}/bin/java"
-fi
-
-CLASSPATH=${TESTCLASSES}
-export CLASSPATH
-
-
-# Check that we have libLauncher.so for the right platform.
-# On Solaris we assume 64-bit
-
-DFLAG=
-if [ "$os" = "SunOS" ]; then
- PLATFORM=solaris
- case "`uname -p`" in
- i[3-9]86)
- ARCH=amd64
- ;;
- sparc)
- ARCH=sparcv9
- ;;
- esac
-fi
-
-if [ "$os" = "Linux" ]; then
- PLATFORM=linux
- ARCH=unknown
- case "`uname -m`" in
- i[3-6]86)
- ARCH=i586
- ;;
- ia64)
- ARCH=ia64
- ;;
- x86_64)
- ARCH=amd64
- ;;
- esac
-fi
-
-LIBDIR=lib/${PLATFORM}-${ARCH}
-LAUNCHERLIB=${LIBDIR}/libLauncher.so
-echo $LIBDIR
-
-if [ ! -f "${TESTSRC}/${LAUNCHERLIB}" ]; then
- echo "Cannot find ${LAUNCHERLIB} - library not available for this system"
- exit 0
-fi
-
-LD_LIBRARY_PATH=${TESTSRC}/${LIBDIR}
-export LD_LIBRARY_PATH
-
-failures=0
-
-go() {
- echo ''
- sh -xc "$JAVA ${TESTVMOPTS} --add-opens java.base/java.io=ALL-UNNAMED \
- --add-opens java.base/sun.nio.ch=ALL-UNNAMED $DFLAG \
- $1 $2 $3 $4 $5 $6 $7 $8" 2>&1
- if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-}
-
-# Run the tests
-
-go StateTest
-go EchoTest
-go CloseTest
-
-# Re-run StateTest with a SecurityManager set
-# Note that the system properties are arguments to StateTest and not options.
-# These system properties are passed to the launched service as options:
-# java [-options] class [args...]
-
-go StateTest -Djava.security.manager -Djava.security.policy=${TESTSRC}/java.policy.pass
-go StateTest -expectFail -Djava.security.manager -Djava.security.policy=${TESTSRC}/java.policy.fail
-
-
-#
-# Results
-#
-echo ''
-if [ $failures -gt 0 ];
- then echo "$failures test(s) failed";
- else echo "All test(s) passed"; fi
-exit $failures
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/charset/Charset/DefaultCharsetTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4772857
+ * @summary Unit test for Charset.defaultCharset
+ * @requires (os.family == "linux" | os.family == "solaris")
+ * @library /test/lib
+ * @build jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * Default
+ * @run testng DefaultCharsetTest
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.ProcessTools;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertTrue;
+
+public class DefaultCharsetTest {
+
+ private static final ProcessBuilder pb
+ = ProcessTools.createJavaProcessBuilder(true, Default.class.getName());
+ private static final Map<String, String> env = pb.environment();
+ private static String UNSUPPORTED = null;
+
+ @BeforeClass
+ public static void checkSupports() throws Exception {
+ UNSUPPORTED = runWithLocale("nonexist");
+ }
+
+ @DataProvider
+ public static Iterator<Object[]> locales() {
+ List<Object[]> data = new ArrayList<>();
+ data.add(new String[]{"en_US", "iso-8859-1"});
+ data.add(new String[]{"ja_JP.utf8", "utf-8"});
+ data.add(new String[]{"tr_TR", "iso-8859-9"});
+ data.add(new String[]{"C", "us-ascii"});
+ if (Platform.isLinux()) {
+ data.add(new String[]{"ja_JP", "x-euc-jp-linux"});
+ data.add(new String[]{"ja_JP.eucjp", "x-euc-jp-linux"});
+ data.add(new String[]{"ja_JP.ujis", "x-euc-jp-linux"});
+ data.add(new String[]{"ja_JP.utf8", "utf-8"});
+ }
+ if (Platform.isSolaris()) {
+ data.add(new String[]{"ja", "x-eucjp-open"});
+ data.add(new String[]{"ja_JP.eucJP", "x-eucjp-open"});
+ data.add(new String[]{"ja_JP.PCK", "x-PCK"});
+ data.add(new String[]{"ja_JP.UTF-8", "utf-8"});
+ }
+ return data.iterator();
+ }
+
+ @Test(dataProvider = "locales")
+ public void testDefaultCharset(String locale, String expectedCharset)
+ throws Exception {
+ String actual = runWithLocale(locale);
+ if (UNSUPPORTED.equals(actual)) {
+ System.out.println(locale + ": Locale not supported, skipping...");
+ } else {
+ assertTrue(actual.equalsIgnoreCase(expectedCharset),
+ String.format("LC_ALL = %s, got defaultCharset = %s, "
+ + "NOT as expected %s",
+ locale, actual, expectedCharset));
+ }
+ }
+
+ private static String runWithLocale(String locale) throws Exception {
+ env.remove("LC_ALL");
+ env.put("LC_ALL", locale);
+ return ProcessTools.executeProcess(pb)
+ .shouldHaveExitValue(0)
+ .getStdout()
+ .replace(System.lineSeparator(), "");
+ }
+}
--- a/jdk/test/java/nio/charset/Charset/EmptyCharsetName.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/charset/Charset/EmptyCharsetName.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,10 +25,6 @@
* @bug 4786884
* @summary Ensure that passing the empty string to Charset methods and
* constructors causes an IllegalArgumentException to be thrown
- *
- * @build EmptyCharsetName
- * @run main EmptyCharsetName
- * @run main/othervm -Dsun.nio.cs.bugLevel=1.4 EmptyCharsetName
*/
import java.io.*;
@@ -38,8 +34,6 @@
public class EmptyCharsetName {
- static boolean compat;
-
static abstract class Test {
public abstract void go() throws Exception;
@@ -48,13 +42,6 @@
try {
go();
} catch (Exception x) {
- if (compat) {
- if (x instanceof UnsupportedCharsetException) {
- System.err.println("Thrown as expected: " + x);
- return;
- }
- throw new Exception("Exception thrown", x);
- }
if (x instanceof IllegalCharsetNameException) {
System.err.println("Thrown as expected: " + x);
return;
@@ -63,18 +50,13 @@
+ x.getClass().getName(),
x);
}
- if (!compat)
- throw new Exception("No exception thrown");
+ throw new Exception("No exception thrown");
}
}
public static void main(String[] args) throws Exception {
- // If sun.nio.cs.bugLevel == 1.4 then we want the 1.4 behavior
- String bl = System.getProperty("sun.nio.cs.bugLevel");
- compat = (bl != null && bl.equals("1.4"));
-
new Test() {
public void go() throws Exception {
Charset.forName("");
--- a/jdk/test/java/nio/charset/Charset/default.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4772857
-# @summary Unit test for Charset.defaultCharset
-#
-# @build Default
-# @run shell default.sh
-#
-
-# Command-line usage: sh default.sh [/path/to/build]
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA=$1; shift
- TESTSRC=`pwd`
- TESTCLASSES=`pwd`
-fi
-
-s="`uname -s`"
-if [ "$s" != Linux -a "$s" != SunOS ]; then
- echo "$s: locale command not supported on this system, skipping..."
- exit 0
-fi
-
-JAVA=$TESTJAVA/bin/java
-
-tolower() {
- echo "$1" | tr '[A-Z]' '[a-z]'
-}
-
-go() {
-
- L="$1"
- shift
- if [ "x`locale -a | grep \^$L\$`" != "x$L" ]; then
- echo "$L: Locale not supported, skipping..."
- return
- fi
-
- ecs="$1"; shift
-
- echo -n "$L: "
- cs="`LC_ALL=$L $JAVA ${TESTVMOPTS} -cp $TESTCLASSES Default`"
- if [ $? != 0 ]; then
- exit 1
- elif [ "`tolower $cs`" != "`tolower $ecs`" ]; then
- echo "$cs, expected $ecs -- ERROR"
- exit 1
- else
- echo "$cs, as expected"
- fi
-
-}
-
-go en_US iso-8859-1
-go ja_JP.utf8 utf-8
-go tr_TR iso-8859-9
-go C us-ascii
-
-if [ "$s" = Linux ]; then
- go ja_JP x-euc-jp-linux
- go ja_JP.eucjp x-euc-jp-linux
- go ja_JP.ujis x-euc-jp-linux
- go ja_JP.utf8 utf-8
-fi
-
-# Solaris
-if [ "$s" = SunOS ]; then
- go ja x-eucjp-open
- go ja_JP.eucJP x-eucjp-open
- go ja_JP.PCK x-PCK
- go ja_JP.UTF-8 utf-8
-fi
--- a/jdk/test/java/nio/charset/CharsetDecoder/AverageMax.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/charset/CharsetDecoder/AverageMax.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -24,10 +24,6 @@
/* @test
* @bug 4853350
* @summary Ensure that averages do not exceed maxima
- *
- * @build AverageMax
- * @run main AverageMax
- * @run main/othervm -Dsun.nio.cs.bugLevel=1.4 AverageMax
*/
import java.nio.*;
@@ -36,8 +32,6 @@
public class AverageMax {
- static boolean compat;
-
static abstract class Test {
public abstract void go() throws Exception;
@@ -46,9 +40,6 @@
try {
go();
} catch (Exception x) {
- if (compat) {
- throw new Exception("Exception thrown", x);
- }
if (x instanceof IllegalArgumentException) {
System.err.println("Thrown as expected: " + x);
return;
@@ -57,17 +48,13 @@
+ x.getClass().getName(),
x);
}
- if (!compat)
- throw new Exception("No exception thrown");
+ throw new Exception("No exception thrown");
}
}
public static void main(String[] args) throws Exception {
- // If sun.nio.cs.bugLevel == 1.4 then we want the 1.4 behavior
- String bl = System.getProperty("sun.nio.cs.bugLevel");
- compat = (bl != null && bl.equals("1.4"));
final Charset ascii = Charset.forName("US-ASCII");
new Test() {
--- a/jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Verify that sun.nio.cs.map property interpreted in ja multibyte locales
-# @bug 4879123
-# @build SJISPropTest
-#
-# @run shell/timeout=300 CheckSJISMappingProp.sh
-
-# set platform-dependent variables
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX ) ;;
- # Skip locale test for Windows
- Windows* | CYGWIN* )
- echo "Passed"; exit 0 ;;
- * ) echo "Unrecognized system!" ; exit 1 ;;
-esac
-
-expectPass() {
- if [ $1 -eq 0 ]
- then echo "--- passed as expected"
- else
- echo "--- failed"
- exit $1
- fi
-}
-
-
-JAVA="${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES}"
-runTest() {
- echo "Testing:" ${1}
- LC_ALL="$1" ; export LC_ALL
- locale
- # Firstly, test with property set
- # (shift_jis should map to windows-31J charset)
- ${JAVA} -Dsun.nio.cs.map="Windows-31J/Shift_JIS" SJISPropTest MS932
- expectPass $?
-
- # Next, test without property set - "shift_jis" follows IANA conventions
- # and should map to the sun.nio.cs.ext.Shift_JIS charset
- ${JAVA} SJISPropTest Shift_JIS
- expectPass $?
-}
-
-# Run the test in the common Solaris/Linux/Mac OS locales
-# Tests will simply run in current locale if locale isn't supported
-# on the test machine/platform
-
-for i in "ja" "ja_JP.PCK" "ja_JP.eucJP" ; do
- runTest ${i}
-done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/charset/coders/SJISMappingPropTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 4879123
+ * @summary Verify that sun.nio.cs.map property interpreted in ja multibyte locales
+ * @requires (os.family != "windows")
+ * @modules jdk.charsets
+ * @library /test/lib
+ * @build jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * SJISPropTest
+ * @run testng SJISMappingPropTest
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+public class SJISMappingPropTest {
+
+ @DataProvider
+ public static Iterator<Object[]> locales() {
+ List<Object[]> data = new ArrayList<>();
+ data.add(new String[]{"ja"});
+ data.add(new String[]{"ja_JP.PCK"});
+ data.add(new String[]{"ja_JP.eucJP"});
+ return data.iterator();
+ }
+
+ @Test(dataProvider = "locales")
+ public void testWithProperty(String locale) throws Exception {
+ // with property set, shift_jis should map to windows-31J charset
+ runTest(locale,
+ "-Dsun.nio.cs.map=Windows-31J/Shift_JIS",
+ SJISPropTest.class.getName(),
+ "MS932");
+ }
+
+ @Test(dataProvider = "locales")
+ public void testWithoutProperty(String locale) throws Exception {
+ // without property set - "shift_jis" follows IANA conventions
+ // and should map to the sun.nio.cs.ext.Shift_JIS charset
+ runTest(locale,
+ SJISPropTest.class.getName(),
+ "Shift_JIS");
+ }
+
+ private void runTest(String locale, String... cmd) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmd);
+ Map<String, String> env = pb.environment();
+ env.put("LC_ALL", locale);
+ OutputAnalyzer out = ProcessTools.executeProcess(pb)
+ .outputTo(System.out)
+ .errorTo(System.err);
+ assertEquals(out.getExitValue(), 0);
+ }
+}
--- a/jdk/test/java/nio/charset/coders/SJISPropTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/charset/coders/SJISPropTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,12 +22,9 @@
*/
/*
- *
- *
- * Regression test class run by CheckSJISMappingProp.sh to verify
+ * Regression test class run by SJISMappingPropTest.java to verify
* that sun.nio.cs.map property is correctly interpreted in
* multibyte Japanese locales
- *
*/
public class SJISPropTest {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/charset/spi/CharsetProviderBasicTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 4429040 4591027 4814743
+ * @summary Unit test for charset providers
+ * @library /test/lib
+ * /lib/testlibrary
+ * @build jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * JarUtils
+ * FooCharset FooProvider CharsetTest
+ * @run driver SetupJar
+ * @run testng CharsetProviderBasicTest
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Stream;
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static java.util.Arrays.asList;
+
+public class CharsetProviderBasicTest {
+
+ private static final String TEST_SRC = System.getProperty("test.src");
+
+ private static final List DEFAULT_CSS = List.of(
+ "US-ASCII", "8859_1", "iso-ir-6", "UTF-16", "windows-1252", "!BAR", "cp1252"
+ );
+
+ private static final List MINIMAL_POLICY = List.of(
+ "-Djava.security.manager",
+ "-Djava.security.policy=" + TEST_SRC + File.separator + "default-pol"
+ );
+
+ private static final List CP_POLICY = List.of(
+ "-Djava.security.manager",
+ "-Djava.security.policy=" + TEST_SRC + File.separator + "charsetProvider.sp"
+ );
+
+ private static boolean checkSupports(String locale) throws Throwable {
+ return ProcessTools.executeProcess("sh", "-c", "LC_ALL=" + locale + " && "
+ + "locale -a | grep " + locale)
+ .getStdout()
+ .replace(System.lineSeparator(), "")
+ .equals(locale);
+ }
+
+ @DataProvider
+ public static Iterator<Object[]> testCases() {
+ return Stream.of("", "ja_JP.eucJP", "tr_TR")
+ .flatMap(locale -> Stream.of(
+ new Object[]{locale, List.of(""), "FOO"},
+ new Object[]{locale, MINIMAL_POLICY, "!FOO"},
+ new Object[]{locale, CP_POLICY, "FOO"}
+ ))
+ .iterator();
+ }
+
+ @Test(dataProvider = "testCases")
+ public void testDefaultCharset(String locale, List opts, String css) throws Throwable {
+ if ((System.getProperty("os.name").startsWith("Windows") || !checkSupports(locale))
+ && (!locale.isEmpty())) {
+ System.out.println(locale + ": Locale not supported, skipping...");
+ return;
+ }
+
+ List<String> args = new ArrayList<>();
+ args.add(JDKToolFinder.getJDKTool("java"));
+ args.addAll(asList(Utils.getTestJavaOpts()));
+ args.add("-cp");
+ args.add(System.getProperty("test.class.path") + File.pathSeparator + "test.jar");
+ args.addAll(opts);
+ args.add(CharsetTest.class.getName());
+ args.addAll(DEFAULT_CSS);
+ args.add(css);
+ args.removeIf(t -> t.isEmpty());
+
+ ProcessBuilder pb = new ProcessBuilder(args);
+
+ if (!locale.isEmpty()) {
+ pb.environment().put("LC_ALL", locale);
+ }
+
+ ProcessTools.executeCommand(pb)
+ .shouldHaveExitValue(0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/charset/spi/CharsetTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2010, 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.io.InputStreamReader;
+import java.io.PrintStream;
+import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
+import java.util.Iterator;
+import java.util.SortedMap;
+
+public class CharsetTest {
+
+ private static PrintStream out = System.err;
+ private static final SortedMap available = Charset.availableCharsets();
+
+ private static void fail(String csn, String msg) {
+ throw new RuntimeException(csn + ": " + msg);
+ }
+
+ private static void testPositive(String csn) {
+ if (!Charset.isSupported(csn))
+ fail(csn, "Not supported");
+
+ Charset cs = Charset.forName(csn);
+ out.println(csn + " --> " + cs.getClass().getName());
+ out.println(" " + cs.name() + " " + cs.aliases());
+
+ if (!available.containsKey(cs.name()))
+ fail(csn, "Not in available charsets: " + available.keySet());
+ if (!((Charset)available.get(cs.name())).equals(cs))
+ fail(csn, "Available charset != looked-up charset");
+
+ if (csn.equalsIgnoreCase("FOO")) {
+ if (!(cs instanceof FooCharset))
+ fail(csn, "instanceof failed");
+ }
+ }
+
+ private static void testNegative(String csn) {
+ if (Charset.isSupported(csn))
+ fail(csn, "Supported");
+ if (available.containsKey(csn))
+ fail(csn, "Available");
+ try {
+ Charset.forName(csn);
+ } catch (UnsupportedCharsetException x) {
+ out.println(csn + " not supported, as expected");
+ return;
+ }
+ fail(csn, "Lookup succeeded");
+ }
+
+ public static void main(String [] args) {
+
+ out.println("Default: "
+ + new InputStreamReader(System.in).getEncoding());
+
+ out.print("Available:");
+ for (Iterator i = available.keySet().iterator(); i.hasNext();)
+ out.print(" " + (String)i.next());
+ out.println();
+
+ for (int i = 0; i < args.length; i++) {
+ String a = args[i];
+ boolean not = a.startsWith("!");
+ String csn = (not ? a.substring(1) : a);
+ if (not)
+ testNegative(csn);
+ else
+ testPositive(csn);
+ }
+ }
+
+}
--- a/jdk/test/java/nio/charset/spi/FooProvider.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/charset/spi/FooProvider.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -21,10 +21,10 @@
* questions.
*/
-import java.util.*;
-import java.nio.charset.*;
-import java.nio.charset.spi.*;
-
+import java.nio.charset.Charset;
+import java.nio.charset.spi.CharsetProvider;
+import java.util.Collections;
+import java.util.Iterator;
public class FooProvider
extends CharsetProvider
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/charset/spi/SetupJar.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * 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.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.CREATE;
+
+public class SetupJar {
+
+ private static final String PROVIDER
+ = "META-INF/services/java.nio.charset.spi.CharsetProvider";
+ private static final String TEST_DIR = System.getProperty("test.dir", ".");
+
+ public static void main(String args[]) throws Exception {
+ Path xdir = Files.createDirectories(Paths.get(TEST_DIR, "xdir"));
+ Path provider = xdir.resolve(PROVIDER);
+ Files.createDirectories(provider.getParent());
+ Files.write(provider, "FooProvider".getBytes(), CREATE);
+
+ String[] files = {"FooCharset.class", "FooProvider.class"};
+ for (String f : files) {
+ Path source = Paths.get(System.getProperty("test.classes")).resolve(f);
+ Path target = xdir.resolve(source.getFileName());
+ Files.copy(source, target, REPLACE_EXISTING);
+ }
+
+ JarUtils.createJarFile(Paths.get("test.jar"), xdir);
+ }
+}
--- a/jdk/test/java/nio/charset/spi/Test.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-import java.nio.charset.*;
-import java.util.*;
-
-
-public class Test {
-
- private static PrintStream out = System.err;
- private static final SortedMap available = Charset.availableCharsets();
-
- private static void fail(String csn, String msg) {
- throw new RuntimeException(csn + ": " + msg);
- }
-
- private static void testPositive(String csn) {
- if (!Charset.isSupported(csn))
- fail(csn, "Not supported");
-
- Charset cs = Charset.forName(csn);
- out.println(csn + " --> " + cs.getClass().getName());
- out.println(" " + cs.name() + " " + cs.aliases());
-
- if (!available.containsKey(cs.name()))
- fail(csn, "Not in available charsets: " + available.keySet());
- if (!((Charset)available.get(cs.name())).equals(cs))
- fail(csn, "Available charset != looked-up charset");
-
- if (csn.equalsIgnoreCase("FOO")) {
- if (!(cs instanceof FooCharset))
- fail(csn, "instanceof failed");
- }
- }
-
- private static void testNegative(String csn) {
- if (Charset.isSupported(csn))
- fail(csn, "Supported");
- if (available.containsKey(csn))
- fail(csn, "Available");
- try {
- Charset.forName(csn);
- } catch (UnsupportedCharsetException x) {
- out.println(csn + " not supported, as expected");
- return;
- }
- fail(csn, "Lookup succeeded");
- }
-
- public static void main(String [] args) {
-
- out.println("Default: "
- + new InputStreamReader(System.in).getEncoding());
-
- out.print("Available:");
- for (Iterator i = available.keySet().iterator(); i.hasNext();)
- out.print(" " + (String)i.next());
- out.println();
-
- for (int i = 0; i < args.length; i++) {
- String a = args[i];
- boolean not = a.startsWith("!");
- String csn = (not ? a.substring(1) : a);
- if (not)
- testNegative(csn);
- else
- testPositive(csn);
- }
- }
-
-}
--- a/jdk/test/java/nio/charset/spi/basic.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4429040 4591027 4814743
-# @summary Unit test for charset providers
-#
-# @build Test FooCharset FooProvider
-# @run shell basic.sh
-# @run shell basic.sh ja_JP.eucJP
-# @run shell basic.sh tr_TR
-#
-
-# Command-line usage: sh basic.sh /path/to/build [locale]
-
-if [ -z "$TESTJAVA" ]; then
- if [ $# -lt 1 ]; then exit 1; fi
- TESTJAVA=$1; shift
- COMPILEJDK="${TESTJAVA}"
- TESTSRC=`pwd`
- TESTCLASSES=`pwd`
-fi
-
-JAVA=$TESTJAVA/bin/java
-JAR=$COMPILEJAVA/bin/jar
-
-DIR=`pwd`
-case `uname` in
- SunOS | Linux | Darwin | AIX ) CPS=':' ;;
- Windows* ) CPS=';' ;;
- CYGWIN* )
- DIR=`/usr/bin/cygpath -a -s -m $DIR`
- CPS=";";;
- *) echo "Unknown platform: `uname`"; exit 1 ;;
-esac
-
-JARD=$DIR/x.jar
-APPD=$DIR/x.ext
-TESTD=$DIR/x.test
-
-CSS='US-ASCII 8859_1 iso-ir-6 UTF-16 windows-1252 !BAR cp1252'
-
-
-if [ \! -d $APPD ]; then
- # Initialize
- echo Initializing...
- rm -rf $JARD $APPD $TESTD
- mkdir -p $JARD/META-INF/services x.ext
- echo FooProvider \
- >$JARD/META-INF/services/java.nio.charset.spi.CharsetProvider
- cp $TESTCLASSES/FooProvider.class $TESTCLASSES/FooCharset.class $JARD
- mkdir $TESTD
- cp $TESTCLASSES/Test.class $TESTD
- (cd $JARD; $JAR ${TESTTOOLVMOPTS} -cf $APPD/test.jar *)
-fi
-
-if [ $# -gt 0 ]; then
- # Use locale specified on command line, if it's supported
- L="$1"
- shift
- s=`uname -s`
- if [ $s != Linux -a $s != SunOS -a $s != Darwin -a $s != AIX ]; then
- echo "$L: Locales not supported on this system, skipping..."
- exit 0
- fi
- if [ "x`locale -a | grep $L`" != "x$L" ]; then
- echo "$L: Locale not supported, skipping..."
- exit 0
- fi
- LC_ALL=$L; export LC_ALL
-fi
-
-TMP=${TMP:-$TEMP}; TMP=${TMP:-/tmp}
-cd $TMP
-
-failures=0
-for where in app; do
- for security in none minimal-policy cp-policy; do
- echo '';
- echo "LC_ALL=$LC_ALL where=$where security=$security"
- av=''
- if [ $where = app ]; then
- av="$av -cp $TESTD$CPS$APPD/test.jar";
- fi
- case $security in
- none) css="$CSS FOO";;
- # Minimal policy in this case is more or less carbon copy of jre default
- # security policy and doesn't give explicit runtime permission
- # for user provided runtime loadable charsets
- minimal-policy) css="$CSS !FOO";
- av="$av -Djava.security.manager -Djava.security.policy==$TESTSRC/default-pol";;
- cp-policy) css="$CSS FOO";
- av="$av -Djava.security.manager
- -Djava.security.policy=$TESTSRC/charsetProvider.sp";;
- esac
- if (set -x; $JAVA ${TESTVMOPTS} $av Test $css) 2>&1; then
- continue;
- else
- failures=`expr $failures + 1`
- fi
- done
-done
-
-echo ''
-if [ $failures -gt 0 ];
- then echo "$failures cases failed";
- else echo "All cases passed"; fi
-exit $failures
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/file/Path/MacPath.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,169 @@
+/*
+ * 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
+ * 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.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.text.Normalizer;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+public class MacPath {
+
+ public static void main(String args[]) throws Throwable {
+ System.out.printf("sun.jnu.encoding=%s, file.encoding=%s%n",
+ System.getProperty("file.encoding"),
+ System.getProperty("sun.jnu.encoding"));
+ // English
+ test("TestDir_apple", // test dir
+ "dir_macosx", // dir
+ "file_macosx"); // file
+
+ // Japanese composite character
+ test("TestDir_\u30c8\u30a4\u30e4\u30cb\u30ca\u30eb/",
+ "dir_\u30a4\u30c1\u30b4\u306e\u30b1\u30fc\u30ad",
+ "file_\u30a4\u30c1\u30b4\u306e\u30b1\u30fc\u30ad");
+
+ // latin-1 supplementory
+ test("TestDir_K\u00f6rperlich\u00e4\u00df/",
+ "dir_Entt\u00e4uschung",
+ "file_Entt\u00e4uschung");
+
+ test("TestDir_K\u00f6rperlich\u00e4\u00df/",
+ "dir_Entt\u00c4uschung",
+ "file_Entt\u00c4uschung");
+
+ // Korean syblla
+ test("TestDir_\uac00\uac01\uac02",
+ "dir_\uac20\uac21\uac22",
+ "file_\uacc0\uacc1\uacc2");
+ }
+
+ private static boolean equal(Object x, Object y) {
+ return x == null ? y == null : x.equals(y);
+ }
+
+ private static boolean match(Path target, Path src) {
+ String fname = target.toString();
+ System.out.printf(" --> Trying [%s], length=%d...", fname, fname.length());
+ if (target.equals(src)) {
+ System.out.println(" MATCHED!");
+ return true;
+ } else {
+ System.out.println(" NOT MATCHED!");
+ }
+ return false;
+ }
+
+ private static void test(String testdir, String dname, String fname_nfc)
+ throws Throwable
+ {
+ String fname = null;
+ String dname_nfd = Normalizer.normalize(dname, Normalizer.Form.NFD);
+ String fname_nfd = Normalizer.normalize(fname_nfc, Normalizer.Form.NFD);
+
+ System.out.printf("%n%n--------Testing...----------%n");
+ Path bpath = Paths.get(testdir);
+ Path dpath = Paths.get(testdir, dname);
+ Path dpath_nfd = Paths.get(testdir, dname_nfd);
+ Path fpath_nfc = Paths.get(testdir, fname_nfc);
+ Path fpath_nfd = Paths.get(testdir, fname_nfd);
+
+ if (Files.exists(bpath))
+ TestUtil.removeAll(bpath);
+ Files.createDirectories(dpath);
+
+ fname = dpath.toString();
+ System.out.printf(":Directory [%s][len=%d] created%n", fname, fname.length());
+
+ //////////////////////////////////////////////////////////////
+ if (!Files.isDirectory(dpath) || !Files.isDirectory(dpath_nfd)) {
+ throw new RuntimeException("Files.isDirectory(...) failed");
+ }
+
+ //////////////////////////////////////////////////////////////
+ // write out with nfd, read in with nfc + case
+ Files.write(fpath_nfd, new byte[] { 'n', 'f', 'd'});
+ System.out.println(" read in with nfc (from nfd):" + new String(Files.readAllBytes(fpath_nfc)));
+
+ // check attrs with nfc + case
+ Set<PosixFilePermission> pfp = Files.getPosixFilePermissions(fpath_nfd);
+ if (!equal(pfp, Files.getPosixFilePermissions(fpath_nfc)) ) {
+ throw new RuntimeException("Files.getPosixfilePermission(...) failed");
+ }
+ Files.delete(fpath_nfd);
+
+ // write out with nfc, read in with nfd + case
+ Files.write(fpath_nfc, new byte[] { 'n', 'f', 'c'});
+ System.out.println(" read in with nfd (from nfc):" + new String(Files.readAllBytes(fpath_nfd)));
+
+ // check attrs with nfc + case
+ pfp = Files.getPosixFilePermissions(fpath_nfc);
+ if (!equal(pfp, Files.getPosixFilePermissions(fpath_nfd))) {
+ throw new RuntimeException("Files.getPosixfilePermission(...) failed");
+ }
+ //////////////////////////////////////////////////////////////
+ boolean found_dir = false;
+ boolean found_file_nfc = false;
+ boolean found_file_nfd = false;
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(bpath)) {
+ for (Path path: stream) {
+ fname = path.toString();
+ System.out.printf("Found : [%s], length=%d%n", fname, fname.length());
+ found_dir |= match(dpath, path);
+ found_file_nfc |= match(fpath_nfc, path);
+ found_file_nfd |= match(fpath_nfd, path);
+ }
+ }
+ if (!found_dir || !found_file_nfc || !found_file_nfd) {
+ throw new RuntimeException("File.equal() failed");
+ }
+ // glob
+ String glob = "*" + fname_nfd.substring(2); // remove leading "FI" from "FILE..."
+ System.out.println("glob=" + glob);
+ boolean globmatched = false;
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(bpath, glob)) {
+ for (Path path: stream) {
+ fname = path.toString();
+ System.out.printf("PathMatch : [%s], length=%d%n", fname, fname.length());
+ globmatched |= match(fpath_nfc, path);
+ }
+ }
+ if (!globmatched) {
+ //throw new RuntimeException("path matcher failed");
+ // it appears we have a regex.anon_eq bug in hangul syllable handling
+ System.out.printf("pathmatcher failed, glob=[%s]%n", glob);
+ System.out.printf(" -> fname_nfd.matches(fname_nfc)=%b%n",
+ Pattern.compile(fname_nfd, Pattern.CANON_EQ)
+ .matcher(fname_nfc)
+ .matches());
+ System.out.printf(" -> fname_nfc.matches(fname_nfd)=%b%n",
+ Pattern.compile(fname_nfc, Pattern.CANON_EQ)
+ .matcher(fname_nfd)
+ .matches());
+ }
+ TestUtil.removeAll(bpath);
+ }
+}
--- a/jdk/test/java/nio/file/Path/MacPathTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/nio/file/Path/MacPathTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 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
@@ -24,154 +24,28 @@
/* @test
* @bug 7130915
* @summary Tests file path with nfc/nfd forms on MacOSX
- * @library ../
- * @build MacPathTest
- * @run shell MacPathTest.sh
+ * @requires (os.family == "mac")
+ * @library /test/lib ..
+ * @build jdk.test.lib.Utils
+ * jdk.test.lib.Asserts
+ * jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.JDKToolLauncher
+ * jdk.test.lib.Platform
+ * jdk.test.lib.process.*
+ * TestUtil MacPath
+ * @run main MacPathTest
*/
-import java.nio.file.*;
-import java.nio.file.attribute.*;
-import java.text.*;
-import java.util.*;
-import java.util.regex.*;
+import jdk.test.lib.process.ProcessTools;
public class MacPathTest {
- public static void main(String args[]) throws Throwable {
- String osname = System.getProperty("os.name");
- if (!osname.contains("OS X") && !osname.contains("Darwin"))
- return;
- System.out.printf("sun.jnu.encoding=%s, file.encoding=%s%n",
- System.getProperty("file.encoding"),
- System.getProperty("sun.jnu.encoding"));
- // English
- test("TestDir_apple", // test dir
- "dir_macosx", // dir
- "file_macosx"); // file
-
- // Japanese composite character
- test("TestDir_\u30c8\u30a4\u30e4\u30cb\u30ca\u30eb/",
- "dir_\u30a4\u30c1\u30b4\u306e\u30b1\u30fc\u30ad",
- "file_\u30a4\u30c1\u30b4\u306e\u30b1\u30fc\u30ad");
-
- // latin-1 supplementory
- test("TestDir_K\u00f6rperlich\u00e4\u00df/",
- "dir_Entt\u00e4uschung",
- "file_Entt\u00e4uschung");
-
- test("TestDir_K\u00f6rperlich\u00e4\u00df/",
- "dir_Entt\u00c4uschung",
- "file_Entt\u00c4uschung");
-
- // Korean syblla
- test("TestDir_\uac00\uac01\uac02",
- "dir_\uac20\uac21\uac22",
- "file_\uacc0\uacc1\uacc2");
- }
-
- private static boolean equal(Object x, Object y) {
- return x == null ? y == null : x.equals(y);
- }
-
- private static boolean match(Path target, Path src) {
- String fname = target.toString();
- System.out.printf(" --> Trying [%s], length=%d...", fname, fname.length());
- if (target.equals(src)) {
- System.out.println(" MATCHED!");
- return true;
- } else {
- System.out.println(" NOT MATCHED!");
- }
- return false;
- }
-
- private static void test(String testdir, String dname, String fname_nfc)
- throws Throwable
- {
- String fname = null;
- String dname_nfd = Normalizer.normalize(dname, Normalizer.Form.NFD);
- String fname_nfd = Normalizer.normalize(fname_nfc, Normalizer.Form.NFD);
-
- System.out.printf("%n%n--------Testing...----------%n");
- Path bpath = Paths.get(testdir);
- Path dpath = Paths.get(testdir, dname);
- Path dpath_nfd = Paths.get(testdir, dname_nfd);
- Path fpath_nfc = Paths.get(testdir, fname_nfc);
- Path fpath_nfd = Paths.get(testdir, fname_nfd);
-
- if (Files.exists(bpath))
- TestUtil.removeAll(bpath);
- Files.createDirectories(dpath);
-
- fname = dpath.toString();
- System.out.printf(":Directory [%s][len=%d] created%n", fname, fname.length());
-
- //////////////////////////////////////////////////////////////
- if (!Files.isDirectory(dpath) || !Files.isDirectory(dpath_nfd)) {
- throw new RuntimeException("Files.isDirectory(...) failed");
- }
-
- //////////////////////////////////////////////////////////////
- // write out with nfd, read in with nfc + case
- Files.write(fpath_nfd, new byte[] { 'n', 'f', 'd'});
- System.out.println(" read in with nfc (from nfd):" + new String(Files.readAllBytes(fpath_nfc)));
-
- // check attrs with nfc + case
- Set<PosixFilePermission> pfp = Files.getPosixFilePermissions(fpath_nfd);
- if (!equal(pfp, Files.getPosixFilePermissions(fpath_nfc)) ) {
- throw new RuntimeException("Files.getPosixfilePermission(...) failed");
- }
- Files.delete(fpath_nfd);
-
- // write out with nfc, read in with nfd + case
- Files.write(fpath_nfc, new byte[] { 'n', 'f', 'c'});
- System.out.println(" read in with nfd (from nfc):" + new String(Files.readAllBytes(fpath_nfd)));
-
- // check attrs with nfc + case
- pfp = Files.getPosixFilePermissions(fpath_nfc);
- if (!equal(pfp, Files.getPosixFilePermissions(fpath_nfd))) {
- throw new RuntimeException("Files.getPosixfilePermission(...) failed");
- }
- //////////////////////////////////////////////////////////////
- boolean found_dir = false;
- boolean found_file_nfc = false;
- boolean found_file_nfd = false;
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(bpath)) {
- for (Path path: stream) {
- fname = path.toString();
- System.out.printf("Found : [%s], length=%d%n", fname, fname.length());
- found_dir |= match(dpath, path);
- found_file_nfc |= match(fpath_nfc, path);
- found_file_nfd |= match(fpath_nfd, path);
- }
- }
- if (!found_dir || !found_file_nfc || !found_file_nfd) {
- throw new RuntimeException("File.equal() failed");
- }
- // glob
- String glob = "*" + fname_nfd.substring(2); // remove leading "FI" from "FILE..."
- System.out.println("glob=" + glob);
- boolean globmatched = false;
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(bpath, glob)) {
- for (Path path: stream) {
- fname = path.toString();
- System.out.printf("PathMatch : [%s], length=%d%n", fname, fname.length());
- globmatched |= match(fpath_nfc, path);
- }
- }
- if (!globmatched) {
- //throw new RuntimeException("path matcher failed");
- // it appears we have a regex.anon_eq bug in hangul syllable handling
- System.out.printf("pathmatcher failed, glob=[%s]%n", glob);
- System.out.printf(" -> fname_nfd.matches(fname_nfc)=%b%n",
- Pattern.compile(fname_nfd, Pattern.CANON_EQ)
- .matcher(fname_nfc)
- .matches());
- System.out.printf(" -> fname_nfc.matches(fname_nfd)=%b%n",
- Pattern.compile(fname_nfc, Pattern.CANON_EQ)
- .matcher(fname_nfd)
- .matches());
- }
- TestUtil.removeAll(bpath);
+ public static void main(String args[]) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, MacPath.class.getName());
+ pb.environment().put("LC_ALL", "en_US.UTF-8");
+ ProcessTools.executeProcess(pb)
+ .outputTo(System.out)
+ .errorTo(System.err)
+ .shouldHaveExitValue(0);
}
}
--- a/jdk/test/java/nio/file/Path/MacPathTest.sh Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-OS=`uname -s`
-case "$OS" in
- Darwin ) ;;
- * )
- exit 0
- ;;
-esac
-
-if [ "x$TESTJAVA" = x ]; then
- TESTJAVA=$1; shift
- TESTCLASSES=.
-fi
-
-export LC_ALL=en_US.UTF-8; ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} MacPathTest
--- a/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -89,6 +89,7 @@
assertTrue(executeTestJava("--class-path", MODS_DIR.resolve(TEST_MODULE).toString(),
"--module-path", MODS_DIR.resolve(MAIN_BUNDLES_MODULE).toString(),
"--add-modules", MAIN_BUNDLES_MODULE,
+ "--illegal-access=deny",
MAIN_CLASS, "cache")
.outputTo(System.out)
.errorTo(System.out)
@@ -111,6 +112,7 @@
assertTrue(executeTestJava("--class-path", MODS_DIR.resolve(TEST_MODULE).toString(),
"--module-path", MODS_DIR.resolve(MAIN_BUNDLES_MODULE).toString(),
"--add-modules", MAIN_BUNDLES_MODULE,
+ "--illegal-access=deny",
MAIN_CLASS)
.outputTo(System.out)
.errorTo(System.out)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/BadProvidersTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,265 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @library /test/lib
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ * jdk.compiler
+ * @build jdk.test.lib.compiler.CompilerUtils
+ * @run testng/othervm BadProvidersTest
+ * @summary Basic test of ServiceLoader with bad provider and bad provider
+ * factories deployed on the module path
+ */
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+import java.util.ServiceLoader.Provider;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
+
+import jdk.test.lib.compiler.CompilerUtils;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+import static org.testng.Assert.*;
+
+/**
+ * Basic test of `provides S with PF` and `provides S with P` where the provider
+ * factory or provider
+ */
+
+public class BadProvidersTest {
+
+ private static final String TEST_SRC = System.getProperty("test.src");
+
+ private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
+ private static final Path SRC_DIR = Paths.get(TEST_SRC, "modules");
+
+ private static final Path BADFACTORIES_DIR = Paths.get(TEST_SRC, "badfactories");
+ private static final Path BADPROVIDERS_DIR = Paths.get(TEST_SRC, "badproviders");
+
+ private static final String TEST1_MODULE = "test1";
+ private static final String TEST2_MODULE = "test2";
+
+ private static final String TEST_SERVICE = "p.Service";
+
+ /**
+ * Compiles a module, returning a module path with the compiled module.
+ */
+ private Path compileTest(String moduleName) throws Exception {
+ Path dir = Files.createTempDirectory(USER_DIR, "mods");
+ Path output = Files.createDirectory(dir.resolve(moduleName));
+ boolean compiled = CompilerUtils.compile(SRC_DIR.resolve(moduleName), output);
+ assertTrue(compiled);
+ return dir;
+ }
+
+ /**
+ * Resolves a test module and loads it into its own layer. ServiceLoader
+ * is then used to load all providers.
+ */
+ private List<Provider> loadProviders(Path mp, String moduleName) throws Exception {
+ ModuleFinder finder = ModuleFinder.of(mp);
+
+ ModuleLayer bootLayer = ModuleLayer.boot();
+
+ Configuration cf = bootLayer.configuration()
+ .resolveAndBind(finder, ModuleFinder.of(), Set.of(moduleName));
+
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+ ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
+
+ Class<?> service = layer.findLoader(moduleName).loadClass(TEST_SERVICE);
+
+ return ServiceLoader.load(layer, service)
+ .stream()
+ .collect(Collectors.toList());
+ }
+
+ @Test
+ public void sanityTest1() throws Exception {
+ Path mods = compileTest(TEST1_MODULE);
+ List<Provider> list = loadProviders(mods, TEST1_MODULE);
+ assertTrue(list.size() == 1);
+
+ // the provider is a singleton, enforced by the provider factory
+ Object p1 = list.get(0).get();
+ Object p2 = list.get(0).get();
+ assertTrue(p1 != null);
+ assertTrue(p1 == p2);
+ }
+
+ @Test
+ public void sanityTest2() throws Exception {
+ Path mods = compileTest(TEST2_MODULE);
+ List<Provider> list = loadProviders(mods, TEST2_MODULE);
+ assertTrue(list.size() == 1);
+ Object p = list.get(0).get();
+ assertTrue(p != null);
+ }
+
+
+ @DataProvider(name = "badfactories")
+ public Object[][] createBadFactories() {
+ return new Object[][] {
+ { "classnotpublic", null },
+ { "methodnotpublic", null },
+ { "badreturntype", null },
+ { "returnsnull", null },
+ { "throwsexception", null },
+ };
+ }
+
+
+ @Test(dataProvider = "badfactories",
+ expectedExceptions = ServiceConfigurationError.class)
+ public void testBadFactory(String testName, String ignore) throws Exception {
+ Path mods = compileTest(TEST1_MODULE);
+
+ // compile the bad factory
+ Path source = BADFACTORIES_DIR.resolve(testName);
+ Path output = Files.createTempDirectory(USER_DIR, "tmp");
+ boolean compiled = CompilerUtils.compile(source, output);
+ assertTrue(compiled);
+
+ // copy the compiled class into the module
+ Path classFile = Paths.get("p", "ProviderFactory.class");
+ Files.copy(output.resolve(classFile),
+ mods.resolve(TEST1_MODULE).resolve(classFile),
+ StandardCopyOption.REPLACE_EXISTING);
+
+ // load providers and instantiate each one
+ loadProviders(mods, TEST1_MODULE).forEach(Provider::get);
+ }
+
+
+ @DataProvider(name = "badproviders")
+ public Object[][] createBadProviders() {
+ return new Object[][] {
+ { "notpublic", null },
+ { "ctornotpublic", null },
+ { "notasubtype", null },
+ { "throwsexception", null }
+ };
+ }
+
+
+ @Test(dataProvider = "badproviders",
+ expectedExceptions = ServiceConfigurationError.class)
+ public void testBadProvider(String testName, String ignore) throws Exception {
+ Path mods = compileTest(TEST2_MODULE);
+
+ // compile the bad provider
+ Path source = BADPROVIDERS_DIR.resolve(testName);
+ Path output = Files.createTempDirectory(USER_DIR, "tmp");
+ boolean compiled = CompilerUtils.compile(source, output);
+ assertTrue(compiled);
+
+ // copy the compiled class into the module
+ Path classFile = Paths.get("p", "Provider.class");
+ Files.copy(output.resolve(classFile),
+ mods.resolve(TEST2_MODULE).resolve(classFile),
+ StandardCopyOption.REPLACE_EXISTING);
+
+ // load providers and instantiate each one
+ loadProviders(mods, TEST2_MODULE).forEach(Provider::get);
+ }
+
+
+ /**
+ * Test a service provider that defines more than one no-args
+ * public static "provider" method.
+ */
+ @Test(expectedExceptions = ServiceConfigurationError.class)
+ public void testWithTwoFactoryMethods() throws Exception {
+ Path mods = compileTest(TEST1_MODULE);
+
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
+ + ClassWriter.COMPUTE_FRAMES);
+ cw.visit(V1_9,
+ ACC_PUBLIC + ACC_SUPER,
+ "p/ProviderFactory",
+ null,
+ "java/lang/Object",
+ null);
+
+ // public static p.Service provider()
+ MethodVisitor mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC,
+ "provider",
+ "()Lp/Service;",
+ null,
+ null);
+ mv.visitTypeInsn(NEW, "p/ProviderFactory$1");
+ mv.visitInsn(DUP);
+ mv.visitMethodInsn(INVOKESPECIAL,
+ "p/ProviderFactory$1",
+ "<init>", "()V",
+ false);
+ mv.visitInsn(ARETURN);
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+
+ // public static p.ProviderFactory$1 provider()
+ mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC,
+ "provider",
+ "()Lp/ProviderFactory$1;",
+ null,
+ null);
+ mv.visitTypeInsn(NEW, "p/ProviderFactory$1");
+ mv.visitInsn(DUP);
+ mv.visitMethodInsn(INVOKESPECIAL,
+ "p/ProviderFactory$1",
+ "<init>",
+ "()V",
+ false);
+ mv.visitInsn(ARETURN);
+ mv.visitMaxs(0, 0);
+ mv.visitEnd();
+
+ cw.visitEnd();
+
+ // write the class bytes into the compiled module directory
+ Path classFile = mods.resolve(TEST1_MODULE)
+ .resolve("p")
+ .resolve("ProviderFactory.class");
+ Files.write(classFile, cw.toByteArray());
+
+ // load providers and instantiate each one
+ loadProviders(mods, TEST1_MODULE).forEach(Provider::get);
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/ModulesTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,479 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @modules java.scripting
+ * @library modules /lib/testlibrary
+ * @build bananascript/*
+ * @build JarUtils
+ * @compile classpath/pearscript/org/pear/PearScriptEngineFactory.java
+ * classpath/pearscript/org/pear/PearScript.java
+ * @run testng/othervm ModulesTest
+ * @summary Basic test for ServiceLoader with a provider deployed as a module.
+ */
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.ServiceLoader.Provider;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.script.ScriptEngineFactory;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeTest;
+import static org.testng.Assert.*;
+
+/**
+ * Basic test for ServiceLoader. The test make use of two service providers:
+ * 1. BananaScriptEngine - a ScriptEngineFactory deployed as a module on the
+ * module path. It implementations a singleton via the public static
+ * provider method.
+ * 2. PearScriptEngine - a ScriptEngineFactory deployed on the class path
+ * with a service configuration file.
+ */
+
+public class ModulesTest {
+
+ // Copy the services configuration file for "pearscript" into place.
+ @BeforeTest
+ public void setup() throws Exception {
+ Path src = Paths.get(System.getProperty("test.src"));
+ Path classes = Paths.get(System.getProperty("test.classes"));
+ String st = ScriptEngineFactory.class.getName();
+ Path config = Paths.get("META-INF", "services", st);
+ Path source = src.resolve("classpath").resolve("pearscript").resolve(config);
+ Path target = classes.resolve(config);
+ Files.createDirectories(target.getParent());
+ Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
+ }
+
+ /**
+ * Basic test of iterator() to ensure that providers located as modules
+ * and on the class path are found.
+ */
+ @Test
+ public void testIterator() {
+ ServiceLoader<ScriptEngineFactory> loader
+ = ServiceLoader.load(ScriptEngineFactory.class);
+ Set<String> names = collectAll(loader)
+ .stream()
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toSet());
+ assertTrue(names.contains("BananaScriptEngine"));
+ assertTrue(names.contains("PearScriptEngine"));
+ }
+
+ /**
+ * Basic test of iterator() to test iteration order. Providers deployed
+ * as named modules should be found before providers deployed on the class
+ * path.
+ */
+ @Test
+ public void testIteratorOrder() {
+ ServiceLoader<ScriptEngineFactory> loader
+ = ServiceLoader.load(ScriptEngineFactory.class);
+ boolean foundUnnamed = false;
+ for (ScriptEngineFactory factory : collectAll(loader)) {
+ if (factory.getClass().getModule().isNamed()) {
+ if (foundUnnamed) {
+ assertTrue(false, "Named module element after unnamed");
+ }
+ } else {
+ foundUnnamed = true;
+ }
+ }
+ }
+
+ /**
+ * Basic test of Provider::type
+ */
+ @Test
+ public void testProviderType() {
+ Set<String> types = ServiceLoader.load(ScriptEngineFactory.class)
+ .stream()
+ .map(Provider::type)
+ .map(Class::getName)
+ .collect(Collectors.toSet());
+ assertTrue(types.contains("org.banana.BananaScriptEngineFactory"));
+ assertTrue(types.contains("org.pear.PearScriptEngineFactory"));
+ }
+
+ /**
+ * Basic test of Provider::get
+ */
+ @Test
+ public void testProviderGet() {
+ Set<String> names = ServiceLoader.load(ScriptEngineFactory.class)
+ .stream()
+ .map(Provider::get)
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toSet());
+ assertTrue(names.contains("BananaScriptEngine"));
+ assertTrue(names.contains("PearScriptEngine"));
+ }
+
+ /**
+ * Basic test of the public static provider method. BananaScriptEngine
+ * defines a provider method that returns the same instance.
+ */
+ @Test
+ public void testSingleton() {
+ Optional<Provider<ScriptEngineFactory>> oprovider
+ = ServiceLoader.load(ScriptEngineFactory.class)
+ .stream()
+ .filter(p -> p.type().getName().equals("org.banana.BananaScriptEngineFactory"))
+ .findFirst();
+ assertTrue(oprovider.isPresent());
+ Provider<ScriptEngineFactory> provider = oprovider.get();
+
+ // invoke Provider::get twice
+ ScriptEngineFactory factory1 = provider.get();
+ ScriptEngineFactory factory2 = provider.get();
+ assertTrue(factory1 == factory2);
+ }
+
+ /**
+ * Basic test of stream() to ensure that elements for providers in named
+ * modules come before elements for providers in unnamed modules.
+ */
+ @Test
+ public void testStreamOrder() {
+ List<Class<?>> types = ServiceLoader.load(ScriptEngineFactory.class)
+ .stream()
+ .map(Provider::type)
+ .collect(Collectors.toList());
+
+ boolean foundUnnamed = false;
+ for (Class<?> factoryClass : types) {
+ if (factoryClass.getModule().isNamed()) {
+ if (foundUnnamed) {
+ assertTrue(false, "Named module element after unnamed");
+ }
+ } else {
+ foundUnnamed = true;
+ }
+ }
+ }
+
+ /**
+ * Basic test of ServiceLoader.findFirst()
+ */
+ @Test
+ public void testFindFirst() {
+ Optional<ScriptEngineFactory> ofactory
+ = ServiceLoader.load(ScriptEngineFactory.class).findFirst();
+ assertTrue(ofactory.isPresent());
+ ScriptEngineFactory factory = ofactory.get();
+ assertTrue(factory.getClass().getModule().isNamed());
+
+ class S { }
+ assertFalse(ServiceLoader.load(S.class).findFirst().isPresent());
+ }
+
+ /**
+ * Basic test ServiceLoader.load specifying the platform class loader.
+ * The providers on the module path and class path should not be located.
+ */
+ @Test
+ public void testWithPlatformClassLoader() {
+ ClassLoader pcl = ClassLoader.getPlatformClassLoader();
+
+ // iterator
+ ServiceLoader<ScriptEngineFactory> loader
+ = ServiceLoader.load(ScriptEngineFactory.class, pcl);
+ Set<String> names = collectAll(loader)
+ .stream()
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toSet());
+ assertFalse(names.contains("BananaScriptEngine"));
+ assertFalse(names.contains("PearScriptEngine"));
+
+ // stream
+ names = ServiceLoader.load(ScriptEngineFactory.class, pcl)
+ .stream()
+ .map(Provider::get)
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toSet());
+ assertFalse(names.contains("BananaScriptEngine"));
+ assertFalse(names.contains("PearScriptEngine"));
+ }
+
+ /**
+ * Basic test of ServiceLoader.load where the service provider module is an
+ * automatic module.
+ */
+ @Test
+ public void testWithAutomaticModule() throws Exception {
+ Path classes = Paths.get(System.getProperty("test.classes"));
+ Path jar = Files.createTempDirectory("lib").resolve("pearscript.jar");
+ JarUtils.createJarFile(jar, classes, "META-INF", "org");
+
+ ModuleFinder finder = ModuleFinder.of(jar);
+ ModuleLayer bootLayer = ModuleLayer.boot();
+ Configuration parent = bootLayer.configuration();
+ Configuration cf = parent.resolveAndBind(finder, ModuleFinder.of(), Set.of());
+ assertTrue(cf.modules().size() == 1);
+
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+ ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+ assertTrue(layer.modules().size() == 1);
+
+ ClassLoader loader = layer.findLoader("pearscript");
+ ScriptEngineFactory factory;
+
+ // load using the class loader as context
+ factory = ServiceLoader.load(ScriptEngineFactory.class, loader)
+ .findFirst()
+ .orElse(null);
+ assertNotNull(factory);
+ assertTrue(factory.getClass().getClassLoader() == loader);
+
+ // load using the layer as context
+ factory = ServiceLoader.load(layer, ScriptEngineFactory.class)
+ .findFirst()
+ .orElse(null);
+ assertNotNull(factory);
+ assertTrue(factory.getClass().getClassLoader() == loader);
+ }
+
+ /**
+ * Basic test of ServiceLoader.load, using the class loader for
+ * a module in a custom layer as the context.
+ */
+ @Test
+ public void testWithCustomLayer1() {
+ ModuleLayer layer = createCustomLayer("bananascript");
+
+ ClassLoader loader = layer.findLoader("bananascript");
+ List<ScriptEngineFactory> providers
+ = collectAll(ServiceLoader.load(ScriptEngineFactory.class, loader));
+
+ // should have at least 2 x bananascript + pearscript
+ assertTrue(providers.size() >= 3);
+
+ // first element should be the provider in the custom layer
+ ScriptEngineFactory factory = providers.get(0);
+ assertTrue(factory.getClass().getClassLoader() == loader);
+ assertTrue(factory.getClass().getModule().getLayer() == layer);
+ assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
+
+ // remainder should be the boot layer
+ providers.remove(0);
+ Set<String> names = providers.stream()
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toSet());
+ assertTrue(names.contains("BananaScriptEngine"));
+ assertTrue(names.contains("PearScriptEngine"));
+ }
+
+ /**
+ * Basic test of ServiceLoader.load using a custom Layer as the context.
+ */
+ @Test
+ public void testWithCustomLayer2() {
+ ModuleLayer layer = createCustomLayer("bananascript");
+
+ List<ScriptEngineFactory> factories
+ = collectAll(ServiceLoader.load(layer, ScriptEngineFactory.class));
+
+ // should have at least 2 x bananascript
+ assertTrue(factories.size() >= 2);
+
+ // first element should be the provider in the custom layer
+ ScriptEngineFactory factory = factories.get(0);
+ assertTrue(factory.getClass().getModule().getLayer() == layer);
+ assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
+
+ // remainder should be the boot layer
+ factories.remove(0);
+ Set<String> names = factories.stream()
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toSet());
+ assertTrue(names.contains("BananaScriptEngine"));
+ assertFalse(names.contains("PearScriptEngine"));
+ }
+
+ /**
+ * Basic test of ServiceLoader.load with a tree of layers.
+ *
+ * Test scenario:
+ * - boot layer contains "bananascript", maybe other script engines
+ * - layer1, with boot layer as parent, contains "bananascript"
+ * - layer2, with boot layer as parent, contains "bananascript"
+ * - layer3, with layer1 ad layer as parents, contains "bananascript"
+ *
+ * ServiceLoader should locate all 4 script engine factories in DFS order.
+ */
+ @Test
+ public void testWithCustomLayer3() {
+ ModuleLayer bootLayer = ModuleLayer.boot();
+ Configuration cf0 = bootLayer.configuration();
+
+ // boot layer should contain "bananascript"
+ List<ScriptEngineFactory> factories
+ = collectAll(ServiceLoader.load(bootLayer, ScriptEngineFactory.class));
+ int countInBootLayer = factories.size();
+ assertTrue(countInBootLayer >= 1);
+ assertTrue(factories.stream()
+ .map(p -> p.getEngineName())
+ .filter("BananaScriptEngine"::equals)
+ .findAny()
+ .isPresent());
+
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+ Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
+ ModuleFinder finder = ModuleFinder.of(dir);
+
+ // layer1
+ Configuration cf1 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
+ ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl);
+ assertTrue(layer1.modules().size() == 1);
+
+ // layer2
+ Configuration cf2 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
+ ModuleLayer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl);
+ assertTrue(layer2.modules().size() == 1);
+
+ // layer3 with layer1 and layer2 as parents
+ Configuration cf3 = Configuration.resolveAndBind(finder,
+ List.of(cf1, cf2),
+ ModuleFinder.of(),
+ Set.of());
+ ModuleLayer layer3
+ = ModuleLayer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer();
+ assertTrue(layer3.modules().size() == 1);
+
+
+ // class loaders
+ ClassLoader loader1 = layer1.findLoader("bananascript");
+ ClassLoader loader2 = layer2.findLoader("bananascript");
+ ClassLoader loader3 = layer3.findLoader("bananascript");
+ assertTrue(loader1 != loader2);
+ assertTrue(loader1 != loader3);
+ assertTrue(loader2 != loader3);
+
+ // load all factories with layer3 as the context
+ factories = collectAll(ServiceLoader.load(layer3, ScriptEngineFactory.class));
+ int count = factories.size();
+ assertTrue(count == countInBootLayer + 3);
+
+ // the ordering should be layer3, layer1, boot layer, layer2
+
+ ScriptEngineFactory factory = factories.get(0);
+ assertTrue(factory.getClass().getModule().getLayer() == layer3);
+ assertTrue(factory.getClass().getClassLoader() == loader3);
+ assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
+
+ factory = factories.get(1);
+ assertTrue(factory.getClass().getModule().getLayer() == layer1);
+ assertTrue(factory.getClass().getClassLoader() == loader1);
+ assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
+
+ // boot layer "bananascript" and maybe other factories
+ int last = count -1;
+ boolean found = false;
+ for (int i=2; i<last; i++) {
+ factory = factories.get(i);
+ assertTrue(factory.getClass().getModule().getLayer() == bootLayer);
+ if (factory.getEngineName().equals("BananaScriptEngine")) {
+ assertFalse(found);
+ found = true;
+ }
+ }
+ assertTrue(found);
+
+ factory = factories.get(last);
+ assertTrue(factory.getClass().getModule().getLayer() == layer2);
+ assertTrue(factory.getClass().getClassLoader() == loader2);
+ assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
+ }
+
+
+ // -- nulls --
+
+ @Test(expectedExceptions = { NullPointerException.class })
+ public void testLoadNull1() {
+ ServiceLoader.load(null);
+ }
+
+ @Test(expectedExceptions = { NullPointerException.class })
+ public void testLoadNull2() {
+ ServiceLoader.load((Class<?>) null, ClassLoader.getSystemClassLoader());
+ }
+
+ @Test(expectedExceptions = { NullPointerException.class })
+ public void testLoadNull3() {
+ class S { }
+ ServiceLoader.load((ModuleLayer) null, S.class);
+ }
+
+ @Test(expectedExceptions = { NullPointerException.class })
+ public void testLoadNull4() {
+ ServiceLoader.load(ModuleLayer.empty(), null);
+ }
+
+ @Test(expectedExceptions = { NullPointerException.class })
+ public void testLoadNull5() {
+ ServiceLoader.loadInstalled(null);
+ }
+
+ /**
+ * Create a custom layer by resolving the given module names. The modules
+ * are located in the {@code ${test.classes}/modules} directory.
+ */
+ private ModuleLayer createCustomLayer(String... modules) {
+ Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
+ ModuleFinder finder = ModuleFinder.of(dir);
+ Set<String> roots = new HashSet<>();
+ Collections.addAll(roots, modules);
+ ModuleLayer bootLayer = ModuleLayer.boot();
+ Configuration parent = bootLayer.configuration();
+ Configuration cf = parent.resolve(finder, ModuleFinder.of(), roots);
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+ ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
+ assertTrue(layer.modules().size() == 1);
+ return layer;
+ }
+
+ private <E> List<E> collectAll(ServiceLoader<E> loader) {
+ List<E> list = new ArrayList<>();
+ Iterator<E> iterator = loader.iterator();
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+ return list;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/NoInterferenceTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @library /test/lib
+ * @modules jdk.compiler
+ * @build jdk.test.lib.compiler.CompilerUtils
+ * @run testng NoInterferenceTest
+ * @summary Basic test of ServiceLoader that ensures there is no interference
+ * when there are two service interfaces of the same name in a layer
+ * or overridden in a child layer.
+ */
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.Set;
+
+import jdk.test.lib.compiler.CompilerUtils;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class NoInterferenceTest {
+
+ private static final String TEST_SRC = System.getProperty("test.src");
+ private static final Path SRC_DIR = Paths.get(TEST_SRC, "modules");
+ private static final Path MODS_DIR = Paths.get("mods");
+ private static final List<String> MODULES = Arrays.asList("s1", "p1", "s2", "p2");
+
+ @BeforeTest
+ void compile() throws Exception {
+ Files.createDirectory(MODS_DIR);
+ for (String name : MODULES) {
+ Path src = SRC_DIR.resolve(name);
+ Path output = Files.createDirectory(MODS_DIR.resolve(name));
+ assertTrue(CompilerUtils.compile(src, output, "-p", MODS_DIR.toString()));
+ }
+ }
+
+ @Test
+ public void test() throws Exception {
+ ModuleFinder empty = ModuleFinder.of();
+ ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+
+ ModuleLayer bootLayer = ModuleLayer.boot();
+
+ Configuration cf0 = bootLayer.configuration();
+ Configuration cf1 = cf0.resolveAndBind(finder, empty, Set.of("s1", "s2"));
+ Configuration cf2 = cf1.resolveAndBind(finder, empty, Set.of("s1", "s2"));
+
+ // cf1 contains s1, p1, s2, p2
+ assertTrue(cf1.modules().size() == 4);
+
+ // cf1 contains s1, p1, s2, p2
+ assertTrue(cf2.modules().size() == 4);
+
+ ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+ ModuleLayer layer1 = bootLayer.defineModulesWithManyLoaders(cf1, scl);
+ testLayer(layer1);
+
+ ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, scl);
+ testLayer(layer2);
+ }
+
+ /**
+ * Tests that the layer contains s1, p1, s2, and p2.
+ *
+ * Tests loading instances of s1/p.S and s2/p.S.
+ */
+ private void testLayer(ModuleLayer layer) throws Exception {
+ assertTrue(layer.modules().size() == 4);
+ Module s1 = layer.findModule("s1").get();
+ Module p1 = layer.findModule("p1").get();
+ Module s2 = layer.findModule("s2").get();
+ Module p2 = layer.findModule("p2").get();
+
+ // p1 reads s1
+ assertTrue(p1.canRead(s1));
+ assertFalse(p1.canRead(s2));
+
+ // p2 reads s2
+ assertTrue(p2.canRead(s2));
+ assertFalse(p2.canRead(s1));
+
+ // iterate over implementations of s1/p.S
+ {
+ ClassLoader loader = layer.findLoader("s1");
+ Class<?> service = loader.loadClass("p.S");
+
+ List<?> list = collectAll(ServiceLoader.load(service, loader));
+ assertTrue(list.size() == 1);
+ assertTrue(list.get(0).getClass().getModule() == p1);
+
+ list = collectAll(ServiceLoader.load(layer, service));
+ assertTrue(list.size() == 1);
+ assertTrue(list.get(0).getClass().getModule() == p1);
+ }
+
+ // iterate over implementations of s2/p.S
+ {
+ ClassLoader loader = layer.findLoader("s2");
+ Class<?> service = loader.loadClass("p.S");
+
+ List<?> list = collectAll(ServiceLoader.load(service, loader));
+ assertTrue(list.size() == 1);
+ assertTrue(list.get(0).getClass().getModule() == p2);
+
+ list = collectAll(ServiceLoader.load(layer, service));
+ assertTrue(list.size() == 1);
+ assertTrue(list.get(0).getClass().getModule() == p2);
+ }
+ }
+
+ private <E> List<E> collectAll(ServiceLoader<E> loader) {
+ List<E> list = new ArrayList<>();
+ Iterator<E> iterator = loader.iterator();
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+ return list;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/ReloadTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @library modules
+ * @modules java.scripting
+ * @run testng/othervm ReloadTest
+ * @summary Basic test of ServiceLoader.reload
+ */
+
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.ServiceLoader.Provider;
+import java.util.Spliterator;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import static java.util.ServiceLoader.*;
+import javax.script.ScriptEngineFactory;
+
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+@Test
+public class ReloadTest {
+
+ public void testReload() {
+ ServiceLoader<ScriptEngineFactory> sl = load(ScriptEngineFactory.class);
+ List<String> names1 = sl.stream()
+ .map(Provider::get)
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toList());
+ assertFalse(names1.isEmpty());
+ sl.reload();
+ List<String> names2 = sl.stream()
+ .map(Provider::get)
+ .map(ScriptEngineFactory::getEngineName)
+ .collect(Collectors.toList());
+ assertEquals(names1, names2);
+ }
+
+ @Test(expectedExceptions = { ConcurrentModificationException.class })
+ public void testIteratorHasNext() {
+ ServiceLoader<ScriptEngineFactory> sl = load(ScriptEngineFactory.class);
+ Iterator<ScriptEngineFactory> iterator = sl.iterator();
+ sl.reload();
+ iterator.hasNext();
+ }
+
+ @Test(expectedExceptions = { ConcurrentModificationException.class })
+ public void testIteratorNext() {
+ ServiceLoader<ScriptEngineFactory> sl = load(ScriptEngineFactory.class);
+ Iterator<ScriptEngineFactory> iterator = sl.iterator();
+ assertTrue(iterator.hasNext());
+ sl.reload();
+ iterator.next();
+ }
+
+ @Test(expectedExceptions = { ConcurrentModificationException.class })
+ public void testStreamFindAny() {
+ ServiceLoader<ScriptEngineFactory> sl = load(ScriptEngineFactory.class);
+ Stream<Provider<ScriptEngineFactory>> stream = sl.stream();
+ sl.reload();
+ stream.findAny();
+ }
+
+ @Test(expectedExceptions = { ConcurrentModificationException.class })
+ public void testSpliteratorTryAdvance() {
+ ServiceLoader<ScriptEngineFactory> sl = load(ScriptEngineFactory.class);
+ Stream<Provider<ScriptEngineFactory>> stream = sl.stream();
+ Spliterator<Provider<ScriptEngineFactory>> spliterator = stream.spliterator();
+ sl.reload();
+ spliterator.tryAdvance(System.out::println);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/badreturntype/ProviderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A provider factory with a provider() method with a return type that is not
+ * p.Service
+ */
+
+public class ProviderFactory {
+ ProviderFactory() { }
+
+ public static Object provider() {
+ throw new RuntimeException("Should not be called");
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/classnotpublic/ProviderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Not a provider factory because the class is not public.
+ */
+
+class ProviderFactory {
+ ProviderFactory() { }
+
+ public static Service provider() {
+ throw new RuntimeException("Should not be called");
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/classnotpublic/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/methodnotpublic/ProviderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Not a provider factory because the static provider() method is not public.
+ */
+
+public class ProviderFactory {
+ ProviderFactory() { }
+
+ static Service provider() {
+ throw new RuntimeException("Should not be called");
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/methodnotpublic/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/returnsnull/ProviderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A provider factory that defines a public static provider method that returns
+ * null.
+ */
+
+public class ProviderFactory {
+ ProviderFactory() { }
+
+ public static Service provider() {
+ return null;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/returnsnull/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/throwsexception/ProviderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A provider factory that throws an exception.
+ */
+
+public class ProviderFactory {
+ ProviderFactory() { }
+
+ public static Service provider() {
+ throw new RuntimeException();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badfactories/throwsexception/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/ctornotpublic/Provider.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A provider class with a non-public constructor
+ */
+
+public class Provider implements Service {
+ Provider() { }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/ctornotpublic/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/notasubtype/Provider.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A provider class that is not a subtype of Service.
+ */
+
+public class Provider {
+ Provider() { }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/notpublic/Provider.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Provider class not public.
+ */
+
+class Provider implements Service {
+ public Provider() { }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/notpublic/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/throwsexception/Provider.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * A provider class with a constructor throws an exception.
+ */
+
+public class Provider {
+ public Provider() {
+ throw new RuntimeException();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/badproviders/throwsexception/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/classpath/pearscript/META-INF/services/javax.script.ScriptEngineFactory Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,1 @@
+org.pear.PearScriptEngineFactory
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/classpath/pearscript/org/pear/PearScript.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.pear;
+
+import java.io.Reader;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+
+public class PearScript implements ScriptEngine {
+
+ @Override
+ public Object eval(String script, ScriptContext context) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(Reader reader , ScriptContext context) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(String script) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(Reader reader) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(String script, Bindings n) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(Reader reader , Bindings n) {
+ throw new RuntimeException();
+ }
+ @Override
+ public void put(String key, Object value) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object get(String key) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Bindings getBindings(int scope) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void setBindings(Bindings bindings, int scope) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Bindings createBindings() {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public ScriptContext getContext() {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void setContext(ScriptContext context) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public ScriptEngineFactory getFactory() {
+ throw new RuntimeException();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/classpath/pearscript/org/pear/PearScriptEngineFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.pear;
+
+import java.util.Arrays;
+import java.util.List;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+
+public class PearScriptEngineFactory implements ScriptEngineFactory {
+
+ public PearScriptEngineFactory() { }
+
+ public static PearScriptEngineFactory provider() {
+ throw new RuntimeException("Should not be called");
+ }
+
+ @Override
+ public String getEngineName() {
+ return "PearScriptEngine";
+ }
+
+ @Override
+ public String getEngineVersion() {
+ return "1.0";
+ }
+
+ @Override
+ public List<String> getExtensions() {
+ return Arrays.asList("pear");
+ }
+
+ @Override
+ public List<String> getMimeTypes() {
+ return Arrays.asList("application/x-pearscript");
+ }
+
+ @Override
+ public List<String> getNames() {
+ return Arrays.asList("PearScript");
+ }
+
+ @Override
+ public String getLanguageName() {
+ return "PearScript";
+ }
+
+ @Override
+ public String getLanguageVersion() {
+ return "1.0";
+ }
+
+ @Override
+ public Object getParameter(String key) {
+ return null;
+ }
+
+ @Override
+ public String getMethodCallSyntax(String obj, String m, String... args) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public String getOutputStatement(String toDisplay) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public String getProgram(String... statements) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public ScriptEngine getScriptEngine() {
+ return new PearScript();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/inheritance/NoInheritanceTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @build test/*
+ * @run main/othervm test/p.Main
+ * @summary Basic test of ServiceLoader to ensure that static provider methods
+ * are explicitly declared and not inherited from super classes
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/inheritance/test/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,30 @@
+/*
+ * 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 p.Main.*;
+
+module test {
+ exports p;
+ uses S;
+ provides S with P1, P2, P3;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/inheritance/test/p/Main.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+package p;
+
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.stream.Collectors;
+
+/**
+ * Basic test of ServiceLoader with a provider interface and 3 provider
+ * implementations.
+ *
+ * The provider interface (test.Main.Provider) defines a static factory method
+ * name "provider" that locates a provider implementation. At least one of the
+ * provider implementations does not define a static "provider" method.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ List<S> providers = ServiceLoader.load(S.class).stream()
+ .map(ServiceLoader.Provider::get)
+ .collect(Collectors.toList());
+ if (providers.size() != 3)
+ throw new RuntimeException("Expected 3 providers");
+ }
+
+ /**
+ * Service type
+ */
+ public static interface S {
+ }
+
+ /**
+ * Base implementation, its static provider method should never be called
+ */
+ public static class BaseProvider implements S {
+ protected BaseProvider() { }
+ public static S provider() {
+ throw new RuntimeException("Should not get here");
+ }
+ }
+
+ /**
+ * Provider implementation with public constructor.
+ */
+ public static class P1 extends BaseProvider {
+ public P1() { }
+ }
+
+ /**
+ * Provider implementation with static factory method.
+ */
+ public static class P2 extends BaseProvider {
+ private P2() { }
+ public static P2 provider() {
+ return new P2();
+ }
+ }
+
+ /**
+ * Provider implementation with static factory method and public
+ * constructor.
+ */
+ public static class P3 extends BaseProvider {
+ public P3() {
+ throw new RuntimeException("Should not get here");
+ }
+ private P3(int x) { }
+ public static S provider() {
+ return new P3(0);
+ }
+ }
+}
--- a/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @library /lib/testlibrary /test/lib
- * @modules jdk.compiler
- * @build jdk.test.lib.compiler.CompilerUtils
- * @run testng/othervm BadProvidersTest
- * @summary Basic test of ServiceLoader with bad provider and bad provider
- * factories deployed on the module path
- */
-
-import java.lang.module.Configuration;
-import java.lang.module.ModuleFinder;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.List;
-import java.util.ServiceConfigurationError;
-import java.util.ServiceLoader;
-import java.util.ServiceLoader.Provider;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import jdk.test.lib.compiler.CompilerUtils;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.*;
-
-/**
- * Basic test of `provides S with PF` and `provides S with P` where the provider
- * factory or provider
- */
-
-public class BadProvidersTest {
-
- private static final String TEST_SRC = System.getProperty("test.src");
-
- private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
- private static final Path SRC_DIR = Paths.get(TEST_SRC, "modules");
-
- private static final Path BADFACTORIES_DIR = Paths.get(TEST_SRC, "badfactories");
- private static final Path BADPROVIDERS_DIR = Paths.get(TEST_SRC, "badproviders");
-
- private static final String TEST1_MODULE = "test1";
- private static final String TEST2_MODULE = "test2";
-
- private static final String TEST_SERVICE = "p.Service";
-
- /**
- * Compiles a module, returning a module path with the compiled module.
- */
- private Path compileTest(String moduleName) throws Exception {
- Path dir = Files.createTempDirectory(USER_DIR, "mods");
- Path output = Files.createDirectory(dir.resolve(moduleName));
- boolean compiled = CompilerUtils.compile(SRC_DIR.resolve(moduleName), output);
- assertTrue(compiled);
- return dir;
- }
-
- /**
- * Resolves a test module and loads it into its own layer. ServiceLoader
- * is then used to load all providers.
- */
- private List<Provider> loadProviders(Path mp, String moduleName) throws Exception {
- ModuleFinder finder = ModuleFinder.of(mp);
-
- ModuleLayer bootLayer = ModuleLayer.boot();
-
- Configuration cf = bootLayer.configuration()
- .resolveAndBind(finder, ModuleFinder.of(), Set.of(moduleName));
-
- ClassLoader scl = ClassLoader.getSystemClassLoader();
-
- ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
-
- Class<?> service = layer.findLoader(moduleName).loadClass(TEST_SERVICE);
-
- return ServiceLoader.load(layer, service)
- .stream()
- .collect(Collectors.toList());
- }
-
- @Test
- public void sanityTest1() throws Exception {
- Path mods = compileTest(TEST1_MODULE);
- List<Provider> list = loadProviders(mods, TEST1_MODULE);
- assertTrue(list.size() == 1);
-
- // the provider is a singleton, enforced by the provider factory
- Object p1 = list.get(0).get();
- Object p2 = list.get(0).get();
- assertTrue(p1 != null);
- assertTrue(p1 == p2);
- }
-
- @Test
- public void sanityTest2() throws Exception {
- Path mods = compileTest(TEST2_MODULE);
- List<Provider> list = loadProviders(mods, TEST2_MODULE);
- assertTrue(list.size() == 1);
- Object p = list.get(0).get();
- assertTrue(p != null);
- }
-
-
- @DataProvider(name = "badfactories")
- public Object[][] createBadFactories() {
- return new Object[][] {
- { "classnotpublic", null },
- { "methodnotpublic", null },
- { "badreturntype", null },
- { "returnsnull", null },
- { "throwsexception", null },
- };
- }
-
-
- @Test(dataProvider = "badfactories",
- expectedExceptions = ServiceConfigurationError.class)
- public void testBadFactory(String testName, String ignore) throws Exception {
- Path mods = compileTest(TEST1_MODULE);
-
- // compile the bad factory
- Path source = BADFACTORIES_DIR.resolve(testName);
- Path output = Files.createTempDirectory(USER_DIR, "tmp");
- boolean compiled = CompilerUtils.compile(source, output);
- assertTrue(compiled);
-
- // copy the compiled class into the module
- Path classFile = Paths.get("p", "ProviderFactory.class");
- Files.copy(output.resolve(classFile),
- mods.resolve(TEST1_MODULE).resolve(classFile),
- StandardCopyOption.REPLACE_EXISTING);
-
- // load providers and instantiate each one
- loadProviders(mods, TEST1_MODULE).forEach(Provider::get);
- }
-
-
- @DataProvider(name = "badproviders")
- public Object[][] createBadProviders() {
- return new Object[][] {
- { "notpublic", null },
- { "ctornotpublic", null },
- { "notasubtype", null },
- { "throwsexception", null }
- };
- }
-
-
- @Test(dataProvider = "badproviders",
- expectedExceptions = ServiceConfigurationError.class)
- public void testBadProvider(String testName, String ignore) throws Exception {
- Path mods = compileTest(TEST2_MODULE);
-
- // compile the bad provider
- Path source = BADPROVIDERS_DIR.resolve(testName);
- Path output = Files.createTempDirectory(USER_DIR, "tmp");
- boolean compiled = CompilerUtils.compile(source, output);
- assertTrue(compiled);
-
- // copy the compiled class into the module
- Path classFile = Paths.get("p", "Provider.class");
- Files.copy(output.resolve(classFile),
- mods.resolve(TEST2_MODULE).resolve(classFile),
- StandardCopyOption.REPLACE_EXISTING);
-
- // load providers and instantiate each one
- loadProviders(mods, TEST2_MODULE).forEach(Provider::get);
- }
-
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/Basic.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,433 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @library modules
- * @modules java.scripting
- * @build bananascript/*
- * @compile src/pearscript/org/pear/PearScriptEngineFactory.java
- * src/pearscript/org/pear/PearScript.java
- * @run testng/othervm Basic
- * @summary Basic test for ServiceLoader with a provider deployed as a module.
- */
-
-import java.lang.module.Configuration;
-import java.lang.module.ModuleFinder;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.*;
-import java.util.ServiceLoader.Provider;
-import java.util.stream.Collectors;
-import javax.script.ScriptEngineFactory;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeTest;
-import static org.testng.Assert.*;
-
-/**
- * Basic test for ServiceLoader. The test make use of two service providers:
- * 1. BananaScriptEngine - a ScriptEngineFactory deployed as a module on the
- * module path. It implementations a singleton via the public static
- * provider method.
- * 2. PearScriptEngine - a ScriptEngineFactory deployed on the class path
- * with a service configuration file.
- */
-
-public class Basic {
-
- // Copy the services configuration file for "pearscript" into place.
- @BeforeTest
- public void setup() throws Exception {
- Path src = Paths.get(System.getProperty("test.src", ""));
- Path classes = Paths.get(System.getProperty("test.classes", ""));
- String st = ScriptEngineFactory.class.getName();
- Path config = Paths.get("META-INF", "services", st);
- Path source = src.resolve("src").resolve("pearscript").resolve(config);
- Path target = classes.resolve(config);
- Files.createDirectories(target.getParent());
- Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
- }
-
- /**
- * Basic test of iterator() to ensure that providers located as modules
- * and on the class path are found.
- */
- @Test
- public void testIterator() {
- ServiceLoader<ScriptEngineFactory> loader
- = ServiceLoader.load(ScriptEngineFactory.class);
- Set<String> names = collectAll(loader)
- .stream()
- .map(ScriptEngineFactory::getEngineName)
- .collect(Collectors.toSet());
- assertTrue(names.contains("BananaScriptEngine"));
- assertTrue(names.contains("PearScriptEngine"));
- }
-
- /**
- * Basic test of iterator() to test iteration order. Providers deployed
- * as named modules should be found before providers deployed on the class
- * path.
- */
- @Test
- public void testIteratorOrder() {
- ServiceLoader<ScriptEngineFactory> loader
- = ServiceLoader.load(ScriptEngineFactory.class);
- boolean foundUnnamed = false;
- for (ScriptEngineFactory factory : collectAll(loader)) {
- if (factory.getClass().getModule().isNamed()) {
- if (foundUnnamed) {
- assertTrue(false, "Named module element after unnamed");
- }
- } else {
- foundUnnamed = true;
- }
- }
- }
-
- /**
- * Basic test of Provider::type
- */
- @Test
- public void testProviderType() {
- Set<String> types = ServiceLoader.load(ScriptEngineFactory.class)
- .stream()
- .map(Provider::type)
- .map(Class::getName)
- .collect(Collectors.toSet());
- assertTrue(types.contains("org.banana.BananaScriptEngineFactory"));
- assertTrue(types.contains("org.pear.PearScriptEngineFactory"));
- }
-
- /**
- * Basic test of Provider::get
- */
- @Test
- public void testProviderGet() {
- Set<String> names = ServiceLoader.load(ScriptEngineFactory.class)
- .stream()
- .map(Provider::get)
- .map(ScriptEngineFactory::getEngineName)
- .collect(Collectors.toSet());
- assertTrue(names.contains("BananaScriptEngine"));
- assertTrue(names.contains("PearScriptEngine"));
- }
-
- /**
- * Basic test of the public static provider method. BananaScriptEngine
- * defines a provider method that returns the same instance.
- */
- @Test
- public void testSingleton() {
- Optional<Provider<ScriptEngineFactory>> oprovider
- = ServiceLoader.load(ScriptEngineFactory.class)
- .stream()
- .filter(p -> p.type().getName().equals("org.banana.BananaScriptEngineFactory"))
- .findFirst();
- assertTrue(oprovider.isPresent());
- Provider<ScriptEngineFactory> provider = oprovider.get();
-
- // invoke Provider::get twice
- ScriptEngineFactory factory1 = provider.get();
- ScriptEngineFactory factory2 = provider.get();
- assertTrue(factory1 == factory2);
- }
-
- /**
- * Basic test of stream() to ensure that elements for providers in named
- * modules come before elements for providers in unnamed modules.
- */
- @Test
- public void testStreamOrder() {
- List<Class<?>> types = ServiceLoader.load(ScriptEngineFactory.class)
- .stream()
- .map(Provider::type)
- .collect(Collectors.toList());
-
- boolean foundUnnamed = false;
- for (Class<?> factoryClass : types) {
- if (factoryClass.getModule().isNamed()) {
- if (foundUnnamed) {
- assertTrue(false, "Named module element after unnamed");
- }
- } else {
- foundUnnamed = true;
- }
- }
- }
-
- /**
- * Basic test of ServiceLoader.findFirst()
- */
- @Test
- public void testFindFirst() {
- Optional<ScriptEngineFactory> ofactory
- = ServiceLoader.load(ScriptEngineFactory.class).findFirst();
- assertTrue(ofactory.isPresent());
- ScriptEngineFactory factory = ofactory.get();
- assertTrue(factory.getClass().getModule().isNamed());
-
- class S { }
- assertFalse(ServiceLoader.load(S.class).findFirst().isPresent());
- }
-
- /**
- * Basic test ServiceLoader.load specifying the platform class loader.
- * The providers on the module path and class path should not be located.
- */
- @Test
- public void testWithPlatformClassLoader() {
- ClassLoader pcl = ClassLoader.getPlatformClassLoader();
-
- // iterator
- ServiceLoader<ScriptEngineFactory> loader
- = ServiceLoader.load(ScriptEngineFactory.class, pcl);
- Set<String> names = collectAll(loader)
- .stream()
- .map(ScriptEngineFactory::getEngineName)
- .collect(Collectors.toSet());
- assertFalse(names.contains("BananaScriptEngine"));
- assertFalse(names.contains("PearScriptEngine"));
-
- // stream
- names = ServiceLoader.load(ScriptEngineFactory.class, pcl)
- .stream()
- .map(Provider::get)
- .map(ScriptEngineFactory::getEngineName)
- .collect(Collectors.toSet());
- assertFalse(names.contains("BananaScriptEngine"));
- assertFalse(names.contains("PearScriptEngine"));
- }
-
- /**
- * Basic test of ServiceLoader.load, using the class loader for
- * a module in a custom layer as the context.
- */
- @Test
- public void testWithCustomLayer1() {
- ModuleLayer layer = createCustomLayer("bananascript");
-
- ClassLoader loader = layer.findLoader("bananascript");
- List<ScriptEngineFactory> providers
- = collectAll(ServiceLoader.load(ScriptEngineFactory.class, loader));
-
- // should have at least 2 x bananascript + pearscript
- assertTrue(providers.size() >= 3);
-
- // first element should be the provider in the custom layer
- ScriptEngineFactory factory = providers.get(0);
- assertTrue(factory.getClass().getClassLoader() == loader);
- assertTrue(factory.getClass().getModule().getLayer() == layer);
- assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
-
- // remainder should be the boot layer
- providers.remove(0);
- Set<String> names = providers.stream()
- .map(ScriptEngineFactory::getEngineName)
- .collect(Collectors.toSet());
- assertTrue(names.contains("BananaScriptEngine"));
- assertTrue(names.contains("PearScriptEngine"));
- }
-
- /**
- * Basic test of ServiceLoader.load using a custom Layer as the context.
- */
- @Test
- public void testWithCustomLayer2() {
- ModuleLayer layer = createCustomLayer("bananascript");
-
- List<ScriptEngineFactory> factories
- = collectAll(ServiceLoader.load(layer, ScriptEngineFactory.class));
-
- // should have at least 2 x bananascript
- assertTrue(factories.size() >= 2);
-
- // first element should be the provider in the custom layer
- ScriptEngineFactory factory = factories.get(0);
- assertTrue(factory.getClass().getModule().getLayer() == layer);
- assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
-
- // remainder should be the boot layer
- factories.remove(0);
- Set<String> names = factories.stream()
- .map(ScriptEngineFactory::getEngineName)
- .collect(Collectors.toSet());
- assertTrue(names.contains("BananaScriptEngine"));
- assertFalse(names.contains("PearScriptEngine"));
- }
-
- /**
- * Basic test of ServiceLoader.load with a tree of layers.
- *
- * Test scenario:
- * - boot layer contains "bananascript", maybe other script engines
- * - layer1, with boot layer as parent, contains "bananascript"
- * - layer2, with boot layer as parent, contains "bananascript"
- * - layer3, with layer1 ad layer as parents, contains "bananascript"
- *
- * ServiceLoader should locate all 4 script engine factories in DFS order.
- */
- @Test
- public void testWithCustomLayer3() {
- ModuleLayer bootLayer = ModuleLayer.boot();
- Configuration cf0 = bootLayer.configuration();
-
- // boot layer should contain "bananascript"
- List<ScriptEngineFactory> factories
- = collectAll(ServiceLoader.load(bootLayer, ScriptEngineFactory.class));
- int countInBootLayer = factories.size();
- assertTrue(countInBootLayer >= 1);
- assertTrue(factories.stream()
- .map(p -> p.getEngineName())
- .filter("BananaScriptEngine"::equals)
- .findAny()
- .isPresent());
-
- ClassLoader scl = ClassLoader.getSystemClassLoader();
- Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
- ModuleFinder finder = ModuleFinder.of(dir);
-
- // layer1
- Configuration cf1 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
- ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl);
- assertTrue(layer1.modules().size() == 1);
-
- // layer2
- Configuration cf2 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of());
- ModuleLayer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl);
- assertTrue(layer2.modules().size() == 1);
-
- // layer3 with layer1 and layer2 as parents
- Configuration cf3 = Configuration.resolveAndBind(finder,
- List.of(cf1, cf2),
- ModuleFinder.of(),
- Set.of());
- ModuleLayer layer3
- = ModuleLayer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer();
- assertTrue(layer3.modules().size() == 1);
-
-
- // class loaders
- ClassLoader loader1 = layer1.findLoader("bananascript");
- ClassLoader loader2 = layer2.findLoader("bananascript");
- ClassLoader loader3 = layer3.findLoader("bananascript");
- assertTrue(loader1 != loader2);
- assertTrue(loader1 != loader3);
- assertTrue(loader2 != loader3);
-
- // load all factories with layer3 as the context
- factories = collectAll(ServiceLoader.load(layer3, ScriptEngineFactory.class));
- int count = factories.size();
- assertTrue(count == countInBootLayer + 3);
-
- // the ordering should be layer3, layer1, boot layer, layer2
-
- ScriptEngineFactory factory = factories.get(0);
- assertTrue(factory.getClass().getModule().getLayer() == layer3);
- assertTrue(factory.getClass().getClassLoader() == loader3);
- assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
-
- factory = factories.get(1);
- assertTrue(factory.getClass().getModule().getLayer() == layer1);
- assertTrue(factory.getClass().getClassLoader() == loader1);
- assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
-
- // boot layer "bananascript" and maybe other factories
- int last = count -1;
- boolean found = false;
- for (int i=2; i<last; i++) {
- factory = factories.get(i);
- assertTrue(factory.getClass().getModule().getLayer() == bootLayer);
- if (factory.getEngineName().equals("BananaScriptEngine")) {
- assertFalse(found);
- found = true;
- }
- }
- assertTrue(found);
-
- factory = factories.get(last);
- assertTrue(factory.getClass().getModule().getLayer() == layer2);
- assertTrue(factory.getClass().getClassLoader() == loader2);
- assertTrue(factory.getEngineName().equals("BananaScriptEngine"));
- }
-
-
- // -- nulls --
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testLoadNull1() {
- ServiceLoader.load(null);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testLoadNull2() {
- ServiceLoader.load((Class<?>) null, ClassLoader.getSystemClassLoader());
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testLoadNull3() {
- class S { }
- ServiceLoader.load((ModuleLayer) null, S.class);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testLoadNull4() {
- ServiceLoader.load(ModuleLayer.empty(), null);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testLoadNull5() {
- ServiceLoader.loadInstalled(null);
- }
-
- /**
- * Create a custom layer by resolving the given module names. The modules
- * are located in the {@code ${test.classes}/modules} directory.
- */
- private ModuleLayer createCustomLayer(String... modules) {
- Path dir = Paths.get(System.getProperty("test.classes", "."), "modules");
- ModuleFinder finder = ModuleFinder.of(dir);
- Set<String> roots = new HashSet<>();
- Collections.addAll(roots, modules);
- ModuleLayer bootLayer = ModuleLayer.boot();
- Configuration parent = bootLayer.configuration();
- Configuration cf = parent.resolve(finder, ModuleFinder.of(), roots);
- ClassLoader scl = ClassLoader.getSystemClassLoader();
- ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl);
- assertTrue(layer.modules().size() == 1);
- return layer;
- }
-
- private <E> List<E> collectAll(ServiceLoader<E> loader) {
- List<E> list = new ArrayList<>();
- Iterator<E> iterator = loader.iterator();
- while (iterator.hasNext()) {
- list.add(iterator.next());
- }
- return list;
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/badreturntype/ProviderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * A provider factory with a provider() method with a return type that is not
- * p.Service
- */
-
-public class ProviderFactory {
- ProviderFactory() { }
-
- public static Object provider() {
- throw new RuntimeException("Should not be called");
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/classnotpublic/ProviderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Not a provider factory because the class is not public.
- */
-
-class ProviderFactory {
- ProviderFactory() { }
-
- public static Service provider() {
- throw new RuntimeException("Should not be called");
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/classnotpublic/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/methodnotpublic/ProviderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Not a provider factory because the static provider() method is not public.
- */
-
-public class ProviderFactory {
- ProviderFactory() { }
-
- static Service provider() {
- throw new RuntimeException("Should not be called");
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/methodnotpublic/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/returnsnull/ProviderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * A provider factory that defines a public static provider method that returns
- * null.
- */
-
-public class ProviderFactory {
- ProviderFactory() { }
-
- public static Service provider() {
- return null;
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/returnsnull/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/throwsexception/ProviderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * A provider factory that throws an exception.
- */
-
-public class ProviderFactory {
- ProviderFactory() { }
-
- public static Service provider() {
- throw new RuntimeException();
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badfactories/throwsexception/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/ctornotpublic/Provider.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * A provider class with a non-public constructor
- */
-
-public class Provider implements Service {
- Provider() { }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/ctornotpublic/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/notasubtype/Provider.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * A provider class that is not a subtype of Service.
- */
-
-public class Provider {
- Provider() { }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/notpublic/Provider.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Provider class not public.
- */
-
-class Provider implements Service {
- public Provider() { }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/notpublic/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/throwsexception/Provider.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * A provider class with a constructor throws an exception.
- */
-
-public class Provider {
- public Provider() {
- throw new RuntimeException();
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/badproviders/throwsexception/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/bananascript/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+module bananascript {
+ requires java.scripting;
+
+ provides javax.script.ScriptEngineFactory
+ with org.banana.BananaScriptEngineFactory;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/bananascript/org/banana/BananaScript.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.banana;
+
+import java.io.Reader;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+
+public class BananaScript implements ScriptEngine {
+
+ @Override
+ public Object eval(String script, ScriptContext context) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(Reader reader , ScriptContext context) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(String script) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(Reader reader) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(String script, Bindings n) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object eval(Reader reader , Bindings n) {
+ throw new RuntimeException();
+ }
+ @Override
+ public void put(String key, Object value) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Object get(String key) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Bindings getBindings(int scope) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void setBindings(Bindings bindings, int scope) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public Bindings createBindings() {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public ScriptContext getContext() {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void setContext(ScriptContext context) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public ScriptEngineFactory getFactory() {
+ throw new RuntimeException();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/bananascript/org/banana/BananaScriptEngineFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.banana;
+
+import java.util.Arrays;
+import java.util.List;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+
+public class BananaScriptEngineFactory implements ScriptEngineFactory {
+
+ static final BananaScriptEngineFactory INSTANCE = new BananaScriptEngineFactory(null);
+
+ public BananaScriptEngineFactory() {
+ throw new RuntimeException("Should not be called");
+ }
+
+ private BananaScriptEngineFactory(Void param) { }
+
+ public static BananaScriptEngineFactory provider() {
+ return INSTANCE;
+ }
+
+ @Override
+ public String getEngineName() {
+ return "BananaScriptEngine";
+ }
+
+ @Override
+ public String getEngineVersion() {
+ return "1.0";
+ }
+
+ @Override
+ public List<String> getExtensions() {
+ return Arrays.asList("banana");
+ }
+
+ @Override
+ public List<String> getMimeTypes() {
+ return Arrays.asList("application/x-bananascript");
+ }
+
+ @Override
+ public List<String> getNames() {
+ return Arrays.asList("BananaScript");
+ }
+
+ @Override
+ public String getLanguageName() {
+ return "BananaScript";
+ }
+
+ @Override
+ public String getLanguageVersion() {
+ return "1.0";
+ }
+
+ @Override
+ public Object getParameter(String key) {
+ return null;
+ }
+
+ @Override
+ public String getMethodCallSyntax(String obj, String m, String... args) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public String getOutputStatement(String toDisplay) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public String getProgram(String... statements) {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public ScriptEngine getScriptEngine() {
+ return new BananaScript();
+ }
+}
--- a/jdk/test/java/util/ServiceLoader/modules/modules/bananascript/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-module bananascript {
- requires java.scripting;
-
- provides javax.script.ScriptEngineFactory
- with org.banana.BananaScriptEngineFactory;
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/modules/bananascript/org/banana/BananaScript.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.banana;
-
-import java.io.Reader;
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-
-public class BananaScript implements ScriptEngine {
-
- @Override
- public Object eval(String script, ScriptContext context) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(Reader reader , ScriptContext context) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(String script) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(Reader reader) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(String script, Bindings n) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(Reader reader , Bindings n) {
- throw new RuntimeException();
- }
- @Override
- public void put(String key, Object value) {
- throw new RuntimeException();
- }
-
- @Override
- public Object get(String key) {
- throw new RuntimeException();
- }
-
- @Override
- public Bindings getBindings(int scope) {
- throw new RuntimeException();
- }
-
- @Override
- public void setBindings(Bindings bindings, int scope) {
- throw new RuntimeException();
- }
-
- @Override
- public Bindings createBindings() {
- throw new RuntimeException();
- }
-
- @Override
- public ScriptContext getContext() {
- throw new RuntimeException();
- }
-
- @Override
- public void setContext(ScriptContext context) {
- throw new RuntimeException();
- }
-
- @Override
- public ScriptEngineFactory getFactory() {
- throw new RuntimeException();
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/modules/bananascript/org/banana/BananaScriptEngineFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.banana;
-
-import java.util.Arrays;
-import java.util.List;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-
-public class BananaScriptEngineFactory implements ScriptEngineFactory {
-
- static final BananaScriptEngineFactory INSTANCE = new BananaScriptEngineFactory(null);
-
- public BananaScriptEngineFactory() {
- throw new RuntimeException("Should not be called");
- }
-
- private BananaScriptEngineFactory(Void param) { }
-
- public static BananaScriptEngineFactory provider() {
- return INSTANCE;
- }
-
- @Override
- public String getEngineName() {
- return "BananaScriptEngine";
- }
-
- @Override
- public String getEngineVersion() {
- return "1.0";
- }
-
- @Override
- public List<String> getExtensions() {
- return Arrays.asList("banana");
- }
-
- @Override
- public List<String> getMimeTypes() {
- return Arrays.asList("application/x-bananascript");
- }
-
- @Override
- public List<String> getNames() {
- return Arrays.asList("BananaScript");
- }
-
- @Override
- public String getLanguageName() {
- return "BananaScript";
- }
-
- @Override
- public String getLanguageVersion() {
- return "1.0";
- }
-
- @Override
- public Object getParameter(String key) {
- return null;
- }
-
- @Override
- public String getMethodCallSyntax(String obj, String m, String... args) {
- throw new RuntimeException();
- }
-
- @Override
- public String getOutputStatement(String toDisplay) {
- throw new RuntimeException();
- }
-
- @Override
- public String getProgram(String... statements) {
- throw new RuntimeException();
- }
-
- @Override
- public ScriptEngine getScriptEngine() {
- return new BananaScript();
- }
-}
--- a/jdk/test/java/util/ServiceLoader/modules/modules/test1/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Test module that provides an implementation of p.Service via a
- * provider factory class.
- */
-
-module test1 {
- exports p;
- provides p.Service with p.ProviderFactory;
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/modules/test1/p/ProviderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Provider factory
- */
-public class ProviderFactory {
- ProviderFactory() { }
-
- private static final Service INSTANCE = new Service() { };
-
- public static Service provider() {
- return INSTANCE;
- }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/modules/test1/p/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Service type
- */
-public interface Service { }
--- a/jdk/test/java/util/ServiceLoader/modules/modules/test2/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * Test module that provides an implementation of p.Service.
- */
-
-module test2 {
- exports p;
- provides p.Service with p.Provider;
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/modules/test2/p/Provider.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Provider type
- */
-public class Provider implements Service {
- public Provider() { }
-}
-
--- a/jdk/test/java/util/ServiceLoader/modules/modules/test2/p/Service.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package p;
-
-/**
- * Service type
- */
-public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/p1/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+module p1 {
+ requires s1;
+ provides p.S with q.P;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/p1/q/P.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package q;
+
+import p.S;
+
+public class P implements S { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/p2/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+module p2 {
+ requires s2;
+ provides p.S with q.P;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/p2/q/P.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package q;
+
+import p.S;
+
+public class P implements S { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/s1/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+module s1 {
+ exports p;
+ uses p.S;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/s1/p/S.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package p;
+
+public interface S { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/s2/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+module s2 {
+ exports p;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/s2/p/S.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package p;
+
+public interface S { }
--- a/jdk/test/java/util/ServiceLoader/modules/src/pearscript/META-INF/services/javax.script.ScriptEngineFactory Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-org.pear.PearScriptEngineFactory
--- a/jdk/test/java/util/ServiceLoader/modules/src/pearscript/org/pear/PearScript.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.pear;
-
-import java.io.Reader;
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-
-public class PearScript implements ScriptEngine {
-
- @Override
- public Object eval(String script, ScriptContext context) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(Reader reader , ScriptContext context) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(String script) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(Reader reader) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(String script, Bindings n) {
- throw new RuntimeException();
- }
-
- @Override
- public Object eval(Reader reader , Bindings n) {
- throw new RuntimeException();
- }
- @Override
- public void put(String key, Object value) {
- throw new RuntimeException();
- }
-
- @Override
- public Object get(String key) {
- throw new RuntimeException();
- }
-
- @Override
- public Bindings getBindings(int scope) {
- throw new RuntimeException();
- }
-
- @Override
- public void setBindings(Bindings bindings, int scope) {
- throw new RuntimeException();
- }
-
- @Override
- public Bindings createBindings() {
- throw new RuntimeException();
- }
-
- @Override
- public ScriptContext getContext() {
- throw new RuntimeException();
- }
-
- @Override
- public void setContext(ScriptContext context) {
- throw new RuntimeException();
- }
-
- @Override
- public ScriptEngineFactory getFactory() {
- throw new RuntimeException();
- }
-}
--- a/jdk/test/java/util/ServiceLoader/modules/src/pearscript/org/pear/PearScriptEngineFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package org.pear;
-
-import java.util.Arrays;
-import java.util.List;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-
-public class PearScriptEngineFactory implements ScriptEngineFactory {
-
- public PearScriptEngineFactory() { }
-
- public static PearScriptEngineFactory provider() {
- throw new RuntimeException("Should not be called");
- }
-
- @Override
- public String getEngineName() {
- return "PearScriptEngine";
- }
-
- @Override
- public String getEngineVersion() {
- return "1.0";
- }
-
- @Override
- public List<String> getExtensions() {
- return Arrays.asList("pear");
- }
-
- @Override
- public List<String> getMimeTypes() {
- return Arrays.asList("application/x-pearscript");
- }
-
- @Override
- public List<String> getNames() {
- return Arrays.asList("PearScript");
- }
-
- @Override
- public String getLanguageName() {
- return "PearScript";
- }
-
- @Override
- public String getLanguageVersion() {
- return "1.0";
- }
-
- @Override
- public Object getParameter(String key) {
- return null;
- }
-
- @Override
- public String getMethodCallSyntax(String obj, String m, String... args) {
- throw new RuntimeException();
- }
-
- @Override
- public String getOutputStatement(String toDisplay) {
- throw new RuntimeException();
- }
-
- @Override
- public String getProgram(String... statements) {
- throw new RuntimeException();
- }
-
- @Override
- public ScriptEngine getScriptEngine() {
- return new PearScript();
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/test1/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Test module that provides an implementation of p.Service via a
+ * provider factory class.
+ */
+
+module test1 {
+ exports p;
+ provides p.Service with p.ProviderFactory;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/test1/p/ProviderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Provider factory
+ */
+public class ProviderFactory {
+ ProviderFactory() { }
+
+ private static final Service INSTANCE = new Service() { };
+
+ public static Service provider() {
+ return INSTANCE;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/test1/p/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Service type
+ */
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/test2/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Test module that provides an implementation of p.Service.
+ */
+
+module test2 {
+ exports p;
+ provides p.Service with p.Provider;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/test2/p/Provider.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Provider type
+ */
+public class Provider implements Service {
+ public Provider() { }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/modules/test2/p/Service.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p;
+
+/**
+ * Service type
+ */
+public interface Service { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/nouses/NoUsesTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -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.
+ */
+
+/**
+ * @test
+ * @modules java.scripting
+ * @build test/*
+ * @run main/othervm test/p.Main
+ * @summary Basic test of ServiceLoader.load from named modules that does
+ * does delcare the use
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/nouses/test/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+module test {
+ exports p;
+ requires java.scripting;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/nouses/test/p/Main.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+package p;
+
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+import javax.script.ScriptEngineFactory;
+
+public class Main {
+
+ public static void main(String[] args) {
+ Module thisModule = Main.class.getModule();
+ assertTrue(thisModule.isNamed());
+
+ // this module does not declare that it uses ScriptEngineFactory
+ assertFalse(thisModule.canUse(ScriptEngineFactory.class));
+ try {
+ ServiceLoader.load(ScriptEngineFactory.class);
+ assertTrue(false);
+ } catch (ServiceConfigurationError expected) { }
+
+ // invoke addUses and retry
+ thisModule.addUses(ScriptEngineFactory.class);
+ ServiceLoader.load(ScriptEngineFactory.class).findFirst();
+ }
+
+ static void assertFalse(boolean value) {
+ if (value) throw new RuntimeException();
+ }
+
+ static void assertTrue(boolean value) {
+ if (!value) throw new RuntimeException();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/security/SecurityTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @build test/*
+ * @run testng/othervm test/p.Tests
+ * @summary Tests to exercise ServiceLoader with a security manager
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/security/test/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * 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 p.Tests.*;
+
+module test {
+ uses S1;
+ uses S2;
+ provides S1 with P1;
+ provides S2 with P2;
+ requires testng;
+ exports p to testng;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/ServiceLoader/security/test/p/Tests.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,185 @@
+/*
+ * 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.
+ */
+
+package p;
+
+import java.security.AccessControlContext;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+import java.util.ServiceLoader.Provider;
+import static java.security.AccessController.doPrivileged;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeTest;
+import static org.testng.Assert.*;
+
+/**
+ * Basic tests with a security manager to ensure that the provider code
+ * is run with permissions restricted by whatever created the ServiceLoader
+ * object.
+ */
+
+public class Tests {
+
+ static final Permission PERM = new RuntimePermission("eatMuffin");
+
+ static <T> PrivilegedAction<ServiceLoader<T>> loadAction(Class<T> service) {
+ return () -> ServiceLoader.load(service);
+ }
+
+ static AccessControlContext withPermissions(Permission... perms) {
+ Permissions p = new Permissions();
+ for (Permission perm : perms) {
+ p.add(perm);
+ }
+ ProtectionDomain pd = new ProtectionDomain(null, p);
+ return new AccessControlContext(new ProtectionDomain[]{ pd });
+ }
+
+ static AccessControlContext noPermissions() {
+ return withPermissions(/*empty*/);
+ }
+
+ @BeforeTest
+ public void setSecurityManager() {
+ class Policy extends java.security.Policy {
+ private final Permissions perms;
+ public Policy(Permission... permissions) {
+ perms = new Permissions();
+ for (Permission permission : permissions) {
+ perms.add(permission);
+ }
+ }
+ public PermissionCollection getPermissions(CodeSource cs) {
+ return perms;
+ }
+ public PermissionCollection getPermissions(ProtectionDomain pd) {
+ return perms;
+ }
+ public boolean implies(ProtectionDomain pd, Permission p) {
+ return perms.implies(p);
+ }
+ public void refresh() { }
+ }
+ Policy policy = new Policy(new AllPermission());
+ Policy.setPolicy(policy);
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ @Test
+ public void testConstructorUsingIteratorWithPermission() {
+ ServiceLoader<S1> sl = doPrivileged(loadAction(S1.class), withPermissions(PERM));
+ S1 obj = sl.iterator().next();
+ }
+
+ @Test
+ public void testConstructorUsingStreamWithPermission() {
+ ServiceLoader<S1> sl = doPrivileged(loadAction(S1.class), withPermissions(PERM));
+ assertTrue(sl.stream().map(Provider::get).count() == 1);
+ }
+
+ @Test
+ public void testConstructorUsingIteratorNoPermission() {
+ ServiceLoader<S1> sl = doPrivileged(loadAction(S1.class), noPermissions());
+ try {
+ sl.iterator().next();
+ assertTrue(false);
+ } catch (ServiceConfigurationError e) {
+ assertTrue(e.getCause() instanceof AccessControlException);
+ }
+ }
+
+ @Test
+ public void testConstructorUsingStreamNoPermission() {
+ ServiceLoader<S1> sl = doPrivileged(loadAction(S1.class), noPermissions());
+ try {
+ sl.stream().map(Provider::get).count();
+ assertTrue(false);
+ } catch (ServiceConfigurationError e) {
+ assertTrue(e.getCause() instanceof AccessControlException);
+ }
+ }
+
+ @Test
+ public void testFactoryMethodUsingIteratorWithPermission() {
+ ServiceLoader<S2> sl = doPrivileged(loadAction(S2.class), withPermissions(PERM));
+ S2 obj = sl.iterator().next();
+ }
+
+ @Test
+ public void testFactoryMethodUsingStreamWithPermission() {
+ ServiceLoader<S2> sl = doPrivileged(loadAction(S2.class), withPermissions(PERM));
+ assertTrue(sl.stream().map(Provider::get).count() == 1);
+ }
+
+ @Test
+ public void testFactoryMethodUsingIteratorNoPermission() {
+ ServiceLoader<S2> sl = doPrivileged(loadAction(S2.class), noPermissions());
+ try {
+ sl.iterator().next();
+ assertTrue(false);
+ } catch (ServiceConfigurationError e) {
+ assertTrue(e.getCause() instanceof AccessControlException);
+ }
+ }
+
+ @Test
+ public void testFactoryMethodUsingStreamNoPermission() {
+ ServiceLoader<S2> sl = doPrivileged(loadAction(S2.class), noPermissions());
+ try {
+ sl.stream().map(Provider::get).count();
+ assertTrue(false);
+ } catch (ServiceConfigurationError e) {
+ assertTrue(e.getCause() instanceof AccessControlException);
+ }
+ }
+
+
+ // service types and implementations
+
+ public static interface S1 { }
+ public static interface S2 { }
+
+ public static class P1 implements S1 {
+ public P1() {
+ AccessController.getContext().checkPermission(PERM);
+ }
+ }
+ public static class P2 implements S2 {
+ private P2() {
+ AccessController.getContext().checkPermission(PERM);
+ }
+ public static S2 provider() {
+ return new P2();
+ }
+ }
+}
--- a/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,9 +27,9 @@
* @summary Check that notification dispatch is not linear in number of MBeans.
* @author Eamonn McManus
*
- * @library /lib/testlibrary
+ * @library /test/lib
*
- * @run build jdk.testlibrary.* ListenerScaleTest
+ * @run build jdk.test.lib.Platform ListenerScaleTest
* @run main ListenerScaleTest
*/
@@ -71,7 +71,7 @@
import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL;
-import jdk.testlibrary.Platform;
+import jdk.test.lib.Platform;
public class ListenerScaleTest {
private static final int WARMUP_WITH_ONE_MBEAN = 1000;
--- a/jdk/test/javax/swing/plaf/windows/6921687/bug6921687.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/javax/swing/plaf/windows/6921687/bug6921687.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,8 +27,8 @@
* @summary Mnemonic disappears after repeated attempts to open menu items using
* mnemonics
* @author Semyon Sadetsky
- * @library /lib/testlibrary
- * @build jdk.testlibrary.Platform
+ * @library /test/lib
+ * @build jdk.test.lib.Platform
* @requires (os.family == "windows")
* @modules java.desktop/com.sun.java.swing.plaf.windows
* @run main bug6921687
@@ -41,7 +41,7 @@
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
-import jdk.testlibrary.Platform;
+import jdk.test.lib.Platform;
public class bug6921687 {
--- a/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -69,8 +69,7 @@
}
static Set<String> KNOWN_EXCEPTIONS =
- Set.of("java.xml/com.sun.xml.internal.stream.writers",
- "jdk.internal.vm.ci/jdk.vm.ci.services",
+ Set.of("jdk.internal.vm.ci/jdk.vm.ci.services",
"jdk.jsobject/jdk.internal.netscape.javascript.spi");
static void checkExports(ModuleDescriptor md) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/modules/etc/UpgradeableModules.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @summary Verify that upgradeable modules are not hashed in java.base
+ * whereas non-upgradeable modules are.
+ * @modules java.base/jdk.internal.module
+ * @run main UpgradeableModules
+ */
+
+import jdk.internal.module.ModuleHashes;
+import jdk.internal.module.ModuleReferenceImpl;
+
+import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
+import java.lang.module.ResolvedModule;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class UpgradeableModules {
+ private static final List<String> UPGRADEABLE_MODULES =
+ List.of("java.activation",
+ "java.compiler",
+ "java.corba",
+ "java.jnlp",
+ "java.transaction",
+ "java.xml.bind",
+ "java.xml.ws",
+ "java.xml.ws.annotation",
+ "jdk.internal.vm.compiler",
+ "jdk.deploy",
+ "jdk.javaws",
+ "jdk.plugin",
+ "jdk.plugin.dom",
+ "jdk.xml.bind",
+ "jdk.xml.ws");
+
+ public static void main(String... args) {
+ Set<String> hashedModules = hashedModules();
+ if (hashedModules.isEmpty())
+ return;
+
+ if (UPGRADEABLE_MODULES.stream().anyMatch(hashedModules::contains)) {
+ throw new RuntimeException("upgradeable modules are hashed: " +
+ UPGRADEABLE_MODULES.stream()
+ .filter(hashedModules::contains)
+ .collect(Collectors.joining(" ")));
+ }
+
+ Set<String> nonUpgradeableModules =
+ ModuleFinder.ofSystem().findAll().stream()
+ .map(mref -> mref.descriptor().name())
+ .filter(mn -> !UPGRADEABLE_MODULES.contains(mn))
+ .collect(Collectors.toSet());
+
+ if (nonUpgradeableModules.stream().anyMatch(mn -> !hashedModules.contains(mn))) {
+ throw new RuntimeException("non-upgradeable modules are not hashed: " +
+ nonUpgradeableModules.stream()
+ .filter(mn -> !hashedModules.contains(mn))
+ .collect(Collectors.joining(" ")));
+ }
+ }
+
+ private static Set<String> hashedModules() {
+ Optional<ResolvedModule> resolvedModule = ModuleLayer.boot()
+ .configuration()
+ .findModule("java.base");
+ assert resolvedModule.isPresent();
+ ModuleReference mref = resolvedModule.get().reference();
+ assert mref instanceof ModuleReferenceImpl;
+ ModuleHashes hashes = ((ModuleReferenceImpl) mref).recordedHashes();
+ if (hashes != null) {
+ Set<String> names = new HashSet<>(hashes.names());
+ names.add("java.base");
+ return names;
+ }
+
+ return Set.of();
+ }
+}
--- a/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -29,13 +29,9 @@
*/
import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReference;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
-import static java.lang.module.ModuleDescriptor.Requires.Modifier.*;
-
import org.testng.annotations.*;
import static org.testng.Assert.*;
@@ -76,8 +72,9 @@
ClassLoader loader1 = boot.findLoader(md.name());
ClassLoader loader2 = boot.findLoader(req.name());
if (loader1 != loader2 && !isAncestor(loader2, loader1)) {
- throw new Error(md.name() + " can't delegate to " +
- "find classes from " + req.name());
+ throw new Error(loader1.getName() + "/" + md.name() +
+ " can't delegate to find classes from " +
+ loader2.getName() + "/" + req.name());
}
}));
}
--- a/jdk/test/jdk/modules/open/Basic.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/jdk/modules/open/Basic.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,7 +25,7 @@
* @test
* @library modules
* @build m1/* m2/*
- * @run testng/othervm --add-modules=m1,m2 Basic
+ * @run testng/othervm --add-modules=m1,m2 --illegal-access=deny Basic
* @summary Basic test of open modules and open packages
*/
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java Thu Aug 24 16:24:44 2017 +0200
@@ -99,7 +99,7 @@
+ "When running test separately, set this property using '-D" + property + "=/path/to/jdk'.");
}
- Path toolName = Paths.get("bin", tool + (Platform.isWindows() ? ".exe" : ""));
+ Path toolName = Paths.get("bin", tool + (isWindows() ? ".exe" : ""));
Path jdkTool = Paths.get(jdkPath, toolName.toString());
if (!jdkTool.toFile().exists()) {
@@ -108,4 +108,8 @@
return jdkTool.toAbsolutePath().toString();
}
+
+ private static boolean isWindows() {
+ return System.getProperty("os.name").toLowerCase().startsWith("win");
+ }
}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-import java.util.regex.Pattern;
-import java.io.RandomAccessFile;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * @deprecated This class is deprecated. Use the one from
- * {@code <root>/test/lib/jdk/test/lib}
- */
-@Deprecated
-public class Platform {
- private static final String osName = System.getProperty("os.name");
- private static final String dataModel = System.getProperty("sun.arch.data.model");
- private static final String vmVersion = System.getProperty("java.vm.version");
- private static final String jdkDebug = System.getProperty("jdk.debug");
- private static final String osArch = System.getProperty("os.arch");
- private static final String vmName = System.getProperty("java.vm.name");
- private static final String userName = System.getProperty("user.name");
- private static final String compiler = System.getProperty("sun.management.compiler");
-
- public static boolean isClient() {
- return vmName.endsWith(" Client VM");
- }
-
- public static boolean isServer() {
- return vmName.endsWith(" Server VM");
- }
-
- public static boolean isGraal() {
- return vmName.endsWith(" Graal VM");
- }
-
- public static boolean isMinimal() {
- return vmName.endsWith(" Minimal VM");
- }
-
- public static boolean isTieredSupported() {
- return compiler.contains("Tiered Compilers");
- }
-
-
- public static boolean is32bit() {
- return dataModel.equals("32");
- }
-
- public static boolean is64bit() {
- return dataModel.equals("64");
- }
-
- public static boolean isAix() {
- return isOs("aix");
- }
-
- public static boolean isLinux() {
- return isOs("linux");
- }
-
- public static boolean isOSX() {
- return isOs("mac");
- }
-
- public static boolean isSolaris() {
- return isOs("sunos");
- }
-
- public static boolean isWindows() {
- return isOs("win");
- }
-
- private static boolean isOs(String osname) {
- return osName.toLowerCase().startsWith(osname.toLowerCase());
- }
-
- public static String getOsName() {
- return osName;
- }
-
- public static boolean isDebugBuild() {
- return (jdkDebug.toLowerCase().contains("debug"));
- }
-
- public static String getVMVersion() {
- return vmVersion;
- }
-
- // Returns true for sparc and sparcv9.
- public static boolean isSparc() {
- return isArch("sparc.*");
- }
-
- public static boolean isARM() {
- return isArch("arm.*");
- }
-
- public static boolean isPPC() {
- return isArch("ppc.*");
- }
-
- public static boolean isX86() {
- // On Linux it's 'i386', Windows 'x86' without '_64' suffix.
- return isArch("(i386)|(x86(?!_64))");
- }
-
- public static boolean isX64() {
- // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
- return isArch("(amd64)|(x86_64)");
- }
-
- private static boolean isArch(String archnameRE) {
- return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
- .matcher(osArch)
- .matches();
- }
-
- public static String getOsArch() {
- return osArch;
- }
-
- /**
- * Return a boolean for whether we expect to be able to attach
- * the SA to our own processes on this system.
- */
- public static boolean shouldSAAttach()
- throws IOException {
-
- if (isAix()) {
- return false; // SA not implemented.
- } else if (isLinux()) {
- return canPtraceAttachLinux();
- } else if (isOSX()) {
- return canAttachOSX();
- } else {
- // Other platforms expected to work:
- return true;
- }
- }
-
- /**
- * On Linux, first check the SELinux boolean "deny_ptrace" and return false
- * as we expect to be denied if that is "1".
- */
- public static boolean canPtraceAttachLinux()
- throws IOException {
-
- // SELinux deny_ptrace:
- try(RandomAccessFile file = new RandomAccessFile("/sys/fs/selinux/booleans/deny_ptrace", "r")) {
- if (file.readByte() != '0') {
- return false;
- }
- }
- catch(FileNotFoundException ex) {
- // Ignored
- }
-
- // YAMA enhanced security ptrace_scope:
- // 0 - a process can PTRACE_ATTACH to any other process running under the same uid
- // 1 - restricted ptrace: a process must be a children of the inferior or user is root
- // 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
- // 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
-
- try(RandomAccessFile file = new RandomAccessFile("/proc/sys/kernel/yama/ptrace_scope", "r")) {
- byte yama_scope = file.readByte();
- if (yama_scope == '3') {
- return false;
- }
-
- if (!userName.equals("root") && yama_scope != '0') {
- return false;
- }
- }
- catch(FileNotFoundException ex) {
- // Ignored
- }
-
- // Otherwise expect to be permitted:
- return true;
- }
-
- /**
- * On OSX, expect permission to attach only if we are root.
- */
- public static boolean canAttachOSX() {
- return userName.equals("root");
- }
-}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Aug 24 16:24:44 2017 +0200
@@ -217,63 +217,6 @@
}
/**
- * Uses "jcmd -l" to search for a jvm pid. This function will wait
- * forever (until jtreg timeout) for the pid to be found.
- * @param key Regular expression to search for
- * @return The found pid.
- */
- public static int waitForJvmPid(String key) throws Throwable {
- final long iterationSleepMillis = 250;
- System.out.println("waitForJvmPid: Waiting for key '" + key + "'");
- System.out.flush();
- while (true) {
- int pid = tryFindJvmPid(key);
- if (pid >= 0) {
- return pid;
- }
- Thread.sleep(iterationSleepMillis);
- }
- }
-
- /**
- * Searches for a jvm pid in the output from "jcmd -l".
- *
- * Example output from jcmd is:
- * 12498 sun.tools.jcmd.JCmd -l
- * 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar
- *
- * @param key A regular expression to search for.
- * @return The found pid, or -1 if Enot found.
- * @throws Exception If multiple matching jvms are found.
- */
- public static int tryFindJvmPid(String key) throws Throwable {
- OutputAnalyzer output = null;
- try {
- JDKToolLauncher jcmdLauncher = JDKToolLauncher.create("jcmd");
- jcmdLauncher.addToolArg("-l");
- output = ProcessTools.executeProcess(jcmdLauncher.getCommand());
- output.shouldHaveExitValue(0);
-
- // Search for a line starting with numbers (pid), follwed by the key.
- Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n");
- Matcher matcher = pattern.matcher(output.getStdout());
-
- int pid = -1;
- if (matcher.find()) {
- pid = Integer.parseInt(matcher.group(1));
- System.out.println("findJvmPid.pid: " + pid);
- if (matcher.find()) {
- throw new Exception("Found multiple JVM pids for key: " + key);
- }
- }
- return pid;
- } catch (Throwable t) {
- System.out.println(String.format("Utils.findJvmPid(%s) failed: %s", key, t));
- throw t;
- }
- }
-
- /**
* Adjusts the provided timeout value for the TIMEOUT_FACTOR
* @param tOut the timeout value to be adjusted
* @return The timeout value adjusted for the value of "test.timeout.factor"
--- a/jdk/test/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -22,8 +22,8 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.Platform;
import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.Platform;
import java.io.BufferedWriter;
import java.io.IOException;
--- a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -29,9 +29,9 @@
* @summary Check SSL config file permission for out-of-the-box management
* @author Taras Ledkov
*
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
*
- * @build jdk.testlibrary.* AbstractFilePermissionTest Dummy
+ * @build jdk.testlibrary.* jdk.test.lib.Platform AbstractFilePermissionTest Dummy
* @run main/timeout=300 PasswordFilePermissionTest
*/
public class PasswordFilePermissionTest extends AbstractFilePermissionTest {
--- a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -29,9 +29,9 @@
* @summary Check SSL config file permission for out-of-the-box management
* @author Taras Ledkov
*
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
*
- * @build jdk.testlibrary.* Dummy AbstractFilePermissionTest
+ * @build jdk.testlibrary.* jdk.test.lib.Platform Dummy AbstractFilePermissionTest
* @run main/timeout=300 SSLConfigFilePermissionTest
*/
public class SSLConfigFilePermissionTest extends AbstractFilePermissionTest {
--- a/jdk/test/sun/security/krb5/auto/KdcPolicy.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/sun/security/krb5/auto/KdcPolicy.java Thu Aug 24 16:24:44 2017 +0200
@@ -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,7 +38,7 @@
/*
* @test
- * @bug 8164656
+ * @bug 8164656 8181461
* @run main/othervm KdcPolicy udp
* @run main/othervm KdcPolicy tcp
* @summary krb5.kdc.bad.policy test
@@ -110,7 +110,7 @@
// It is possible the real KDC cannot fulfil the request
// in 3s, so it might fail (either 1st time or 2nd time).
writeConf(1, 3000, p1, p3);
- test("a3000c3000c3000|a3000c3000-|a3000c3000c3000-");
+ test("a3000c3000c3000|a3000c3000-|a3000c3000c3000a3000-");
// If a test case won't use a real KDC, it can be sped up.
writeConf(3, 5, p1, p2);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs12/ProbeLargeKeystore.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8181978
+ * @summary Test automatic keystore type detection for a large PKCS12 keystore
+ */
+
+import java.io.*;
+import java.security.*;
+import java.security.cert.*;
+import java.security.cert.Certificate;
+
+public class ProbeLargeKeystore {
+
+ private static final String DIR = System.getProperty("test.src", ".");
+ private static final String CERT = DIR + "/trusted.pem";
+ private static final String ALIAS = "test-entry-";
+ private static final int COUNT = 100;
+ private static final String KEYSTORE = "test-keystore.p12";
+ private static final char[] PASSWORD = "passphrase".toCharArray();
+
+ public static final void main(String[] args) throws Exception {
+
+ // Create a large PKCS12 keystore
+
+ new File(KEYSTORE).delete();
+ KeyStore keystore = KeyStore.getInstance("PKCS12");
+ keystore.load(null, null);
+ Certificate cert = loadCertificate(CERT);
+
+ for (int i = 0; i < COUNT; i++) {
+ keystore.setCertificateEntry(ALIAS + i, cert);
+ }
+
+ try (FileOutputStream out = new FileOutputStream(KEYSTORE)) {
+ keystore.store(out, PASSWORD);
+ }
+
+ // Test the automatic keystore type detection mechanism for PKCS12
+
+ KeyStore largeKeystore =
+ KeyStore.getInstance(new File(KEYSTORE), PASSWORD);
+
+ if (largeKeystore.size() != COUNT) {
+ throw new Exception("Error detecting a large PKCS12 keystore");
+ }
+
+ new File(KEYSTORE).delete();
+ System.out.println("OK");
+ }
+
+ private static final Certificate loadCertificate(String certFile)
+ throws Exception {
+ try (FileInputStream certStream = new FileInputStream(certFile)) {
+ CertificateFactory factory =
+ CertificateFactory.getInstance("X.509");
+ return factory.generateCertificate(certStream);
+ }
+ }
+}
--- a/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -27,9 +27,9 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.apps.LingeredAppWithDeadlock;
+import jdk.test.lib.Platform;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.Platform;
import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.ProcessTools;
@@ -40,7 +40,7 @@
* @library /test/lib
* @library /lib/testlibrary
* @build jdk.testlibrary.*
- * @build jdk.test.lib.apps.*
+ * @build jdk.test.lib.apps.* jdk.test.lib.Platform
* @build DeadlockDetectionTest
* @run main DeadlockDetectionTest
*/
--- a/jdk/test/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Thu Aug 24 16:24:44 2017 +0200
@@ -75,7 +75,8 @@
Paths.get("Test1.class"), Paths.get("Test2.class"));
// java -jar test.jar
- return ProcessTools.executeTestJava("-jar", jarfile.toString())
+ return ProcessTools.executeTestJava("--illegal-access=deny",
+ "-jar", jarfile.toString())
.outputTo(System.out)
.errorTo(System.out);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/IllegalAccessTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,494 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @modules java.base/jdk.internal.misc
+ * java.base/sun.security.x509
+ * java.activation
+ * @library /test/lib /lib/testlibrary modules
+ * @build IllegalAccessTest TryAccess JarUtils
+ * jdk.test.lib.compiler.CompilerUtils
+ * jdk.testlibrary.*
+ * @build m/*
+ * @run testng/othervm/timeout=180 IllegalAccessTest
+ * @summary Basic test for java --illegal-access=$VALUE
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.stream.Stream;
+
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.OutputAnalyzer;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * Basic test of --illegal-access=value to deny or permit access to JDK internals.
+ */
+
+@Test
+public class IllegalAccessTest {
+
+ static final String TEST_SRC = System.getProperty("test.src");
+ static final String TEST_CLASSES = System.getProperty("test.classes");
+ static final String MODULE_PATH = System.getProperty("jdk.module.path");
+
+ /**
+ * Represents the expected result of a test.
+ */
+ static final class Result {
+ private final boolean success;
+ private final List<String> expectedOutput = new ArrayList<>();
+ private final List<String> notExpectedOutput = new ArrayList<>();
+
+ Result(boolean success) {
+ this.success = success;
+ }
+
+ Result expect(String msg) {
+ expectedOutput.add(msg);
+ return this;
+ }
+
+ Result doNotExpect(String msg) {
+ notExpectedOutput.add(msg);
+ return this;
+ }
+
+ boolean shouldSucceed() {
+ return success;
+ }
+
+ Stream<String> expectedOutput() {
+ return expectedOutput.stream();
+ }
+
+ Stream<String> notExpectedOutput() {
+ return notExpectedOutput.stream();
+ }
+
+ @Override
+ public String toString() {
+ String s = (success) ? "success" : "failure";
+ for (String msg : expectedOutput) {
+ s += "/" + msg;
+ }
+ return s;
+ }
+ }
+
+ static Result success() {
+ return new Result(true);
+ }
+
+ static Result successNoWarning() {
+ return success().doNotExpect("WARNING");
+ }
+
+ static Result successWithWarning() {
+ return success().expect("WARNING");
+ }
+
+ static Result fail(String expectedOutput) {
+ return new Result(false).expect(expectedOutput).doNotExpect("WARNING");
+ }
+
+ @DataProvider(name = "denyCases")
+ public Object[][] denyCases() {
+ return new Object[][] {
+ { "accessPublicClassNonExportedPackage", fail("IllegalAccessError") },
+ { "accessPublicClassJdk9NonExportedPackage", fail("IllegalAccessError") },
+
+ { "reflectPublicMemberExportedPackage", successNoWarning() },
+ { "reflectNonPublicMemberExportedPackage", fail("IllegalAccessException") },
+ { "reflectPublicMemberNonExportedPackage", fail("IllegalAccessException") },
+ { "reflectNonPublicMemberNonExportedPackage", fail("IllegalAccessException") },
+ { "reflectPublicMemberJdk9NonExportedPackage", fail("IllegalAccessException") },
+ { "reflectPublicMemberApplicationModule", successNoWarning() },
+
+ { "setAccessiblePublicMemberExportedPackage", successNoWarning() },
+ { "setAccessibleNonPublicMemberExportedPackage", fail("InaccessibleObjectException") },
+ { "setAccessiblePublicMemberNonExportedPackage", fail("InaccessibleObjectException") },
+ { "setAccessibleNonPublicMemberNonExportedPackage", fail("InaccessibleObjectException") },
+ { "setAccessiblePublicMemberJdk9NonExportedPackage", fail("InaccessibleObjectException") },
+ { "setAccessiblePublicMemberApplicationModule", successNoWarning() },
+ { "setAccessibleNotPublicMemberApplicationModule", fail("InaccessibleObjectException") },
+
+ { "privateLookupPublicClassExportedPackage", fail("IllegalAccessException") },
+ { "privateLookupNonPublicClassExportedPackage", fail("IllegalAccessException") },
+ { "privateLookupPublicClassNonExportedPackage", fail("IllegalAccessException") },
+ { "privateLookupNonPublicClassNonExportedPackage", fail("IllegalAccessException") },
+ { "privateLookupPublicClassJdk9NonExportedPackage", fail("IllegalAccessException") },
+ };
+ }
+
+ @DataProvider(name = "permitCases")
+ public Object[][] permitCases() {
+ return new Object[][] {
+ { "accessPublicClassNonExportedPackage", successNoWarning() },
+ { "accessPublicClassJdk9NonExportedPackage", fail("IllegalAccessError") },
+
+ { "reflectPublicMemberExportedPackage", successNoWarning() },
+ { "reflectNonPublicMemberExportedPackage", fail("IllegalAccessException") },
+ { "reflectPublicMemberNonExportedPackage", successWithWarning() },
+ { "reflectNonPublicMemberNonExportedPackage", fail("IllegalAccessException") },
+ { "reflectPublicMemberJdk9NonExportedPackage", fail("IllegalAccessException") },
+
+ { "setAccessiblePublicMemberExportedPackage", successNoWarning()},
+ { "setAccessibleNonPublicMemberExportedPackage", successWithWarning() },
+ { "setAccessiblePublicMemberNonExportedPackage", successWithWarning() },
+ { "setAccessibleNonPublicMemberNonExportedPackage", successWithWarning() },
+ { "setAccessiblePublicMemberJdk9NonExportedPackage", fail("InaccessibleObjectException") },
+ { "setAccessiblePublicMemberApplicationModule", successNoWarning() },
+ { "setAccessibleNotPublicMemberApplicationModule", fail("InaccessibleObjectException") },
+
+ { "privateLookupPublicClassExportedPackage", successWithWarning() },
+ { "privateLookupNonPublicClassExportedPackage", successWithWarning() },
+ { "privateLookupPublicClassNonExportedPackage", successWithWarning() },
+ { "privateLookupNonPublicClassNonExportedPackage", successWithWarning() },
+ { "privateLookupPublicClassJdk9NonExportedPackage", fail("IllegalAccessException") },
+ { "privateLookupPublicClassApplicationModule", fail("IllegalAccessException") },
+ };
+ }
+
+ /**
+ * Checks an expected result with the output captured by the given
+ * OutputAnalyzer.
+ */
+ void checkResult(Result expectedResult, OutputAnalyzer outputAnalyzer) {
+ expectedResult.expectedOutput().forEach(outputAnalyzer::shouldContain);
+ expectedResult.notExpectedOutput().forEach(outputAnalyzer::shouldNotContain);
+ int exitValue = outputAnalyzer.getExitValue();
+ if (expectedResult.shouldSucceed()) {
+ assertTrue(exitValue == 0);
+ } else {
+ assertTrue(exitValue != 0);
+ }
+ }
+
+ /**
+ * Runs the test to execute the given test action. The VM is run with the
+ * given VM options and the output checked to see that it matches the
+ * expected result.
+ */
+ OutputAnalyzer run(String action, Result expectedResult, String... vmopts)
+ throws Exception
+ {
+ Stream<String> s1 = Stream.of(vmopts);
+ Stream<String> s2 = Stream.of("-p", MODULE_PATH, "--add-modules=m",
+ "-cp", TEST_CLASSES, "TryAccess", action);
+ String[] opts = Stream.concat(s1, s2).toArray(String[]::new);
+ OutputAnalyzer outputAnalyzer = ProcessTools
+ .executeTestJava(opts)
+ .outputTo(System.out)
+ .errorTo(System.out);
+ if (expectedResult != null)
+ checkResult(expectedResult, outputAnalyzer);
+ return outputAnalyzer;
+ }
+
+ OutputAnalyzer run(String action, String... vmopts) throws Exception {
+ return run(action, null, vmopts);
+ }
+
+ /**
+ * Runs an executable JAR to execute the given test action. The VM is run
+ * with the given VM options and the output checked to see that it matches
+ * the expected result.
+ */
+ void run(Path jarFile, String action, Result expectedResult, String... vmopts)
+ throws Exception
+ {
+ Stream<String> s1 = Stream.of(vmopts);
+ Stream<String> s2 = Stream.of("-jar", jarFile.toString(), action);
+ String[] opts = Stream.concat(s1, s2).toArray(String[]::new);
+ checkResult(expectedResult, ProcessTools.executeTestJava(opts)
+ .outputTo(System.out)
+ .errorTo(System.out));
+ }
+
+ @Test(dataProvider = "denyCases")
+ public void testDeny(String action, Result expectedResult) throws Exception {
+ run(action, expectedResult, "--illegal-access=deny");
+ }
+
+ @Test(dataProvider = "permitCases")
+ public void testDefault(String action, Result expectedResult) throws Exception {
+ run(action, expectedResult);
+ }
+
+ @Test(dataProvider = "permitCases")
+ public void testPermit(String action, Result expectedResult) throws Exception {
+ run(action, expectedResult, "--illegal-access=permit");
+ }
+
+ @Test(dataProvider = "permitCases")
+ public void testWarn(String action, Result expectedResult) throws Exception {
+ run(action, expectedResult, "--illegal-access=warn");
+ }
+
+ @Test(dataProvider = "permitCases")
+ public void testDebug(String action, Result expectedResult) throws Exception {
+ // expect stack trace with WARNING
+ if (expectedResult.expectedOutput().anyMatch("WARNING"::equals)) {
+ expectedResult.expect("TryAccess.main");
+ }
+ run(action, expectedResult, "--illegal-access=debug");
+ }
+
+ /**
+ * Test accessing internals of upgradeable module
+ */
+ public void testWithUpgradedModule() throws Exception {
+ // upgradeable module loaded from run-time image
+ run("setAccessibleNotPublicMemberUpgradeableModule", successWithWarning(),
+ "--add-modules=java.activation");
+
+ // upgradeable module loaded from upgrade module path
+ Path upgradesrc = Paths.get(TEST_SRC, "upgradesrc");
+ Path upgrademods = Files.createDirectory(Paths.get("upgrademods"));
+ Path output = upgrademods.resolve("java.activation");
+ assertTrue(CompilerUtils.compile(upgradesrc, output));
+ run("setAccessibleNotPublicMemberUpgradeableModule",
+ fail("InaccessibleObjectException"),
+ "--upgrade-module-path=" + upgrademods,
+ "--add-modules=java.activation");
+ }
+
+ /**
+ * Specify --add-exports to export a package
+ */
+ public void testWithAddExportsOption() throws Exception {
+ // warning
+ run("reflectPublicMemberNonExportedPackage", successWithWarning());
+
+ // no warning due to --add-exports
+ run("reflectPublicMemberNonExportedPackage", successNoWarning(),
+ "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED");
+
+ // attempt two illegal accesses, one allowed by --add-exports
+ run("reflectPublicMemberNonExportedPackage"
+ + ",setAccessibleNonPublicMemberExportedPackage",
+ successWithWarning(),
+ "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED");
+ }
+
+ /**
+ * Specify --add-open to open a package
+ */
+ public void testWithAddOpensOption() throws Exception {
+ // warning
+ run("setAccessibleNonPublicMemberExportedPackage", successWithWarning());
+
+ // no warning due to --add-opens
+ run("setAccessibleNonPublicMemberExportedPackage", successNoWarning(),
+ "--add-opens", "java.base/java.lang=ALL-UNNAMED");
+
+ // attempt two illegal accesses, one allowed by --add-opens
+ run("reflectPublicMemberNonExportedPackage"
+ + ",setAccessibleNonPublicMemberExportedPackage",
+ successWithWarning(),
+ "--add-opens", "java.base/java.lang=ALL-UNNAMED");
+ }
+
+ /**
+ * Test reflective API to export a package
+ */
+ public void testWithReflectiveExports() throws Exception {
+ // compile patch for java.base
+ Path src = Paths.get(TEST_SRC, "patchsrc", "java.base");
+ Path patch = Files.createDirectories(Paths.get("patches", "java.base"));
+ assertTrue(CompilerUtils.compile(src, patch,
+ "--patch-module", "java.base=" + src));
+
+ // reflectively export, then access
+ run("exportNonExportedPackages,reflectPublicMemberNonExportedPackage",
+ successNoWarning(),
+ "--patch-module", "java.base=" + patch);
+
+ // access, reflectively export, access again
+ List<String> output = run("reflectPublicMemberNonExportedPackage,"
+ + "exportNonExportedPackages,"
+ + "reflectPublicMemberNonExportedPackage",
+ "--patch-module", "java.base="+patch,
+ "--illegal-access=warn").asLines();
+ assertTrue(count(output, "WARNING") == 1); // one warning
+ }
+
+ /**
+ * Test reflective API to open a package
+ */
+ public void testWithReflectiveOpens() throws Exception {
+ // compile patch for java.base
+ Path src = Paths.get(TEST_SRC, "patchsrc", "java.base");
+ Path patch = Files.createDirectories(Paths.get("patches", "java.base"));
+ assertTrue(CompilerUtils.compile(src, patch,
+ "--patch-module", "java.base=" + src));
+
+ // reflectively open exported package, then access
+ run("openExportedPackage,setAccessibleNonPublicMemberExportedPackage",
+ successNoWarning(),
+ "--patch-module", "java.base=" + patch);
+
+ // access, reflectively open exported package, access again
+ List<String> output1 = run("setAccessibleNonPublicMemberExportedPackage"
+ + ",openExportedPackage"
+ + ",setAccessibleNonPublicMemberExportedPackage",
+ "--patch-module", "java.base=" + patch,
+ "--illegal-access=warn").asLines();
+ assertTrue(count(output1, "WARNING") == 1); // one warning
+
+ // reflectively open non-exported packages, then access
+ run("openNonExportedPackages,setAccessibleNonPublicMemberNonExportedPackage",
+ successNoWarning(),
+ "--patch-module", "java.base=" + patch);
+
+ // access, reflectively open non-exported package, access again
+ List<String> output2 = run("setAccessibleNonPublicMemberNonExportedPackage"
+ + ",openNonExportedPackages"
+ + ",setAccessibleNonPublicMemberNonExportedPackage",
+ "--patch-module", "java.base=" + patch,
+ "--illegal-access=warn").asLines();
+ assertTrue(count(output2, "WARNING") == 1); // one warning
+ }
+
+ /**
+ * Specify Add-Exports in JAR file manifest
+ */
+ public void testWithAddExportsInManifest() throws Exception {
+ Manifest man = new Manifest();
+ Attributes attrs = man.getMainAttributes();
+ attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ attrs.put(Attributes.Name.MAIN_CLASS, "TryAccess");
+ attrs.put(new Attributes.Name("Add-Exports"), "java.base/sun.security.x509");
+ Path jarfile = Paths.get("x.jar");
+ Path classes = Paths.get(TEST_CLASSES);
+ JarUtils.createJarFile(jarfile, man, classes, Paths.get("TryAccess.class"));
+
+ run(jarfile, "reflectPublicMemberNonExportedPackage", successNoWarning());
+
+ run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successWithWarning());
+
+ // attempt two illegal accesses, one allowed by Add-Exports
+ run(jarfile, "reflectPublicMemberNonExportedPackage,"
+ + "setAccessibleNonPublicMemberExportedPackage",
+ successWithWarning());
+ }
+
+ /**
+ * Specify Add-Opens in JAR file manifest
+ */
+ public void testWithAddOpensInManifest() throws Exception {
+ Manifest man = new Manifest();
+ Attributes attrs = man.getMainAttributes();
+ attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ attrs.put(Attributes.Name.MAIN_CLASS, "TryAccess");
+ attrs.put(new Attributes.Name("Add-Opens"), "java.base/java.lang");
+ Path jarfile = Paths.get("x.jar");
+ Path classes = Paths.get(TEST_CLASSES);
+ JarUtils.createJarFile(jarfile, man, classes, Paths.get("TryAccess.class"));
+
+ run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successNoWarning());
+
+ run(jarfile, "reflectPublicMemberNonExportedPackage", successWithWarning());
+
+ // attempt two illegal accesses, one allowed by Add-Opens
+ run(jarfile, "reflectPublicMemberNonExportedPackage,"
+ + "setAccessibleNonPublicMemberExportedPackage",
+ successWithWarning());
+ }
+
+ /**
+ * Test that default behavior is to print a warning on the first illegal
+ * access only.
+ */
+ public void testWarnOnFirstIllegalAccess() throws Exception {
+ String action1 = "reflectPublicMemberNonExportedPackage";
+ String action2 = "setAccessibleNonPublicMemberExportedPackage";
+ int warningCount = count(run(action1).asLines(), "WARNING");
+
+ // same illegal access
+ List<String> output1 = run(action1 + "," + action1).asLines();
+ assertTrue(count(output1, "WARNING") == warningCount);
+
+ // different illegal access
+ List<String> output2 = run(action1 + "," + action2).asLines();
+ assertTrue(count(output2, "WARNING") == warningCount);
+ }
+
+ /**
+ * Test that --illegal-access=warn prints a one-line warning per each unique
+ * illegal access.
+ */
+ public void testWarnPerIllegalAccess() throws Exception {
+ String action1 = "reflectPublicMemberNonExportedPackage";
+ String action2 = "setAccessibleNonPublicMemberExportedPackage";
+
+ // same illegal access
+ String repeatedActions = action1 + "," + action1;
+ List<String> output1 = run(repeatedActions, "--illegal-access=warn").asLines();
+ assertTrue(count(output1, "WARNING") == 1);
+
+ // different illegal access
+ String differentActions = action1 + "," + action2;
+ List<String> output2 = run(differentActions, "--illegal-access=warn").asLines();
+ assertTrue(count(output2, "WARNING") == 2);
+ }
+
+ /**
+ * Specify --illegal-access more than once, last one wins
+ */
+ public void testRepeatedOption() throws Exception {
+ run("accessPublicClassNonExportedPackage", successNoWarning(),
+ "--illegal-access=deny", "--illegal-access=permit");
+ run("accessPublicClassNonExportedPackage", fail("IllegalAccessError"),
+ "--illegal-access=permit", "--illegal-access=deny");
+ }
+
+ /**
+ * Specify bad value to --illegal-access
+ */
+ public void testBadValue() throws Exception {
+ run("accessPublicClassNonExportedPackage",
+ fail("Value specified to --illegal-access not recognized"),
+ "--illegal-access=BAD");
+ }
+
+ private int count(Iterable<String> lines, CharSequence cs) {
+ int count = 0;
+ for (String line : lines) {
+ if (line.contains(cs)) count++;
+ }
+ return count;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/TryAccess.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,194 @@
+/*
+ * 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 javax.activation.MimeTypeParameterList;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.nio.channels.SocketChannel;
+
+/**
+ * Launched by IllegalAccessTest to attempt illegal access.
+ */
+
+public class TryAccess {
+
+ public static void main(String[] args) throws Exception {
+ String[] methodNames = args[0].split(",");
+ for (String methodName : methodNames) {
+ Method m = TryAccess.class.getDeclaredMethod(methodName);
+ m.invoke(null);
+ }
+ }
+
+ // -- static access --
+
+ static void accessPublicClassNonExportedPackage() throws Exception {
+ Object obj = new sun.security.x509.X500Name("CN=name");
+ }
+
+ static void accessPublicClassJdk9NonExportedPackage() {
+ Object obj = jdk.internal.misc.Unsafe.getUnsafe();
+ }
+
+ // -- reflective access --
+
+ static void reflectPublicMemberExportedPackage() throws Exception {
+ Constructor<?> ctor = String.class.getConstructor(String.class);
+ Object name = ctor.newInstance("value");
+ }
+
+ static void reflectNonPublicMemberExportedPackage() throws Exception {
+ Field f = String.class.getDeclaredField("value");
+ Object obj = f.get("foo");
+ }
+
+ static void reflectPublicMemberNonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("sun.security.x509.X500Name");
+ Constructor<?> ctor = clazz.getConstructor(String.class);
+ Object obj = ctor.newInstance("CN=user");
+ }
+
+ static void reflectNonPublicMemberNonExportedPackage() throws Exception {
+ SocketChannel sc = SocketChannel.open();
+ Field f = sc.getClass().getDeclaredField("fd");
+ Object obj = f.get(sc);
+ }
+
+ static void reflectPublicMemberJdk9NonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("jdk.internal.misc.Unsafe");
+ Method m = clazz.getMethod("getUnsafe");
+ Object obj = m.invoke(null);
+ }
+
+ static void reflectPublicMemberApplicationModule() throws Exception {
+ Class<?> clazz = Class.forName("p.Type");
+ Constructor<?> ctor = clazz.getConstructor(int.class);
+ Object obj = ctor.newInstance(1);
+ }
+
+ // -- setAccessible --
+
+ static void setAccessiblePublicMemberExportedPackage() throws Exception {
+ Constructor<?> ctor = String.class.getConstructor(String.class);
+ ctor.setAccessible(true);
+ }
+
+ static void setAccessibleNonPublicMemberExportedPackage() throws Exception {
+ Method method = ClassLoader.class.getDeclaredMethod("defineClass",
+ byte[].class, int.class, int.class);
+ method.setAccessible(true);
+ }
+
+ static void setAccessiblePublicMemberNonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("sun.security.x509.X500Name");
+ Constructor<?> ctor = clazz.getConstructor(String.class);
+ ctor.setAccessible(true);
+ }
+
+ static void setAccessibleNonPublicMemberNonExportedPackage() throws Exception {
+ SocketChannel sc = SocketChannel.open();
+ Field f = sc.getClass().getDeclaredField("fd");
+ f.setAccessible(true);
+ }
+
+ static void setAccessiblePublicMemberJdk9NonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("jdk.internal.misc.Unsafe");
+ Method m = clazz.getMethod("getUnsafe");
+ m.setAccessible(true);
+ }
+
+ static void setAccessiblePublicMemberApplicationModule() throws Exception {
+ Class<?> clazz = Class.forName("p.Type");
+ Constructor<?> ctor = clazz.getConstructor(int.class);
+ ctor.setAccessible(true);
+ }
+
+ static void setAccessibleNotPublicMemberUpgradeableModule() throws Exception {
+ Method method = MimeTypeParameterList.class.getDeclaredMethod("parse",
+ String.class);
+ method.setAccessible(true);
+ }
+
+ static void setAccessibleNotPublicMemberApplicationModule() throws Exception {
+ Class<?> clazz = Class.forName("p.Type");
+ Constructor<?> ctor = clazz.getDeclaredConstructor(int.class, int.class);
+ ctor.setAccessible(true);
+ }
+
+
+ // -- privateLookupIn --
+
+ static void privateLookupPublicClassExportedPackage() throws Exception {
+ MethodHandles.privateLookupIn(String.class, MethodHandles.lookup());
+ }
+
+ static void privateLookupNonPublicClassExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("java.lang.WeakPairMap");
+ MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+ }
+
+ static void privateLookupPublicClassNonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("sun.security.x509.X500Name");
+ MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+ }
+
+ static void privateLookupNonPublicClassNonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("sun.nio.ch.SocketChannelImpl");
+ MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+ }
+
+ static void privateLookupPublicClassJdk9NonExportedPackage() throws Exception {
+ Class<?> clazz = Class.forName("jdk.internal.misc.Unsafe");
+ MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+ }
+
+ static void privateLookupPublicClassApplicationModule() throws Exception {
+ Class<?> clazz = Class.forName("p.Type");
+ MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+ }
+
+
+ // -- export/open packages to this unnamed module --
+
+ static void exportNonExportedPackages() throws Exception {
+ Class<?> helper = Class.forName("java.lang.Helper");
+ Method m = helper.getMethod("export", String.class, Module.class);
+ m.invoke(null, "sun.security.x509", TryAccess.class.getModule());
+ m.invoke(null, "sun.nio.ch", TryAccess.class.getModule());
+ }
+
+ static void openExportedPackage() throws Exception {
+ Class<?> helper = Class.forName("java.lang.Helper");
+ Method m = helper.getMethod("open", String.class, Module.class);
+ m.invoke(null, "java.lang", TryAccess.class.getModule());
+ }
+
+ static void openNonExportedPackages() throws Exception {
+ Class<?> helper = Class.forName("java.lang.Helper");
+ Method m = helper.getMethod("open", String.class, Module.class);
+ m.invoke(null, "sun.security.x509", TryAccess.class.getModule());
+ m.invoke(null, "sun.nio.ch", TryAccess.class.getModule());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/modules/m/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module m {
+ exports p;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/modules/m/p/Type.java Thu Aug 24 16:24:44 2017 +0200
@@ -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.
+ */
+
+package p;
+
+public class Type {
+
+ private Type(int x, int y) { }
+
+ public Type(int x) { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/patchsrc/java.base/java/lang/Helper.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package java.lang;
+
+public class Helper {
+ private Helper() { }
+
+ /**
+ * Exports a package to a module.
+ */
+ public static void export(String pn, Module other) {
+ Helper.class.getModule().addExports(pn, other);
+ }
+
+ /**
+ * Opens a package to a module.
+ */
+ public static void open(String pn, Module other) {
+ Helper.class.getModule().addOpens(pn, other);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/upgradesrc/java.activation/javax/activation/MimeTypeParameterList.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package javax.activation;
+
+public class MimeTypeParameterList {
+ protected void parse(String parameterList) { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/modules/illegalaccess/upgradesrc/java.activation/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module java.activation {
+ exports javax.activation;
+}
--- a/jdk/test/tools/launcher/modules/patch/systemmodules/src1/java.base/jdk/internal/modules/SystemModules.java Wed Jun 28 11:27:28 2017 -0700
+++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src1/java.base/jdk/internal/modules/SystemModules.java Thu Aug 24 16:24:44 2017 +0200
@@ -23,6 +23,10 @@
package jdk.internal.module;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
/*
* Test --patch-module java.base=jdk/modules/java.base to override
* java.base with an exploded image
@@ -35,4 +39,12 @@
public static boolean hasSplitPackages() {
return true;
}
+
+ public static Map<String, Set<String>> concealedPackagesToOpen() {
+ return Collections.emptyMap();
+ }
+
+ public static Map<String, Set<String>> exportedPackagesToOpen() {
+ return Collections.emptyMap();
+ }
}
--- a/jdk/test/tools/launcher/modules/permit/AttemptAccess.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * 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.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- * Launched by PermitIllegalAccess to attempt illegal access.
- */
-
-public class AttemptAccess {
-
- public static void main(String[] args) throws Exception {
- String action = args[0];
- int count = Integer.parseInt(args[1]);
-
- for (int i=0; i<count; i++) {
- switch (action) {
- case "access":
- tryAccess();
- break;
- case "setAccessible":
- trySetAccessible();
- break;
- case "trySetAccessible":
- tryTrySetAccessible();
- break;
- }
- }
- }
-
- static void tryAccess() throws Exception {
- Class<?> clazz = Class.forName("sun.security.x509.X500Name");
- Constructor<?> ctor = clazz.getConstructor(String.class);
- Object name = ctor.newInstance("CN=user");
- }
-
- static void trySetAccessible() throws Exception {
- Method find = ClassLoader.class.getDeclaredMethod("findClass", String.class);
- find.setAccessible(true);
- }
-
- static void tryTrySetAccessible() throws Exception {
- Method find = ClassLoader.class.getDeclaredMethod("findClass", String.class);
- find.trySetAccessible();
- }
-
-}
--- a/jdk/test/tools/launcher/modules/permit/PermitIllegalAccess.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * @test
- * @library /lib/testlibrary
- * @build PermitIllegalAccess AttemptAccess jdk.testlibrary.*
- * @run testng PermitIllegalAccess
- * @summary Basic test for java --permit-illegal-access
- */
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
-
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-
-/**
- * Basic test of --permit-illegal-access to ensure that it permits access
- * via core reflection and setAccessible/trySetAccessible.
- */
-
-@Test
-public class PermitIllegalAccess {
-
- static final String TEST_CLASSES = System.getProperty("test.classes");
- static final String TEST_MAIN = "AttemptAccess";
-
- static final String WARNING = "WARNING";
- static final String STARTUP_WARNING =
- "WARNING: --permit-illegal-access will be removed in the next major release";
- static final String ILLEGAL_ACCESS_WARNING =
- "WARNING: Illegal access by " + TEST_MAIN;
-
- /**
- * Launches AttemptAccess to execute an action, returning the OutputAnalyzer
- * to analyze the output/exitCode.
- */
- private OutputAnalyzer tryAction(String action, int count, String... args)
- throws Exception
- {
- Stream<String> s1 = Stream.of(args);
- Stream<String> s2 = Stream.of("-cp", TEST_CLASSES, TEST_MAIN, action, "" + count);
- String[] opts = Stream.concat(s1, s2).toArray(String[]::new);
- return ProcessTools.executeTestJava(opts)
- .outputTo(System.out)
- .errorTo(System.out);
- }
-
- /**
- * Launches AttemptAccess with --permit-illegal-access to execute an action,
- * returning the OutputAnalyzer to analyze the output/exitCode.
- */
- private OutputAnalyzer tryActionPermittingIllegalAccess(String action, int count)
- throws Exception
- {
- return tryAction(action, count, "--permit-illegal-access");
- }
-
- /**
- * Sanity check to ensure that IllegalAccessException is thrown.
- */
- public void testAccessFail() throws Exception {
- int exitValue = tryAction("access", 1)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("IllegalAccessException")
- .stderrShouldNotContain(WARNING)
- .stderrShouldContain("IllegalAccessException")
- .getExitValue();
- assertTrue(exitValue != 0);
- }
-
- /**
- * Sanity check to ensure that InaccessibleObjectException is thrown.
- */
- public void testSetAccessibleFail() throws Exception {
- int exitValue = tryAction("setAccessible", 1)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("InaccessibleObjectException")
- .stderrShouldNotContain(WARNING)
- .stderrShouldContain("InaccessibleObjectException")
- .getExitValue();
- assertTrue(exitValue != 0);
- }
-
- /**
- * Permit illegal access to succeed
- */
- public void testAccessPermitted() throws Exception {
- tryActionPermittingIllegalAccess("access", 1)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("IllegalAccessException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("IllegalAccessException")
- .stderrShouldContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
- }
-
- /**
- * Permit repeated illegal access to succeed
- */
- public void testRepeatedAccessPermitted() throws Exception {
- OutputAnalyzer outputAnalyzer = tryActionPermittingIllegalAccess("access", 10)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("IllegalAccessException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("IllegalAccessException")
- .stderrShouldContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);;
-
- // should only have one illegal access warning
- assertTrue(containsCount(outputAnalyzer.asLines(), ILLEGAL_ACCESS_WARNING) == 1);
- }
-
- /**
- * Permit setAccessible to succeed
- */
- public void testSetAccessiblePermitted() throws Exception {
- tryActionPermittingIllegalAccess("setAccessible", 1)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
- }
-
- /**
- * Permit repeated calls to setAccessible to succeed
- */
- public void testRepeatedSetAccessiblePermitted() throws Exception {
- OutputAnalyzer outputAnalyzer = tryActionPermittingIllegalAccess("setAccessible", 10)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
-
- // should only have one illegal access warning
- assertTrue(containsCount(outputAnalyzer.asLines(), ILLEGAL_ACCESS_WARNING) == 1);
- }
-
- /**
- * Permit trySetAccessible to succeed
- */
- public void testTrySetAccessiblePermitted() throws Exception {
- tryActionPermittingIllegalAccess("trySetAccessible", 1)
- .stdoutShouldNotContain(WARNING)
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
- }
-
- /**
- * Permit repeated calls to trySetAccessible to succeed
- */
- public void testRepeatedTrySetAccessiblePermitted() throws Exception {
- OutputAnalyzer outputAnalyzer = tryActionPermittingIllegalAccess("trySetAccessible", 10)
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
-
- // should only have one illegal access warning
- assertTrue(containsCount(outputAnalyzer.asLines(), ILLEGAL_ACCESS_WARNING) == 1);
-
- }
-
- /**
- * Permit access to succeed with --add-exports. No warning should be printed.
- */
- public void testAccessWithAddExports() throws Exception {
- tryAction("access", 1, "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED")
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("IllegalAccessException")
- .stderrShouldNotContain(WARNING)
- .stderrShouldNotContain("IllegalAccessException")
- .shouldHaveExitValue(0);
- }
-
- /**
- * Permit access to succeed with --add-exports and --permit-illegal-access.
- * The only warning emitted should be the startup warning.
- */
- public void testAccessWithePermittedAddExports() throws Exception {
- tryAction("access", 1, "--permit-illegal-access",
- "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED")
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("IllegalAccessException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("IllegalAccessException")
- .stderrShouldNotContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
- }
-
- /**
- * Permit setAccessible to succeed with --add-opens. No warning should be printed.
- */
- public void testSetAccessibleWithAddOpens() throws Exception {
- tryAction("setAccessible", 1, "--add-opens", "java.base/java.lang=ALL-UNNAMED")
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("InaccessibleObjectException")
- .stderrShouldNotContain(WARNING)
- .stderrShouldNotContain("InaccessibleObjectException")
- .shouldHaveExitValue(0);
- }
-
- /**
- * Permit setAccessible to succeed with both --add-opens and --permit-illegal-access.
- * The only warning emitted should be the startup warning.
- */
- public void testSetAccessiblePermittedWithAddOpens() throws Exception {
- tryAction("setAccessible", 1, "--permit-illegal-access",
- "--add-opens", "java.base/java.lang=ALL-UNNAMED")
- .stdoutShouldNotContain(WARNING)
- .stdoutShouldNotContain("InaccessibleObjectException")
- .stderrShouldContain(STARTUP_WARNING)
- .stderrShouldNotContain("InaccessibleObjectException")
- .stderrShouldNotContain(ILLEGAL_ACCESS_WARNING)
- .shouldHaveExitValue(0);
- }
-
-
- /**
- * Returns the number of lines in the given input that contain the
- * given char sequence.
- */
- private int containsCount(List<String> lines, CharSequence cs) {
- int count = 0;
- for (String line : lines) {
- if (line.contains(cs)) count++;
- }
- return count;
- }
-}
--- a/langtools/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -428,3 +428,5 @@
03669efa77f51852f5301623cad4a2e1bb4fb9f6 jdk-9+172
daa70bfed35ecf0575884c954dc95135e0f94b29 jdk-10+11
123eb0956a459bca29d0812c62fca50da563ee40 jdk-9+173
+50c077995aa249890ece698a2a2db4c4fba90e10 jdk-9+174
+2bd34895dda246cff9e713401f3544260dfbe80f jdk-10+12
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/package-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/package-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -29,6 +29,8 @@
*
* @author Jonathan Gibbons
* @since 1.8
- * @see <a href="http://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html#CHDJGIJB">http://docs.oracle.com/javase/8/docs/technotes/tools/unix/javadoc.html#CHDJGIJB</a>
+ *
+ * @see <a href="{@docRoot}/../specs/doc-comment-spec.html">
+ * Documentation Comment Specification for the Standard Doclet</a>
*/
package com.sun.source.doctree;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java Thu Aug 24 16:24:44 2017 +0200
@@ -336,12 +336,28 @@
};
/**
+ * Create a copy of Env if needed.
+ */
+ Env<AttrContext> copyEnvIfNeeded(JCTree tree, Env<AttrContext> env) {
+ if (!analyzerModes.isEmpty() &&
+ !env.info.isSpeculative &&
+ TreeInfo.isStatement(tree)) {
+ Env<AttrContext> analyzeEnv =
+ env.dup(env.tree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
+ analyzeEnv.info.returnResult = analyzeEnv.info.returnResult != null ?
+ attr.new ResultInfo(analyzeEnv.info.returnResult.pkind,
+ analyzeEnv.info.returnResult.pt) : null;
+ return analyzeEnv;
+ } else {
+ return null;
+ }
+ }
+
+ /**
* Analyze an AST node if needed.
*/
void analyzeIfNeeded(JCTree tree, Env<AttrContext> env) {
- if (!analyzerModes.isEmpty() &&
- !env.info.isSpeculative &&
- TreeInfo.isStatement(tree)) {
+ if (env != null) {
JCStatement stmt = (JCStatement)tree;
analyze(stmt, env);
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Aug 24 16:24:44 2017 +0200
@@ -718,8 +718,7 @@
/** Derived visitor method: attribute a statement or definition tree.
*/
public Type attribStat(JCTree tree, Env<AttrContext> env) {
- Env<AttrContext> analyzeEnv =
- env.dup(tree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
+ Env<AttrContext> analyzeEnv = analyzer.copyEnvIfNeeded(tree, env);
try {
return attribTree(tree, env, statInfo);
} finally {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Aug 24 16:24:44 2017 +0200
@@ -2056,7 +2056,7 @@
Assert.error(skind.name());
throw new AssertionError();
}
- if (ret != sym) {
+ if (ret != sym && skind.propagateAnnotations()) {
ret.setDeclarationAttributes(sym.getRawAttributes());
ret.setTypeAttributes(sym.getRawTypeAttributes());
}
@@ -2092,7 +2092,6 @@
if (m.containsKey(lambdaIdent.sym)) {
Symbol tSym = m.get(lambdaIdent.sym);
JCTree t = make.Ident(tSym).setType(lambdaIdent.type);
- tSym.setTypeAttributes(lambdaIdent.sym.getRawTypeAttributes());
return t;
}
break;
@@ -2101,7 +2100,6 @@
// Transform outer instance variable references anchoring them to the captured synthetic.
Symbol tSym = m.get(lambdaIdent.sym.owner);
JCExpression t = make.Ident(tSym).setType(lambdaIdent.sym.owner.type);
- tSym.setTypeAttributes(lambdaIdent.sym.owner.getRawTypeAttributes());
t = make.Select(t, lambdaIdent.name);
t.setType(lambdaIdent.type);
TreeInfo.setSymbol(t, lambdaIdent.sym);
@@ -2122,7 +2120,6 @@
if (m.containsKey(fieldAccess.sym.owner)) {
Symbol tSym = m.get(fieldAccess.sym.owner);
JCExpression t = make.Ident(tSym).setType(fieldAccess.sym.owner.type);
- tSym.setTypeAttributes(fieldAccess.sym.owner.getRawTypeAttributes());
return t;
}
return null;
@@ -2322,7 +2319,18 @@
CAPTURED_VAR, // variables in enclosing scope to translated synthetic parameters
CAPTURED_THIS, // class symbols to translated synthetic parameters (for captured member access)
CAPTURED_OUTER_THIS, // used when `this' capture is illegal, but outer this capture is legit (JDK-8129740)
- TYPE_VAR // original to translated lambda type variables
+ TYPE_VAR; // original to translated lambda type variables
+
+ boolean propagateAnnotations() {
+ switch (this) {
+ case CAPTURED_VAR:
+ case CAPTURED_THIS:
+ case CAPTURED_OUTER_THIS:
+ return false;
+ default:
+ return true;
+ }
+ }
}
/**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -33,7 +33,11 @@
import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
/**
- * This doclet generates HTML-formatted documentation for the specified modules, packages and types.
+ * This doclet generates HTML-formatted documentation for the specified modules,
+ * packages and types.
+ *
+ * @see <a href="{@docRoot}/../specs/doc-comment-spec.html">
+ * Documentation Comment Specification for the Standard Doclet</a>
*/
public class StandardDoclet implements Doclet {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -375,7 +375,7 @@
Content li = HtmlTree.LI(contents.summaryLabel);
li.addContent(Contents.SPACE);
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
- MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+ MemberSummaryBuilder memberSummaryBuilder =
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
Content liNavField = new HtmlTree(HtmlTag.LI);
addNavSummaryLink(memberSummaryBuilder,
@@ -426,7 +426,7 @@
Content li = HtmlTree.LI(contents.detailLabel);
li.addContent(Contents.SPACE);
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
- MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+ MemberSummaryBuilder memberSummaryBuilder =
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
AbstractMemberWriter writerField =
((AbstractMemberWriter) memberSummaryBuilder.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Thu Aug 24 16:24:44 2017 +0200
@@ -688,7 +688,7 @@
Content li = HtmlTree.LI(contents.summaryLabel);
li.addContent(Contents.SPACE);
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
- MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+ MemberSummaryBuilder memberSummaryBuilder =
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.summarySet) {
Content liNav = new HtmlTree(HtmlTag.LI);
@@ -724,7 +724,7 @@
Content li = HtmlTree.LI(contents.detailLabel);
li.addContent(Contents.SPACE);
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
- MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
+ MemberSummaryBuilder memberSummaryBuilder =
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.detailSet) {
Content liNav = new HtmlTree(HtmlTag.LI);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AnnotationTypeRequiredMemberWriter.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -25,10 +25,9 @@
package jdk.javadoc.internal.doclets.toolkit;
-import java.io.*;
-
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
+
/**
* The interface for writing annotation type required member output.
*
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,28 +25,22 @@
package jdk.javadoc.internal.doclets.toolkit.builders;
-import java.lang.reflect.*;
import java.util.*;
import javax.lang.model.element.PackageElement;
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
-import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.DocletException;
import jdk.javadoc.internal.doclets.toolkit.Messages;
import jdk.javadoc.internal.doclets.toolkit.Resources;
-import jdk.javadoc.internal.doclets.toolkit.util.UncheckedDocletException;
-import jdk.javadoc.internal.doclets.toolkit.util.InternalException;
-import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
-import static javax.tools.Diagnostic.Kind.*;
/**
* The superclass for all builders. A builder is a class that provides
* the structure and content of API documentation. A builder is completely
* doclet independent which means that any doclet can use builders to
- * construct documentation, as long as it impelements the appropriate
+ * construct documentation, as long as it implements the appropriate
* writer interfaces. For example, if a doclet wanted to use
* {@link ConstantsSummaryBuilder} to build a constant summary, all it has to
* do is implement the ConstantsSummaryWriter interface and pass it to the
@@ -74,17 +68,9 @@
*/
final Set<PackageElement> containingPackagesSeen;
- /**
- * Shared parser for the builder XML file
- */
- final LayoutParser layoutParser;
-
- Context(BaseConfiguration configuration,
- Set<PackageElement> containingPackagesSeen,
- LayoutParser layoutParser) {
+ Context(BaseConfiguration configuration, Set<PackageElement> containingPackagesSeen) {
this.configuration = configuration;
this.containingPackagesSeen = containingPackagesSeen;
- this.layoutParser = layoutParser;
}
}
@@ -93,6 +79,7 @@
*/
protected final BaseConfiguration configuration;
+ protected final BuilderFactory builderFactory;
protected final Messages messages;
protected final Resources resources;
protected final Utils utils;
@@ -104,99 +91,23 @@
*/
protected final Set<PackageElement> containingPackagesSeen;
- protected final LayoutParser layoutParser;
-
- /**
- * True if we want to print debug output.
- */
- protected static final boolean DEBUG = false;
-
/**
* Construct a Builder.
* @param c a context providing information used in this run of the doclet
*/
public AbstractBuilder(Context c) {
this.configuration = c.configuration;
+ this.builderFactory = configuration.getBuilderFactory();
this.messages = configuration.getMessages();
this.resources = configuration.getResources();
this.utils = configuration.utils;
this.containingPackagesSeen = c.containingPackagesSeen;
- this.layoutParser = c.layoutParser;
}
/**
- * Return the name of this builder.
- *
- * @return the name of the builder.
- */
- public abstract String getName();
-
- /**
* Build the documentation.
*
* @throws DocletException if there is a problem building the documentation
*/
public abstract void build() throws DocletException;
-
- /**
- * Build the documentation, as specified by the given XML element.
- *
- * @param node the XML element that specifies which component to document.
- * @param contentTree content tree to which the documentation will be added
- * @throws DocletException if there is a problem building the documentation
- */
- protected void build(XMLNode node, Content contentTree) throws DocletException {
- String component = node.name;
- try {
- String methodName = "build" + component;
- if (DEBUG) {
- configuration.reporter.print(ERROR,
- "DEBUG: " + getClass().getName() + "." + methodName);
- }
- Method method = getClass().getMethod(methodName, XMLNode.class, Content.class);
- method.invoke(this, node, contentTree);
-
- } catch (NoSuchMethodException e) {
- // Use SimpleDocletException instead of InternalException because there is nothing
- // informative about about the place the exception occurred, here in this method.
- // The problem is either a misconfigured doclet.xml file or a missing method in the
- // user-supplied(?) doclet
- String message = resources.getText("doclet.builder.unknown.component", component);
- throw new SimpleDocletException(message, e);
-
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- if (cause instanceof DocletException) {
- throw (DocletException) cause;
- } else if (cause instanceof UncheckedDocletException) {
- throw (DocletException) cause.getCause();
- } else {
- // use InternalException, so that a stacktrace showing the position of
- // the internal exception is generated
- String message = resources.getText("doclet.builder.exception.in.component", component,
- e.getCause());
- throw new InternalException(message, e.getCause());
- }
-
- } catch (ReflectiveOperationException e) {
- // Use SimpleDocletException instead of InternalException because there is nothing
- // informative about about the place the exception occurred, here in this method.
- // The problem is specific to the method being invoked, such as illegal access
- // or illegal argument.
- String message = resources.getText("doclet.builder.exception.in.component", component, e);
- throw new SimpleDocletException(message, e.getCause());
- }
- }
-
- /**
- * Build the documentation, as specified by the children of the given XML element.
- *
- * @param node the XML element that specifies which components to document.
- * @param contentTree content tree to which the documentation will be added
- * @throws DocletException if there is a problem while building the children
- */
- protected void buildChildren(XMLNode node, Content contentTree) throws DocletException {
- for (XMLNode child : node.children)
- build(child, contentTree);
- }
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractMemberBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -25,14 +25,6 @@
package jdk.javadoc.internal.doclets.toolkit.builders;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.lang.model.element.Element;
-
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.DocletException;
@@ -50,7 +42,6 @@
*/
public abstract class AbstractMemberBuilder extends AbstractBuilder {
- public final Comparator<Element> comparator;
/**
* Construct a SubBuilder.
* @param context a context object, providing information used in this run
@@ -58,7 +49,6 @@
*/
public AbstractMemberBuilder(Context context) {
super(context);
- comparator = utils.makeGeneralPurposeComparator();
}
/**
@@ -72,20 +62,14 @@
throw new AssertionError();
}
-
/**
- * Builds the sub component if there is anything to document.
+ *
+ * Build the documentation.
*
- * @param node the XML element that specifies which components to document.
- * @param contentTree content tree to which the documentation will be added
- * @throws DocletException if there is a problem while building the documentation
+ * @param contentTree The content tree into which to add the documention
+ * @throws DocletException if there is a problem building the documentation
*/
- @Override
- public void build(XMLNode node, Content contentTree) throws DocletException {
- if (hasMembersToDocument()) {
- super.build(node, contentTree);
- }
- }
+ public abstract void build(Content contentTree) throws DocletException;
/**
* Returns true if this subbuilder has anything to document.
@@ -93,10 +77,4 @@
* @return true if this subbuilder has anything to document
*/
public abstract boolean hasMembersToDocument();
-
- public SortedSet<Element> asSortedSet(Collection<Element> members) {
- SortedSet<Element> out = new TreeSet<>(comparator);
- out.addAll(members);
- return out;
- }
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -47,11 +47,6 @@
public class AnnotationTypeBuilder extends AbstractBuilder {
/**
- * The root element of the annotation type XML is {@value}.
- */
- public static final String ROOT = "AnnotationTypeDoc";
-
- /**
* The annotation type being documented.
*/
private final TypeElement annotationType;
@@ -100,29 +95,24 @@
*/
@Override
public void build() throws DocletException {
- build(layoutParser.parseXML(ROOT), contentTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return ROOT;
+ buildAnnotationTypeDoc(contentTree);
}
/**
* Build the annotation type documentation.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildAnnotationTypeDoc(Content contentTree) throws DocletException {
contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
" " + utils.getSimpleName(annotationType));
Content annotationContentTree = writer.getAnnotationContentHeader();
- buildChildren(node, annotationContentTree);
+
+ buildAnnotationTypeInfo(annotationContentTree);
+ buildMemberSummary(annotationContentTree);
+ buildAnnotationTypeMemberDetails(annotationContentTree);
+
writer.addAnnotationContentTree(contentTree, annotationContentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
@@ -136,7 +126,7 @@
*/
private void copyDocFiles() throws DocletException {
PackageElement containingPackage = utils.containingPackage(annotationType);
- if((configuration.packages == null ||
+ if ((configuration.packages == null ||
!configuration.packages.contains(containingPackage) &&
!containingPackagesSeen.contains(containingPackage))){
//Only copy doc files dir if the containing package is not
@@ -150,34 +140,36 @@
/**
* Build the annotation information tree documentation.
*
- * @param node the XML element that specifies which components to document
* @param annotationContentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree)
+ protected void buildAnnotationTypeInfo(Content annotationContentTree)
throws DocletException {
Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
- buildChildren(node, annotationInfoTree);
+
+ buildDeprecationInfo(annotationInfoTree);
+ buildAnnotationTypeSignature(annotationInfoTree);
+ buildAnnotationTypeDescription(annotationInfoTree);
+ buildAnnotationTypeTagInfo(annotationInfoTree);
+
annotationContentTree.addContent(writer.getAnnotationInfo(annotationInfoTree));
}
/**
* If this annotation is deprecated, build the appropriate information.
*
- * @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo (XMLNode node, Content annotationInfoTree) {
+ protected void buildDeprecationInfo(Content annotationInfoTree) {
writer.addAnnotationTypeDeprecationInfo(annotationInfoTree);
}
/**
* Build the signature of the current annotation type.
*
- * @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/
- public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
+ protected void buildAnnotationTypeSignature(Content annotationInfoTree) {
writer.addAnnotationTypeSignature(utils.modifiersToString(annotationType, true),
annotationInfoTree);
}
@@ -185,48 +177,47 @@
/**
* Build the annotation type description.
*
- * @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/
- public void buildAnnotationTypeDescription(XMLNode node, Content annotationInfoTree) {
+ protected void buildAnnotationTypeDescription(Content annotationInfoTree) {
writer.addAnnotationTypeDescription(annotationInfoTree);
}
/**
* Build the tag information for the current annotation type.
*
- * @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/
- public void buildAnnotationTypeTagInfo(XMLNode node, Content annotationInfoTree) {
+ protected void buildAnnotationTypeTagInfo(Content annotationInfoTree) {
writer.addAnnotationTypeTagInfo(annotationInfoTree);
}
/**
* Build the member summary contents of the page.
*
- * @param node the XML element that specifies which components to document
* @param annotationContentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildMemberSummary(XMLNode node, Content annotationContentTree) throws DocletException {
+ protected void buildMemberSummary(Content annotationContentTree) throws DocletException {
Content memberSummaryTree = writer.getMemberTreeHeader();
- configuration.getBuilderFactory().
- getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
+ builderFactory.getMemberSummaryBuilder(writer).build(memberSummaryTree);
annotationContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
}
/**
* Build the member details contents of the page.
*
- * @param node the XML element that specifies which components to document
* @param annotationContentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree)
+ protected void buildAnnotationTypeMemberDetails(Content annotationContentTree)
throws DocletException {
Content memberDetailsTree = writer.getMemberTreeHeader();
- buildChildren(node, memberDetailsTree);
+
+ buildAnnotationTypeFieldDetails(memberDetailsTree);
+ buildAnnotationTypeRequiredMemberDetails(memberDetailsTree);
+ buildAnnotationTypeOptionalMemberDetails(memberDetailsTree);
+
if (memberDetailsTree.isValid()) {
annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
}
@@ -235,39 +226,33 @@
/**
* Build the annotation type field documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeFieldDetails(Content memberDetailsTree)
throws DocletException {
- configuration.getBuilderFactory().
- getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree);
+ builderFactory.getAnnotationTypeFieldsBuilder(writer).build(memberDetailsTree);
}
/**
* Build the annotation type optional member documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeOptionalMemberDetails(Content memberDetailsTree)
throws DocletException {
- configuration.getBuilderFactory().
- getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree);
+ builderFactory.getAnnotationTypeOptionalMemberBuilder(writer).build(memberDetailsTree);
}
/**
* Build the annotation type required member documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem building the documentation
*/
- public void buildAnnotationTypeRequiredMemberDetails(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeRequiredMemberDetails(Content memberDetailsTree)
throws DocletException {
- configuration.getBuilderFactory().
- getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node, memberDetailsTree);
+ builderFactory.getAnnotationTypeRequiredMemberBuilder(writer).build(memberDetailsTree);
}
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -111,15 +111,6 @@
}
/**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "AnnotationTypeFieldDetails";
- }
-
-
- /**
* Returns whether or not there are members to document.
* @return whether or not there are members to document
*/
@@ -129,25 +120,31 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(Content contentTree) throws DocletException {
+ buildAnnotationTypeField(contentTree);
+ }
+
+ /**
* Build the annotation type field documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeField(Content memberDetailsTree)
throws DocletException {
- buildAnnotationTypeMember(node, memberDetailsTree);
+ buildAnnotationTypeMember(memberDetailsTree);
}
/**
* Build the member documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeMember(Content memberDetailsTree)
throws DocletException {
if (writer == null) {
return;
@@ -162,7 +159,12 @@
writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember,
detailsTree);
- buildChildren(node, annotationDocTree);
+
+ buildSignature(annotationDocTree);
+ buildDeprecationInfo(annotationDocTree);
+ buildMemberComments(annotationDocTree);
+ buildTagInfo(annotationDocTree);
+
detailsTree.addContent(writer.getAnnotationDoc(
annotationDocTree, currentMember == lastElement));
memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
@@ -173,10 +175,9 @@
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content annotationDocTree) {
+ protected void buildSignature(Content annotationDocTree) {
annotationDocTree.addContent(
writer.getSignature(currentMember));
}
@@ -184,10 +185,9 @@
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
+ protected void buildDeprecationInfo(Content annotationDocTree) {
writer.addDeprecated(currentMember, annotationDocTree);
}
@@ -195,11 +195,10 @@
* Build the comments for the member. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildMemberComments(XMLNode node, Content annotationDocTree) {
- if(! configuration.nocomment){
+ protected void buildMemberComments(Content annotationDocTree) {
+ if (!configuration.nocomment) {
writer.addComments(currentMember, annotationDocTree);
}
}
@@ -207,10 +206,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content annotationDocTree) {
+ protected void buildTagInfo(Content annotationDocTree) {
writer.addTags(currentMember, annotationDocTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -81,29 +81,33 @@
* {@inheritDoc}
*/
@Override
- public String getName() {
- return "AnnotationTypeOptionalMemberDetails";
+ public void build(Content contentTree) throws DocletException {
+ buildAnnotationTypeOptionalMember(contentTree);
}
/**
* Build the annotation type optional member documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeOptionalMember(Content memberDetailsTree)
throws DocletException {
- buildAnnotationTypeMember(node, memberDetailsTree);
+ buildAnnotationTypeMember(memberDetailsTree);
+ }
+
+ @Override
+ protected void buildAnnotationTypeMemberChildren(Content annotationDocTree) {
+ super.buildAnnotationTypeMemberChildren(annotationDocTree);
+ buildDefaultValueInfo(annotationDocTree);
}
/**
* Build the default value for this optional member.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
+ protected void buildDefaultValueInfo(Content annotationDocTree) {
((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(currentMember,
annotationDocTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -113,14 +113,6 @@
}
/**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "AnnotationTypeRequiredMemberDetails";
- }
-
- /**
* Returns whether or not there are members to document.
* @return whether or not there are members to document
*/
@@ -130,25 +122,31 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(Content contentTree) throws DocletException {
+ buildAnnotationTypeRequiredMember(contentTree);
+ }
+
+ /**
* Build the annotation type required member documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeRequiredMember(Content memberDetailsTree)
throws DocletException {
- buildAnnotationTypeMember(node, memberDetailsTree);
+ buildAnnotationTypeMember(memberDetailsTree);
}
/**
* Build the member documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if an error occurs
*/
- public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
+ protected void buildAnnotationTypeMember(Content memberDetailsTree)
throws DocletException {
if (writer == null) {
return;
@@ -162,7 +160,9 @@
writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
Content annotationDocTree = writer.getAnnotationDocTreeHeader(
currentMember, detailsTree);
- buildChildren(node, annotationDocTree);
+
+ buildAnnotationTypeMemberChildren(annotationDocTree);
+
detailsTree.addContent(writer.getAnnotationDoc(
annotationDocTree, currentMember == lastMember));
memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
@@ -170,23 +170,28 @@
}
}
+ protected void buildAnnotationTypeMemberChildren(Content annotationDocTree) {
+ buildSignature(annotationDocTree);
+ buildDeprecationInfo(annotationDocTree);
+ buildMemberComments(annotationDocTree);
+ buildTagInfo(annotationDocTree);
+ }
+
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content annotationDocTree) {
+ protected void buildSignature(Content annotationDocTree) {
annotationDocTree.addContent(writer.getSignature(currentMember));
}
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
+ protected void buildDeprecationInfo(Content annotationDocTree) {
writer.addDeprecated(currentMember, annotationDocTree);
}
@@ -194,11 +199,10 @@
* Build the comments for the member. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildMemberComments(XMLNode node, Content annotationDocTree) {
- if(! configuration.nocomment) {
+ protected void buildMemberComments(Content annotationDocTree) {
+ if (!configuration.nocomment) {
writer.addComments(currentMember, annotationDocTree);
}
}
@@ -206,10 +210,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content annotationDocTree) {
+ protected void buildTagInfo(Content annotationDocTree) {
writer.addTags(currentMember, annotationDocTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/BuilderFactory.java Thu Aug 24 16:24:44 2017 +0200
@@ -54,11 +54,6 @@
public class BuilderFactory {
/**
- * The current configuration of the doclet.
- */
- private final BaseConfiguration configuration;
-
- /**
* The factory to retrieve the required writers from.
*/
private final WriterFactory writerFactory;
@@ -71,12 +66,10 @@
* being executed.
*/
public BuilderFactory (BaseConfiguration configuration) {
- this.configuration = configuration;
this.writerFactory = configuration.getWriterFactory();
Set<PackageElement> containingPackagesSeen = new HashSet<>();
- context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
- LayoutParser.getInstance(configuration));
+ context = new AbstractBuilder.Context(configuration, containingPackagesSeen);
}
/**
@@ -150,9 +143,10 @@
/**
* Return an instance of the method builder for the given class.
*
+ * @param classWriter the writer for the enclosing class
* @return an instance of the method builder for the given class.
*/
- public AbstractBuilder getMethodBuilder(ClassWriter classWriter) {
+ public AbstractMemberBuilder getMethodBuilder(ClassWriter classWriter) {
return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
writerFactory.getMethodWriter(classWriter));
}
@@ -161,10 +155,11 @@
* Return an instance of the annotation type fields builder for the given
* class.
*
+ * @param annotationTypeWriter the writer for the enclosing annotation type
* @return an instance of the annotation type field builder for the given
* annotation type.
*/
- public AbstractBuilder getAnnotationTypeFieldsBuilder(
+ public AbstractMemberBuilder getAnnotationTypeFieldsBuilder(
AnnotationTypeWriter annotationTypeWriter) {
return AnnotationTypeFieldBuilder.getInstance(context,
annotationTypeWriter.getAnnotationTypeElement(),
@@ -175,10 +170,11 @@
* Return an instance of the annotation type member builder for the given
* class.
*
+ * @param annotationTypeWriter the writer for the enclosing annotation type
* @return an instance of the annotation type member builder for the given
* annotation type.
*/
- public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
+ public AbstractMemberBuilder getAnnotationTypeOptionalMemberBuilder(
AnnotationTypeWriter annotationTypeWriter) {
return AnnotationTypeOptionalMemberBuilder.getInstance(context,
annotationTypeWriter.getAnnotationTypeElement(),
@@ -189,10 +185,11 @@
* Return an instance of the annotation type member builder for the given
* class.
*
+ * @param annotationTypeWriter the writer for the enclosing annotation type
* @return an instance of the annotation type member builder for the given
* annotation type.
*/
- public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
+ public AbstractMemberBuilder getAnnotationTypeRequiredMemberBuilder(
AnnotationTypeWriter annotationTypeWriter) {
return AnnotationTypeRequiredMemberBuilder.getInstance(context,
annotationTypeWriter.getAnnotationTypeElement(),
@@ -202,9 +199,10 @@
/**
* Return an instance of the enum constants builder for the given class.
*
+ * @param classWriter the writer for the enclosing class
* @return an instance of the enum constants builder for the given class.
*/
- public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter) {
+ public AbstractMemberBuilder getEnumConstantsBuilder(ClassWriter classWriter) {
return EnumConstantBuilder.getInstance(context, classWriter.getTypeElement(),
writerFactory.getEnumConstantWriter(classWriter));
}
@@ -212,9 +210,10 @@
/**
* Return an instance of the field builder for the given class.
*
+ * @param classWriter the writer for the enclosing class
* @return an instance of the field builder for the given class.
*/
- public AbstractBuilder getFieldBuilder(ClassWriter classWriter) {
+ public AbstractMemberBuilder getFieldBuilder(ClassWriter classWriter) {
return FieldBuilder.getInstance(context, classWriter.getTypeElement(),
writerFactory.getFieldWriter(classWriter));
}
@@ -222,9 +221,10 @@
/**
* Return an instance of the property builder for the given class.
*
+ * @param classWriter the writer for the enclosing class
* @return an instance of the field builder for the given class.
*/
- public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) {
+ public AbstractMemberBuilder getPropertyBuilder(ClassWriter classWriter) {
final PropertyWriter propertyWriter =
writerFactory.getPropertyWriter(classWriter);
return PropertyBuilder.getInstance(context,
@@ -235,9 +235,10 @@
/**
* Return an instance of the constructor builder for the given class.
*
+ * @param classWriter the writer for the enclosing class
* @return an instance of the constructor builder for the given class.
*/
- public AbstractBuilder getConstructorBuilder(ClassWriter classWriter) {
+ public AbstractMemberBuilder getConstructorBuilder(ClassWriter classWriter) {
return ConstructorBuilder.getInstance(context, classWriter.getTypeElement(),
writerFactory.getConstructorWriter(classWriter));
}
@@ -245,9 +246,10 @@
/**
* Return an instance of the member summary builder for the given class.
*
+ * @param classWriter the writer for the enclosing class
* @return an instance of the member summary builder for the given class.
*/
- public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter) {
+ public MemberSummaryBuilder getMemberSummaryBuilder(ClassWriter classWriter) {
return MemberSummaryBuilder.getInstance(classWriter, context);
}
@@ -255,10 +257,11 @@
* Return an instance of the member summary builder for the given annotation
* type.
*
+ * @param annotationTypeWriter the writer for the enclosing annotation type
* @return an instance of the member summary builder for the given
* annotation type.
*/
- public AbstractBuilder getMemberSummaryBuilder(AnnotationTypeWriter annotationTypeWriter) {
+ public MemberSummaryBuilder getMemberSummaryBuilder(AnnotationTypeWriter annotationTypeWriter) {
return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -48,11 +48,6 @@
public class ClassBuilder extends AbstractBuilder {
/**
- * The root element of the class XML is {@value}.
- */
- public static final String ROOT = "ClassDoc";
-
- /**
* The class being documented.
*/
private final TypeElement typeElement;
@@ -112,8 +107,7 @@
* @param writer the doclet specific writer.
* @return the new ClassBuilder
*/
- public static ClassBuilder getInstance(Context context,
- TypeElement typeElement, ClassWriter writer) {
+ public static ClassBuilder getInstance(Context context, TypeElement typeElement, ClassWriter writer) {
return new ClassBuilder(context, typeElement, writer);
}
@@ -122,153 +116,151 @@
*/
@Override
public void build() throws DocletException {
- build(layoutParser.parseXML(ROOT), contentTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return ROOT;
+ buildClassDoc(contentTree);
}
/**
* Handles the {@literal <TypeElement>} tag.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
- * @throws DocletException if there is a problem while building the documentation
+ * @throws DocletException if there is a problem while building the documentation
*/
- public void buildClassDoc(XMLNode node, Content contentTree) throws DocletException {
- String key;
- if (isInterface) {
- key = "doclet.Interface";
- } else if (isEnum) {
- key = "doclet.Enum";
- } else {
- key = "doclet.Class";
- }
- contentTree = writer.getHeader(configuration.getText(key) + " " +
- utils.getSimpleName(typeElement));
- Content classContentTree = writer.getClassContentHeader();
- buildChildren(node, classContentTree);
- writer.addClassContentTree(contentTree, classContentTree);
- writer.addFooter(contentTree);
- writer.printDocument(contentTree);
- copyDocFiles();
- }
+ protected void buildClassDoc(Content contentTree) throws DocletException {
+ String key;
+ if (isInterface) {
+ key = "doclet.Interface";
+ } else if (isEnum) {
+ key = "doclet.Enum";
+ } else {
+ key = "doclet.Class";
+ }
+ contentTree = writer.getHeader(configuration.getText(key) + " "
+ + utils.getSimpleName(typeElement));
+ Content classContentTree = writer.getClassContentHeader();
+
+ buildClassTree(classContentTree);
+ buildClassInfo(classContentTree);
+ buildMemberSummary(classContentTree);
+ buildMemberDetails(classContentTree);
+
+ writer.addClassContentTree(contentTree, classContentTree);
+ writer.addFooter(contentTree);
+ writer.printDocument(contentTree);
+ copyDocFiles();
+ }
/**
* Build the class tree documentation.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
*/
- public void buildClassTree(XMLNode node, Content classContentTree) {
+ protected void buildClassTree(Content classContentTree) {
writer.addClassTree(classContentTree);
}
/**
* Build the class information tree documentation.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildClassInfo(XMLNode node, Content classContentTree) throws DocletException {
+ protected void buildClassInfo(Content classContentTree) throws DocletException {
Content classInfoTree = writer.getClassInfoTreeHeader();
- buildChildren(node, classInfoTree);
+
+ buildTypeParamInfo(classInfoTree);
+ buildSuperInterfacesInfo(classInfoTree);
+ buildImplementedInterfacesInfo(classInfoTree);
+ buildSubClassInfo(classInfoTree);
+ buildSubInterfacesInfo(classInfoTree);
+ buildInterfaceUsageInfo(classInfoTree);
+ buildNestedClassInfo(classInfoTree);
+ buildFunctionalInterfaceInfo(classInfoTree);
+ buildDeprecationInfo(classInfoTree);
+ buildClassSignature(classInfoTree);
+ buildClassDescription(classInfoTree);
+ buildClassTagInfo(classInfoTree);
+
classContentTree.addContent(writer.getClassInfo(classInfoTree));
}
/**
* Build the type parameters of this class.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildTypeParamInfo(XMLNode node, Content classInfoTree) {
+ protected void buildTypeParamInfo(Content classInfoTree) {
writer.addTypeParamInfo(classInfoTree);
}
/**
* If this is an interface, list all super interfaces.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildSuperInterfacesInfo(XMLNode node, Content classInfoTree) {
+ protected void buildSuperInterfacesInfo(Content classInfoTree) {
writer.addSuperInterfacesInfo(classInfoTree);
}
/**
* If this is a class, list all interfaces implemented by this class.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildImplementedInterfacesInfo(XMLNode node, Content classInfoTree) {
+ protected void buildImplementedInterfacesInfo(Content classInfoTree) {
writer.addImplementedInterfacesInfo(classInfoTree);
}
/**
* List all the classes extend this one.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildSubClassInfo(XMLNode node, Content classInfoTree) {
+ protected void buildSubClassInfo(Content classInfoTree) {
writer.addSubClassInfo(classInfoTree);
}
/**
* List all the interfaces that extend this one.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildSubInterfacesInfo(XMLNode node, Content classInfoTree) {
+ protected void buildSubInterfacesInfo(Content classInfoTree) {
writer.addSubInterfacesInfo(classInfoTree);
}
/**
* If this is an interface, list all classes that implement this interface.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildInterfaceUsageInfo(XMLNode node, Content classInfoTree) {
+ protected void buildInterfaceUsageInfo(Content classInfoTree) {
writer.addInterfaceUsageInfo(classInfoTree);
}
/**
* If this is an functional interface, display appropriate message.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildFunctionalInterfaceInfo(XMLNode node, Content classInfoTree) {
+ protected void buildFunctionalInterfaceInfo(Content classInfoTree) {
writer.addFunctionalInterfaceInfo(classInfoTree);
}
/**
* If this class is deprecated, build the appropriate information.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo (XMLNode node, Content classInfoTree) {
+ protected void buildDeprecationInfo(Content classInfoTree) {
writer.addClassDeprecationInfo(classInfoTree);
}
/**
* If this is an inner class or interface, list the enclosing class or interface.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildNestedClassInfo (XMLNode node, Content classInfoTree) {
+ protected void buildNestedClassInfo(Content classInfoTree) {
writer.addNestedClassInfo(classInfoTree);
}
@@ -279,7 +271,7 @@
*/
private void copyDocFiles() throws DocFileIOException {
PackageElement containingPackage = utils.containingPackage(typeElement);
- if((configuration.packages == null ||
+ if ((configuration.packages == null ||
!configuration.packages.contains(containingPackage)) &&
!containingPackagesSeen.contains(containingPackage)) {
//Only copy doc files dir if the containing package is not
@@ -293,122 +285,107 @@
/**
* Build the signature of the current class.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildClassSignature(XMLNode node, Content classInfoTree) {
+ protected void buildClassSignature(Content classInfoTree) {
writer.addClassSignature(utils.modifiersToString(typeElement, true), classInfoTree);
}
/**
* Build the class description.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildClassDescription(XMLNode node, Content classInfoTree) {
+ protected void buildClassDescription(Content classInfoTree) {
writer.addClassDescription(classInfoTree);
}
/**
* Build the tag information for the current class.
*
- * @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
- public void buildClassTagInfo(XMLNode node, Content classInfoTree) {
+ protected void buildClassTagInfo(Content classInfoTree) {
writer.addClassTagInfo(classInfoTree);
}
/**
* Build the member summary contents of the page.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildMemberSummary(XMLNode node, Content classContentTree) throws DocletException {
+ protected void buildMemberSummary(Content classContentTree) throws DocletException {
Content memberSummaryTree = writer.getMemberTreeHeader();
- configuration.getBuilderFactory().
- getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
+ builderFactory.getMemberSummaryBuilder(writer).build(memberSummaryTree);
classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
}
/**
* Build the member details contents of the page.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildMemberDetails(XMLNode node, Content classContentTree) throws DocletException {
+ protected void buildMemberDetails(Content classContentTree) throws DocletException {
Content memberDetailsTree = writer.getMemberTreeHeader();
- buildChildren(node, memberDetailsTree);
+
+ buildEnumConstantsDetails(memberDetailsTree);
+ buildPropertyDetails(memberDetailsTree);
+ buildFieldDetails(memberDetailsTree);
+ buildConstructorDetails(memberDetailsTree);
+ buildMethodDetails(memberDetailsTree);
+
classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
}
/**
* Build the enum constants documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildEnumConstantsDetails(XMLNode node,
- Content memberDetailsTree) throws DocletException {
- configuration.getBuilderFactory().
- getEnumConstantsBuilder(writer).buildChildren(node, memberDetailsTree);
+ protected void buildEnumConstantsDetails(Content memberDetailsTree) throws DocletException {
+ builderFactory.getEnumConstantsBuilder(writer).build(memberDetailsTree);
}
/**
* Build the field documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildFieldDetails(XMLNode node,
- Content memberDetailsTree) throws DocletException {
- configuration.getBuilderFactory().
- getFieldBuilder(writer).buildChildren(node, memberDetailsTree);
+ protected void buildFieldDetails(Content memberDetailsTree) throws DocletException {
+ builderFactory.getFieldBuilder(writer).build(memberDetailsTree);
}
/**
* Build the property documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildPropertyDetails(XMLNode node,
- Content memberDetailsTree) throws DocletException {
- configuration.getBuilderFactory().
- getPropertyBuilder(writer).buildChildren(node, memberDetailsTree);
+ public void buildPropertyDetails( Content memberDetailsTree) throws DocletException {
+ builderFactory.getPropertyBuilder(writer).build(memberDetailsTree);
}
/**
* Build the constructor documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildConstructorDetails(XMLNode node,
- Content memberDetailsTree) throws DocletException {
- configuration.getBuilderFactory().
- getConstructorBuilder(writer).buildChildren(node, memberDetailsTree);
+ protected void buildConstructorDetails(Content memberDetailsTree) throws DocletException {
+ builderFactory.getConstructorBuilder(writer).build(memberDetailsTree);
}
/**
* Build the method documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildMethodDetails(XMLNode node,
- Content memberDetailsTree) throws DocletException {
- configuration.getBuilderFactory().
- getMethodBuilder(writer).buildChildren(node, memberDetailsTree);
+ protected void buildMethodDetails(Content memberDetailsTree) throws DocletException {
+ builderFactory.getMethodBuilder(writer).build(memberDetailsTree);
}
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -52,11 +52,6 @@
public class ConstantsSummaryBuilder extends AbstractBuilder {
/**
- * The root element of the constant summary XML is {@value}.
- */
- public static final String ROOT = "ConstantSummary";
-
- /**
* The maximum number of package directories shown in the constant
* value index.
*/
@@ -133,27 +128,21 @@
//Doclet does not support this output.
return;
}
- build(layoutParser.parseXML(ROOT), contentTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return ROOT;
+ buildConstantSummary(contentTree);
}
/**
* Build the constant summary.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildConstantSummary(Content contentTree) throws DocletException {
contentTree = writer.getHeader();
- buildChildren(node, contentTree);
+
+ buildContents(contentTree);
+ buildConstantSummaries(contentTree);
+
writer.addFooter(contentTree);
writer.printDocument(contentTree);
}
@@ -161,10 +150,9 @@
/**
* Build the list of packages.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the content list will be added
*/
- public void buildContents(XMLNode node, Content contentTree) {
+ protected void buildContents(Content contentTree) {
Content contentListTree = writer.getContentsHeader();
printedPackageHeaders.clear();
for (PackageElement pkg : configuration.packages) {
@@ -178,18 +166,20 @@
/**
* Build the summary for each documented package.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the tree to which the summaries will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildConstantSummaries(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildConstantSummaries(Content contentTree) throws DocletException {
printedPackageHeaders.clear();
Content summariesTree = writer.getConstantSummaries();
for (PackageElement aPackage : configuration.packages) {
if (hasConstantField(aPackage)) {
currentPackage = aPackage;
//Build the documentation for the current package.
- buildChildren(node, summariesTree);
+
+ buildPackageHeader(summariesTree);
+ buildClassConstantSummary(summariesTree);
+
first = false;
}
}
@@ -199,10 +189,9 @@
/**
* Build the header for the given package.
*
- * @param node the XML element that specifies which components to document
* @param summariesTree the tree to which the package header will be added
*/
- public void buildPackageHeader(XMLNode node, Content summariesTree) {
+ protected void buildPackageHeader(Content summariesTree) {
PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(currentPackage);
if (!printedPackageHeaders.contains(abbrevPkg)) {
writer.addPackageName(currentPackage, summariesTree, first);
@@ -213,12 +202,11 @@
/**
* Build the summary for the current class.
*
- * @param node the XML element that specifies which components to document
* @param summariesTree the tree to which the class constant summary will be added
* @throws DocletException if there is a problem while building the documentation
*
*/
- public void buildClassConstantSummary(XMLNode node, Content summariesTree)
+ protected void buildClassConstantSummary(Content summariesTree)
throws DocletException {
SortedSet<TypeElement> classes = !currentPackage.isUnnamed()
? utils.getAllClasses(currentPackage)
@@ -231,7 +219,9 @@
}
currentClass = te;
//Build the documentation for the current class.
- buildChildren(node, classConstantTree);
+
+ buildConstantMembers(classConstantTree);
+
}
writer.addClassConstant(summariesTree, classConstantTree);
}
@@ -239,12 +229,11 @@
/**
* Build the summary of constant members in the class.
*
- * @param node the XML element that specifies which components to document
* @param classConstantTree the tree to which the constant members table
* will be added
*/
- public void buildConstantMembers(XMLNode node, Content classConstantTree) {
- new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
+ protected void buildConstantMembers(Content classConstantTree) {
+ new ConstantFieldBuilder(currentClass).buildMembersSummary(classConstantTree);
}
/**
@@ -338,11 +327,10 @@
/**
* Builds the table of constants for a given class.
*
- * @param node the XML element that specifies which components to document
* @param classConstantTree the tree to which the class constants table
* will be added
*/
- protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
+ protected void buildMembersSummary(Content classConstantTree) {
SortedSet<VariableElement> members = members();
if (!members.isEmpty()) {
writer.addConstantMembers(typeElement, members, classConstantTree);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -52,11 +52,6 @@
public class ConstructorBuilder extends AbstractMemberBuilder {
/**
- * The name of this builder.
- */
- public static final String NAME = "ConstructorDetails";
-
- /**
* The current constructor that is being documented at this point in time.
*/
private ExecutableElement currentConstructor;
@@ -85,7 +80,7 @@
* Construct a new ConstructorBuilder.
*
* @param context the build context.
- * @param typeElement the class whoses members are being documented.
+ * @param typeElement the class whose members are being documented.
* @param writer the doclet specific writer.
*/
private ConstructorBuilder(Context context,
@@ -108,7 +103,7 @@
* Construct a new ConstructorBuilder.
*
* @param context the build context.
- * @param typeElement the class whoses members are being documented.
+ * @param typeElement the class whose members are being documented.
* @param writer the doclet specific writer.
* @return the new ConstructorBuilder
*/
@@ -121,14 +116,6 @@
* {@inheritDoc}
*/
@Override
- public String getName() {
- return NAME;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public boolean hasMembersToDocument() {
return !constructors.isEmpty();
}
@@ -143,13 +130,20 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(Content contentTree) throws DocletException {
+ buildConstructorDoc(contentTree);
+ }
+
+ /**
* Build the constructor documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException is there is a problem while building the documentation
*/
- public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+ protected void buildConstructorDoc(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
@@ -161,7 +155,12 @@
for (Element contructor : constructors) {
currentConstructor = (ExecutableElement)contructor;
Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor, constructorDetailsTree);
- buildChildren(node, constructorDocTree);
+
+ buildSignature(constructorDocTree);
+ buildDeprecationInfo(constructorDocTree);
+ buildConstructorComments(constructorDocTree);
+ buildTagInfo(constructorDocTree);
+
constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree,
currentConstructor == lastElement));
}
@@ -173,20 +172,18 @@
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param constructorDocTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content constructorDocTree) {
+ protected void buildSignature(Content constructorDocTree) {
constructorDocTree.addContent(writer.getSignature(currentConstructor));
}
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param constructorDocTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
+ protected void buildDeprecationInfo(Content constructorDocTree) {
writer.addDeprecated(currentConstructor, constructorDocTree);
}
@@ -194,10 +191,9 @@
* Build the comments for the constructor. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param constructorDocTree the content tree to which the documentation will be added
*/
- public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
+ protected void buildConstructorComments(Content constructorDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentConstructor, constructorDocTree);
}
@@ -206,10 +202,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param constructorDocTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content constructorDocTree) {
+ protected void buildTagInfo(Content constructorDocTree) {
writer.addTags(currentConstructor, constructorDocTree);
}
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -108,14 +108,6 @@
}
/**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "EnumConstantDetails";
- }
-
- /**
* Returns whether or not there are members to document.
*
* @return whether or not there are members to document
@@ -126,13 +118,20 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(Content contentTree) throws DocletException {
+ buildEnumConstant(contentTree);
+ }
+
+ /**
* Build the enum constant documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException is there is a problem while building the documentation
*/
- public void buildEnumConstant(XMLNode node, Content memberDetailsTree) throws DocletException {
+ protected void buildEnumConstant(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
@@ -144,7 +143,12 @@
currentElement = (VariableElement)enumConstant;
Content enumConstantsTree = writer.getEnumConstantsTreeHeader(currentElement,
enumConstantsDetailsTree);
- buildChildren(node, enumConstantsTree);
+
+ buildSignature(enumConstantsTree);
+ buildDeprecationInfo(enumConstantsTree);
+ buildEnumConstantComments(enumConstantsTree);
+ buildTagInfo(enumConstantsTree);
+
enumConstantsDetailsTree.addContent(writer.getEnumConstants(
enumConstantsTree, currentElement == lastElement));
}
@@ -156,20 +160,18 @@
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param enumConstantsTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content enumConstantsTree) {
+ protected void buildSignature(Content enumConstantsTree) {
enumConstantsTree.addContent(writer.getSignature(currentElement));
}
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param enumConstantsTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content enumConstantsTree) {
+ protected void buildDeprecationInfo(Content enumConstantsTree) {
writer.addDeprecated(currentElement, enumConstantsTree);
}
@@ -177,10 +179,9 @@
* Build the comments for the enum constant. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param enumConstantsTree the content tree to which the documentation will be added
*/
- public void buildEnumConstantComments(XMLNode node, Content enumConstantsTree) {
+ protected void buildEnumConstantComments(Content enumConstantsTree) {
if (!configuration.nocomment) {
writer.addComments(currentElement, enumConstantsTree);
}
@@ -189,10 +190,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param enumConstantsTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content enumConstantsTree) {
+ protected void buildTagInfo(Content enumConstantsTree) {
writer.addTags(currentElement, enumConstantsTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -110,14 +110,6 @@
}
/**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "FieldDetails";
- }
-
- /**
* Returns whether or not there are members to document.
*
* @return whether or not there are members to document
@@ -128,13 +120,20 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(Content contentTree) throws DocletException {
+ buildFieldDoc(contentTree);
+ }
+
+ /**
* Build the field documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildFieldDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+ protected void buildFieldDoc(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
@@ -145,7 +144,12 @@
for (Element element : fields) {
currentElement = (VariableElement)element;
Content fieldDocTree = writer.getFieldDocTreeHeader(currentElement, fieldDetailsTree);
- buildChildren(node, fieldDocTree);
+
+ buildSignature(fieldDocTree);
+ buildDeprecationInfo(fieldDocTree);
+ buildFieldComments(fieldDocTree);
+ buildTagInfo(fieldDocTree);
+
fieldDetailsTree.addContent(writer.getFieldDoc(
fieldDocTree, currentElement == lastElement));
}
@@ -157,20 +161,18 @@
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param fieldDocTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content fieldDocTree) {
+ protected void buildSignature(Content fieldDocTree) {
fieldDocTree.addContent(writer.getSignature(currentElement));
}
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param fieldDocTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content fieldDocTree) {
+ protected void buildDeprecationInfo(Content fieldDocTree) {
writer.addDeprecated(currentElement, fieldDocTree);
}
@@ -178,10 +180,9 @@
* Build the comments for the field. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param fieldDocTree the content tree to which the documentation will be added
*/
- public void buildFieldComments(XMLNode node, Content fieldDocTree) {
+ protected void buildFieldComments(Content fieldDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentElement, fieldDocTree);
}
@@ -190,10 +191,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param fieldDocTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content fieldDocTree) {
+ protected void buildTagInfo(Content fieldDocTree) {
writer.addTags(currentElement, fieldDocTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/LayoutParser.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.builders;
-
-import java.io.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
-import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
-import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-
-
-/**
- * Parse the XML that specified the order of operation for the builders. This
- * Parser uses SAX parsing.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Jamie Ho
- * @see SAXParser
- */
-public class LayoutParser extends DefaultHandler {
-
- /**
- * The map of XML elements that have been parsed.
- */
- private final Map<String,XMLNode> xmlElementsMap;
- private XMLNode currentNode;
- private final BaseConfiguration configuration;
- private String currentRoot;
- private boolean isParsing;
-
- private LayoutParser(BaseConfiguration configuration) {
- xmlElementsMap = new HashMap<>();
- this.configuration = configuration;
- }
-
- /**
- * Return an instance of the BuilderXML.
- *
- * @param configuration the current configuration of the doclet.
- * @return an instance of the BuilderXML.
- */
- public static LayoutParser getInstance(BaseConfiguration configuration) {
- return new LayoutParser(configuration);
- }
-
- /**
- * Parse the XML specifying the layout of the documentation.
- *
- * @param root the name of the desired node
- * @return the list of XML elements parsed.
- * @throws DocFileIOException if there is a problem reading a user-supplied build file
- * @throws SimpleDocletException if there is a problem reading the system build file
- */
- public XMLNode parseXML(String root) throws DocFileIOException, SimpleDocletException {
- if (!xmlElementsMap.containsKey(root)) {
- try {
- currentRoot = root;
- isParsing = false;
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser saxParser = factory.newSAXParser();
- InputStream in = configuration.getBuilderXML();
- saxParser.parse(in, this);
- } catch (IOException | ParserConfigurationException | SAXException e) {
- String message = (configuration.builderXMLPath == null)
- ? configuration.getResources().getText("doclet.exception.read.resource",
- BaseConfiguration.DEFAULT_BUILDER_XML, e)
- : configuration.getResources().getText("doclet.exception.read.file",
- configuration.builderXMLPath, e);
- throw new SimpleDocletException(message, e);
- }
- }
- return xmlElementsMap.get(root);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void startElement(String namespaceURI, String sName, String qName, Attributes attrs)
- throws SAXException {
- if (isParsing || qName.equals(currentRoot)) {
- isParsing = true;
- currentNode = new XMLNode(currentNode, qName);
- for (int i = 0; i < attrs.getLength(); i++)
- currentNode.attrs.put(attrs.getLocalName(i), attrs.getValue(i));
- if (qName.equals(currentRoot))
- xmlElementsMap.put(qName, currentNode);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void endElement(String namespaceURI, String sName, String qName)
- throws SAXException {
- if (! isParsing) {
- return;
- }
- currentNode = currentNode.parent;
- isParsing = ! qName.equals(currentRoot);
- }
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -32,12 +32,6 @@
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.ArrayType;
-import javax.lang.model.type.DeclaredType;
-import javax.lang.model.type.ExecutableType;
-import javax.lang.model.type.PrimitiveType;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.SimpleTypeVisitor9;
import com.sun.source.doctree.DocTree;
import com.sun.source.doctree.DocTree.Kind;
@@ -53,6 +47,9 @@
/**
* Builds the member summary.
+ * There are two anonymous subtype variants of this builder, created
+ * in the {@link #getInstance} methods. One is for general types;
+ * the other is for annotation types.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
@@ -62,12 +59,12 @@
* @author Jamie Ho
* @author Bhavesh Patel (Modified)
*/
-public class MemberSummaryBuilder extends AbstractMemberBuilder {
+public abstract class MemberSummaryBuilder extends AbstractMemberBuilder {
- /**
- * The XML root for this builder.
+ /*
+ * Comparator used to sort the members in the summary.
*/
- public static final String NAME = "MemberSummary";
+ private final Comparator<Element> comparator;
/**
* The member summary writers for the given class.
@@ -77,7 +74,7 @@
/**
* The type being documented.
*/
- private final TypeElement typeElement;
+ protected final TypeElement typeElement;
/**
* Construct a new MemberSummaryBuilder.
@@ -90,22 +87,45 @@
super(context);
this.typeElement = typeElement;
memberSummaryWriters = new EnumMap<>(VisibleMemberMap.Kind.class);
+
+ comparator = utils.makeGeneralPurposeComparator();
}
/**
- * Construct a new MemberSummaryBuilder.
+ * Construct a new MemberSummaryBuilder for a general type.
*
* @param classWriter the writer for the class whose members are being
* summarized.
* @param context the build context.
+ * @return the instance
*/
public static MemberSummaryBuilder getInstance(
ClassWriter classWriter, Context context) {
- MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
- classWriter.getTypeElement());
+ MemberSummaryBuilder builder = new MemberSummaryBuilder(context, classWriter.getTypeElement()) {
+ @Override
+ public void build(Content contentTree) {
+ buildPropertiesSummary(contentTree);
+ buildNestedClassesSummary(contentTree);
+ buildEnumConstantsSummary(contentTree);
+ buildFieldsSummary(contentTree);
+ buildConstructorsSummary(contentTree);
+ buildMethodsSummary(contentTree);
+ }
+
+ @Override
+ public boolean hasMembersToDocument() {
+ for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
+ VisibleMemberMap members = getVisibleMemberMap(kind);
+ if (!members.noVisibleMembers()) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
WriterFactory wf = context.configuration.getWriterFactory();
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
- MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
+ MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
? null
: wf.getMemberSummaryWriter(classWriter, kind);
builder.memberSummaryWriters.put(kind, msw);
@@ -114,16 +134,29 @@
}
/**
- * Construct a new MemberSummaryBuilder.
+ * Construct a new MemberSummaryBuilder for an annotation type.
*
* @param annotationTypeWriter the writer for the class whose members are
* being summarized.
- * @param configuration the current configuration of the doclet.
+ * @param context the build context.
+ * @return the instance
*/
public static MemberSummaryBuilder getInstance(
AnnotationTypeWriter annotationTypeWriter, Context context) {
MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
- annotationTypeWriter.getAnnotationTypeElement());
+ annotationTypeWriter.getAnnotationTypeElement()) {
+ @Override
+ public void build(Content contentTree) {
+ buildAnnotationTypeFieldsSummary(contentTree);
+ buildAnnotationTypeRequiredMemberSummary(contentTree);
+ buildAnnotationTypeOptionalMemberSummary(contentTree);
+ }
+
+ @Override
+ public boolean hasMembersToDocument() {
+ return !utils.getAnnotationMembers(typeElement).isEmpty();
+ }
+ };
WriterFactory wf = context.configuration.getWriterFactory();
for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
@@ -135,14 +168,6 @@
}
/**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return NAME;
- }
-
- /**
* Return the specified visible member map.
*
* @param kind the kind of visible member map to return.
@@ -182,31 +207,11 @@
}
/**
- * Return true it there are any members to summarize.
- *
- * @return true if there are any members to summarize.
- */
- @Override
- public boolean hasMembersToDocument() {
- if (utils.isAnnotationType(typeElement)) {
- return !utils.getAnnotationMethods(typeElement).isEmpty();
- }
- for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
- VisibleMemberMap members = getVisibleMemberMap(kind);
- if (!members.noVisibleMembers()) {
- return true;
- }
- }
- return false;
- }
-
- /**
* Build the summary for the enum constants.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildEnumConstantsSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildEnumConstantsSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.ENUM_CONSTANTS);
VisibleMemberMap visibleMemberMap =
@@ -217,10 +222,9 @@
/**
* Build the summary for fields.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildAnnotationTypeFieldsSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildAnnotationTypeFieldsSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
VisibleMemberMap visibleMemberMap =
@@ -231,10 +235,9 @@
/**
* Build the summary for the optional members.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildAnnotationTypeOptionalMemberSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildAnnotationTypeOptionalMemberSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL);
VisibleMemberMap visibleMemberMap =
@@ -245,10 +248,9 @@
/**
* Build the summary for the optional members.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildAnnotationTypeRequiredMemberSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED);
VisibleMemberMap visibleMemberMap =
@@ -259,10 +261,9 @@
/**
* Build the summary for the fields.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildFieldsSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.FIELDS);
VisibleMemberMap visibleMemberMap =
@@ -272,8 +273,10 @@
/**
* Build the summary for the fields.
+ *
+ * @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildPropertiesSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildPropertiesSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.PROPERTIES);
VisibleMemberMap visibleMemberMap =
@@ -284,10 +287,9 @@
/**
* Build the summary for the nested classes.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildNestedClassesSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildNestedClassesSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.INNER_CLASSES);
VisibleMemberMap visibleMemberMap =
@@ -298,10 +300,9 @@
/**
* Build the method summary.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildMethodsSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS);
VisibleMemberMap visibleMemberMap =
@@ -312,10 +313,9 @@
/**
* Build the constructor summary.
*
- * @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/
- public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) {
+ protected void buildConstructorsSummary(Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS);
VisibleMemberMap visibleMemberMap =
@@ -521,4 +521,10 @@
writer.addMemberTree(memberSummaryTree, memberTree);
}
}
+
+ private SortedSet<Element> asSortedSet(Collection<Element> members) {
+ SortedSet<Element> out = new TreeSet<>(comparator);
+ out.addAll(members);
+ return out;
+ }
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -116,26 +116,25 @@
* {@inheritDoc}
*/
@Override
- public String getName() {
- return "MethodDetails";
+ public boolean hasMembersToDocument() {
+ return !methods.isEmpty();
}
/**
* {@inheritDoc}
*/
@Override
- public boolean hasMembersToDocument() {
- return !methods.isEmpty();
+ public void build(Content contentTree) throws DocletException {
+ buildMethodDoc(contentTree);
}
/**
* Build the method documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildMethodDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+ protected void buildMethodDoc(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
@@ -147,7 +146,12 @@
for (Element method : methods) {
currentMethod = (ExecutableElement)method;
Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree);
- buildChildren(node, methodDocTree);
+
+ buildSignature(methodDocTree);
+ buildDeprecationInfo(methodDocTree);
+ buildMethodComments(methodDocTree);
+ buildTagInfo(methodDocTree);
+
methodDetailsTree.addContent(writer.getMethodDoc(
methodDocTree, currentMethod == lastElement));
}
@@ -158,20 +162,18 @@
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param methodDocTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content methodDocTree) {
+ protected void buildSignature(Content methodDocTree) {
methodDocTree.addContent(writer.getSignature(currentMethod));
}
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param methodDocTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content methodDocTree) {
+ protected void buildDeprecationInfo(Content methodDocTree) {
writer.addDeprecated(currentMethod, methodDocTree);
}
@@ -179,10 +181,9 @@
* Build the comments for the method. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param methodDocTree the content tree to which the documentation will be added
*/
- public void buildMethodComments(XMLNode node, Content methodDocTree) {
+ protected void buildMethodComments(Content methodDocTree) {
if (!configuration.nocomment) {
ExecutableElement method = currentMethod;
if (utils.getFullBody(currentMethod).isEmpty()) {
@@ -199,10 +200,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param methodDocTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content methodDocTree) {
+ protected void buildTagInfo(Content methodDocTree) {
writer.addTags(currentMethod, methodDocTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,8 +26,6 @@
package jdk.javadoc.internal.doclets.toolkit.builders;
import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.PackageElement;
-import javax.tools.StandardLocation;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.DocletException;
@@ -46,10 +44,6 @@
* @author Bhavesh Patel
*/
public class ModuleSummaryBuilder extends AbstractBuilder {
- /**
- * The root element of the module summary XML is {@value}.
- */
- public static final String ROOT = "ModuleDoc";
/**
* The module being documented.
@@ -67,11 +61,6 @@
private Content contentTree;
/**
- * The module package being documented.
- */
- private PackageElement pkg;
-
- /**
* Construct a new ModuleSummaryBuilder.
*
* @param context the build context.
@@ -112,27 +101,20 @@
//Doclet does not support this output.
return;
}
- build(layoutParser.parseXML(ROOT), contentTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return ROOT;
+ buildModuleDoc(contentTree);
}
/**
* Build the module documentation.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildModuleDoc(Content contentTree) throws DocletException {
contentTree = moduleWriter.getModuleHeader(mdle.getSimpleName().toString());
- buildChildren(node, contentTree);
+
+ buildContent(contentTree);
+
moduleWriter.addModuleFooter(contentTree);
moduleWriter.printDocument(contentTree);
utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
@@ -141,70 +123,72 @@
/**
* Build the content for the module doc.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the module contents
* will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildContent(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildContent(Content contentTree) throws DocletException {
Content moduleContentTree = moduleWriter.getContentHeader();
- buildChildren(node, moduleContentTree);
+
+ buildModuleDescription(moduleContentTree);
+ buildModuleTags(moduleContentTree);
+ buildSummary(moduleContentTree);
+
moduleWriter.addModuleContent(contentTree, moduleContentTree);
}
/**
* Build the module summary.
*
- * @param node the XML element that specifies which components to document
* @param moduleContentTree the module content tree to which the summaries will
* be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildSummary(XMLNode node, Content moduleContentTree) throws DocletException {
+ protected void buildSummary(Content moduleContentTree) throws DocletException {
Content summaryContentTree = moduleWriter.getSummaryHeader();
- buildChildren(node, summaryContentTree);
+
+ buildPackagesSummary(summaryContentTree);
+ buildModulesSummary(summaryContentTree);
+ buildServicesSummary(summaryContentTree);
+
moduleContentTree.addContent(moduleWriter.getSummaryTree(summaryContentTree));
}
/**
* Build the modules summary.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the content tree to which the summaries will
* be added
*/
- public void buildModulesSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildModulesSummary(Content summaryContentTree) {
moduleWriter.addModulesSummary(summaryContentTree);
}
/**
* Build the package summary.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the content tree to which the summaries will be added
*/
- public void buildPackagesSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildPackagesSummary(Content summaryContentTree) {
moduleWriter.addPackagesSummary(summaryContentTree);
- }
+ }
/**
* Build the services summary.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the content tree to which the summaries will be added
*/
- public void buildServicesSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildServicesSummary(Content summaryContentTree) {
moduleWriter.addServicesSummary(summaryContentTree);
}
/**
* Build the description for the module.
*
- * @param node the XML element that specifies which components to document
* @param moduleContentTree the tree to which the module description will
* be added
*/
- public void buildModuleDescription(XMLNode node, Content moduleContentTree) {
+ protected void buildModuleDescription(Content moduleContentTree) {
if (!configuration.nocomment) {
moduleWriter.addModuleDescription(moduleContentTree);
}
@@ -213,10 +197,9 @@
/**
* Build the tags of the summary.
*
- * @param node the XML element that specifies which components to document
* @param moduleContentTree the tree to which the module tags will be added
*/
- public void buildModuleTags(XMLNode node, Content moduleContentTree) {
+ protected void buildModuleTags(Content moduleContentTree) {
if (!configuration.nocomment) {
moduleWriter.addModuleTags(moduleContentTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -50,10 +50,6 @@
* @author Bhavesh Patel (Modified)
*/
public class PackageSummaryBuilder extends AbstractBuilder {
- /**
- * The root element of the package summary XML is {@value}.
- */
- public static final String ROOT = "PackageDoc";
/**
* The package being documented.
@@ -112,27 +108,20 @@
//Doclet does not support this output.
return;
}
- build(layoutParser.parseXML(ROOT), contentTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return ROOT;
+ buildPackageDoc(contentTree);
}
/**
* Build the package documentation.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildPackageDoc(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildPackageDoc(Content contentTree) throws DocletException {
contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageElement));
- buildChildren(node, contentTree);
+
+ buildContent(contentTree);
+
packageWriter.addPackageFooter(contentTree);
packageWriter.printDocument(contentTree);
utils.copyDocFiles(packageElement);
@@ -141,39 +130,47 @@
/**
* Build the content for the package.
*
- * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the package contents
* will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildContent(XMLNode node, Content contentTree) throws DocletException {
+ protected void buildContent(Content contentTree) throws DocletException {
Content packageContentTree = packageWriter.getContentHeader();
- buildChildren(node, packageContentTree);
+
+ buildPackageDescription(packageContentTree);
+ buildPackageTags(packageContentTree);
+ buildSummary(packageContentTree);
+
packageWriter.addPackageContent(contentTree, packageContentTree);
}
/**
* Build the package summary.
*
- * @param node the XML element that specifies which components to document
* @param packageContentTree the package content tree to which the summaries will
* be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildSummary(XMLNode node, Content packageContentTree) throws DocletException {
+ protected void buildSummary(Content packageContentTree) throws DocletException {
Content summaryContentTree = packageWriter.getSummaryHeader();
- buildChildren(node, summaryContentTree);
+
+ buildInterfaceSummary(summaryContentTree);
+ buildClassSummary(summaryContentTree);
+ buildEnumSummary(summaryContentTree);
+ buildExceptionSummary(summaryContentTree);
+ buildErrorSummary(summaryContentTree);
+ buildAnnotationTypeSummary(summaryContentTree);
+
packageContentTree.addContent(summaryContentTree);
}
/**
* Build the summary for the interfaces in this package.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the summary tree to which the interface summary
* will be added
*/
- public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildInterfaceSummary(Content summaryContentTree) {
String interfaceTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Interface_Summary"),
@@ -195,11 +192,10 @@
/**
* Build the summary for the classes in this package.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the summary tree to which the class summary will
* be added
*/
- public void buildClassSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildClassSummary(Content summaryContentTree) {
String classTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Class_Summary"),
@@ -220,11 +216,10 @@
/**
* Build the summary for the enums in this package.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the summary tree to which the enum summary will
* be added
*/
- public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildEnumSummary(Content summaryContentTree) {
String enumTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Enum_Summary"),
@@ -245,11 +240,10 @@
/**
* Build the summary for the exceptions in this package.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the summary tree to which the exception summary will
* be added
*/
- public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildExceptionSummary(Content summaryContentTree) {
String exceptionTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Exception_Summary"),
@@ -272,11 +266,10 @@
/**
* Build the summary for the errors in this package.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the summary tree to which the error summary will
* be added
*/
- public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildErrorSummary(Content summaryContentTree) {
String errorTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Error_Summary"),
@@ -298,11 +291,10 @@
/**
* Build the summary for the annotation type in this package.
*
- * @param node the XML element that specifies which components to document
* @param summaryContentTree the summary tree to which the annotation type
* summary will be added
*/
- public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
+ protected void buildAnnotationTypeSummary(Content summaryContentTree) {
String annotationtypeTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Annotation_Types_Summary"),
@@ -327,11 +319,10 @@
/**
* Build the description of the summary.
*
- * @param node the XML element that specifies which components to document
* @param packageContentTree the tree to which the package description will
* be added
*/
- public void buildPackageDescription(XMLNode node, Content packageContentTree) {
+ protected void buildPackageDescription(Content packageContentTree) {
if (configuration.nocomment) {
return;
}
@@ -341,10 +332,9 @@
/**
* Build the tags of the summary.
*
- * @param node the XML element that specifies which components to document
* @param packageContentTree the tree to which the package tags will be added
*/
- public void buildPackageTags(XMLNode node, Content packageContentTree) {
+ protected void buildPackageTags(Content packageContentTree) {
if (configuration.nocomment) {
return;
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -110,14 +110,6 @@
}
/**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "PropertyDetails";
- }
-
- /**
* Returns whether or not there are members to document.
*
* @return whether or not there are members to document
@@ -128,13 +120,20 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void build(Content contentTree) throws DocletException {
+ buildPropertyDoc(contentTree);
+ }
+
+ /**
* Build the property documentation.
*
- * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) throws DocletException {
+ protected void buildPropertyDoc(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
@@ -146,7 +145,11 @@
currentProperty = (ExecutableElement)property;
Content propertyDocTree = writer.getPropertyDocTreeHeader(currentProperty,
propertyDetailsTree);
- buildChildren(node, propertyDocTree);
+
+ buildSignature(propertyDocTree);
+ buildPropertyComments(propertyDocTree);
+ buildTagInfo(propertyDocTree);
+
propertyDetailsTree.addContent(writer.getPropertyDoc(
propertyDocTree, currentProperty == lastElement));
}
@@ -158,20 +161,18 @@
/**
* Build the signature.
*
- * @param node the XML element that specifies which components to document
* @param propertyDocTree the content tree to which the documentation will be added
*/
- public void buildSignature(XMLNode node, Content propertyDocTree) {
+ protected void buildSignature(Content propertyDocTree) {
propertyDocTree.addContent(writer.getSignature(currentProperty));
}
/**
* Build the deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param propertyDocTree the content tree to which the documentation will be added
*/
- public void buildDeprecationInfo(XMLNode node, Content propertyDocTree) {
+ protected void buildDeprecationInfo(Content propertyDocTree) {
writer.addDeprecated(currentProperty, propertyDocTree);
}
@@ -179,10 +180,9 @@
* Build the comments for the property. Do nothing if
* {@link BaseConfiguration#nocomment} is set to true.
*
- * @param node the XML element that specifies which components to document
* @param propertyDocTree the content tree to which the documentation will be added
*/
- public void buildPropertyComments(XMLNode node, Content propertyDocTree) {
+ protected void buildPropertyComments(Content propertyDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentProperty, propertyDocTree);
}
@@ -191,10 +191,9 @@
/**
* Build the tag information.
*
- * @param node the XML element that specifies which components to document
* @param propertyDocTree the content tree to which the documentation will be added
*/
- public void buildTagInfo(XMLNode node, Content propertyDocTree) {
+ protected void buildTagInfo(Content propertyDocTree) {
writer.addTags(currentProperty, propertyDocTree);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java Thu Aug 24 16:24:44 2017 +0200
@@ -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
@@ -25,7 +25,10 @@
package jdk.javadoc.internal.doclets.toolkit.builders;
-import java.util.*;
+
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
@@ -55,11 +58,6 @@
public class SerializedFormBuilder extends AbstractBuilder {
/**
- * The root element of the serialized form XML is {@value}.
- */
- public static final String NAME = "SerializedForm";
-
- /**
* The writer for this builder.
*/
private SerializedFormWriter writer;
@@ -139,28 +137,21 @@
//Doclet does not support this output.
return;
}
- build(layoutParser.parseXML(NAME), contentTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return NAME;
+ buildSerializedForm(contentTree);
}
/**
* Build the serialized form.
*
- * @param node the XML element that specifies which components to document
* @param serializedTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildSerializedForm(XMLNode node, Content serializedTree) throws DocletException {
+ protected void buildSerializedForm(Content serializedTree) throws DocletException {
serializedTree = writer.getHeader(configuration.getText(
"doclet.Serialized_Form"));
- buildChildren(node, serializedTree);
+
+ buildSerializedFormSummaries(serializedTree);
+
writer.addFooter(serializedTree);
writer.printDocument(serializedTree);
}
@@ -168,16 +159,16 @@
/**
* Build the serialized form summaries.
*
- * @param node the XML element that specifies which components to document
* @param serializedTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildSerializedFormSummaries(XMLNode node, Content serializedTree)
+ protected void buildSerializedFormSummaries(Content serializedTree)
throws DocletException {
Content serializedSummariesTree = writer.getSerializedSummariesHeader();
for (PackageElement pkg : configuration.packages) {
currentPackage = pkg;
- buildChildren(node, serializedSummariesTree);
+
+ buildPackageSerializedForm(serializedSummariesTree);
}
serializedTree.addContent(writer.getSerializedContent(
serializedSummariesTree));
@@ -186,11 +177,10 @@
/**
* Build the package serialized form for the current package being processed.
*
- * @param node the XML element that specifies which components to document
* @param serializedSummariesTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) throws DocletException {
+ protected void buildPackageSerializedForm(Content serializedSummariesTree) throws DocletException {
Content packageSerializedTree = writer.getPackageSerializedHeader();
SortedSet<TypeElement> classes = utils.getAllClassesUnfiltered(currentPackage);
if (classes.isEmpty()) {
@@ -202,17 +192,19 @@
if (!serialClassFoundToDocument(classes)) {
return;
}
- buildChildren(node, packageSerializedTree);
+
+ buildPackageHeader(packageSerializedTree);
+ buildClassSerializedForm(packageSerializedTree);
+
writer.addPackageSerializedTree(serializedSummariesTree, packageSerializedTree);
}
/**
* Build the package header.
*
- * @param node the XML element that specifies which components to document
* @param packageSerializedTree content tree to which the documentation will be added
*/
- public void buildPackageHeader(XMLNode node, Content packageSerializedTree) {
+ protected void buildPackageHeader(Content packageSerializedTree) {
packageSerializedTree.addContent(writer.getPackageHeader(
utils.getPackageName(currentPackage)));
}
@@ -220,11 +212,10 @@
/**
* Build the class serialized form.
*
- * @param node the XML element that specifies which components to document
* @param packageSerializedTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree)
+ protected void buildClassSerializedForm(Content packageSerializedTree)
throws DocletException {
Content classSerializedTree = writer.getClassSerializedHeader();
SortedSet<TypeElement> typeElements = utils.getAllClassesUnfiltered(currentPackage);
@@ -237,7 +228,10 @@
continue;
}
Content classTree = writer.getClassHeader(currentTypeElement);
- buildChildren(node, classTree);
+
+ buildSerialUIDInfo(classTree);
+ buildClassContent(classTree);
+
classSerializedTree.addContent(classTree);
}
}
@@ -247,10 +241,9 @@
/**
* Build the serial UID information for the given class.
*
- * @param node the XML element that specifies which components to document
* @param classTree content tree to which the serial UID information will be added
*/
- public void buildSerialUIDInfo(XMLNode node, Content classTree) {
+ protected void buildSerialUIDInfo(Content classTree) {
Content serialUidTree = writer.getSerialUIDInfoHeader();
for (Element e : utils.getFieldsUnfiltered(currentTypeElement)) {
VariableElement field = (VariableElement)e;
@@ -267,25 +260,26 @@
/**
* Build the summaries for the methods and fields.
*
- * @param node the XML element that specifies which components to document
* @param classTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildClassContent(XMLNode node, Content classTree) throws DocletException {
+ protected void buildClassContent(Content classTree) throws DocletException {
Content classContentTree = writer.getClassContentHeader();
- buildChildren(node, classContentTree);
+
+ buildSerializableMethods(classContentTree);
+ buildFieldHeader(classContentTree);
+ buildSerializableFields(classContentTree);
+
classTree.addContent(classContentTree);
}
/**
- * Build the summaries for the methods that belong to the given
- * class.
+ * Build the summaries for the methods that belong to the given class.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildSerializableMethods(XMLNode node, Content classContentTree) throws DocletException {
+ protected void buildSerializableMethods(Content classContentTree) throws DocletException {
Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
SortedSet<ExecutableElement> members = utils.serializationMethods(currentTypeElement);
if (!members.isEmpty()) {
@@ -293,7 +287,11 @@
currentMember = member;
Content methodsContentTree = methodWriter.getMethodsContentHeader(
currentMember == members.last());
- buildChildren(node, methodsContentTree);
+
+ buildMethodSubHeader(methodsContentTree);
+ buildDeprecatedMethodInfo(methodsContentTree);
+ buildMethodInfo(methodsContentTree);
+
serializableMethodTree.addContent(methodsContentTree);
}
}
@@ -316,54 +314,51 @@
/**
* Build the method sub header.
*
- * @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
- public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
+ protected void buildMethodSubHeader(Content methodsContentTree) {
methodWriter.addMemberHeader((ExecutableElement)currentMember, methodsContentTree);
}
/**
* Build the deprecated method description.
*
- * @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
- public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
+ protected void buildDeprecatedMethodInfo(Content methodsContentTree) {
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
}
/**
* Build the information for the method.
*
- * @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildMethodInfo(XMLNode node, Content methodsContentTree) throws DocletException {
- if(configuration.nocomment){
+ protected void buildMethodInfo(Content methodsContentTree) throws DocletException {
+ if (configuration.nocomment) {
return;
}
- buildChildren(node, methodsContentTree);
+
+ buildMethodDescription(methodsContentTree);
+ buildMethodTags(methodsContentTree);
}
/**
* Build method description.
*
- * @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
- public void buildMethodDescription(XMLNode node, Content methodsContentTree) {
+ protected void buildMethodDescription(Content methodsContentTree) {
methodWriter.addMemberDescription((ExecutableElement)currentMember, methodsContentTree);
}
/**
* Build the method tags.
*
- * @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
- public void buildMethodTags(XMLNode node, Content methodsContentTree) {
+ protected void buildMethodTags(Content methodsContentTree) {
methodWriter.addMemberTags((ExecutableElement)currentMember, methodsContentTree);
ExecutableElement method = (ExecutableElement)currentMember;
if (method.getSimpleName().toString().compareTo("writeExternal") == 0
@@ -380,10 +375,9 @@
/**
* Build the field header.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree content tree to which the documentation will be added
*/
- public void buildFieldHeader(XMLNode node, Content classContentTree) {
+ protected void buildFieldHeader(Content classContentTree) {
if (!utils.serializableFields(currentTypeElement).isEmpty()) {
buildFieldSerializationOverview(currentTypeElement, classContentTree);
}
@@ -419,11 +413,10 @@
/**
* Build the summaries for the fields that belong to the given class.
*
- * @param node the XML element that specifies which components to document
* @param classContentTree content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
- public void buildSerializableFields(XMLNode node, Content classContentTree)
+ protected void buildSerializableFields(Content classContentTree)
throws DocletException {
SortedSet<VariableElement> members = utils.serializableFields(currentTypeElement);
if (!members.isEmpty()) {
@@ -433,7 +426,11 @@
if (!utils.definesSerializableFields(currentTypeElement)) {
Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
currentMember == members.last());
- buildChildren(node, fieldsContentTree);
+
+ buildFieldSubHeader(fieldsContentTree);
+ buildFieldDeprecationInfo(fieldsContentTree);
+ buildFieldInfo(fieldsContentTree);
+
serializableFieldsTree.addContent(fieldsContentTree);
} else {
buildSerialFieldTagsInfo(serializableFieldsTree);
@@ -448,10 +445,9 @@
/**
* Build the field sub header.
*
- * @param node the XML element that specifies which components to document
* @param fieldsContentTree content tree to which the documentation will be added
*/
- public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) {
+ protected void buildFieldSubHeader(Content fieldsContentTree) {
if (!utils.definesSerializableFields(currentTypeElement)) {
VariableElement field = (VariableElement) currentMember;
fieldWriter.addMemberHeader(utils.asTypeElement(field.asType()),
@@ -464,10 +460,9 @@
/**
* Build the field deprecation information.
*
- * @param node the XML element that specifies which components to document
* @param fieldsContentTree content tree to which the documentation will be added
*/
- public void buildFieldDeprecationInfo(XMLNode node, Content fieldsContentTree) {
+ protected void buildFieldDeprecationInfo(Content fieldsContentTree) {
if (!utils.definesSerializableFields(currentTypeElement)) {
fieldWriter.addMemberDeprecatedInfo((VariableElement)currentMember,
fieldsContentTree);
@@ -479,8 +474,8 @@
*
* @param serializableFieldsTree content tree to which the documentation will be added
*/
- public void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
- if(configuration.nocomment){
+ protected void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
+ if (configuration.nocomment) {
return;
}
VariableElement field = (VariableElement)currentMember;
@@ -524,17 +519,16 @@
/**
* Build the field information.
*
- * @param node the XML element that specifies which components to document
* @param fieldsContentTree content tree to which the documentation will be added
*/
- public void buildFieldInfo(XMLNode node, Content fieldsContentTree) {
- if(configuration.nocomment){
+ protected void buildFieldInfo(Content fieldsContentTree) {
+ if (configuration.nocomment) {
return;
}
VariableElement field = (VariableElement)currentMember;
TypeElement te = utils.getEnclosingTypeElement(currentMember);
// Process default Serializable field.
- if ((utils.getSerialTrees(field).isEmpty()) /*&& ! field.isSynthetic()*/
+ if ((utils.getSerialTrees(field).isEmpty()) /*&& !field.isSynthetic()*/
&& configuration.serialwarn) {
messages.warning(field,
"doclet.MissingSerialTag", utils.getFullyQualifiedName(te),
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/XMLNode.java Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.toolkit.builders;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Simple class to represent the attribute and elements of an XML node.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class XMLNode {
- XMLNode(XMLNode parent, String qname) {
- this.parent = parent;
- name = qname;
- attrs = new HashMap<>();
- children = new ArrayList<>();
-
- if (parent != null)
- parent.children.add(this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("<");
- sb.append(name);
- for (Map.Entry<String,String> e: attrs.entrySet())
- sb.append(" " + e.getKey() + "=\"" + e.getValue() + "\"");
- if (children.size() == 0)
- sb.append("/>");
- else {
- sb.append(">");
- for (XMLNode c: children)
- sb.append(c.toString());
- sb.append("</" + name + ">");
- }
- return sb.toString();
- }
-
- final XMLNode parent;
- final String name;
- final Map<String,String> attrs;
- final List<XMLNode> children;
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml Wed Jun 28 11:27:28 2017 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-
-<!--
- 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
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-
-<Doclet>
-
- <ModuleDoc>
- <Content>
- <ModuleDescription/>
- <ModuleTags/>
- <Summary>
- <PackagesSummary/>
- <ModulesSummary/>
- <ServicesSummary/>
- </Summary>
- </Content>
- </ModuleDoc>
-
- <PackageDoc>
- <Content>
- <PackageDescription/>
- <PackageTags/>
- <Summary>
- <InterfaceSummary/>
- <ClassSummary/>
- <EnumSummary/>
- <ExceptionSummary/>
- <ErrorSummary/>
- <AnnotationTypeSummary/>
- </Summary>
- </Content>
- </PackageDoc>
-
- <AnnotationTypeDoc>
- <AnnotationTypeInfo>
- <DeprecationInfo/>
- <AnnotationTypeSignature/>
- <AnnotationTypeDescription/>
- <AnnotationTypeTagInfo/>
- </AnnotationTypeInfo>
- <MemberSummary>
- <AnnotationTypeFieldsSummary/>
- <AnnotationTypeRequiredMemberSummary/>
- <AnnotationTypeOptionalMemberSummary/>
- </MemberSummary>
- <AnnotationTypeMemberDetails>
- <AnnotationTypeFieldDetails>
- <AnnotationTypeField>
- <Signature/>
- <DeprecationInfo/>
- <MemberComments/>
- <TagInfo/>
- </AnnotationTypeField>
- </AnnotationTypeFieldDetails>
- <AnnotationTypeRequiredMemberDetails>
- <AnnotationTypeRequiredMember>
- <Signature/>
- <DeprecationInfo/>
- <MemberComments/>
- <TagInfo/>
- </AnnotationTypeRequiredMember>
- </AnnotationTypeRequiredMemberDetails>
- <AnnotationTypeOptionalMemberDetails>
- <AnnotationTypeOptionalMember>
- <Signature/>
- <DeprecationInfo/>
- <MemberComments/>
- <TagInfo/>
- <DefaultValueInfo/>
- </AnnotationTypeOptionalMember>
- </AnnotationTypeOptionalMemberDetails>
- </AnnotationTypeMemberDetails>
- </AnnotationTypeDoc>
-
- <ClassDoc>
- <ClassTree/>
- <ClassInfo>
- <TypeParamInfo/>
- <SuperInterfacesInfo/>
- <ImplementedInterfacesInfo/>
- <SubClassInfo/>
- <SubInterfacesInfo/>
- <InterfaceUsageInfo/>
- <NestedClassInfo/>
- <FunctionalInterfaceInfo/>
- <DeprecationInfo/>
- <ClassSignature/>
- <ClassDescription/>
- <ClassTagInfo/>
- </ClassInfo>
- <MemberSummary>
- <PropertiesSummary/>
- <NestedClassesSummary/>
- <EnumConstantsSummary/>
- <FieldsSummary/>
- <ConstructorsSummary/>
- <MethodsSummary/>
- </MemberSummary>
- <MemberDetails>
- <EnumConstantsDetails>
- <EnumConstant>
- <Signature/>
- <DeprecationInfo/>
- <EnumConstantComments/>
- <TagInfo/>
- </EnumConstant>
- </EnumConstantsDetails>
- <PropertyDetails>
- <PropertyDoc>
- <Signature/>
- <PropertyComments/>
- <TagInfo/>
- </PropertyDoc>
- </PropertyDetails>
- <FieldDetails>
- <FieldDoc>
- <Signature/>
- <DeprecationInfo/>
- <FieldComments/>
- <TagInfo/>
- </FieldDoc>
- </FieldDetails>
- <ConstructorDetails>
- <ConstructorDoc>
- <Signature/>
- <DeprecationInfo/>
- <ConstructorComments/>
- <TagInfo/>
- </ConstructorDoc>
- </ConstructorDetails>
- <MethodDetails>
- <MethodDoc>
- <Signature/>
- <DeprecationInfo/>
- <MethodComments/>
- <TagInfo/>
- </MethodDoc>
- </MethodDetails>
- </MemberDetails>
- </ClassDoc>
-
- <ConstantSummary>
- <Contents/>
- <ConstantSummaries>
- <PackageHeader/>
- <ClassConstantSummary>
- <ConstantMembers/>
- </ClassConstantSummary>
- </ConstantSummaries>
- </ConstantSummary>
-
- <SerializedForm>
- <SerializedFormSummaries>
- <PackageSerializedForm>
- <PackageHeader/>
- <ClassSerializedForm>
- <SerialUIDInfo/>
- <ClassContent>
- <SerializableMethods>
- <MethodSubHeader/>
- <DeprecatedMethodInfo/>
- <MethodInfo>
- <MethodDescription/>
- <MethodTags/>
- </MethodInfo>
- </SerializableMethods>
- <FieldHeader/>
- <SerializableFields>
- <FieldSubHeader/>
- <FieldDeprecationInfo/>
- <FieldInfo/>
- </SerializableFields>
- </ClassContent>
- </ClassSerializedForm>
- </PackageSerializedForm>
- </SerializedFormSummaries>
- </SerializedForm>
-</Doclet>
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Thu Aug 24 16:24:44 2017 +0200
@@ -14,9 +14,6 @@
doclet.Option_doclint_no_qualifiers=Access qualifiers not permitted for -Xdoclint arguments
doclet.Option_doclint_invalid_arg=Invalid argument for -Xdoclint option
doclet.Option_doclint_package_invalid_arg=Invalid argument for -Xdoclint/package option
-doclet.builder.exception.in.component=An exception occurred while building a component: {0}\n\
-\t({1})
-doclet.builder.unknown.component=Unknown component referenced in doclet build file: {0}
doclet.error.initializing.dest.dir=Error initializing destination directory: {0}
doclet.exception.read.file=Error reading file: {0}\n\
\t({1})
--- a/langtools/src/jdk.javadoc/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +27,9 @@
* {@link javax.tools.ToolProvider#getSystemDocumentationTool system documentation tool}
* and its command line equivalent, <em>javadoc</em>.
*
+ * @see <a href="{@docRoot}/../specs/doc-comment-spec.html">
+ * Documentation Comment Specification for the Standard Doclet</a>
+ *
* @moduleGraph
* @since 9
*/
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Thu Aug 24 16:24:44 2017 +0200
@@ -1706,9 +1706,13 @@
// Documentation pseudo-commands
registerCommand(new Command("/<id>",
"help.id",
+ arg -> cmdHelp("rerun"),
+ EMPTY_COMPLETION_PROVIDER,
CommandKind.HELP_ONLY));
registerCommand(new Command("/-<n>",
"help.previous",
+ arg -> cmdHelp("rerun"),
+ EMPTY_COMPLETION_PROVIDER,
CommandKind.HELP_ONLY));
registerCommand(new Command("intro",
"help.intro",
--- a/langtools/test/jdk/jshell/ToolSimpleTest.java Wed Jun 28 11:27:28 2017 -0700
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -388,6 +388,14 @@
);
}
+ @Test
+ public void testConfusedUserPseudoCommands() {
+ test(
+ (a) -> assertHelp(a, "/-<n>", "last snippet", "digits"),
+ (a) -> assertHelp(a, "/<id>", "last snippet", "digits")
+ );
+ }
+
private void assertHelp(boolean a, String command, String... find) {
assertCommandCheckOutput(a, command, s -> {
for (String f : find) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TypeAnnotationPropagationTest.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8144185
+ * @summary javac produces incorrect RuntimeInvisibleTypeAnnotations length attribute
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ */
+
+import static java.lang.annotation.ElementType.TYPE_USE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
+import com.sun.tools.classfile.TypeAnnotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.util.Arrays;
+import java.util.Objects;
+
+public class TypeAnnotationPropagationTest extends ClassfileTestHelper {
+ public static void main(String[] args) throws Exception {
+ new TypeAnnotationPropagationTest().run();
+ }
+
+ public void run() throws Exception {
+ ClassFile cf = getClassFile("TypeAnnotationPropagationTest$Test.class");
+
+ Method f = null;
+ for (Method m : cf.methods) {
+ if (m.getName(cf.constant_pool).contains("f")) {
+ f = m;
+ break;
+ }
+ }
+
+ int idx = f.attributes.getIndex(cf.constant_pool, Attribute.Code);
+ Code_attribute cattr = (Code_attribute) f.attributes.get(idx);
+ idx = cattr.attributes.getIndex(cf.constant_pool, Attribute.RuntimeVisibleTypeAnnotations);
+ RuntimeVisibleTypeAnnotations_attribute attr =
+ (RuntimeVisibleTypeAnnotations_attribute) cattr.attributes.get(idx);
+
+ TypeAnnotation anno = attr.annotations[0];
+ assertEquals(anno.position.lvarOffset, new int[] {3}, "start_pc");
+ assertEquals(anno.position.lvarLength, new int[] {8}, "length");
+ assertEquals(anno.position.lvarIndex, new int[] {1}, "index");
+ }
+
+ void assertEquals(int[] actual, int[] expected, String message) {
+ if (!Arrays.equals(actual, expected)) {
+ throw new AssertionError(
+ String.format(
+ "actual: %s, expected: %s, %s",
+ Arrays.toString(actual), Arrays.toString(expected), message));
+ }
+ }
+
+ /** ********************* Test class ************************ */
+ static class Test {
+ void f() {
+ @A String s = "";
+ Runnable r =
+ () -> {
+ Objects.requireNonNull(s);
+ Objects.requireNonNull(s);
+ Objects.requireNonNull(s);
+ Objects.requireNonNull(s);
+ Objects.requireNonNull(s);
+ Objects.requireNonNull(s);
+ };
+ }
+
+ @Retention(RUNTIME)
+ @Target(TYPE_USE)
+ @interface A {}
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv28.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8181911
+ * @summary Verify that the analyzer does not affect ordinary compilation.
+ * @compile/ref=LambdaConv28.out -XDrawDiagnostics -XDfind=lambda LambdaConv28.java
+ */
+
+class LambdaConv28 {
+
+ public void test(A a) {
+ test(()-> {
+ return new I() {
+ public <T> void t() {
+ }
+ };
+ });
+ test(new A() {
+ public I get() {
+ return null;
+ }
+ });
+ }
+
+ public interface I {
+ public <T> void t();
+ }
+
+ public interface A {
+ public I get();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaConv28.out Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,2 @@
+LambdaConv28.java:17:22: compiler.warn.potential.lambda.found
+1 warning
--- a/make/CreateJmods.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/make/CreateJmods.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -105,10 +105,10 @@
DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \
$(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules)))
- EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES))))
+ EXCLUDE_PATTERN := $(strip $(subst $(SPACE),$$|,$(strip $(ALL_UPGRADEABLE_MODULES))))
JMOD_FLAGS += --module-path $(JMODS_DIR) \
- --hash-modules '^(?!$(EXCLUDE_PATTERN))'
+ --hash-modules '^(?!$(EXCLUDE_PATTERN)$$)'
endif
endif
endif
--- a/make/Docs.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/make/Docs.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -63,7 +63,7 @@
# URLs
JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage
BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/
-COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
+COPYRIGHT_URL := {@docroot}/../legal/copyright.html
LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
@@ -116,9 +116,9 @@
# General text snippets
FULL_COMPANY_NAME := Oracle and/or its affiliates
-COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA
+COMPANY_ADDRESS := 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-JAVA_PLATFORM := Java™ Platform
+JAVA_PLATFORM := Java Platform
ifeq ($(IS_DRAFT), true)
DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
@@ -127,51 +127,44 @@
else
DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
endif
- DRAFT_TEXT := Please note that the specifications and other information \
- contained herein are not final and are subject to change. The \
- information is being made available to you solely for purpose of \
- evaluation.
+ DRAFT_TEXT := This specification is not final and is subject to change. \
+ Use is subject to <a href="$(LICENSE_URL)">license terms</a>.
endif
JAVADOC_BOTTOM := \
- <span style="font-size:smaller"> \
- <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a><br> \
- For further API reference and developer documentation, see \
+ <a href="$(BUG_SUBMIT_URL)">Report a bug or suggest an enhancement</a><br> \
+ For further API reference and developer documentation see the \
<a href="$(JAVADOC_BASE_URL)" target="_blank">Java SE \
- Documentation</a>. That documentation contains more detailed, \
- developer-targeted descriptions, with conceptual overviews, definitions \
+ Documentation</a>, which contains more detailed, \
+ developer-targeted descriptions with conceptual overviews, definitions \
of terms, workarounds, and working code examples.<br> \
Java is a trademark or registered trademark of $(FULL_COMPANY_NAME) in \
the US and other countries.<br> \
<a href="$(COPYRIGHT_URL)">Copyright</a> \
- © 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME). \
- $(COMPANY_ADDRESS). All rights reserved. \
- Use is subject to <a href="$(LICENSE_URL)">license terms</a>. Also see the \
+ © 1993, $(COPYRIGHT_YEAR), $(FULL_COMPANY_NAME), \
+ $(COMPANY_ADDRESS).<br>All rights reserved. \
+ Use is subject to <a href="$(LICENSE_URL)">license terms</a> and the \
<a href="$(REDISTRIBUTION_URL)">documentation redistribution policy</a>. \
- $(DRAFT_MARKER_STR)</span>
+ $(DRAFT_MARKER_STR) <!-- Version $(VERSION_STRING) -->
+
JAVADOC_TOP := \
- <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
- margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \
- 6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \
- sans-serif; font-weight: normal;">$(DRAFT_TEXT)</div></div>
+ <div style="padding: 6px; text-align: center; font-size: 80%; \
+ font-family: DejaVu Sans, Arial, Helvetica, sans-serif; \
+ font-weight: normal;">$(DRAFT_TEXT)</div>
################################################################################
# JDK javadoc titles/text snippets
-JDK_SHORT_NAME := JDK™ $(VERSION_SPECIFICATION)
-JDK_LONG_NAME := Standard Edition Development Kit (JDK™) $(VERSION_SPECIFICATION)
+JDK_SHORT_NAME := Java SE $(VERSION_SPECIFICATION) & JDK $(VERSION_SPECIFICATION)
+JDK_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition \
+ <span style="white-space: nowrap;">& Java Development Kit</span>
################################################################################
# Java SE javadoc titles/text snippets
-JAVASE_SHORT_NAME := SE $(VERSION_SPECIFICATION)
-JAVASE_LONG_NAME := Standard Edition $(VERSION_SPECIFICATION)
-
-################################################################################
-# Index page text titles/snippets
-
-JDK_INDEX_TITLE := $(JAVA_PLATFORM), $(JDK_LONG_NAME) Specification $(DRAFT_MARKER_TITLE)
+JAVASE_SHORT_NAME := Java SE $(VERSION_SPECIFICATION)
+JAVASE_LONG_NAME := Java<sup>®</sup> Platform, Standard Edition
################################################################################
# Functions
@@ -204,24 +197,19 @@
$1_OVERVIEW_TEXT := \
<!DOCTYPE html> \
<html><head></head><body> \
- <p>This document is the API specification for $$($1_FULL_NAME).</p> \
#
ifneq ($$($1_GROUPS),)
$1_OVERVIEW_TEXT += \
- <p>For an overview of the full specification, grouped by usage, see the <a href="../index.html">$$(JAVA_PLATFORM), $$($1_LONG_NAME) Specification</a>.</p> \
- <dl> \
- #
+ <p>This document is divided into \
+ $$(subst 2,two,$$(subst 3,three,$$(words $$($1_GROUPS)))) sections:</p> \
+ <blockquote><dl> \
+ #
$1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
- <dt><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
- <dd>$$($$g_GROUP_DESCRIPTION)</dt> \
+ <dt style="margin-top: 8px;"><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
+ <dd style="margin-top: 8px;">$$($$g_GROUP_DESCRIPTION)</dt> \
)
$1_OVERVIEW_TEXT += \
- </dl> \
- #
- endif
- ifeq ($$(IS_DRAFT), true)
- $1_OVERVIEW_TEXT += \
- <p><strong>$$(DRAFT_TEXT)</strong></p> \
+ </dl><blockquote> \
#
endif
$1_OVERVIEW_TEXT += \
@@ -279,13 +267,16 @@
$1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
$$(JAVADOC_DISABLED_DOCLINT)))
- $1_FULL_NAME := $$(JAVA_PLATFORM), $$($1_LONG_NAME) \
- $$(DRAFT_MARKER_TITLE)
- $1_DOC_TITLE := $$($1_FULL_NAME)<br>API Specification
- $1_WINDOW_TITLE := $$(subst ™,,$$(JAVA_PLATFORM) $$($1_SHORT_NAME)) \
+ $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API Specification
+ $1_WINDOW_TITLE := $$(subst &,&,$$($1_SHORT_NAME)) \
$$(DRAFT_MARKER_TITLE)
- $1_HEADER_TITLE := <strong>$$(JAVA_PLATFORM)<br>$$($1_SHORT_NAME)</strong> \
- $$(DRAFT_MARKER_STR)
+ ifeq ($(VERSION_IS_GA), true) # Workaround stylesheet bug
+ $1_HEADER_PAD := 14
+ else
+ $1_HEADER_PAD := 9
+ endif
+ $1_HEADER_TITLE := <div style="margin-top: $$($1_HEADER_PAD)px;"><strong>$$($1_SHORT_NAME)</strong> \
+ $$(DRAFT_MARKER_STR)</div>
$1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
$1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
@@ -379,18 +370,18 @@
JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se.ee \
$(call FindTransitiveIndirectDepsForModules, java.se.ee)))
JavaSE_GROUP_DESCRIPTION := \
- The Java Platform, Standard Edition ("Java SE") APIs define the core Java \
- platform for general-purpose computing. These APIs are in modules with \
- names starting with the string "java.". \
+ The Java Platform, Standard Edition (Java SE) APIs define the core Java \
+ platform for general-purpose computing. These APIs are in modules whose \
+ names start with {@code java}. \
#
JDK_GROUPS += JavaSE
JDK_GROUP_NAME := JDK
JDK_GROUP_MODULES := jdk.*
JDK_GROUP_DESCRIPTION := \
- The Java Development Kit ("JDK") APIs define an implementation of the Java \
- SE Platform which may include platform-specific details. These APIs are in \
- modules with names starting with the string "jdk.". \
+ The Java Development Kit (JDK) APIs are specific to the JDK and will not \
+ necessarily be available in all implementations of the Java SE Platform. \
+ These APIs are in modules whose names start with {@code jdk}. \
#
JDK_GROUPS += JDK
@@ -401,9 +392,9 @@
JavaFX_GROUP_NAME := JavaFX
JavaFX_GROUP_MODULES := javafx.*
JavaFX_GROUP_DESCRIPTION := \
- The JavaFX APIs define a set of user interface (UI) controls, graphics, \
+ The JavaFX APIs define a set of user-interface controls, graphics, \
media, and web packages for developing rich client applications. These \
- APIs are in modules with names starting with the string "javafx.". \
+ APIs are in modules whose names start with {@code javafx}. \
#
JDK_GROUPS += JavaFX
endif
@@ -425,7 +416,7 @@
################################################################################
# Setup generation of the Java SE API documentation (javadoc + modulegraph)
-# The Java SE module scope is just java.se.ee and it's transitive indirect
+# The Java SE module scope is just java.se.ee and its transitive indirect
# exports.
JAVASE_MODULES := java.se.ee
@@ -442,17 +433,19 @@
################################################################################
JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
-JDK_INDEX_TOOLS_DIR := $(TOOLS_CLASSES_DIR)/build/tools/docs
-$(JDK_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) \
- $(JDK_INDEX_TOOLS_DIR)/docs-bundle-page.html \
- $(JDK_INDEX_TOOLS_DIR)/docs-module-groups.properties
- $(call LogInfo, Generating docs bundle index page)
- $(MKDIR) -p $(@D)
- $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_INDEX_TITLE)' \
- --output $@
+JDK_INDEX_CONTENT := \
+ <!DOCTYPE html> \
+ <html lang="en"> \
+ <head> \
+ <meta http-equiv="refresh" content="0;url=api/index.html"> \
+ </head> \
+ </html>
-JDK_INDEX_TARGETS := $(JDK_INDEX_HTML)
+$(JDK_INDEX_HTML):
+ $(ECHO) '$(JDK_INDEX_CONTENT)' > $@
+
+JDK_INDEX_TARGETS += $(JDK_INDEX_HTML)
# Copy the global resources
GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/
@@ -463,6 +456,15 @@
))
JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
+# Copy the legal notices distributed with the docs bundle
+DOCS_LEGAL_NOTICES := jquery.md jszip.md pako.md
+$(eval $(call SetupCopyFiles, COPY_DOCS_LEGAL_NOTICES, \
+ SRC := $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/legal, \
+ FILES := $(DOCS_LEGAL_NOTICES), \
+ DEST := $(DOCS_OUTPUTDIR)/legal, \
+))
+JDK_INDEX_TARGETS += $(COPY_DOCS_LEGAL_NOTICES)
+
################################################################################
# Copy JDK specs files
--- a/make/Main.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/make/Main.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -843,7 +843,7 @@
build-test-hotspot-jtreg-native: buildtools-jdk \
hotspot-$(JVM_VARIANT_MAIN)-libs
- build-test-jdk-jtreg-native: buildtools-jdk
+ build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
--- a/make/common/Modules.gmk Wed Jun 28 11:27:28 2017 -0700
+++ b/make/common/Modules.gmk Thu Aug 24 16:24:44 2017 +0200
@@ -72,8 +72,11 @@
jdk.naming.rmi \
#
+# Modules that directly or indirectly requiring upgradeable modules
+# should carefully be considered if it should be upgradeable or not.
UPGRADEABLE_MODULES += \
java.activation \
+ java.compiler \
java.corba \
java.transaction \
java.xml.bind \
@@ -82,10 +85,9 @@
jdk.internal.vm.compiler \
#
-# Modules explicitly declared as not being upgradeable even though they require
-# an upgradeable module.
-NON_UPGRADEABLE_MODULES += \
- jdk.aot \
+UPGRADEABLE_TOOL_MODULES += \
+ jdk.xml.bind \
+ jdk.xml.ws \
#
AGGREGATOR_MODULES += \
@@ -99,7 +101,6 @@
#
PLATFORM_MODULES += \
- java.compiler \
java.scripting \
java.security.jgss \
java.smartcardio \
@@ -381,15 +382,8 @@
# Upgradeable modules are those that are either defined as upgradeable or that
# require an upradeable module.
FindAllUpgradeableModules = \
- $(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \
- $(sort $(UPGRADEABLE_MODULES) $(foreach m, \
- $(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \
- $(if $(filter $(UPGRADEABLE_MODULES), \
- $(call FindTransitiveDepsForModule, $m)), \
- $m \
- ) \
- )) \
- )
+ $(sort $(filter-out $(MODULES_FILTER), $(UPGRADEABLE_MODULES) $(UPGRADEABLE_TOOL_MODULES)))
+
################################################################################
--- a/make/jprt.properties Wed Jun 28 11:27:28 2017 -0700
+++ b/make/jprt.properties Thu Aug 24 16:24:44 2017 +0200
@@ -174,7 +174,13 @@
# Select test targets - jprt default for jprt.test.set is "default"
jprt.test.targets=${my.test.targets.${jprt.test.set}}
jprt.make.rule.test.targets=${my.make.rule.test.targets.${jprt.test.set}}
-jprt.test.bundle.targets=${my.jprt.test.bundle.targets.${jprt.test.set}}
+
+# Not all test targets need the test image
+jprt.test.bundle.targets=\
+ ${my.make.rule.test.targets.hotspot.reg}, \
+ ${my.make.rule.test.targets.hotspot.gtest} \
+ ${my.make.rule.test.targets.nativesanity} \
+ ${my.test.target.set:TESTNAME=jdk_lang}
# 7155453: Work-around to prevent popups on OSX from blocking test completion
# but the work-around is added to all platforms to be consistent
@@ -473,20 +479,11 @@
${my.make.rule.test.targets.hotspot.reg} \
${my.make.rule.test.targets.hotspot.other}
-# Install the test bundle for the testset hotspot jtreg tests
-# (but not for the other Makefile based tests)
-my.jprt.test.bundle.targets.hotspot= \
- ${my.make.rule.test.targets.hotspot.reg}, \
- ${my.make.rule.test.targets.hotspot.gtest}
-
# Native jdk and hotspot test targets (testset=nativesanity)
my.make.rule.test.targets.nativesanity= \
${my.test.target.set:TESTNAME=jdk_native_sanity}, \
${my.test.target.set:TESTNAME=hotspot_native_sanity}
-# Install the test bundle for the nativesanity jtreg tests
-my.jprt.test.bundle.targets.nativesanity=${my.make.rule.test.targets.nativesanity}
-
################################################################################
# Testset buildinfra
my.build.flavors.buildinfra = \
--- a/nashorn/.hgtags Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/.hgtags Thu Aug 24 16:24:44 2017 +0200
@@ -419,3 +419,7 @@
c8d6b740f0f7ec834b4157bf0d4523e8bbddb3f0 jdk-9+172
ae0c4f1560e41e94a843e9933558d0223575869d jdk-10+11
fa8e4de50e821eed876388c84f7129a6739268be jdk-9+173
+7d4006eaa088848c4fa2ac4aef0ba9982f80752a jdk-9+174
+de571c0a93258599054f18184cbdeae42cd95265 jdk-10+12
+734b3209b6edeb57e482c97793ae9c066af72871 jdk-9+175
+2ab4a2055c2e309872f648fa7ab4daae0bf8994c jdk-10+13
--- a/nashorn/.jcheck/conf Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/.jcheck/conf Thu Aug 24 16:24:44 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/nashorn/src/jdk.dynalink/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/src/jdk.dynalink/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,6 +24,7 @@
*/
/**
+ * Defines the API for dynamic linking of high-level operations on objects.
* <p>
* Dynalink is a library for dynamic linking of high-level operations on objects.
* These operations include "read a property",
@@ -217,6 +218,8 @@
* from B will get a chance to link the call site in A when it encounters the
* object from B.
*
+ * @uses jdk.dynalink.linker.GuardingDynamicLinkerExporter
+ *
* @moduleGraph
* @since 9
*/
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,14 +24,23 @@
*/
/**
- * Nashorn shell module
+ * Defines Nashorn shell module.
+ *
+ * <p>This module includes the command line tool <em>{@index jjs jjs tool}</em>
+ * to invoke the Nashorn engine.
*
+ * <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
+ * <dt class="simpleTagLabel">Tool Guides:
+ * <dd>{@extLink jjs_tool_reference jjs}
+ * </dl>
+ *
+ * @moduleGraph
* @since 9
*/
module jdk.scripting.nashorn.shell {
+ requires java.compiler;
requires java.desktop;
- requires java.compiler;
+ requires jdk.internal.le;
requires jdk.scripting.nashorn;
- requires jdk.internal.le;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java Thu Aug 24 16:24:44 2017 +0200
@@ -349,8 +349,6 @@
setType(hasDualFields() ? JSType.unboxedFieldType(initialValue) : Object.class);
if (initialValue instanceof Integer) {
invokeSetter(owner, ((Integer)initialValue).intValue());
- } else if (initialValue instanceof Long) {
- invokeSetter(owner, ((Long)initialValue).longValue());
} else if (initialValue instanceof Double) {
invokeSetter(owner, ((Double)initialValue).doubleValue());
} else {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -339,9 +339,11 @@
protected void loadMeta() throws IOException {
if (length == 0 && lastModified == 0) {
final URLConnection c = url.openConnection();
- length = c.getContentLength();
- lastModified = c.getLastModified();
- debug("loaded metadata for ", url);
+ try (InputStream in = c.getInputStream()) {
+ length = c.getContentLength();
+ lastModified = c.getLastModified();
+ debug("loaded metadata for ", url);
+ }
}
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java Thu Aug 24 16:24:44 2017 +0200
@@ -24,79 +24,127 @@
*/
/**
-<p>
-Nashorn is a runtime environment for programs written in ECMAScript 5.1.
-</p>
-<h1>Usage</h1>
-The recommended way to use Nashorn is through the <a href="http://jcp.org/en/jsr/detail?id=223" target="_top">JSR-223
-"Scripting for the Java Platform"</a> APIs found in the {@link javax.script} package. Usually, you'll obtain a
-{@link javax.script.ScriptEngine} instance for Nashorn using:
-<pre>
+ * Provides the implementation of Nashorn script engine and
+ * the runtime environment for programs written in ECMAScript 5.1.
+ * <p>
+ * Nashorn is a runtime environment for programs written in ECMAScript 5.1.
+ * </p>
+ *
+ * <h1>Usage</h1>
+ *
+ * The recommended way to use Nashorn is through the
+ * <a href="http://jcp.org/en/jsr/detail?id=223" target="_top">JSR-223
+ * "Scripting for the Java Platform"</a> APIs found in the
+ * {@link javax.script} package. Usually, you'll obtain a
+ * {@link javax.script.ScriptEngine} instance for Nashorn using:
+ * <pre>
import javax.script.*;
...
ScriptEngine nashornEngine = new ScriptEngineManager().getEngineByName("nashorn");
</pre>
-and then use it just as you would any other JSR-223 script engine. See
-<a href="jdk/nashorn/api/scripting/package-summary.html">{@code jdk.nashorn.api.scripting}</a> package
-for details.
-<h1>Compatibility</h1>
-Nashorn is 100% compliant with the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"
-target="_top">ECMA-262 Standard, Edition 5.1</a>. It requires a Java Virtual Machine that implements the
-<a href="http://jcp.org/en/jsr/detail?id=292" target="_top">JSR-292 "Supporting Dynamically Typed Languages on the Java
-Platform"</a> specification (often referred to as "invokedynamic"), as well as the already mentioned JSR-223.
-<h1>Interoperability with the Java platform</h1>
-In addition to being a 100% ECMAScript 5.1 runtime, Nashorn provides features for interoperability of the ECMAScript
-programs with the Java platform. In general, any Java object put into the script engine's context will be visible from
-the script. In terms of the standard, such Java objects are not considered "native objects", but rather "host objects",
-as defined in section 4.3.8. This distinction allows certain semantical differences in handling them compared to native
-objects. For most purposes, Java objects behave just as native objects do: you can invoke their methods, get and set
-their properties. In most cases, though, you can't add arbitrary properties to them, nor can you remove existing
-properties.
-<h2>Java collection handling</h2>
-Native Java arrays and {@link java.util.List}s support indexed access to their elements through the property accessors,
-and {@link java.util.Map}s support both property and element access through both dot and square-bracket property
-accessors, with the difference being that dot operator gives precedence to object properties (its fields and properties
-defined as {@code getXxx} and {@code setXxx} methods) while the square bracket operator gives precedence to map
-elements. Native Java arrays expose the {@code length} property.
-<h2>ECMAScript primitive types</h2>
-ECMAScript primitive types for number, string, and boolean are represented with {@link java.lang.Number},
-{@link java.lang.CharSequence}, and {@link java.lang.Boolean} objects. While the most often used number type is
-{@link java.lang.Double} and the most often used string type is {@link java.lang.String}, don't rely on it as various
-internal optimizations cause other subclasses of {@code Number} and internal implementations of {@code CharSequence} to
-be used.
-<h2>Type conversions</h2>
-When a method on a Java object is invoked, the arguments are converted to the formal parameter types of the Java method
-using all allowed ECMAScript conversions. This can be surprising, as in general, conversions from string to number will
-succeed according to Standard's section 9.3 "ToNumber" and so on; string to boolean, number to boolean, Object to
-number, Object to string all work. Note that if the Java method's declared parameter type is {@code java.lang.Object},
-Nashorn objects are passed without any conversion whatsoever; specifically if the JavaScript value being passed is of
-primitive string type, you can only rely on it being a {@code java.lang.CharSequence}, and if the value is a number, you
-can only rely on it being a {@code java.lang.Number}. If the Java method declared parameter type is more specific (e.g.
-{@code java.lang.String} or {@code java.lang.Double}), then Nashorn will of course ensure the required type is passed.
-<h2>SAM types</h2>
-As a special extension when invoking Java methods, ECMAScript function objects can be passed in place of an argument
-whose Java type is so-called "single abstract method" or "SAM" type. While this name usually covers single-method
-interfaces, Nashorn is a bit more versatile, and it recognizes a type as a SAM type if all its abstract methods are
-overloads of the same name, and it is either an interface, or it is an abstract class with
-a no-arg constructor. The type itself must be public, while the constructor and the methods can be either public or
-protected. If there are multiple abstract overloads of the same name, the single function will serve as the shared
-implementation for all of them, <em>and additionally it will also override any non-abstract methods of the same name</em>.
-This is done to be consistent with the fact that ECMAScript does not have the concept of overloaded methods.
-<h2>The {@code Java} object</h2>
-Nashorn exposes a non-standard global object named {@code Java} that is the primary API entry point into Java
-platform-specific functionality. You can use it to create instances of Java classes, convert from Java arrays to native
-arrays and back, and so on.
-<h2>Other non-standard built-in objects</h2>
-In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects:
-{@code JSAdapter}, {@code JavaImporter}, {@code Packages}
-
-@moduleGraph
-@since 9
+ *
+ * and then use it just as you would any other JSR-223 script engine. See
+ * <a href="jdk/nashorn/api/scripting/package-summary.html">
+ * {@code jdk.nashorn.api.scripting}</a> package for details.
+ * <h1>Compatibility</h1>
+ * Nashorn is 100% compliant with the
+ * <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"
+ * target="_top">ECMA-262 Standard, Edition 5.1</a>.
+ * It requires a Java Virtual Machine that implements the
+ * <a href="http://jcp.org/en/jsr/detail?id=292" target="_top">
+ * JSR-292 "Supporting Dynamically Typed Languages on the Java Platform"</a>
+ * specification (often referred to as "invokedynamic"), as well as
+ * the already mentioned JSR-223.
+ *
+ * <h1>Interoperability with the Java platform</h1>
+ *
+ * In addition to being a 100% ECMAScript 5.1 runtime, Nashorn provides features
+ * for interoperability of the ECMAScript programs with the Java platform.
+ * In general, any Java object put into the script engine's context will be
+ * visible from the script. In terms of the standard, such Java objects are not
+ * considered "native objects", but rather "host objects", as defined in
+ * section 4.3.8. This distinction allows certain semantical differences
+ * in handling them compared to native objects. For most purposes, Java objects
+ * behave just as native objects do: you can invoke their methods, get and set
+ * their properties. In most cases, though, you can't add arbitrary properties
+ * to them, nor can you remove existing properties.
+ *
+ * <h2>Java collection handling</h2>
+ *
+ * Native Java arrays and {@link java.util.List}s support indexed access to
+ * their elements through the property accessors, and {@link java.util.Map}s
+ * support both property and element access through both dot and square-bracket
+ * property accessors, with the difference being that dot operator gives
+ * precedence to object properties (its fields and properties defined as
+ * {@code getXxx} and {@code setXxx} methods) while the square bracket
+ * operator gives precedence to map elements. Native Java arrays expose
+ * the {@code length} property.
+ *
+ * <h2>ECMAScript primitive types</h2>
+ *
+ * ECMAScript primitive types for number, string, and boolean are represented
+ * with {@link java.lang.Number}, {@link java.lang.CharSequence}, and
+ * {@link java.lang.Boolean} objects. While the most often used number type
+ * is {@link java.lang.Double} and the most often used string type is
+ * {@link java.lang.String}, don't rely on it as various internal optimizations
+ * cause other subclasses of {@code Number} and internal implementations of
+ * {@code CharSequence} to be used.
+ *
+ * <h2>Type conversions</h2>
+ *
+ * When a method on a Java object is invoked, the arguments are converted to
+ * the formal parameter types of the Java method using all allowed ECMAScript
+ * conversions. This can be surprising, as in general, conversions from string
+ * to number will succeed according to Standard's section 9.3 "ToNumber"
+ * and so on; string to boolean, number to boolean, Object to number,
+ * Object to string all work. Note that if the Java method's declared parameter
+ * type is {@code java.lang.Object}, Nashorn objects are passed without any
+ * conversion whatsoever; specifically if the JavaScript value being passed
+ * is of primitive string type, you can only rely on it being a
+ * {@code java.lang.CharSequence}, and if the value is a number, you can only
+ * rely on it being a {@code java.lang.Number}. If the Java method declared
+ * parameter type is more specific (e.g. {@code java.lang.String} or
+ * {@code java.lang.Double}), then Nashorn will of course ensure
+ * the required type is passed.
+ *
+ * <h2>SAM types</h2>
+ *
+ * As a special extension when invoking Java methods, ECMAScript function
+ * objects can be passed in place of an argument whose Java type is so-called
+ * "single abstract method" or "SAM" type. While this name usually covers
+ * single-method interfaces, Nashorn is a bit more versatile, and it
+ * recognizes a type as a SAM type if all its abstract methods are
+ * overloads of the same name, and it is either an interface, or it is an
+ * abstract class with a no-arg constructor. The type itself must be public,
+ * while the constructor and the methods can be either public or protected.
+ * If there are multiple abstract overloads of the same name, the single
+ * function will serve as the shared implementation for all of them,
+ * <em>and additionally it will also override any non-abstract methods of
+ * the same name</em>. This is done to be consistent with the fact that
+ * ECMAScript does not have the concept of overloaded methods.
+ *
+ * <h2>The {@code Java} object</h2>
+ *
+ * Nashorn exposes a non-standard global object named {@code Java} that is
+ * the primary API entry point into Java platform-specific functionality.
+ * You can use it to create instances of Java classes, convert from Java arrays
+ * to native arrays and back, and so on.
+ *
+ * <h2>Other non-standard built-in objects</h2>
+ *
+ * In addition to {@code Java}, Nashorn also exposes some other
+ * non-standard built-in objects:
+ * {@code JSAdapter}, {@code JavaImporter}, {@code Packages}
+ *
+ * @provides javax.script.ScriptEngineFactory
+ * @moduleGraph
+ * @since 9
*/
module jdk.scripting.nashorn {
requires java.logging;
+ requires jdk.dynalink;
+
requires transitive java.scripting;
- requires jdk.dynalink;
exports jdk.nashorn.api.scripting;
exports jdk.nashorn.api.tree;
@@ -108,9 +156,9 @@
exports jdk.nashorn.tools to
jdk.scripting.nashorn.shell;
- provides javax.script.ScriptEngineFactory
- with jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+ provides javax.script.ScriptEngineFactory with
+ jdk.nashorn.api.scripting.NashornScriptEngineFactory;
- provides jdk.dynalink.linker.GuardingDynamicLinkerExporter
- with jdk.nashorn.api.linker.NashornLinkerExporter;
+ provides jdk.dynalink.linker.GuardingDynamicLinkerExporter with
+ jdk.nashorn.api.linker.NashornLinkerExporter;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/JDK_8182996_Test.java Thu Aug 24 16:24:44 2017 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.script.*;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * @bug 8182996
+ * @summary Incorrect mapping Long type to JavaScript equivalent
+ */
+@SuppressWarnings("javadoc")
+public class JDK_8182996_Test {
+
+ private ScriptEngine engine;
+ Bindings bindings;
+
+
+ @BeforeClass
+ public void setupTest() {
+ engine = new ScriptEngineManager().getEngineByName("js");
+ bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
+
+ bindings.put("long1", Long.valueOf(1L));
+ bindings.put("long2", Long.valueOf(2L));
+ bindings.put("long2", Long.valueOf(3L));
+ }
+
+ @Test
+ public void testType() throws ScriptException {
+ assertEquals(engine.eval("typeof long1"), "object");
+ assertEquals(engine.eval("typeof long2"), "object");
+ }
+
+ @Test
+ public void testValue() throws ScriptException {
+ assertEquals(engine.eval("long1"), Long.valueOf(1));
+ assertEquals(engine.eval("long2"), Long.valueOf(3));
+ assertEquals(bindings.get("long1"), Long.valueOf(1));
+ assertEquals(bindings.get("long2"), Long.valueOf(3));
+ }
+
+}
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -199,7 +199,7 @@
try {
return getEvaluator().run(out, err, args);
} catch (final IOException e) {
- throw new UnsupportedOperationException("I/O error in initializing shell - cannot redirect output to file");
+ throw new UnsupportedOperationException("I/O error in initializing shell - cannot redirect output to file", e);
}
}
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Wed Jun 28 11:27:28 2017 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java Thu Aug 24 16:24:44 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -118,9 +118,10 @@
if (errors != 0 || checkCompilerMsg) {
if (expectCompileFailure || checkCompilerMsg) {
- final PrintStream outputDest = new PrintStream(new FileOutputStream(errorFileName));
- TestHelper.dumpFile(outputDest, new StringReader(new String(err.toByteArray())));
- outputDest.println("--");
+ try (PrintStream outputDest = new PrintStream(new FileOutputStream(errorFileName))) {
+ TestHelper.dumpFile(outputDest, new StringReader(new String(err.toByteArray())));
+ outputDest.println("--");
+ }
} else {
log(new String(err.toByteArray()));
}
@@ -224,7 +225,6 @@
BufferedReader expected;
if (expectedFile.exists()) {
- expected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFileName0)));
// copy expected file overwriting existing file and preserving last
// modified time of source
try {
@@ -235,11 +235,14 @@
} catch (final IOException ex) {
fail("failed to copy expected " + expectedFileName + " to " + copyExpectedFileName + ": " + ex.getMessage());
}
+ expected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFileName0)));
} else {
expected = new BufferedReader(new StringReader(""));
}
- final BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(outputFileName0)));
- compare(actual, expected, compareCompilerMsg);
+ try (BufferedReader actual = new BufferedReader(new InputStreamReader(new FileInputStream(outputFileName0)));
+ BufferedReader expected0 = expected){
+ compare(actual, expected0, compareCompilerMsg);
+ }
}
}
--- a/test/lib/jdk/test/lib/Platform.java Wed Jun 28 11:27:28 2017 -0700
+++ b/test/lib/jdk/test/lib/Platform.java Thu Aug 24 16:24:44 2017 +0200
@@ -23,10 +23,9 @@
package jdk.test.lib;
+import java.io.File;
import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.io.RandomAccessFile;
import java.util.regex.Pattern;
public class Platform {
@@ -208,12 +207,13 @@
* Return a boolean for whether we expect to be able to attach
* the SA to our own processes on this system.
*/
- public static boolean shouldSAAttach() throws Exception {
-
+ public static boolean shouldSAAttach() throws IOException {
if (isAix()) {
- return false; // SA not implemented.
+ return false; // SA not implemented.
} else if (isLinux()) {
- if (isS390x()) { return false; } // SA not implemented.
+ if (isS390x()) {
+ return false; // SA not implemented.
+ }
return canPtraceAttachLinux();
} else if (isOSX()) {
return canAttachOSX();
@@ -229,13 +229,15 @@
* if we are root, so return true. Then return false for an expected denial
* if "ptrace_scope" is 1, and true otherwise.
*/
- public static boolean canPtraceAttachLinux() throws Exception {
-
+ private static boolean canPtraceAttachLinux() throws IOException {
// SELinux deny_ptrace:
- String deny_ptrace = fileAsString("/sys/fs/selinux/booleans/deny_ptrace");
- if (deny_ptrace != null && deny_ptrace.contains("1")) {
- // ptrace will be denied:
- return false;
+ File deny_ptrace = new File("/sys/fs/selinux/booleans/deny_ptrace");
+ if (deny_ptrace.exists()) {
+ try (RandomAccessFile file = new RandomAccessFile(deny_ptrace, "r")) {
+ if (file.readByte() != '0') {
+ return false;
+ }
+ }
}
// YAMA enhanced security ptrace_scope:
@@ -243,14 +245,17 @@
// 1 - restricted ptrace: a process must be a children of the inferior or user is root
// 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
// 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
- String ptrace_scope = fileAsString("/proc/sys/kernel/yama/ptrace_scope");
- if (ptrace_scope != null) {
- if (ptrace_scope.startsWith("3")) {
- return false;
- }
- if (!userName.equals("root") && !ptrace_scope.startsWith("0")) {
- // ptrace will be denied:
- return false;
+ File ptrace_scope = new File("/proc/sys/kernel/yama/ptrace_scope");
+ if (ptrace_scope.exists()) {
+ try (RandomAccessFile file = new RandomAccessFile(ptrace_scope, "r")) {
+ byte yama_scope = file.readByte();
+ if (yama_scope == '3') {
+ return false;
+ }
+
+ if (!userName.equals("root") && yama_scope != '0') {
+ return false;
+ }
}
}
// Otherwise expect to be permitted:
@@ -260,7 +265,7 @@
/**
* On OSX, expect permission to attach only if we are root.
*/
- public static boolean canAttachOSX() throws Exception {
+ private static boolean canAttachOSX() {
return userName.equals("root");
}
@@ -269,10 +274,4 @@
.matcher(osArch)
.matches();
}
-
- private static String fileAsString(String filename) throws IOException {
- Path filePath = Paths.get(filename);
- if (!Files.exists(filePath)) return null;
- return new String(Files.readAllBytes(filePath));
- }
}
--- a/test/lib/sun/hotspot/WhiteBox.java Wed Jun 28 11:27:28 2017 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java Thu Aug 24 16:24:44 2017 +0200
@@ -453,7 +453,6 @@
Object[] packages);
public native void AddModuleExports(Object from_module, String pkg, Object to_module);
public native void AddReadsModule(Object from_module, Object source_module);
- public native void AddModulePackage(Object module, String pkg);
public native void AddModuleExportsToAllUnnamed(Object module, String pkg);
public native void AddModuleExportsToAll(Object module, String pkg);
public native Object GetModuleByPackageName(Object ldr, String pkg);