--- a/.hgtags-top-repo Thu Jun 29 12:05:08 2017 +0200
+++ b/.hgtags-top-repo Thu Aug 24 16:24:31 2017 +0200
@@ -430,3 +430,5 @@
88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173
5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174
8d4ed1e06fe184c9cb08c5b708e7d6f5c066644f jdk-10+12
+8f7227c6012b0051ea4e0bcee040c627bf699b88 jdk-9+175
+d67a3f1f057f7e31e12f33ebe3667cb73d252268 jdk-10+13
--- a/.jcheck/conf Thu Jun 29 12:05:08 2017 +0200
+++ b/.jcheck/conf Thu Aug 24 16:24:31 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/common/doc/testing.html Thu Jun 29 12:05:08 2017 +0200
+++ b/common/doc/testing.html Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/common/doc/testing.md Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/.hgtags Thu Aug 24 16:24:31 2017 +0200
@@ -430,3 +430,5 @@
534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173
3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174
00ae6307d78bac49883ddc85d687aa88c49f3971 jdk-10+12
+dc78a3dd6b3a4f11cdae8a3e3d160e6a78bc7838 jdk-9+175
+564fced058bd2c8375e9104aa8f9494642cd7bdd jdk-10+13
--- a/corba/.jcheck/conf Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/.jcheck/conf Thu Aug 24 16:24:31 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/corba/src/java.corba/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/src/java.corba/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/.hgtags Thu Aug 24 16:24:31 2017 +0200
@@ -590,3 +590,5 @@
e64b1cb48d6e7703928a9d1da106fc27f8cb65fd jdk-9+173
944791f8160185bffa13fbb821fc09b6198f1f25 jdk-9+174
070aa7a2eb14c4645f7eb31384cba0a2ba72a4b5 jdk-10+12
+8f04d457168b9f1f4a1b2c37f49e0513ca9d33a7 jdk-9+175
+a9da03357f190807591177fe9846d6e68ad64fc0 jdk-10+13
--- a/hotspot/.jcheck/conf Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/.jcheck/conf Thu Aug 24 16:24:31 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/hotspot/make/symbols/symbols-unix Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/make/symbols/symbols-unix Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/make/test/JtregNative.gmk Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/vtableStubs_aarch64.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/cpu/arm/vm/c1_LIRGenerator_arm.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/jdk.aot/share/classes/module-info.java Thu Aug 24 16:24:31 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.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Thu Jun 29 12:05:08 2017 +0200
+++ 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/module-info.java Thu Aug 24 16:24:31 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/share/vm/c1/c1_LIRGenerator.cpp Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/classfile/modules.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/classfile/modules.hpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/code/codeCache.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/code/codeCache.hpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvm.h Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp Thu Aug 24 16:24:31 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;
+ }
}
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c1/MultiplyByMaxInt.java Thu Aug 24 16:24:31 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/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Thu Aug 24 16:24:31 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/runtime/modules/JVMAddModulePackage.java Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/test/runtime/modules/ModuleHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/test/serviceability/jvmti/GetNamedModule/MyPackage/GetNamedModuleTest.java Thu Aug 24 16:24:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java Thu Aug 24 16:24:31 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/jdk/.hgtags Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/.hgtags Thu Aug 24 16:24:31 2017 +0200
@@ -430,3 +430,5 @@
a5506b425f1bf91530d8417b57360e5d89328c0c jdk-9+173
42f18c931bd4fae5c206ccf6d8e591e4c4e69d31 jdk-9+174
5f504872a75b71f2fb19299f0d1e3395cf32eaa0 jdk-10+12
+e6c4f6ef717d104dba880e2dae538690c993b46f jdk-9+175
+4540d6376f3ef22305cca546f85f9b2ce9a210c4 jdk-10+13
--- a/jdk/.jcheck/conf Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/.jcheck/conf Thu Aug 24 16:24:31 2017 +0200
@@ -1,1 +1,2 @@
project=jdk10
+bugids=dup
--- a/jdk/make/ModuleTools.gmk Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/make/ModuleTools.gmk Thu Aug 24 16:24:31 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/mapfiles/libjava/mapfile-vers Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +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 \
-jdk.xml.bind \
-jdk.xml.ws
-
-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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/make/src/classes/build/tools/jigsaw/technology-summary.html Thu Aug 24 16:24:31 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/src/java.base/share/classes/java/io/File.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/io/File.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Thu Aug 24 16:24:31 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,7 +2165,7 @@
* @revised 9
* @spec JPMS
*
- * @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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/FdLibm.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Module.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java Thu Aug 24 16:24:31 2017 +0200
@@ -109,7 +109,7 @@
* and have no specification and implementation versioning information.
*
* @jvms 5.3 Run-time package
- * @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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java Thu Aug 24 16:24:31 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/System.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/module/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/MalformedParameterizedTypeException.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGeneratorSpi.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/Key.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGeneratorSpi.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/Provider.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/Security.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/CRL.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/interfaces/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/security/spec/package-info.java Thu Aug 24 16:24:31 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/Deque.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Deque.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/ServiceConfigurationError.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Thu Aug 24 16:24:31 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:31 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:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/jar/Manifest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/jar/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/util/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGeneratorSpi.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/interfaces/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/spec/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java Thu Aug 24 16:24:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java Thu Aug 24 16:24:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -129,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
@@ -192,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,
@@ -218,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,
@@ -233,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,
@@ -241,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
@@ -253,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,
@@ -349,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;
@@ -358,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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/lib/security/default.policy Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/native/include/jvm.h Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/share/native/libjava/Module.c Thu Aug 24 16:24:31 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/unix/native/libnet/NetworkInterface.c Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.base/windows/classes/java/io/WinNTFileSystem.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Clipboard.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/ClipboardOwner.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorEvent.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorListener.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorMap.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/FlavorTable.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeType.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParameterList.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/MimeTypeParseException.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/StringSelection.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/Transferable.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/UnsupportedFlavorException.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DataFlavorUtil.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.datatransfer/share/classes/sun/datatransfer/DesktopDatatransferService.java Thu Aug 24 16:24:31 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/share/classes/java/applet/AppletContext.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/AWTPermission.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibilityProvider.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/Accessible.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleAction.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleAttributeSequence.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleComponent.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleEditableText.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedComponent.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedTable.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedText.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleHyperlink.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleHypertext.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleIcon.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleKeyBinding.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRelation.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRelationSet.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleResourceBundle.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleRole.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleSelection.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleState.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleStateSet.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleStreamable.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTable.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTableModelChange.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleText.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleTextSequence.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleValue.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/print/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Action.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/BoxLayout.java Thu Aug 24 16:24:31 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/JFormattedTextField.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java Thu Aug 24 16:24:31 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/filechooser/package-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/MaskFormatter.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/undo/UndoManager.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -49,9 +49,10 @@
* @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;
--- /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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.logging/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.management.rmi/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -51,9 +51,10 @@
*/
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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.management/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -46,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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.management/share/classes/sun/management/MemoryPoolImpl.java Thu Aug 24 16:24:31 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.naming/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.naming/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.prefs/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -35,5 +35,6 @@
requires java.xml;
exports java.util.prefs;
+
uses java.util.prefs.PreferencesFactory;
}
--- a/jdk/src/java.rmi/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.rmi/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -53,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;
@@ -66,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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.scripting/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -44,5 +44,6 @@
*/
module java.scripting {
exports javax.script;
+
uses javax.script.ScriptEngineFactory;
}
--- a/jdk/src/java.se.ee/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.se.ee/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -32,8 +32,8 @@
* @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 {
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.security.jgss/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.security.jgss/share/classes/org/ietf/jgss/package.html Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/Sasl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.security.sasl/share/classes/javax/security/sasl/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.security.sasl/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.smartcardio/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.sql.rowset/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -39,5 +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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.sql/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -38,5 +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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.transaction/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/java.xml.crypto/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.accessibility/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.attach/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -36,8 +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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.charsets/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -33,6 +33,6 @@
* @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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -34,5 +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/legal/ecc.md Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.crypto.ec/share/legal/ecc.md Thu Aug 24 16:24:31 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.editpad/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.editpad/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -30,8 +30,9 @@
* @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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.httpserver/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -35,5 +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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLDelegate.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ExchangeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Request.java Thu Aug 24 16:24:31 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/HttpRequestImpl.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.java Thu Aug 24 16:24:31 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/RequestProcessors.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/RequestProcessors.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseHeaders.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseProcessors.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java Thu Aug 24 16:24:31 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;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.internal.ed/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jartool/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -48,5 +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.jconsole/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jconsole/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -39,14 +39,17 @@
* @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/tools/jdi/AbstractLauncher.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/AbstractLauncher.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ArrayReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ArrayTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BaseLineInfo.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/BooleanValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ByteTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ByteValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CharTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CharValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassLoaderReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassObjectReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ClassTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/CommandSender.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ConnectorImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/DoubleTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/DoubleValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventQueueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventRequestManagerImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FieldImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FloatTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/FloatValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericAttachingConnector.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/GenericListeningConnector.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/IntegerTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/IntegerValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InternalEventHandler.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/JDWPException.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/JNITypeParser.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LineInfo.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocalVariableImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocationImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LockObject.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LongTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/LongValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MirrorImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ModuleReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/MonitorInfoImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/NonConcreteMethodImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ObsoleteMethodImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/Packet.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PacketStream.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PrimitiveTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/PrimitiveValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ProcessAttachingConnector.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/RawCommandLineLauncher.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SDE.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ShortTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ShortValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Thu Aug 24 16:24:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SocketTransportService.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StackFrameImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StratumLineInfo.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/StringReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TargetVM.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadAction.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadGroupReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TypeComponentImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/TypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMAction.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMListener.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMModifiers.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VMState.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ValueContainer.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/ValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerService.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VoidTypeImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VoidValueImpl.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jdi/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -39,12 +39,13 @@
* 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>.
+ * 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
@@ -102,10 +103,6 @@
* unloaded.
* </blockquote>
*
- * <h3>jdb</h3>
- *
- * <em>{@index jdb jdb tool}</em> is a simple command-line debugger provided
- * in this module.
*
* <dl style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">
* <dt class="simpleTagLabel">Tool Guides:
@@ -119,6 +116,8 @@
*
* @moduleGraph
* @since 9
+ * @see <a href="{@docRoot}/../specs/jpda/jpda.html">
+ * Java Platform Debugger Architecture (JPDA)</a>
*/
module jdk.jdi {
requires jdk.attach;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java Thu Aug 24 16:24:31 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.jsobject/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jsobject/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.jstatd/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -42,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.naming.dns/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.naming.dns/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -36,6 +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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.naming.rmi/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -33,10 +33,12 @@
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.policytool/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.policytool/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -40,8 +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.security.auth/share/classes/com/sun/security/auth/callback/package-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/callback/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/login/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/package-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.security.auth/share/classes/module-info.java Thu Aug 24 16:24:31 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,7 +24,7 @@
*/
/**
- * Provides the implementation of the {@code javax.security.auth.*}
+ * Provides implementations of the {@code javax.security.auth.*}
* interfaces and various authentication modules.
*
* @provides javax.security.auth.spi.LoginModule
@@ -32,8 +32,10 @@
* @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;
--- a/jdk/src/jdk.security.jgss/share/classes/module-info.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.security.jgss/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.unsupported/share/classes/module-info.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/src/jdk.zipfs/share/classes/module-info.java Thu Aug 24 16:24:31 2017 +0200
@@ -29,12 +29,14 @@
* <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} if installed.
+ * {@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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/ProblemList.txt Thu Aug 24 16:24:31 2017 +0200
@@ -303,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/java/awt/image/MultiResolutionImageTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/awt/image/MultiResolutionImageTest.java Thu Aug 24 16:24:31 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/xembed/server/RunTestXEmbed.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/awt/xembed/server/RunTestXEmbed.java Thu Aug 24 16:24:31 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/lang/ClassLoader/LibraryPathProperty.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ClassLoader/LibraryPathProperty.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ModuleLayer/BasicLayerTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ModuleLayer/LayerControllerTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ModuleTests/AnnotationsTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ModuleTests/BasicModuleTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ModuleTests/annotation/Basic.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Thu Aug 24 16:24:31 2017 +0200
@@ -42,14 +42,7 @@
* @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
@@ -251,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]));
--- a/jdk/test/java/lang/System/OsVersionTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/System/OsVersionTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/instrument/RedefineModuleTest.java Thu Aug 24 16:24:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/module/AutomaticModulesTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/reflect/AccessibleObject/CanAccessTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/lang/reflect/AccessibleObject/TrySetAccessibleTest.java Thu Aug 24 16:24:31 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:31 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");
+ }
+ }
+}
--- a/jdk/test/java/net/httpclient/SmokeTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/net/httpclient/SmokeTest.java Thu Aug 24 16:24:31 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8087112
+ * @bug 8087112 8178699
* @modules jdk.incubator.httpclient
* java.logging
* jdk.httpserver
--- a/jdk/test/java/net/httpclient/http2/BasicTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/net/httpclient/http2/BasicTest.java Thu Aug 24 16:24:31 2017 +0200
@@ -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
--- a/jdk/test/java/net/httpclient/http2/FixedThreadPoolTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/net/httpclient/http2/FixedThreadPoolTest.java Thu Aug 24 16:24:31 2017 +0200
@@ -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
--- a/jdk/test/java/net/httpclient/http2/TLSConnection.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/net/httpclient/http2/TLSConnection.java Thu Aug 24 16:24:31 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();
--- a/jdk/test/java/net/httpclient/http2/server/Http2TestServer.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/net/httpclient/http2/server/Http2TestServer.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/net/httpclient/http2/server/Http2TestServerConnection.java Thu Aug 24 16:24:31 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/charset/Charset/EmptyCharsetName.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/nio/charset/Charset/EmptyCharsetName.java Thu Aug 24 16:24:31 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/CharsetDecoder/AverageMax.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/nio/charset/CharsetDecoder/AverageMax.java Thu Aug 24 16:24:31 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/util/ResourceBundle/modules/cache/CacheTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/java/util/ResourceBundle/modules/cache/CacheTest.java Thu Aug 24 16:24:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/javax/swing/plaf/windows/6921687/bug6921687.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java Thu Aug 24 16:24:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/jdk/modules/open/Basic.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Thu Aug 24 16:24:31 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 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs12/ProbeLargeKeystore.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Thu Aug 24 16:24:31 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:31 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:31 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:31 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:31 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:31 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:31 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:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src1/java.base/jdk/internal/modules/SystemModules.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ /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 Thu Jun 29 12:05:08 2017 +0200
+++ /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/make/CreateJmods.gmk Thu Jun 29 12:05:08 2017 +0200
+++ b/make/CreateJmods.gmk Thu Aug 24 16:24:31 2017 +0200
@@ -81,7 +81,6 @@
LEGAL_NOTICES := \
$(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
- $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)) \
$(call FindModuleLegalDirs, $(MODULE)) \
#
@@ -106,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 Thu Jun 29 12:05:08 2017 +0200
+++ b/make/Docs.gmk Thu Aug 24 16:24:31 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/common/Modules.gmk Thu Jun 29 12:05:08 2017 +0200
+++ b/make/common/Modules.gmk Thu Aug 24 16:24:31 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 \
@@ -175,13 +176,10 @@
jdk.policytool \
jdk.rmic \
jdk.scripting.nashorn \
- jdk.scripting.nashorn.shell \
jdk.sctp \
jdk.security.auth \
jdk.security.jgss \
- jdk.xml.bind \
jdk.xml.dom \
- jdk.xml.ws \
jdk.zipfs \
#
@@ -384,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/test/lib/jdk/test/lib/Platform.java Thu Jun 29 12:05:08 2017 +0200
+++ b/test/lib/jdk/test/lib/Platform.java Thu Aug 24 16:24:31 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 Thu Jun 29 12:05:08 2017 +0200
+++ b/test/lib/sun/hotspot/WhiteBox.java Thu Aug 24 16:24:31 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);