--- a/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -1,3 +1,5 @@
+d3e973f1809606c67412361041ad197e50fe8cec jdk-9+166
+3965b747cfe1e6cbd66b8739da5a1ea6ec6985e9 jdk-9+165
d16aebbb56d37f12e0c0b0a4fb427db65e1fb1a8 jdk-9+162
18c41483a082e097ac2f5f983c1226ed94aa4215 jdk-9+163
32db52c675e7d5bc413605d2e89b68b608b19be0 jdk-9+164
@@ -411,3 +413,5 @@
74116beae88a8f17a80301aa6c83865c82f10ece jdk-10+1
4a79ad46e578112fce68f1af9dd931025cc235cb jdk-10+2
d1cab6c7e608479be4ebfad48a25b0ed48600f62 jdk-10+3
+02253db2ace1422f576f58502fc7831ead77424b jdk-10+4
+f113ce12fe24fbd24acf02711372d9f1e1c12426 jdk-10+5
--- a/.hgtags-top-repo Mon Apr 24 12:08:09 2017 -0400
+++ b/.hgtags-top-repo Mon Apr 24 21:34:23 2017 +0200
@@ -408,3 +408,5 @@
21b063d75b3edbffb9bebc8872d990920c4ae1e5 jdk-9+162
c38c6b270ccc8e2b86d1631bcf42248241b54d2c jdk-9+163
7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164
+aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165
+ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
--- a/common/conf/jib-profiles.js Mon Apr 24 12:08:09 2017 -0400
+++ b/common/conf/jib-profiles.js Mon Apr 24 21:34:23 2017 +0200
@@ -231,7 +231,8 @@
// List of the main profile names used for iteration
common.main_profile_names = [
"linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
- "solaris-sparcv9", "windows-x64", "windows-x86"
+ "solaris-sparcv9", "windows-x64", "windows-x86",
+ "linux-arm64", "linux-arm-vfp-hflt", "linux-arm-vfp-hflt-dyn"
];
// These are the base setttings for all the main build profiles.
@@ -391,7 +392,7 @@
// on such hardware.
if (input.build_cpu == "sparcv9") {
var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
- if (cpu_brand.trim() == 'SPARC-M7') {
+ if (cpu_brand.trim().match('SPARC-.7')) {
boot_jdk_revision = "8u20";
boot_jdk_subdirpart = "1.8.0_20";
}
@@ -471,8 +472,43 @@
build_cpu: "x64",
dependencies: ["devkit", "freetype"],
configure_args: concat(common.configure_args_32bit),
+ },
+
+ "linux-arm64": {
+ target_os: "linux",
+ target_cpu: "aarch64",
+ build_cpu: "x64",
+ dependencies: ["devkit", "build_devkit", "cups", "headless_stubs"],
+ configure_args: [
+ "--with-cpu-port=arm64",
+ "--with-jvm-variants=server",
+ "--openjdk-target=aarch64-linux-gnu",
+ "--enable-headless-only"
+ ],
+ },
+
+ "linux-arm-vfp-hflt": {
+ target_os: "linux",
+ target_cpu: "arm",
+ build_cpu: "x64",
+ dependencies: ["devkit", "build_devkit", "cups"],
+ configure_args: [
+ "--with-jvm-variants=minimal1,client",
+ "--with-x=" + input.get("devkit", "install_path") + "/arm-linux-gnueabihf/libc/usr/X11R6-PI",
+ "--openjdk-target=arm-linux-gnueabihf",
+ "--with-abi-profile=arm-vfp-hflt"
+ ],
+ },
+
+ // Special version of the SE profile adjusted to be testable on arm64 hardware.
+ "linux-arm-vfp-hflt-dyn": {
+ configure_args: "--with-stdc++lib=dynamic"
}
};
+ // Let linux-arm-vfp-hflt-dyn inherit everything from linux-arm-vfp-hflt
+ profiles["linux-arm-vfp-hflt-dyn"] = concatObjects(
+ profiles["linux-arm-vfp-hflt-dyn"], profiles["linux-arm-vfp-hflt"]);
+
// Add the base settings to all the main profiles
common.main_profile_names.forEach(function (name) {
profiles[name] = concatObjects(common.main_profile_base, profiles[name]);
@@ -584,7 +620,7 @@
var testOnlyProfilesPrebuilt = {
"run-test-prebuilt": {
src: "src.conf",
- dependencies: [ "jtreg", "gnumake", testedProfile + ".jdk",
+ dependencies: [ "jtreg", "gnumake", "boot_jdk", testedProfile + ".jdk",
testedProfile + ".test", "src.full"
],
work_dir: input.get("src.full", "install_path") + "/test",
@@ -658,16 +694,28 @@
"windows-x86": {
platform: "windows-x86",
demo_ext: "zip"
+ },
+ "linux-arm64": {
+ platform: "linux-arm64-vfp-hflt",
+ demo_ext: "tar.gz"
+ },
+ "linux-arm-vfp-hflt": {
+ platform: "linux-arm32-vfp-hflt",
+ demo_ext: "tar.gz"
+ },
+ "linux-arm-vfp-hflt-dyn": {
+ platform: "linux-arm32-vfp-hflt-dyn",
+ demo_ext: "tar.gz"
}
}
// Generate common artifacts for all main profiles
- common.main_profile_names.forEach(function (name) {
+ Object.keys(artifactData).forEach(function (name) {
profiles[name] = concatObjects(profiles[name],
common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext));
});
// Generate common artifacts for all debug profiles
- common.main_profile_names.forEach(function (name) {
+ Object.keys(artifactData).forEach(function (name) {
var debugName = name + common.debug_suffix;
profiles[debugName] = concatObjects(profiles[debugName],
common.debug_profile_artifacts(artifactData[name].platform));
@@ -839,7 +887,11 @@
macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
solaris_x64: "SS12u4-Solaris11u1+1.0",
solaris_sparcv9: "SS12u4-Solaris11u1+1.0",
- windows_x64: "VS2013SP4+1.0"
+ windows_x64: "VS2013SP4+1.0",
+ linux_aarch64: "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0",
+ linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
+ ? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
+ : "arm-linaro-4.7+1.0")
};
var devkit_platform = (input.target_cpu == "x86"
@@ -882,7 +934,7 @@
jtreg: {
server: "javare",
revision: "4.2",
- build_number: "b05",
+ build_number: "b07",
checksum_file: "MD5_VALUES",
file: "jtreg_bin-4.2.zip",
environment_name: "JT_HOME",
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/doc/testing.html Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta name="generator" content="pandoc" />
+ <title>Testing OpenJDK</title>
+ <style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="http://openjdk.java.net/page.css" type="text/css" />
+ <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
+ <style type="text/css">pre { font-size: 10pt; }</style>
+</head>
+<body>
+<div id="header">
+<h1 class="title">Testing OpenJDK</h1>
+</div>
+<div id="TOC">
+<ul>
+<li><a href="#using-the-run-test-framework">Using the run-test framework</a></li>
+<li><a href="#test-selection">Test selection</a><ul>
+<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="#gtest-keywords">Gtest keywords</a></li>
+</ul></li>
+</ul>
+</div>
+<h2 id="using-the-run-test-framework">Using the run-test framework</h2>
+<p>This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.</p>
+<p>Some example command-lines:</p>
+<pre><code>$ make run-test-tier1
+$ make run-test-jdk_lang JTREG="JOBS=8"
+$ make run-test TEST=jdk_lang
+$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
+$ 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"</code></pre>
+<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>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>
+<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>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>
+<p>If you want, you can single out an individual test or a group of tests, for instance <code>gtest:LogDecorations</code> or <code>gtest:LogDecorations.level_test_vm</code>. This can be particularly useful if you want to run a shaky test repeatedly.</p>
+<h2 id="test-results-and-summary">Test results and summary</h2>
+<p>At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:</p>
+<pre><code>==============================
+Test summary
+==============================
+ TEST TOTAL PASS FAIL ERROR
+>> jtreg:jdk/test:tier1 1867 1865 2 0 <<
+ jtreg:langtools/test:tier1 4711 4711 0 0
+ jtreg:nashorn/test:tier1 133 133 0 0
+==============================
+TEST FAILURE</code></pre>
+<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>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>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>
+<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>
+<h4 id="timeout">TIMEOUT</h4>
+<p>The timeout factor (<code>-timeoutFactor</code>).</p>
+<p>Defaults to 4.</p>
+<h4 id="test_mode">TEST_MODE</h4>
+<p>The test mode (<code>-agentvm</code>, <code>-samevm</code> or <code>-othervm</code>).</p>
+<p>Defaults to <code>-agentvm</code>.</p>
+<h4 id="assert">ASSERT</h4>
+<p>Enable asserts (<code>-ea -esa</code>, or none).</p>
+<p>Set to <code>true</code> or <code>false</code>. If true, adds <code>-ea -esa</code>. Defaults to true, except for hotspot.</p>
+<h4 id="verbose">VERBOSE</h4>
+<p>The verbosity level (<code>-verbose</code>).</p>
+<p>Defaults to <code>fail,error,summary</code>.</p>
+<h4 id="retain">RETAIN</h4>
+<p>What test data to retain (<code>-retain</code>).</p>
+<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>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>
+<h4 id="java_options">JAVA_OPTIONS</h4>
+<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>
+<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>
+<p>Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with <code>OPTIONS=--gtest_break_on_failure</code> to reproduce an intermittent problem.</p>
+<h4 id="options-1">OPTIONS</h4>
+<p>Additional options to the Gtest test framework.</p>
+<p>Use <code>GTEST="OPTIONS=--help"</code> to see all available Gtest options.</p>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/doc/testing.md Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,207 @@
+% Testing OpenJDK
+
+## Using the run-test framework
+
+This new way of running tests is developer-centric. It assumes that you have
+built a jdk locally and want to test it. Running common test targets is simple,
+and more complex ad-hoc combination of tests is possible. The user interface is
+forgiving, and clearly report errors it cannot resolve.
+
+Some example command-lines:
+
+ $ make run-test-tier1
+ $ make run-test-jdk_lang JTREG="JOBS=8"
+ $ make run-test TEST=jdk_lang
+ $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
+ $ 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"
+
+## Test selection
+
+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 `TEST` 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.
+
+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 `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.
+
+The test specifications given in `TEST` is parsed into fully qualified test
+descriptors, which clearly and unambigously show which tests will be run. As an
+example, `:tier1` will expand to `jtreg:jdk/test:tier1
+jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1`. You
+can always submit a list of fully qualified test descriptors in the `TEST`
+variable if you want to shortcut the parser.
+
+### JTreg
+
+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`.
+
+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.
+
+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.
+
+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
+use a fully qualified test descriptor, add `jtreg:`, e.g.
+`jtreg:hotspot/test/native_sanity`.
+
+### Gtest
+
+Since the Hotspot Gtest suite is so quick, the default is to run all tests.
+This is specified by just `gtest`, or as a fully qualified test descriptor
+`gtest:all`.
+
+If you want, you can single out an individual test or a group of tests, for
+instance `gtest:LogDecorations` or `gtest:LogDecorations.level_test_vm`. This
+can be particularly useful if you want to run a shaky test repeatedly.
+
+## Test results and summary
+
+At the end of the test run, a summary of all tests run will be presented. This
+will have a consistent look, regardless of what test suites were used. This is
+a sample summary:
+
+ ==============================
+ Test summary
+ ==============================
+ TEST TOTAL PASS FAIL ERROR
+ >> jtreg:jdk/test:tier1 1867 1865 2 0 <<
+ jtreg:langtools/test:tier1 4711 4711 0 0
+ jtreg:nashorn/test:tier1 133 133 0 0
+ ==============================
+ TEST FAILURE
+
+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 `>> ... <<` marker
+for easy identification.
+
+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.
+
+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`,
+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
+test run.
+
+Additional work data is stored in `build/$BUILD/test-support/$TEST_ID`. For
+some frameworks, this directory might contain information that is useful in
+determining the cause of a failed test.
+
+## Test suite control
+
+It is possible to control various aspects of the test suites using make control
+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
+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
+`JTREG="TMIEOUT=8"` would give an error, while `JTREG_TMIEOUT=8` would just
+pass unnoticed.
+
+To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell
+normally eats `;`, the recommended usage is to write the assignment inside
+qoutes, e.g. `JTREG="...;..."`. This will also make sure spaces are preserved,
+as in `JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"`.
+
+(Other ways are possible, e.g. using backslash: `JTREG=JOBS=1\;TIMEOUT=8`.
+Also, as a special technique, the string `%20` will be replaced with space for
+certain options, e.g. `JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug`.
+This can be useful if you have layers of scripts and have trouble getting
+proper quoting of command line arguments through.)
+
+As far as possible, the names of the keywords have been standardized between
+test suites.
+
+### JTreg keywords
+
+#### JOBS
+The test concurrency (`-concurrency`).
+
+Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to
+JOBS, except for Hotspot, where the default is *number of CPU cores/2*, but
+never more than 12.
+
+#### TIMEOUT
+The timeout factor (`-timeoutFactor`).
+
+Defaults to 4.
+
+#### TEST_MODE
+The test mode (`-agentvm`, `-samevm` or `-othervm`).
+
+Defaults to `-agentvm`.
+
+#### ASSERT
+Enable asserts (`-ea -esa`, or none).
+
+Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except
+for hotspot.
+
+#### VERBOSE
+The verbosity level (`-verbose`).
+
+Defaults to `fail,error,summary`.
+
+#### RETAIN
+What test data to retain (`-retain`).
+
+Defaults to `fail,error`.
+
+#### 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
+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.
+
+Use `JTREG="OPTIONS=--help all"` to see all available JTreg options.
+
+#### JAVA_OPTIONS
+Additional Java options to JTreg (`-javaoption`).
+
+#### VM_OPTIONS
+Additional VM options to JTreg (`-vmoption`).
+
+### Gtest keywords
+
+#### REPEAT
+The number of times to repeat the tests (`--gtest_repeat`).
+
+Default is 1. Set to -1 to repeat indefinitely. This can be especially useful
+combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent
+problem.
+
+#### OPTIONS
+Additional options to the Gtest test framework.
+
+Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
+
+---
+# Override some definitions in http://openjdk.java.net/page.css that are
+# unsuitable for this document.
+header-includes:
+ - '<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>'
+ - '<style type="text/css">pre { font-size: 10pt; }</style>'
+---
--- a/corba/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/corba/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -408,3 +408,5 @@
18ffcf99a3b4a10457853d94190e825bdf07e39b jdk-9+162
493011dee80e51c2a2b064d049183c047df36d80 jdk-9+163
965bbae3072702f7c0d95c240523b65e6bb19261 jdk-9+164
+a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
+934c18145915b06d3fcc0de1a30f91f5aab8a192 jdk-9+166
--- a/hotspot/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -568,3 +568,5 @@
b01c519b715ef6f785d0631adee0a6537cf6c12e jdk-9+162
983fe207555724d98f4876991e1cbafbcf2733e8 jdk-9+163
0af429be8bbaeaaf0cb838e9af28c953dda6a9c8 jdk-9+164
+c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
+560d7aa083a24b6a56443feb8de0f40435d33aa9 jdk-9+166
--- a/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -917,7 +917,7 @@
break;
case 0x62: // EVEX_4bytes
- assert((UseAVX > 0), "shouldn't have EVEX prefix");
+ assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix");
assert(ip == inst+1, "no prefixes allowed");
// no EVEX collisions, all instructions that have 0x62 opcodes
// have EVEX versions and are subopcodes of 0x66
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -365,6 +365,10 @@
NOT_LP64(assert((0xC0 & ubyte_at(1)) == 0xC0, "shouldn't have LDS and LES instructions"));
return 3;
}
+ if (instr_0 == instruction_EVEX_prefix_4bytes) {
+ assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix");
+ return 4;
+ }
// First check to see if we have a (prefixed or not) xor
if (instr_0 >= instruction_prefix_wide_lo && // 0x40
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -356,6 +356,7 @@
instruction_VEX_prefix_2bytes = Assembler::VEX_2bytes,
instruction_VEX_prefix_3bytes = Assembler::VEX_3bytes,
+ instruction_EVEX_prefix_4bytes = Assembler::EVEX_4bytes,
instruction_size = 4,
instruction_offset = 0,
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Mon Apr 24 21:34:23 2017 +0200
@@ -179,11 +179,14 @@
if (hotspotField.isStatic()) {
HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass();
if (holder.isInitialized()) {
- return memoryAccess.readUnsafeConstant(hotspotField.getJavaKind(), HotSpotObjectConstantImpl.forObject(holder.mirror()), hotspotField.offset());
+ return memoryAccess.readFieldValue(hotspotField, holder.mirror());
}
} else {
- if (receiver.isNonNull() && hotspotField.isInObject(((HotSpotObjectConstantImpl) receiver).object())) {
- return memoryAccess.readUnsafeConstant(hotspotField.getJavaKind(), receiver, hotspotField.offset());
+ if (receiver.isNonNull()) {
+ Object object = ((HotSpotObjectConstantImpl) receiver).object();
+ if (hotspotField.isInObject(object)) {
+ return memoryAccess.readFieldValue(hotspotField, object);
+ }
}
}
return null;
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Mon Apr 24 21:34:23 2017 +0200
@@ -31,6 +31,10 @@
*/
public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider {
+ /**
+ * @throws IllegalArgumentException if the address computed from {@code base} and
+ * {@code displacement} does not denote a location holding a narrow oop
+ */
JavaConstant readNarrowOopConstant(Constant base, long displacement);
Constant readKlassPointerConstant(Constant base, long displacement);
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -22,13 +22,21 @@
*/
package jdk.vm.ci.hotspot;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
+import java.lang.reflect.Array;
+
+import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MemoryAccessProvider;
+import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.PrimitiveConstant;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* HotSpot implementation of {@link MemoryAccessProvider}.
@@ -41,12 +49,93 @@
this.runtime = runtime;
}
- private static Object asObject(Constant base) {
+ /**
+ * Gets the object boxed by {@code base} that is about to have a value of kind {@code kind} read
+ * from it at the offset {@code displacement}.
+ *
+ * @param base constant value containing the base address for a pending read
+ * @return {@code null} if {@code base} does not box an object otherwise the object boxed in
+ * {@code base}
+ */
+ private Object asObject(Constant base, JavaKind kind, long displacement) {
if (base instanceof HotSpotObjectConstantImpl) {
- return ((HotSpotObjectConstantImpl) base).object();
+ HotSpotObjectConstantImpl constant = (HotSpotObjectConstantImpl) base;
+ HotSpotResolvedObjectType type = constant.getType();
+ Object object = constant.object();
+ checkRead(kind, displacement, type, object);
+ return object;
+ }
+ return null;
+ }
+
+ /**
+ * Offset of injected {@code java.lang.Class::oop_size} field. No need to make {@code volatile}
+ * as initialization is idempotent.
+ */
+ private long oopSizeOffset;
+
+ private static int computeOopSizeOffset(HotSpotJVMCIRuntimeProvider runtime) {
+ MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess();
+ ResolvedJavaType staticType = metaAccess.lookupJavaType(Class.class);
+ for (ResolvedJavaField f : staticType.getInstanceFields(false)) {
+ if (f.getName().equals("oop_size")) {
+ int offset = ((HotSpotResolvedJavaField) f).offset();
+ assert offset != 0 : "not expecting offset of java.lang.Class::oop_size to be 0";
+ return offset;
+ }
+ }
+ throw new JVMCIError("Could not find injected java.lang.Class::oop_size field");
+ }
+
+ private boolean checkRead(JavaKind kind, long displacement, HotSpotResolvedObjectType type, Object object) {
+ if (type.isArray()) {
+ ResolvedJavaType componentType = type.getComponentType();
+ JavaKind componentKind = componentType.getJavaKind();
+ final int headerSize = getArrayBaseOffset(componentKind);
+ int sizeOfElement = getArrayIndexScale(componentKind);
+ int length = Array.getLength(object);
+ long arrayEnd = headerSize + (sizeOfElement * length);
+ boolean aligned = ((displacement - headerSize) % sizeOfElement) == 0;
+ if (displacement < 0 || displacement > (arrayEnd - sizeOfElement) || (kind == JavaKind.Object && !aligned)) {
+ int index = (int) ((displacement - headerSize) / sizeOfElement);
+ throw new AssertionError("Unsafe array access: reading element of kind " + kind +
+ " at offset " + displacement + " (index ~ " + index + ") in " +
+ type.toJavaName() + " object of length " + length);
+ }
+ } else if (kind != JavaKind.Object) {
+ long size;
+ if (object instanceof Class) {
+ if (oopSizeOffset == 0) {
+ oopSizeOffset = computeOopSizeOffset(runtime);
+ }
+ int wordSize = runtime.getHostJVMCIBackend().getCodeCache().getTarget().wordSize;
+ size = UNSAFE.getInt(object, oopSizeOffset) * wordSize;
+ } else {
+ size = Math.abs(type.instanceSize());
+ }
+ int bytesToRead = kind.getByteCount();
+ if (displacement + bytesToRead > size || displacement < 0) {
+ throw new IllegalArgumentException("Unsafe access: reading " + bytesToRead + " bytes at offset " + displacement + " in " +
+ type.toJavaName() + " object of size " + size);
+ }
} else {
- return null;
+ ResolvedJavaField field = type.findInstanceFieldWithOffset(displacement, JavaKind.Object);
+ if (field == null && object instanceof Class) {
+ // Read of a static field
+ MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess();
+ HotSpotResolvedObjectTypeImpl staticFieldsHolder = (HotSpotResolvedObjectTypeImpl) metaAccess.lookupJavaType((Class<?>) object);
+ field = staticFieldsHolder.findStaticFieldWithOffset(displacement, JavaKind.Object);
+ }
+ if (field == null) {
+ throw new IllegalArgumentException("Unsafe object access: field not found for read of kind Object" +
+ " at offset " + displacement + " in " + type.toJavaName() + " object");
+ }
+ if (field.getJavaKind() != JavaKind.Object) {
+ throw new IllegalArgumentException("Unsafe object access: field " + field.format("%H.%n:%T") + " not of expected kind Object" +
+ " at offset " + displacement + " in " + type.toJavaName() + " object");
+ }
}
+ return true;
}
private boolean isValidObjectFieldDisplacement(Constant base, long displacement) {
@@ -77,8 +166,8 @@
throw new IllegalArgumentException(String.valueOf(base));
}
- private static long readRawValue(Constant baseConstant, long displacement, int bits) {
- Object base = asObject(baseConstant);
+ private long readRawValue(Constant baseConstant, long displacement, JavaKind kind, int bits) {
+ Object base = asObject(baseConstant, kind, displacement);
if (base != null) {
switch (bits) {
case Byte.SIZE:
@@ -123,9 +212,8 @@
private Object readRawObject(Constant baseConstant, long initialDisplacement, boolean compressed) {
long displacement = initialDisplacement;
-
Object ret;
- Object base = asObject(baseConstant);
+ Object base = asObject(baseConstant, JavaKind.Object, displacement);
if (base == null) {
assert !compressed;
displacement += asRawPointer(baseConstant);
@@ -138,34 +226,43 @@
return ret;
}
- /**
- * Reads a value of this kind using a base address and a displacement. No bounds checking or
- * type checking is performed. Returns {@code null} if the value is not available at this point.
- *
- * @param baseConstant the base address from which the value is read.
- * @param displacement the displacement within the object in bytes
- * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
- * value cannot be read.
- * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not
- * {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind
- */
- JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) {
- if (kind == null) {
- throw new IllegalArgumentException("null JavaKind");
- }
- if (kind == JavaKind.Object) {
- Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops);
+ JavaConstant readFieldValue(HotSpotResolvedJavaField field, Object obj) {
+ assert obj != null;
+ assert !field.isStatic() || obj instanceof Class;
+ long displacement = field.offset();
+ assert checkRead(field.getJavaKind(), displacement, (HotSpotResolvedObjectType) runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(obj.getClass()), obj);
+ if (field.getJavaKind() == JavaKind.Object) {
+ Object o = UNSAFE.getObject(obj, displacement);
return HotSpotObjectConstantImpl.forObject(o);
} else {
- int bits = kind.getByteCount() * Byte.SIZE;
- return readPrimitiveConstant(kind, baseConstant, displacement, bits);
+ JavaKind kind = field.getJavaKind();
+ switch (kind) {
+ case Boolean:
+ return JavaConstant.forBoolean(UNSAFE.getBoolean(obj, displacement));
+ case Byte:
+ return JavaConstant.forByte(UNSAFE.getByte(obj, displacement));
+ case Char:
+ return JavaConstant.forChar(UNSAFE.getChar(obj, displacement));
+ case Short:
+ return JavaConstant.forShort(UNSAFE.getShort(obj, displacement));
+ case Int:
+ return JavaConstant.forInt(UNSAFE.getInt(obj, displacement));
+ case Long:
+ return JavaConstant.forLong(UNSAFE.getLong(obj, displacement));
+ case Float:
+ return JavaConstant.forFloat(UNSAFE.getFloat(obj, displacement));
+ case Double:
+ return JavaConstant.forDouble(UNSAFE.getDouble(obj, displacement));
+ default:
+ throw new IllegalArgumentException("Unsupported kind: " + kind);
+ }
}
}
@Override
public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) {
try {
- long rawValue = readRawValue(baseConstant, initialDisplacement, bits);
+ long rawValue = readRawValue(baseConstant, initialDisplacement, kind, bits);
switch (kind) {
case Boolean:
return JavaConstant.forBoolean(rawValue != 0);
@@ -193,6 +290,10 @@
@Override
public JavaConstant readObjectConstant(Constant base, long displacement) {
+ if (base instanceof HotSpotObjectConstantImpl) {
+ Object o = readRawObject(base, displacement, runtime.getConfig().useCompressedOops);
+ return HotSpotObjectConstantImpl.forObject(o);
+ }
if (!isValidObjectFieldDisplacement(base, displacement)) {
return null;
}
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -847,6 +847,15 @@
@Override
public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedEntryKind) {
ResolvedJavaField[] declaredFields = getInstanceFields(true);
+ return findFieldWithOffset(offset, expectedEntryKind, declaredFields);
+ }
+
+ public ResolvedJavaField findStaticFieldWithOffset(long offset, JavaKind expectedEntryKind) {
+ ResolvedJavaField[] declaredFields = getStaticFields();
+ return findFieldWithOffset(offset, expectedEntryKind, declaredFields);
+ }
+
+ private static ResolvedJavaField findFieldWithOffset(long offset, JavaKind expectedEntryKind, ResolvedJavaField[] declaredFields) {
for (ResolvedJavaField field : declaredFields) {
HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field;
long resolvedFieldOffset = resolvedField.offset();
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java Mon Apr 24 21:34:23 2017 +0200
@@ -35,9 +35,9 @@
* @param displacement the displacement within the object in bytes
* @param bits the number of bits to read from memory
* @return the read value encapsulated in a {@link JavaConstant} object of {@link JavaKind} kind
- * @throws IllegalArgumentException if {@code kind} is {@link JavaKind#Void} or not
- * {@linkplain JavaKind#isPrimitive() primitive} kind or {@code bits} is not 8, 16,
- * 32 or 64
+ * @throws IllegalArgumentException if the read is out of bounds of the object or {@code kind}
+ * is {@link JavaKind#Void} or not {@linkplain JavaKind#isPrimitive() primitive}
+ * kind or {@code bits} is not 8, 16, 32 or 64
*/
JavaConstant readPrimitiveConstant(JavaKind kind, Constant base, long displacement, int bits) throws IllegalArgumentException;
@@ -46,9 +46,9 @@
*
* @param base the base address from which the value is read
* @param displacement the displacement within the object in bytes
- * @return the read value encapsulated in a {@link Constant} object or {@code null} if the
- * address computed from {@code base} and {@code displacement} does not denote a
- * location holding an {@code Object} value
+ * @return the read value encapsulated in a {@link Constant} object
+ * @throws IllegalArgumentException if the address computed from {@code base} and
+ * {@code displacement} does not denote a location holding an {@code Object} value
*/
JavaConstant readObjectConstant(Constant base, long displacement);
}
--- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,6 +28,7 @@
import java.util.Iterator;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
+import java.util.Set;
/**
* A mechanism for accessing service providers via JVMCI.
@@ -108,7 +109,7 @@
Object jvmci = invoke(getModule, Services.class);
Object requestorModule = invoke(getModule, requestor);
if (jvmci != requestorModule) {
- String[] packages = invoke(getPackages, jvmci);
+ Set<String> packages = invoke(getPackages, jvmci);
for (String pkg : packages) {
// Export all JVMCI packages dynamically instead
// of requiring a long list of --add-exports
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java Mon Apr 24 21:34:23 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
@@ -58,22 +58,22 @@
public static final ModuleAPI addExports;
/**
- * {@code java.lang.reflect.Module.getResourceAsStream(String)}.
+ * {@code java.lang.Module.getResourceAsStream(String)}.
*/
public static final ModuleAPI getResourceAsStream;
/**
- * {@code java.lang.reflect.Module.canRead(Module)}.
+ * {@code java.lang.Module.canRead(Module)}.
*/
public static final ModuleAPI canRead;
/**
- * {@code java.lang.reflect.Module.isExported(String)}.
+ * {@code java.lang.Module.isExported(String)}.
*/
public static final ModuleAPI isExported;
/**
- * {@code java.lang.reflect.Module.isExported(String, Module)}.
+ * {@code java.lang.Module.isExported(String, Module)}.
*/
public static final ModuleAPI isExportedTo;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,9 +28,6 @@
import java.util.HashMap;
import java.util.Map.Entry;
-import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
-import jdk.vm.ci.meta.JavaConstant;
-
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.iterators.NodeIterable;
import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
@@ -43,6 +40,9 @@
import org.graalvm.compiler.phases.BasePhase;
import org.graalvm.compiler.phases.tiers.PhaseContext;
+import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
+import jdk.vm.ci.meta.Constant;
+
public class EliminateRedundantInitializationPhase extends BasePhase<PhaseContext> {
/**
* Find blocks with class initializing nodes for the class identified the by the constant node.
@@ -202,7 +202,7 @@
ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, false, true, false);
ArrayList<Node> redundantInits = new ArrayList<>();
for (ConstantNode node : getConstantNodes(graph)) {
- JavaConstant constant = node.asJavaConstant();
+ Constant constant = node.asConstant();
if (constant instanceof HotSpotMetaspaceConstant) {
redundantInits.addAll(processConstantNode(cfg, node));
}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java Mon Apr 24 21:34:23 2017 +0200
@@ -29,14 +29,14 @@
public class ExportingClassLoader extends ClassLoader {
public ExportingClassLoader() {
if (!GraalTest.Java8OrEarlier) {
- JLRModule.fromClass(getClass()).exportAllPackagesTo(JLRModule.getUnnamedModuleFor(this));
+ JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this));
}
}
public ExportingClassLoader(ClassLoader parent) {
super(parent);
if (!GraalTest.Java8OrEarlier) {
- JLRModule.fromClass(getClass()).exportAllPackagesTo(JLRModule.getUnnamedModuleFor(this));
+ JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this));
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,130 @@
+/*
+ * 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 org.graalvm.compiler.test;
+
+import java.lang.reflect.Method;
+import java.util.Set;
+
+/**
+ * Facade for the {@code java.lang.Module} class introduced in JDK9 that allows tests to be
+ * developed against JDK8 but use module logic if deployed on JDK9.
+ */
+public class JLModule {
+
+ static {
+ if (GraalTest.Java8OrEarlier) {
+ throw new AssertionError("Use of " + JLModule.class + " only allowed if " + GraalTest.class.getName() + ".JDK8OrEarlier is false");
+ }
+ }
+
+ private final Object realModule;
+
+ public JLModule(Object module) {
+ this.realModule = module;
+ }
+
+ private static final Class<?> moduleClass;
+ private static final Method getModuleMethod;
+ private static final Method getUnnamedModuleMethod;
+ private static final Method getPackagesMethod;
+ private static final Method isExportedMethod;
+ private static final Method isExported2Method;
+ private static final Method addExportsMethod;
+ static {
+ try {
+ moduleClass = Class.forName("java.lang.Module");
+ getModuleMethod = Class.class.getMethod("getModule");
+ getUnnamedModuleMethod = ClassLoader.class.getMethod("getUnnamedModule");
+ getPackagesMethod = moduleClass.getMethod("getPackages");
+ isExportedMethod = moduleClass.getMethod("isExported", String.class);
+ isExported2Method = moduleClass.getMethod("isExported", String.class, moduleClass);
+ addExportsMethod = moduleClass.getMethod("addExports", String.class, moduleClass);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public static JLModule fromClass(Class<?> cls) {
+ try {
+ return new JLModule(getModuleMethod.invoke(cls));
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public static JLModule getUnnamedModuleFor(ClassLoader cl) {
+ try {
+ return new JLModule(getUnnamedModuleMethod.invoke(cl));
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ /**
+ * Exports all packages in this module to a given module.
+ */
+ public void exportAllPackagesTo(JLModule module) {
+ if (this != module) {
+ for (String pkg : getPackages()) {
+ // Export all JVMCI packages dynamically instead
+ // of requiring a long list of -XaddExports
+ // options on the JVM command line.
+ if (!isExported(pkg, module)) {
+ addExports(pkg, module);
+ }
+ }
+ }
+ }
+
+ public Set<String> getPackages() {
+ try {
+ return (Set<String>) getPackagesMethod.invoke(realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public boolean isExported(String pn) {
+ try {
+ return (Boolean) isExportedMethod.invoke(realModule, pn);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public boolean isExported(String pn, JLModule other) {
+ try {
+ return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public void addExports(String pn, JLModule other) {
+ try {
+ addExportsMethod.invoke(realModule, pn, other.realModule);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLRModule.java Mon Apr 24 12:08:09 2017 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +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 org.graalvm.compiler.test;
-
-import java.lang.reflect.Method;
-
-/**
- * Facade for the {@code java.lang.reflect.Module} class introduced in JDK9 that allows tests to be
- * developed against JDK8 but use module logic if deployed on JDK9.
- */
-public class JLRModule {
-
- static {
- if (GraalTest.Java8OrEarlier) {
- throw new AssertionError("Use of " + JLRModule.class + " only allowed if " + GraalTest.class.getName() + ".JDK8OrEarlier is false");
- }
- }
-
- private final Object realModule;
-
- public JLRModule(Object module) {
- this.realModule = module;
- }
-
- private static final Class<?> moduleClass;
- private static final Method getModuleMethod;
- private static final Method getUnnamedModuleMethod;
- private static final Method getPackagesMethod;
- private static final Method isExportedMethod;
- private static final Method isExported2Method;
- private static final Method addExportsMethod;
- static {
- try {
- moduleClass = Class.forName("java.lang.reflect.Module");
- getModuleMethod = Class.class.getMethod("getModule");
- getUnnamedModuleMethod = ClassLoader.class.getMethod("getUnnamedModule");
- getPackagesMethod = moduleClass.getMethod("getPackages");
- isExportedMethod = moduleClass.getMethod("isExported", String.class);
- isExported2Method = moduleClass.getMethod("isExported", String.class, moduleClass);
- addExportsMethod = moduleClass.getMethod("addExports", String.class, moduleClass);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- public static JLRModule fromClass(Class<?> cls) {
- try {
- return new JLRModule(getModuleMethod.invoke(cls));
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- public static JLRModule getUnnamedModuleFor(ClassLoader cl) {
- try {
- return new JLRModule(getUnnamedModuleMethod.invoke(cl));
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- /**
- * Exports all packages in this module to a given module.
- */
- public void exportAllPackagesTo(JLRModule module) {
- if (this != module) {
- for (String pkg : getPackages()) {
- // Export all JVMCI packages dynamically instead
- // of requiring a long list of -XaddExports
- // options on the JVM command line.
- if (!isExported(pkg, module)) {
- addExports(pkg, module);
- }
- }
- }
- }
-
- public String[] getPackages() {
- try {
- return (String[]) getPackagesMethod.invoke(realModule);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- public boolean isExported(String pn) {
- try {
- return (Boolean) isExportedMethod.invoke(realModule, pn);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- public boolean isExported(String pn, JLRModule other) {
- try {
- return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- public void addExports(String pn, JLRModule other) {
- try {
- addExportsMethod.invoke(realModule, pn, other.realModule);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-}
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -5406,7 +5406,7 @@
ModuleEntry* module_entry = ik->module();
assert(module_entry != NULL, "module_entry should always be set");
- // Obtain java.lang.reflect.Module
+ // Obtain java.lang.Module
Handle module_handle(THREAD, JNIHandles::resolve(module_entry->module()));
// Allocate mirror and initialize static fields
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -773,13 +773,13 @@
InstanceKlass::cast(k())->do_local_static_fields(&initialize_static_field, mirror, CHECK);
}
-// Set the java.lang.reflect.Module module field in the java_lang_Class mirror
+// Set the java.lang.Module module field in the java_lang_Class mirror
void java_lang_Class::set_mirror_module_field(KlassHandle k, Handle mirror, Handle module, TRAPS) {
if (module.is_null()) {
// During startup, the module may be NULL only if java.base has not been defined yet.
- // Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module
+ // Put the class on the fixup_module_list to patch later when the java.lang.Module
// for java.base is known.
- assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization");
+ assert(!Universe::is_module_initialized(), "Incorrect java.lang.Module pre module system initialization");
bool javabase_was_defined = false;
{
@@ -810,7 +810,7 @@
assert(Universe::is_module_initialized() ||
(ModuleEntryTable::javabase_defined() &&
(module() == JNIHandles::resolve(ModuleEntryTable::javabase_moduleEntry()->module()))),
- "Incorrect java.lang.reflect.Module specification while creating mirror");
+ "Incorrect java.lang.Module specification while creating mirror");
set_module(mirror(), module());
}
}
@@ -2804,28 +2804,28 @@
}
-int java_lang_reflect_Module::loader_offset;
-int java_lang_reflect_Module::name_offset;
-int java_lang_reflect_Module::_module_entry_offset = -1;
-
-Handle java_lang_reflect_Module::create(Handle loader, Handle module_name, TRAPS) {
+int java_lang_Module::loader_offset;
+int java_lang_Module::name_offset;
+int java_lang_Module::_module_entry_offset = -1;
+
+Handle java_lang_Module::create(Handle loader, Handle module_name, TRAPS) {
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
- Symbol* name = vmSymbols::java_lang_reflect_Module();
+ Symbol* name = vmSymbols::java_lang_Module();
Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH);
instanceKlassHandle klass (THREAD, k);
- Handle jlrmh = klass->allocate_instance_handle(CHECK_NH);
+ Handle jlmh = klass->allocate_instance_handle(CHECK_NH);
JavaValue result(T_VOID);
- JavaCalls::call_special(&result, jlrmh, KlassHandle(THREAD, klass()),
+ JavaCalls::call_special(&result, jlmh, KlassHandle(THREAD, klass()),
vmSymbols::object_initializer_name(),
- vmSymbols::java_lang_reflect_module_init_signature(),
+ vmSymbols::java_lang_module_init_signature(),
loader, module_name, CHECK_NH);
- return jlrmh;
-}
-
-void java_lang_reflect_Module::compute_offsets() {
- Klass* k = SystemDictionary::reflect_Module_klass();
+ return jlmh;
+}
+
+void java_lang_Module::compute_offsets() {
+ Klass* k = SystemDictionary::Module_klass();
if(NULL != k) {
compute_offset(loader_offset, k, vmSymbols::loader_name(), vmSymbols::classloader_signature());
compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature());
@@ -2834,27 +2834,27 @@
}
-oop java_lang_reflect_Module::loader(oop module) {
+oop java_lang_Module::loader(oop module) {
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
return module->obj_field(loader_offset);
}
-void java_lang_reflect_Module::set_loader(oop module, oop value) {
+void java_lang_Module::set_loader(oop module, oop value) {
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
module->obj_field_put(loader_offset, value);
}
-oop java_lang_reflect_Module::name(oop module) {
+oop java_lang_Module::name(oop module) {
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
return module->obj_field(name_offset);
}
-void java_lang_reflect_Module::set_name(oop module, oop value) {
+void java_lang_Module::set_name(oop module, oop value) {
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
module->obj_field_put(name_offset, value);
}
-ModuleEntry* java_lang_reflect_Module::module_entry(oop module, TRAPS) {
+ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) {
assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null");
assert(module->is_oop(), "module must be oop");
@@ -2863,7 +2863,7 @@
if (module_entry == NULL) {
// If the inject field containing the ModuleEntry* is null then return the
// class loader's unnamed module.
- oop loader = java_lang_reflect_Module::loader(module);
+ oop loader = java_lang_Module::loader(module);
Handle h_loader = Handle(THREAD, loader);
ClassLoaderData* loader_cld = SystemDictionary::register_loader(h_loader, CHECK_NULL);
return loader_cld->modules()->unnamed_module();
@@ -2871,7 +2871,7 @@
return module_entry;
}
-void java_lang_reflect_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
+void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) {
assert(_module_entry_offset != -1, "Uninitialized module_entry_offset");
assert(module != NULL, "module can't be null");
assert(module->is_oop(), "module must be oop");
@@ -3877,7 +3877,7 @@
reflect_ConstantPool::compute_offsets();
reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
java_lang_reflect_Parameter::compute_offsets();
- java_lang_reflect_Module::compute_offsets();
+ java_lang_Module::compute_offsets();
java_lang_StackFrameInfo::compute_offsets();
java_lang_LiveStackFrameInfo::compute_offsets();
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -755,9 +755,9 @@
};
#define MODULE_INJECTED_FIELDS(macro) \
- macro(java_lang_reflect_Module, module_entry, intptr_signature, false)
+ macro(java_lang_Module, module_entry, intptr_signature, false)
-class java_lang_reflect_Module {
+class java_lang_Module {
private:
static int loader_offset;
static int name_offset;
--- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -162,8 +162,8 @@
return obj != NULL && is_subclass(obj->klass());
}
-inline bool java_lang_reflect_Module::is_instance(oop obj) {
- return obj != NULL && obj->klass() == SystemDictionary::reflect_Module_klass();
+inline bool java_lang_Module::is_instance(oop obj) {
+ return obj != NULL && obj->klass() == SystemDictionary::Module_klass();
}
inline int Backtrace::merge_bci_and_version(int bci, int version) {
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -266,19 +266,19 @@
// Each ModuleEntryTable has exactly one unnamed module
if (loader_data->is_the_null_class_loader_data()) {
- // For the boot loader, the java.lang.reflect.Module for the unnamed module
+ // For the boot loader, the java.lang.Module for the unnamed module
// is not known until a call to JVM_SetBootLoaderUnnamedModule is made. At
// this point initially create the ModuleEntry for the unnamed module.
_unnamed_module = new_entry(0, Handle(NULL), NULL, NULL, NULL, loader_data);
} else {
- // For all other class loaders the java.lang.reflect.Module for their
+ // For all other class loaders the java.lang.Module for their
// corresponding unnamed module can be found in the java.lang.ClassLoader object.
oop module = java_lang_ClassLoader::unnamedModule(loader_data->class_loader());
_unnamed_module = new_entry(0, Handle(module), NULL, NULL, NULL, loader_data);
- // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module
+ // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module
// object.
- java_lang_reflect_Module::set_module_entry(module, _unnamed_module);
+ java_lang_Module::set_module_entry(module, _unnamed_module);
}
// Add to bucket 0, no name to hash on
@@ -388,27 +388,27 @@
fatal("Unable to finalize module definition for " JAVA_BASE_NAME);
}
- // Set java.lang.reflect.Module, version and location for java.base
+ // Set java.lang.Module, version and location for java.base
ModuleEntry* jb_module = javabase_moduleEntry();
assert(jb_module != NULL, JAVA_BASE_NAME " ModuleEntry not defined");
jb_module->set_version(version);
jb_module->set_location(location);
// Once java.base's ModuleEntry _module field is set with the known
- // java.lang.reflect.Module, java.base is considered "defined" to the VM.
+ // java.lang.Module, java.base is considered "defined" to the VM.
jb_module->set_module(boot_loader_data->add_handle(module_handle));
- // Store pointer to the ModuleEntry for java.base in the java.lang.reflect.Module object.
- java_lang_reflect_Module::set_module_entry(module_handle(), jb_module);
+ // Store pointer to the ModuleEntry for java.base in the java.lang.Module object.
+ java_lang_Module::set_module_entry(module_handle(), jb_module);
}
-// Within java.lang.Class instances there is a java.lang.reflect.Module field
-// that must be set with the defining module. During startup, prior to java.base's
-// definition, classes needing their module field set are added to the fixup_module_list.
-// Their module field is set once java.base's java.lang.reflect.Module is known to the VM.
+// Within java.lang.Class instances there is a java.lang.Module field that must
+// be set with the defining module. During startup, prior to java.base's definition,
+// classes needing their module field set are added to the fixup_module_list.
+// Their module field is set once java.base's java.lang.Module is known to the VM.
void ModuleEntryTable::patch_javabase_entries(Handle module_handle) {
if (module_handle.is_null()) {
fatal("Unable to patch the module field of classes loaded prior to "
- JAVA_BASE_NAME "'s definition, invalid java.lang.reflect.Module");
+ JAVA_BASE_NAME "'s definition, invalid java.lang.Module");
}
// Do the fixups for the basic primitive types
--- a/hotspot/src/share/vm/classfile/moduleEntry.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/moduleEntry.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -45,7 +45,7 @@
// A ModuleEntry describes a module that has been defined by a call to JVM_DefineModule.
// It contains:
// - Symbol* containing the module's name.
-// - pointer to the java.lang.reflect.Module for this module.
+// - pointer to the java.lang.Module for this module.
// - pointer to the java.security.ProtectionDomain shared by classes defined to this module.
// - ClassLoaderData*, class loader of this module.
// - a growable array containg other module entries that this module can read.
@@ -55,7 +55,7 @@
// data structure.
class ModuleEntry : public HashtableEntry<Symbol*, mtModule> {
private:
- jobject _module; // java.lang.reflect.Module
+ jobject _module; // java.lang.Module
jobject _pd; // java.security.ProtectionDomain, cached
// for shared classes from this module
ClassLoaderData* _loader_data;
--- a/hotspot/src/share/vm/classfile/modules.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/modules.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -62,7 +62,7 @@
}
static char* get_module_name(oop module, TRAPS) {
- oop name_oop = java_lang_reflect_Module::name(module);
+ oop name_oop = java_lang_Module::name(module);
if (name_oop == NULL) {
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Null module name");
}
@@ -98,11 +98,11 @@
static ModuleEntry* get_module_entry(jobject module, TRAPS) {
Handle module_h(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(module_h())) {
+ if (!java_lang_Module::is_instance(module_h())) {
THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(),
- "module is not an instance of type java.lang.reflect.Module");
+ "module is not an instance of type java.lang.Module");
}
- return java_lang_reflect_Module::module_entry(module_h(), CHECK_NULL);
+ return java_lang_Module::module_entry(module_h(), CHECK_NULL);
}
static PackageEntry* get_package_entry(ModuleEntry* module_entry, const char* package_name, TRAPS) {
@@ -181,7 +181,7 @@
}
// Validate java_base's loader is the boot loader.
- oop loader = java_lang_reflect_Module::loader(module_handle());
+ oop loader = java_lang_Module::loader(module_handle());
if (loader != NULL) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Class loader must be the boot class loader");
@@ -234,7 +234,7 @@
// Only the thread that actually defined the base module will get here,
// so no locking is needed.
- // Patch any previously loaded class's module field with java.base's java.lang.reflect.Module.
+ // Patch any previously loaded class's module field with java.base's java.lang.Module.
ModuleEntryTable::patch_javabase_entries(module_handle);
log_debug(modules)("define_javabase_module(): Definition of module: "
@@ -284,9 +284,9 @@
}
Handle module_handle(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(module_handle())) {
+ if (!java_lang_Module::is_instance(module_handle())) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "module is not an instance of type java.lang.reflect.Module");
+ "module is not an instance of type java.lang.Module");
}
char* module_name = get_module_name(module_handle(), CHECK);
@@ -303,7 +303,7 @@
const char* module_version = get_module_version(version);
- oop loader = java_lang_reflect_Module::loader(module_handle());
+ oop loader = java_lang_Module::loader(module_handle());
// Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader.
if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
@@ -424,8 +424,8 @@
pkg_list->at(y)->decrement_refcount();
}
- // Store pointer to ModuleEntry record in java.lang.reflect.Module object.
- java_lang_reflect_Module::set_module_entry(module_handle(), module_entry);
+ // Store pointer to ModuleEntry record in java.lang.Module object.
+ java_lang_Module::set_module_entry(module_handle(), module_entry);
}
}
} // Release the lock
@@ -467,20 +467,20 @@
THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object");
}
Handle module_handle(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(module_handle())) {
+ if (!java_lang_Module::is_instance(module_handle())) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "module is not an instance of type java.lang.reflect.Module");
+ "module is not an instance of type java.lang.Module");
}
// Ensure that this is an unnamed module
- oop name = java_lang_reflect_Module::name(module_handle());
+ oop name = java_lang_Module::name(module_handle());
if (name != NULL) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "boot loader's unnamed module's java.lang.reflect.Module has a name");
+ "boot loader's unnamed module's java.lang.Module has a name");
}
// Validate java_base's loader is the boot loader.
- oop loader = java_lang_reflect_Module::loader(module_handle());
+ oop loader = java_lang_Module::loader(module_handle());
if (loader != NULL) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Class loader must be the boot class loader");
@@ -492,12 +492,12 @@
// Ensure the boot loader's PackageEntryTable has been created
ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK);
- // Set java.lang.reflect.Module for the boot loader's unnamed module
+ // Set java.lang.Module for the boot loader's unnamed module
ModuleEntry* unnamed_module = module_table->unnamed_module();
assert(unnamed_module != NULL, "boot loader's unnamed ModuleEntry not defined");
unnamed_module->set_module(ClassLoaderData::the_null_class_loader_data()->add_handle(module_handle));
- // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module object.
- java_lang_reflect_Module::set_module_entry(module_handle(), unnamed_module);
+ // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module object.
+ java_lang_Module::set_module_entry(module_handle(), unnamed_module);
}
void Modules::add_module_exports(jobject from_module, const char* package_name, jobject to_module, TRAPS) {
@@ -627,13 +627,13 @@
oop module = java_lang_Class::module(mirror);
assert(module != NULL, "java.lang.Class module field not set");
- assert(java_lang_reflect_Module::is_instance(module), "module is not an instance of type java.lang.reflect.Module");
+ assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module");
if (log_is_enabled(Debug, modules)) {
ResourceMark rm(THREAD);
outputStream* logst = Log(modules)::debug_stream();
Klass* klass = java_lang_Class::as_Klass(mirror);
- oop module_name = java_lang_reflect_Module::name(module);
+ oop module_name = java_lang_Module::name(module);
if (module_name != NULL) {
logst->print("get_module(): module ");
java_lang_String::print(module_name, tty);
--- a/hotspot/src/share/vm/classfile/modules.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/modules.hpp Mon Apr 24 21:34:23 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
@@ -55,12 +55,12 @@
jstring location, const char* const* packages,
jsize num_packages, TRAPS);
- // Provides the java.lang.reflect.Module for the unnamed module defined
+ // Provides the java.lang.Module for the unnamed module defined
// to the boot loader.
//
// IllegalArgumentExceptions are thrown for the following :
// * Module has a name
- // * Module is not a subclass of java.lang.reflect.Module
+ // * Module is not a subclass of java.lang.Module
// * Module's class loader is not the boot loader
// NullPointerExceptions are thrown if module is null.
static void set_bootloader_unnamed_module(jobject module, TRAPS);
@@ -96,10 +96,10 @@
// module does not exist.
static void add_reads_module(jobject from_module, jobject to_module, TRAPS);
- // Return the java.lang.reflect.Module object for this class object.
+ // Return the java.lang.Module object for this class object.
static jobject get_module(jclass clazz, TRAPS);
- // Return the java.lang.reflect.Module object for this class loader and package.
+ // Return the java.lang.Module object for this class loader and package.
// Returns NULL if the class loader has not loaded any classes in the package.
// The package should contain /'s, not .'s, as in java/lang, not java.lang.
// NullPointerException is thrown if package is null.
@@ -109,7 +109,7 @@
static jobject get_named_module(Handle h_loader, const char* package, TRAPS);
// If package is defined by loader, return the
- // java.lang.reflect.Module object for the module in which the package is defined.
+ // java.lang.Module object for the module in which the package is defined.
// Returns NULL if package is invalid or not defined by loader.
static jobject get_module(Symbol* package_name, Handle h_loader, TRAPS);
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp Mon Apr 24 21:34:23 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
@@ -133,9 +133,9 @@
do_klass(Thread_klass, java_lang_Thread, Pre ) \
do_klass(ThreadGroup_klass, java_lang_ThreadGroup, Pre ) \
do_klass(Properties_klass, java_util_Properties, Pre ) \
+ do_klass(Module_klass, java_lang_Module, Pre ) \
do_klass(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject, Pre ) \
do_klass(reflect_Field_klass, java_lang_reflect_Field, Pre ) \
- do_klass(reflect_Module_klass, java_lang_reflect_Module, Pre ) \
do_klass(reflect_Parameter_klass, java_lang_reflect_Parameter, Opt ) \
do_klass(reflect_Method_klass, java_lang_reflect_Method, Pre ) \
do_klass(reflect_Constructor_klass, java_lang_reflect_Constructor, Pre ) \
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -56,6 +56,7 @@
template(java_lang_Object, "java/lang/Object") \
template(java_lang_Class, "java/lang/Class") \
template(java_lang_Package, "java/lang/Package") \
+ template(java_lang_Module, "java/lang/Module") \
template(java_lang_String, "java/lang/String") \
template(java_lang_StringLatin1, "java/lang/StringLatin1") \
template(java_lang_StringUTF16, "java/lang/StringUTF16") \
@@ -90,7 +91,6 @@
template(java_lang_reflect_Method, "java/lang/reflect/Method") \
template(java_lang_reflect_Constructor, "java/lang/reflect/Constructor") \
template(java_lang_reflect_Field, "java/lang/reflect/Field") \
- template(java_lang_reflect_Module, "java/lang/reflect/Module") \
template(java_lang_reflect_Parameter, "java/lang/reflect/Parameter") \
template(java_lang_reflect_Array, "java/lang/reflect/Array") \
template(java_lang_StringBuffer, "java/lang/StringBuffer") \
@@ -136,7 +136,7 @@
template(initPhase1_name, "initPhase1") \
template(initPhase2_name, "initPhase2") \
template(initPhase3_name, "initPhase3") \
- template(java_lang_reflect_module_init_signature, "(Ljava/lang/ClassLoader;Ljava/lang/String;)V") \
+ template(java_lang_module_init_signature, "(Ljava/lang/ClassLoader;Ljava/lang/String;)V") \
\
/* class file format tags */ \
template(tag_source_file, "SourceFile") \
@@ -450,7 +450,7 @@
template(getModule_name, "getModule") \
template(input_stream_void_signature, "(Ljava/io/InputStream;)V") \
template(definePackage_name, "definePackage") \
- template(definePackage_signature, "(Ljava/lang/String;Ljava/lang/reflect/Module;)Ljava/lang/Package;") \
+ template(definePackage_signature, "(Ljava/lang/String;Ljava/lang/Module;)Ljava/lang/Package;") \
template(defineOrCheckPackage_name, "defineOrCheckPackage") \
template(defineOrCheckPackage_signature, "(Ljava/lang/String;Ljava/util/jar/Manifest;Ljava/net/URL;)Ljava/lang/Package;") \
template(fileToEncodedURL_name, "fileToEncodedURL") \
@@ -532,7 +532,7 @@
template(void_class_signature, "()Ljava/lang/Class;") \
template(void_class_array_signature, "()[Ljava/lang/Class;") \
template(void_string_signature, "()Ljava/lang/String;") \
- template(void_module_signature, "()Ljava/lang/reflect/Module;") \
+ template(void_module_signature, "()Ljava/lang/Module;") \
template(object_array_object_signature, "([Ljava/lang/Object;)Ljava/lang/Object;") \
template(object_object_array_object_signature, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;")\
template(exception_void_signature, "(Ljava/lang/Exception;)V") \
@@ -552,7 +552,7 @@
template(reference_signature, "Ljava/lang/ref/Reference;") \
template(sun_misc_Cleaner_signature, "Lsun/misc/Cleaner;") \
template(executable_signature, "Ljava/lang/reflect/Executable;") \
- template(module_signature, "Ljava/lang/reflect/Module;") \
+ template(module_signature, "Ljava/lang/Module;") \
template(concurrenthashmap_signature, "Ljava/util/concurrent/ConcurrentHashMap;") \
template(String_StringBuilder_signature, "(Ljava/lang/String;)Ljava/lang/StringBuilder;") \
template(int_StringBuilder_signature, "(I)Ljava/lang/StringBuilder;") \
@@ -642,16 +642,16 @@
template(jdk_internal_module_Modules, "jdk/internal/module/Modules") \
template(jdk_internal_vm_VMSupport, "jdk/internal/vm/VMSupport") \
template(addReads_name, "addReads") \
- template(addReads_signature, "(Ljava/lang/reflect/Module;Ljava/lang/reflect/Module;)V") \
+ template(addReads_signature, "(Ljava/lang/Module;Ljava/lang/Module;)V") \
template(addExports_name, "addExports") \
template(addOpens_name, "addOpens") \
- template(addExports_signature, "(Ljava/lang/reflect/Module;Ljava/lang/String;Ljava/lang/reflect/Module;)V") \
+ template(addExports_signature, "(Ljava/lang/Module;Ljava/lang/String;Ljava/lang/Module;)V") \
template(addUses_name, "addUses") \
- template(addUses_signature, "(Ljava/lang/reflect/Module;Ljava/lang/Class;)V") \
+ template(addUses_signature, "(Ljava/lang/Module;Ljava/lang/Class;)V") \
template(addProvides_name, "addProvides") \
- template(addProvides_signature, "(Ljava/lang/reflect/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \
+ template(addProvides_signature, "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \
template(transformedByAgent_name, "transformedByAgent") \
- template(transformedByAgent_signature, "(Ljava/lang/reflect/Module;)V") \
+ template(transformedByAgent_signature, "(Ljava/lang/Module;)V") \
template(appendToClassPathForInstrumentation_name, "appendToClassPathForInstrumentation") \
do_alias(appendToClassPathForInstrumentation_signature, string_void_signature) \
template(serializePropertiesToByteArray_name, "serializePropertiesToByteArray") \
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,26 @@
}
}
+void GCTaskThread::add_task_timestamp(const char* name, jlong t_entry, jlong t_exit) {
+ if (_time_stamp_index < GCTaskTimeStampEntries) {
+ GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
+ time_stamp->set_name(name);
+ time_stamp->set_entry_time(t_entry);
+ time_stamp->set_exit_time(t_exit);
+ } else {
+ if (_time_stamp_index == GCTaskTimeStampEntries) {
+ log_warning(gc, task, time)("GC-thread %u: Too many timestamps, ignoring future ones. "
+ "Increase GCTaskTimeStampEntries to get more info.",
+ id());
+ }
+ // Let _time_stamp_index keep counting to give the user an idea about how many
+ // are needed.
+ }
+ _time_stamp_index++;
+}
+
GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
- guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
+ assert(index < GCTaskTimeStampEntries, "Precondition");
if (_time_stamps == NULL) {
// We allocate the _time_stamps array lazily since logging can be enabled dynamically
GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
@@ -65,7 +83,6 @@
FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
}
}
-
return &(_time_stamps[index]);
}
@@ -75,8 +92,11 @@
// Since _time_stamps is now lazily allocated we need to check that it
// has in fact been allocated when calling this function.
if (_time_stamps != NULL) {
- log_debug(gc, task, time)("GC-Thread %u entries: %d", id(), _time_stamp_index);
- for(uint i=0; i<_time_stamp_index; i++) {
+ log_debug(gc, task, time)("GC-Thread %u entries: %d%s", id(),
+ _time_stamp_index,
+ _time_stamp_index >= GCTaskTimeStampEntries ? " (overflow)" : "");
+ const uint max_index = MIN2(_time_stamp_index, GCTaskTimeStampEntries);
+ for (uint i = 0; i < max_index; i++) {
GCTaskTimeStamp* time_stamp = time_stamp_at(i);
log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
time_stamp->name(),
@@ -144,16 +164,7 @@
if (log_is_enabled(Debug, gc, task, time)) {
timer.update();
-
- GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
-
- time_stamp->set_name(name);
- time_stamp->set_entry_time(entry_time);
- time_stamp->set_exit_time(timer.ticks());
-
- // Update the index after we have set up the entry correctly since
- // GCTaskThread::print_task_time_stamps() may read this value concurrently.
- _time_stamp_index++;
+ add_task_timestamp(name, entry_time, timer.ticks());
}
} else {
// idle tasks complete outside the normal accounting
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
uint _time_stamp_index;
GCTaskTimeStamp* time_stamp_at(uint index);
+ void add_task_timestamp(const char* name, jlong t_entry, jlong t_exit);
bool _is_working; // True if participating in GC tasks
@@ -92,16 +93,16 @@
private:
jlong _entry_time;
jlong _exit_time;
- char* _name;
+ const char* _name;
public:
jlong entry_time() { return _entry_time; }
jlong exit_time() { return _exit_time; }
- const char* name() const { return (const char*)_name; }
+ const char* name() const { return _name; }
void set_entry_time(jlong time) { _entry_time = time; }
void set_exit_time(jlong time) { _exit_time = time; }
- void set_name(char* name) { _name = name; }
+ void set_name(const char* name) { _name = name; }
};
#endif // SHARE_VM_GC_PARALLEL_GCTASKTHREAD_HPP
--- a/hotspot/src/share/vm/oops/constMethod.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/constMethod.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -359,7 +359,9 @@
}
// Sizing
- static int header_size() { return sizeof(ConstMethod)/wordSize; }
+ static int header_size() {
+ return align_size_up(sizeof(ConstMethod), wordSize) / wordSize;
+ }
// Size needed
static int size(int code_size, InlineTableSizes* sizes);
--- a/hotspot/src/share/vm/oops/constantPool.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/constantPool.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -705,7 +705,9 @@
}
// Sizing (in words)
- static int header_size() { return sizeof(ConstantPool)/wordSize; }
+ static int header_size() {
+ return align_size_up(sizeof(ConstantPool), wordSize) / wordSize;
+ }
static int size(int length) { return align_metadata_size(header_size() + length); }
int size() const { return size(length()); }
#if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/oops/cpCache.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/cpCache.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -359,7 +359,9 @@
return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
// Code generation support
- static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / wordSize); }
+ static WordSize size() {
+ return in_WordSize(align_size_up(sizeof(ConstantPoolCacheEntry), wordSize) / wordSize);
+ }
static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
--- a/hotspot/src/share/vm/oops/klass.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/klass.cpp Mon Apr 24 21:34:23 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
@@ -532,7 +532,7 @@
} else {
module_entry = ModuleEntryTable::javabase_moduleEntry();
}
- // Obtain java.lang.reflect.Module, if available
+ // Obtain java.lang.Module, if available
Handle module_handle(THREAD, ((module_entry != NULL) ? JNIHandles::resolve(module_entry->module()) : (oop)NULL));
java_lang_Class::create_mirror(this, loader, module_handle, protection_domain, CHECK);
}
--- a/hotspot/src/share/vm/oops/metadata.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/metadata.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -47,6 +47,7 @@
virtual bool is_method() const volatile { return false; }
virtual bool is_methodData() const volatile { return false; }
virtual bool is_constantPool() const volatile { return false; }
+ virtual bool is_methodCounters() const volatile { return false; }
virtual const char* internal_name() const = 0;
--- a/hotspot/src/share/vm/oops/method.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/method.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -671,7 +671,9 @@
#endif
// sizing
- static int header_size() { return sizeof(Method)/wordSize; }
+ static int header_size() {
+ return align_size_up(sizeof(Method), wordSize) / wordSize;
+ }
static int size(bool is_native);
int size() const { return method_size(); }
#if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/oops/methodCounters.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/methodCounters.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -73,3 +73,11 @@
#endif
}
+
+void MethodCounters::print_value_on(outputStream* st) const {
+ assert(is_methodCounters(), "must be methodCounters");
+ st->print("method counters");
+ print_address_on(st);
+}
+
+
--- a/hotspot/src/share/vm/oops/methodCounters.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -30,7 +30,7 @@
#include "interpreter/invocationCounter.hpp"
#include "runtime/arguments.hpp"
-class MethodCounters: public MetaspaceObj {
+class MethodCounters : public Metadata {
friend class VMStructs;
friend class JVMCIVMStructs;
private:
@@ -109,16 +109,17 @@
}
public:
+ virtual bool is_methodCounters() const volatile { return true; }
+
static MethodCounters* allocate(methodHandle mh, TRAPS);
void deallocate_contents(ClassLoaderData* loader_data) {}
- DEBUG_ONLY(bool on_stack() { return false; }) // for template
AOT_ONLY(Method* method() const { return _method; })
- static int size() { return sizeof(MethodCounters) / wordSize; }
-
- bool is_klass() const { return false; }
+ static int size() {
+ return align_size_up(sizeof(MethodCounters), wordSize) / wordSize;
+ }
void clear_counters();
@@ -251,5 +252,9 @@
static ByteSize backedge_mask_offset() {
return byte_offset_of(MethodCounters, _backedge_mask);
}
+
+ virtual const char* internal_name() const { return "{method counters}"; }
+ virtual void print_value_on(outputStream* st) const;
+
};
#endif //SHARE_VM_OOPS_METHODCOUNTERS_HPP
--- a/hotspot/src/share/vm/opto/library_call.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/opto/library_call.cpp Mon Apr 24 21:34:23 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
@@ -1668,6 +1668,9 @@
}
Node* adr = array_element_address(value, index, T_CHAR);
+ if (adr->is_top()) {
+ return false;
+ }
if (is_store) {
(void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
false, false, true /* mismatched */);
--- a/hotspot/src/share/vm/prims/jvmti.xml Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/prims/jvmti.xml Mon Apr 24 21:34:23 2017 +0200
@@ -6516,7 +6516,7 @@
<function id="GetNamedModule" num="40" since="9">
<synopsis>Get Named Module</synopsis>
<description>
- Return the <code>java.lang.reflect.Module</code> object for a named
+ Return the <code>java.lang.Module</code> object for a named
module defined to a class loader that contains a given package.
The module is returned via <code>module_ptr</code>.
<p/>
@@ -6554,7 +6554,7 @@
<param id="module_ptr">
<outptr><jobject/></outptr>
<description>
- On return, points to a <code>java.lang.reflect.Module</code> object
+ On return, points to a <code>java.lang.Module</code> object
or points to <code>NULL</code>.
</description>
</param>
@@ -6599,6 +6599,10 @@
<error id="JVMTI_ERROR_INVALID_MODULE">
If <paramlink id="to_module"></paramlink> is not a module object.
</error>
+ <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+ if the module cannot be modified.
+ See <functionlink id="IsModifiableModule"/>.
+ </error>
</errors>
</function>
@@ -6633,7 +6637,7 @@
<description>
The module the package is exported to.
If the <code>to_module</code> is not a subclass of
- <code>java.lang.reflect.Module</code> this function returns
+ <code>java.lang.Module</code> this function returns
<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
</description>
</param>
@@ -6649,6 +6653,10 @@
If the package <paramlink id="pkg_name"></paramlink>
does not belong to the module.
</error>
+ <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+ if the module cannot be modified.
+ See <functionlink id="IsModifiableModule"/>.
+ </error>
</errors>
</function>
@@ -6684,7 +6692,7 @@
<description>
The module with the package to open.
If the <code>to_module</code> is not a subclass of
- <code>java.lang.reflect.Module</code> this function returns
+ <code>java.lang.Module</code> this function returns
<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
</description>
</param>
@@ -6700,6 +6708,10 @@
If the package <paramlink id="pkg_name"></paramlink>
does not belong to the module.
</error>
+ <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+ if the module cannot be modified.
+ See <functionlink id="IsModifiableModule"/>.
+ </error>
</errors>
</function>
@@ -6737,6 +6749,10 @@
<error id="JVMTI_ERROR_INVALID_CLASS">
If <paramlink id="service"></paramlink> is not a class object.
</error>
+ <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+ if the module cannot be modified.
+ See <functionlink id="IsModifiableModule"/>.
+ </error>
</errors>
</function>
@@ -6783,6 +6799,44 @@
<error id="JVMTI_ERROR_INVALID_CLASS">
If <paramlink id="impl_class"></paramlink> is not a class object.
</error>
+ <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+ if the module cannot be modified.
+ See <functionlink id="IsModifiableModule"/>.
+ </error>
+ </errors>
+ </function>
+
+ <function id="IsModifiableModule" num="99" since="9">
+ <synopsis>Is Modifiable Module</synopsis>
+ <description>
+ Determines whether a module is modifiable.
+ If a module is modifiable then this module can be updated with
+ <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
+ <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
+ and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
+ then the module can not be updated with these functions.
+ </description>
+ <origin>new</origin>
+ <capabilities>
+ </capabilities>
+ <parameters>
+ <param id="module">
+ <ptrtype><jobject/></ptrtype>
+ <description>
+ The module to query.
+ </description>
+ </param>
+ <param id="is_modifiable_module_ptr">
+ <outptr><jboolean/></outptr>
+ <description>
+ On return, points to the boolean result of this function.
+ </description>
+ </param>
+ </parameters>
+ <errors>
+ <error id="JVMTI_ERROR_INVALID_MODULE">
+ If <paramlink id="module"></paramlink> is not a module object.
+ </error>
</errors>
</function>
@@ -7803,6 +7857,10 @@
A method in the new class version has different modifiers
than its counterpart in the old class version.
</error>
+ <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
+ A module cannot be modified.
+ See <functionlink id="IsModifiableModule"/>.
+ </error>
</errors>
</function>
@@ -11567,6 +11625,9 @@
<errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
The class cannot be modified.
</errorid>
+ <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
+ The module cannot be modified.
+ </errorid>
<errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
The functionality is not available in this virtual machine.
</errorid>
@@ -14736,6 +14797,7 @@
- Add new functions:
- GetAllModules
- AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides
+ - IsModifiableModule
Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to
disallow some implementation defined classes.
</change>
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -235,12 +235,12 @@
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(h_module())) {
+ if (!java_lang_Module::is_instance(h_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
// check to_module
Handle h_to_module(THREAD, JNIHandles::resolve(to_module));
- if (!java_lang_reflect_Module::is_instance(h_to_module())) {
+ if (!java_lang_Module::is_instance(h_to_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
return JvmtiExport::add_module_reads(h_module, h_to_module, THREAD);
@@ -257,12 +257,12 @@
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(h_module())) {
+ if (!java_lang_Module::is_instance(h_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
// check to_module
Handle h_to_module(THREAD, JNIHandles::resolve(to_module));
- if (!java_lang_reflect_Module::is_instance(h_to_module())) {
+ if (!java_lang_Module::is_instance(h_to_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
return JvmtiExport::add_module_exports(h_module, h_pkg, h_to_module, THREAD);
@@ -279,12 +279,12 @@
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(h_module())) {
+ if (!java_lang_Module::is_instance(h_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
// check to_module
Handle h_to_module(THREAD, JNIHandles::resolve(to_module));
- if (!java_lang_reflect_Module::is_instance(h_to_module())) {
+ if (!java_lang_Module::is_instance(h_to_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
return JvmtiExport::add_module_opens(h_module, h_pkg, h_to_module, THREAD);
@@ -299,7 +299,7 @@
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(h_module())) {
+ if (!java_lang_Module::is_instance(h_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
// check service
@@ -321,7 +321,7 @@
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
- if (!java_lang_reflect_Module::is_instance(h_module())) {
+ if (!java_lang_Module::is_instance(h_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
// check service
@@ -339,6 +339,22 @@
return JvmtiExport::add_module_provides(h_module, h_service, h_impl_class, THREAD);
} /* end AddModuleProvides */
+// module - pre-checked for NULL
+// is_modifiable_class_ptr - pre-checked for NULL
+jvmtiError
+JvmtiEnv::IsModifiableModule(jobject module, jboolean* is_modifiable_module_ptr) {
+ JavaThread* THREAD = JavaThread::current();
+
+ // check module
+ Handle h_module(THREAD, JNIHandles::resolve(module));
+ if (!java_lang_Module::is_instance(h_module())) {
+ return JVMTI_ERROR_INVALID_MODULE;
+ }
+
+ *is_modifiable_module_ptr = JNI_TRUE;
+ return JVMTI_ERROR_NONE;
+} /* end IsModifiableModule */
+
//
// Class functions
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -189,19 +189,6 @@
assert(vf->is_compiled_frame(), "Wrong frame type");
chunk->push(compiledVFrame::cast(vf));
- ScopeDesc* trap_scope = chunk->at(0)->scope();
- Handle exceptionObject;
- if (trap_scope->rethrow_exception()) {
- if (PrintDeoptimizationDetails) {
- tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
- }
- GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
- guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
- ScopeValue* topOfStack = expressions->top();
- exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
- assert(exceptionObject() != NULL, "exception oop can not be null");
- }
-
bool realloc_failures = false;
#if defined(COMPILER2) || INCLUDE_JVMCI
@@ -296,6 +283,19 @@
#endif // INCLUDE_JVMCI
#endif // COMPILER2 || INCLUDE_JVMCI
+ ScopeDesc* trap_scope = chunk->at(0)->scope();
+ Handle exceptionObject;
+ if (trap_scope->rethrow_exception()) {
+ if (PrintDeoptimizationDetails) {
+ tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
+ }
+ GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
+ guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
+ ScopeValue* topOfStack = expressions->top();
+ exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
+ guarantee(exceptionObject() != NULL, "exception oop can not be null");
+ }
+
// Ensure that no safepoint is taken after pointers have been stored
// in fields of rematerialized objects. If a safepoint occurs from here on
// out the java state residing in the vframeArray will be missed.
--- a/hotspot/src/share/vm/runtime/globals.hpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp Mon Apr 24 21:34:23 2017 +0200
@@ -1450,9 +1450,9 @@
"Number of threads concurrent gc will use") \
constraint(ConcGCThreadsConstraintFunc,AfterErgo) \
\
- product(uintx, GCTaskTimeStampEntries, 200, \
+ product(uint, GCTaskTimeStampEntries, 200, \
"Number of time stamp entries per gc worker thread") \
- range(1, max_uintx) \
+ range(1, max_jint) \
\
product(bool, AlwaysTenure, false, \
"Always tenure objects in eden (ParallelGC only)") \
--- a/hotspot/src/share/vm/runtime/reflection.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/runtime/reflection.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -594,9 +594,9 @@
current_class_name, module_from_name, new_class_name,
module_to_name, module_from_name, module_to_name);
} else {
- jobject jlrm = module_to->module();
- assert(jlrm != NULL, "Null jlrm in module_to ModuleEntry");
- intptr_t identity_hash = JNIHandles::resolve(jlrm)->identity_hash();
+ jobject jlm = module_to->module();
+ assert(jlm != NULL, "Null jlm in module_to ModuleEntry");
+ intptr_t identity_hash = JNIHandles::resolve(jlm)->identity_hash();
size_t len = 160 + strlen(current_class_name) + 2*strlen(module_from_name) +
strlen(new_class_name) + 2*sizeof(uintx);
msg = NEW_RESOURCE_ARRAY(char, len);
@@ -621,9 +621,9 @@
current_class_name, module_from_name, new_class_name,
module_to_name, module_to_name, package_name, module_from_name);
} else {
- jobject jlrm = module_from->module();
- assert(jlrm != NULL, "Null jlrm in module_from ModuleEntry");
- intptr_t identity_hash = JNIHandles::resolve(jlrm)->identity_hash();
+ jobject jlm = module_from->module();
+ assert(jlm != NULL, "Null jlm in module_from ModuleEntry");
+ intptr_t identity_hash = JNIHandles::resolve(jlm)->identity_hash();
size_t len = 170 + strlen(current_class_name) + strlen(new_class_name) +
2*strlen(module_to_name) + strlen(package_name) + 2*sizeof(uintx);
msg = NEW_RESOURCE_ARRAY(char, len);
--- a/hotspot/src/share/vm/runtime/thread.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/src/share/vm/runtime/thread.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -3465,7 +3465,7 @@
java_lang_Thread::RUNNABLE);
// The VM creates objects of this class.
- initialize_class(vmSymbols::java_lang_reflect_Module(), CHECK);
+ initialize_class(vmSymbols::java_lang_Module(), CHECK);
// The VM preresolves methods to these classes. Make sure that they get initialized
initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK);
--- a/hotspot/test/TEST.ROOT Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/TEST.ROOT Mon Apr 24 21:34:23 2017 +0200
@@ -50,8 +50,8 @@
vm.cpu.features \
vm.debug
-# Tests using jtreg 4.2 b04 features
-requiredVersion=4.2 b04
+# Tests using jtreg 4.2 b07 features
+requiredVersion=4.2 b07
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- a/hotspot/test/compiler/c2/cr7200264/TestDriver.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/c2/cr7200264/TestDriver.java Mon Apr 24 21:34:23 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,7 +26,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.regex.Pattern;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
@@ -45,7 +44,7 @@
}
private List<String> executeApplication() throws Throwable {
- OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvmAllArgs(
+ OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
"-Xbatch",
"-XX:-TieredCompilation",
"-XX:+PrintCompilation",
--- a/hotspot/test/compiler/ciReplay/SABase.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/ciReplay/SABase.java Mon Apr 24 21:34:23 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
@@ -141,7 +141,7 @@
if (Platform.isSolaris()) {
try {
OutputAnalyzer oa = ProcessTools.executeProcess("coreadm", "-p", "core",
- "" + ProcessHandle.current().getPid());
+ "" + ProcessHandle.current().pid());
oa.shouldHaveExitValue(0);
} catch (Throwable t) {
throw new Error("Can't launch coreadm: " + t, t);
--- a/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
import compiler.compilercontrol.share.actions.BaseAction;
import jdk.test.lib.Asserts;
+import jdk.test.lib.management.InputArguments;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.dcmd.CommandExecutor;
@@ -38,6 +39,7 @@
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -97,9 +99,13 @@
// Start separate thread to connect with test VM
new Thread(() -> connectTestVM(serverSocket)).start();
}
- // Start test VM
- output = ProcessTools.executeTestJvmAllArgs(
- vmOptions.toArray(new String[vmOptions.size()]));
+ // Start a test VM using vm flags from @run and from vm options
+ String[] vmInputArgs = InputArguments.getVmInputArgs();
+ String[] cmds = Arrays.copyOf(vmInputArgs,
+ vmInputArgs.length + vmOptions.size());
+ System.arraycopy(vmOptions.toArray(), 0, cmds, vmInputArgs.length,
+ vmOptions.size());
+ output = ProcessTools.executeTestJvm(cmds);
} catch (Throwable thr) {
throw new Error("Execution failed: " + thr.getMessage(), thr);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/string/TestStringUTF16IntrinsicRangeChecks.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,320 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8158168
+ * @summary Verifies that callers of StringUTF16 intrinsics throw array out of bounds exceptions.
+ * @library /compiler/patches /test/lib
+ * @build java.base/java.lang.Helper
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getCharStringU,_putCharStringU compiler.intrinsics.string.TestStringUTF16IntrinsicRangeChecks
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -esa -ea -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getCharStringU,_putCharStringU compiler.intrinsics.string.TestStringUTF16IntrinsicRangeChecks
+ */
+package compiler.intrinsics.string;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+public class TestStringUTF16IntrinsicRangeChecks {
+
+ public static void main(String[] args) throws Exception {
+ byte[] val = new byte[2];
+ byte[] b4 = new byte[4];
+ char[] c4 = new char[4];
+ String s4 = new String(c4);
+ byte[] valHigh = new byte[2];
+ byte[] valLow = new byte[2];
+ Helper.putCharSB(valHigh, 0, Character.MIN_HIGH_SURROGATE);
+ Helper.putCharSB(valLow, 0, Character.MIN_LOW_SURROGATE);
+
+ for (int i = 0; i < 1000; ++i) {
+ getChars((int)1234, -5, -5 + 4, val);
+ getChars((int)1234, -1, -1 + 4, val);
+ getChars((int)1234, 0, 0 + 4, val);
+ getChars((int)1234, 1, 1 + 4, val);
+
+ getChars((long)1234, -5, -5 + 4, val);
+ getChars((long)1234, -1, -1 + 4, val);
+ getChars((long)1234, 0, 0 + 4, val);
+ getChars((long)1234, 1, 1 + 4, val);
+
+ byte[] val2 = Arrays.copyOf(val, val.length);
+ putCharSB(val2, -1, '!');
+ putCharSB(val2, 1, '!');
+
+ byte[] val4 = Arrays.copyOf(b4, b4.length);
+ char[] c2 = new char[2];
+ String s2 = new String(c2);
+
+ putCharsSB(val4, -3, c2, 0, 2);
+ putCharsSB(val4, -1, c2, 0, 2);
+ putCharsSB(val4, 0, c4, 0, 4);
+ putCharsSB(val4, 1, c2, 0, 2);
+ putCharsSB(val4, -3, s2, 0, 2);
+ putCharsSB(val4, -1, s2, 0, 2);
+ putCharsSB(val4, 0, s4, 0, 4);
+ putCharsSB(val4, 1, s2, 0, 2);
+
+ codePointAtSB(valHigh, -1, 1);
+ codePointAtSB(valHigh, -1, 2);
+ codePointAtSB(valHigh, 0, 2);
+ codePointAtSB(valHigh, 1, 2);
+
+ codePointBeforeSB(valLow, 0);
+ codePointBeforeSB(valLow, -1);
+ codePointBeforeSB(valLow, 2);
+
+ if (Helper.codePointCountSB(valHigh, 0, 1) != 1) {
+ throw new AssertionError("codePointCountSB");
+ }
+ if (Helper.codePointCountSB(valLow, 0, 1) != 1) {
+ throw new AssertionError("codePointCountSB");
+ }
+ codePointCountSB(valHigh, -1, 0);
+ codePointCountSB(valHigh, -1, 2);
+ codePointCountSB(valHigh, 0, 2);
+
+ charAt(val, -1);
+ charAt(val, 1);
+
+ contentEquals(b4, val, -1);
+ contentEquals(b4, val, 2);
+ contentEquals(val, s4, 2);
+ contentEquals(val, s4, -1);
+
+ StringBuilder sb = new StringBuilder();
+ sb.append((String)null).append(true).append(false);
+ if (!sb.toString().equals("nulltruefalse")) {
+ throw new AssertionError("append");
+ }
+
+ putCharsAt(val2, -1, '1', '2', '3', '4');
+ putCharsAt(val2, 0, '1', '2', '3', '4');
+ putCharsAt(val2, 2, '1', '2', '3', '4');
+ putCharsAt(val2, -1, '1', '2', '3', '4', '5');
+ putCharsAt(val2, 0, '1', '2', '3', '4', '5');
+ putCharsAt(val2, 2, '1', '2', '3', '4', '5');
+
+ reverse(valHigh, -1);
+ reverse(valHigh, 2);
+ reverse(valLow, -1);
+ reverse(valLow, 2);
+
+ byte[] d4 = new byte[4];
+ inflate(b4, 0, d4, -1, 2);
+ inflate(b4, 0, d4, 3, 2);
+ inflate(b4, 0, d4, 4, 1);
+
+ byte[] b0 = new byte[0];
+ byte[] b1 = new byte[1];
+ byte[] b2 = new byte[2];
+ byte[] t1 = new byte[] {1};
+ byte[] t2 = new byte[] {1, 2};
+ byte[] t4 = new byte[] {1, 2, 3, 4};
+ indexOf(b1, 1, t2, 1, 0);
+ indexOf(b2, 1, t1, 1, 0);
+ indexOf(b2, 2, t2, 1, 0);
+ indexOf(b2, 1, t2, 2, 0);
+ indexOf(b2, -1, t2, 1, 0);
+ indexOf(b2, 1, t2, -1, 0);
+ indexOf(b2, 1, t2, 1, 1);
+
+ indexOfLatin1(b1, 1, t1, 1, 0);
+ indexOfLatin1(b2, 2, t1, 1, 0);
+ indexOfLatin1(b2, 1, b0, 1, 0);
+ indexOfLatin1(b2, 1, t1, 2, 0);
+ indexOfLatin1(b2, -1, t1, 1, 0);
+ indexOfLatin1(b2, 2, t1, 1, 0);
+ indexOfLatin1(b2, 1, t1, -1, 0);
+ indexOfLatin1(b2, 1, t1, 2, 0);
+
+ lastIndexOf(b1, t2, 1, 0);
+ lastIndexOf(b2, t4, 2, 0);
+ lastIndexOf(b2, t2, 1, 0);
+ lastIndexOf(b2, t2, 1, 1);
+
+ lastIndexOfLatin1(b1, t1, 1, 0);
+ lastIndexOfLatin1(b2, t2, 2, 0);
+ lastIndexOfLatin1(b2, t1, 1, 0);
+ lastIndexOfLatin1(b2, t1, 1, 1);
+ }
+ }
+
+ static void getChars(int i, int begin, int end, byte[] value) {
+ try {
+ Helper.getChars(i, begin, end, value);
+ throw new AssertionError("getChars");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void getChars(long l, int begin, int end, byte[] value) {
+ try {
+ Helper.getChars(l, begin, end, value);
+ throw new AssertionError("getChars");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void putCharSB(byte[] val, int index, int c) {
+ try {
+ Helper.putCharSB(val, index, c);
+ throw new AssertionError("putCharSB");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
+ try {
+ Helper.putCharsSB(val, index, ca, off, end);
+ throw new AssertionError("putCharsSB");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
+ try {
+ Helper.putCharsSB(val, index, s, off, end);
+ throw new AssertionError("putCharsSB");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void codePointAtSB(byte[] val, int index, int end) {
+ try {
+ Helper.codePointAtSB(val, index, end);
+ throw new AssertionError("codePointAtSB");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void codePointBeforeSB(byte[] val, int index) {
+ try {
+ Helper.codePointBeforeSB(val, index);
+ throw new AssertionError("codePointBeforeSB");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void codePointCountSB(byte[] val, int beginIndex, int endIndex) {
+ try {
+ Helper.codePointCountSB(val, beginIndex, endIndex);
+ throw new AssertionError("codePointCountSB");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void charAt(byte[] v, int index) {
+ try {
+ Helper.charAt(v, index);
+ throw new AssertionError("charAt");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void contentEquals(byte[] v1, byte[] v2, int len) {
+ try {
+ Helper.contentEquals(v1, v2, len);
+ throw new AssertionError("contentEquals");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void contentEquals(byte[] v, CharSequence cs, int len) {
+ try {
+ Helper.contentEquals(v, cs, len);
+ throw new AssertionError("contentEquals");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void putCharsAt(byte[] v, int i, char c1, char c2, char c3, char c4) {
+ try {
+ Helper.putCharsAt(v, i, c1, c2, c3, c4);
+ throw new AssertionError("putCharsAt");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void putCharsAt(byte[] v, int i, char c1, char c2, char c3, char c4, char c5) {
+ try {
+ Helper.putCharsAt(v, i, c1, c2, c3, c4, c5);
+ throw new AssertionError("putCharsAt");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void reverse(byte[] v, int len) {
+ try {
+ Helper.reverse(v, len);
+ throw new AssertionError("reverse");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void inflate(byte[] v1, int o1, byte[] v2, int o2, int len) {
+ try {
+ Helper.inflate(v1, o1, v2, o2, len);
+ throw new AssertionError("inflate");
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void indexOf(byte[] v1, int l1, byte[] v2, int l2, int from) {
+ try {
+ if (Helper.indexOf(v1, l1, v2, l2, from) != -1) {
+ throw new AssertionError("indexOf");
+ }
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void lastIndexOf(byte[] v1, byte[] v2, int l2, int from) {
+ try {
+ if (Helper.lastIndexOf(v1, v2, l2, from) != -1) {
+ throw new AssertionError("lastIndexOf");
+ }
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void indexOfLatin1(byte[] v1, int l1, byte[] v2, int l2, int from) {
+ try {
+ if (Helper.indexOfLatin1(v1, l1, v2, l2, from) != -1) {
+ throw new AssertionError("indexOfLatin1");
+ }
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+
+ static void lastIndexOfLatin1(byte[] v1, byte[] v2, int l2, int from) {
+ try {
+ if (Helper.lastIndexOfLatin1(v1, v2, l2, from) != -1) {
+ throw new AssertionError("lastIndexOfLatin1");
+ }
+ } catch (IndexOutOfBoundsException io) {
+ }
+ }
+}
--- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java Mon Apr 24 21:34:23 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
@@ -41,7 +41,6 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
import java.lang.reflect.Parameter;
import java.util.HashMap;
import java.util.Map;
--- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,11 +30,9 @@
* @modules java.base/jdk.internal.misc
* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @run main/othervm compiler.jvmci.compilerToVM.DebugOutputTest
+ * @run driver compiler.jvmci.compilerToVM.DebugOutputTest
*/
- // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' should be replaced w/ '@run driver'
-
package compiler.jvmci.compilerToVM;
import jdk.test.lib.process.OutputAnalyzer;
@@ -42,8 +40,11 @@
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import java.util.Arrays;
+import java.nio.file.Path;
+import java.nio.file.Paths;
public class DebugOutputTest {
+ private static final String VM_CI_MODULE = "jdk.internal.vm.ci";
public static void main(String[] args) {
new DebugOutputTest().test();
}
@@ -53,10 +54,18 @@
System.out.println(testCase);
OutputAnalyzer oa;
try {
- oa = ProcessTools.executeTestJvmAllArgs(
+ Path patch = Paths.get(System.getProperty("test.patch.path"));
+ Path jvmciPath = patch.resolve(VM_CI_MODULE).toAbsolutePath();
+ if (!jvmciPath.toFile().exists()) {
+ throw new Error("TESTBUG: patch for " + VM_CI_MODULE + " : "
+ + jvmciPath.toString() + " does not exist");
+ }
+ oa = ProcessTools.executeTestJvm(
"-XX:+UnlockExperimentalVMOptions",
"-XX:+EnableJVMCI",
- "-Xbootclasspath/a:.",
+ "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
+ "--add-exports", "jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED",
+ "--patch-module", VM_CI_MODULE + "=" + jvmciPath.toString(),
DebugOutputTest.Worker.class.getName(),
testCase.name());
} catch (Throwable e) {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,6 +27,7 @@
import org.testng.annotations.DataProvider;
+import sun.hotspot.WhiteBox;
import jdk.internal.misc.Unsafe;
import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
@@ -36,6 +37,10 @@
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.runtime.JVMCI;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
public class MemoryAccessProviderData {
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
@@ -43,6 +48,18 @@
private static final TestClass TEST_OBJECT = new TestClass();
private static final JavaConstant TEST_CONSTANT = CONSTANT_REFLECTION.forObject(TEST_OBJECT);
private static final JavaConstant TEST_CLASS_CONSTANT = CONSTANT_REFLECTION.forObject(TestClass.class);
+ private static KindData[] PRIMITIVE_KIND_DATA = {
+ new KindData(JavaKind.Boolean, TEST_OBJECT),
+ new KindData(JavaKind.Byte, TEST_OBJECT),
+ new KindData(JavaKind.Char, TEST_OBJECT),
+ new KindData(JavaKind.Short, TEST_OBJECT),
+ new KindData(JavaKind.Int, TEST_OBJECT),
+ new KindData(JavaKind.Float, TEST_OBJECT),
+ new KindData(JavaKind.Long, TEST_OBJECT),
+ new KindData(JavaKind.Double, TEST_OBJECT)
+ };
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
@DataProvider(name = "positiveObject")
public static Object[][] getPositiveObjectJavaKind() {
@@ -54,51 +71,40 @@
@DataProvider(name = "positivePrimitive")
public static Object[][] getPositivePrimitiveJavaKinds() {
- Field booleanField;
- Field byteField;
- Field shortField;
- Field intField;
- Field longField;
- Field floatField;
- Field doubleField;
- Field charField;
- try {
- booleanField = MemoryAccessProviderData.TestClass.class.getDeclaredField("booleanField");
- byteField = MemoryAccessProviderData.TestClass.class.getDeclaredField("byteField");
- shortField = MemoryAccessProviderData.TestClass.class.getDeclaredField("shortField");
- intField = MemoryAccessProviderData.TestClass.class.getDeclaredField("intField");
- longField = MemoryAccessProviderData.TestClass.class.getDeclaredField("longField");
- floatField = MemoryAccessProviderData.TestClass.class.getDeclaredField("floatField");
- doubleField = MemoryAccessProviderData.TestClass.class.getDeclaredField("doubleField");
- charField = MemoryAccessProviderData.TestClass.class.getDeclaredField("charField");
- } catch (NoSuchFieldException e) {
- throw new Error("TESTBUG: can't find test field " + e, e);
+ List<Object[]> result = new ArrayList<>();
+ for (KindData k : PRIMITIVE_KIND_DATA) {
+ result.add(new Object[] {k.kind, TEST_CONSTANT, k.instanceFieldOffset, k.instanceFieldValue, Math.max(8, k.kind.getBitCount())});
+ result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, k.staticFieldOffset, k.staticFieldValue, Math.max(8, k.kind.getBitCount())});
}
- long booleanFieldOffset = UNSAFE.objectFieldOffset(booleanField);
- long byteFieldOffset = UNSAFE.objectFieldOffset(byteField);
- long shortFieldOffset = UNSAFE.objectFieldOffset(shortField);
- long intFieldOffset = UNSAFE.objectFieldOffset(intField);
- long longFieldOffset = UNSAFE.objectFieldOffset(longField);
- long floatFieldOffset = UNSAFE.objectFieldOffset(floatField);
- long doubleFieldOffset = UNSAFE.objectFieldOffset(doubleField);
- long charFieldOffset = UNSAFE.objectFieldOffset(charField);
- return new Object[][]{
- new Object[]{JavaKind.Boolean, TEST_CONSTANT, booleanFieldOffset,
- JavaConstant.forBoolean(TEST_OBJECT.booleanField), 8},
- new Object[]{JavaKind.Byte, TEST_CONSTANT, byteFieldOffset,
- JavaConstant.forByte(TEST_OBJECT.byteField), 8},
- new Object[]{JavaKind.Short, TEST_CONSTANT, shortFieldOffset,
- JavaConstant.forShort(TEST_OBJECT.shortField), 16},
- new Object[]{JavaKind.Int, TEST_CONSTANT, intFieldOffset,
- JavaConstant.forInt(TEST_OBJECT.intField), 32},
- new Object[]{JavaKind.Long, TEST_CONSTANT, longFieldOffset,
- JavaConstant.forLong(TEST_OBJECT.longField), 64},
- new Object[]{JavaKind.Float, TEST_CONSTANT, floatFieldOffset,
- JavaConstant.forFloat(TEST_OBJECT.floatField), 32},
- new Object[]{JavaKind.Double, TEST_CONSTANT, doubleFieldOffset,
- JavaConstant.forDouble(TEST_OBJECT.doubleField), 64},
- new Object[]{JavaKind.Char, TEST_CONSTANT, charFieldOffset,
- JavaConstant.forChar(TEST_OBJECT.charField), 16}};
+ return result.toArray(new Object[result.size()][]);
+ }
+
+ @DataProvider(name = "outOfBoundsInstanceFields")
+ public static Object[][] getOutOfBoundsStaticFieldReads() {
+ long instanceSize = WHITE_BOX.getObjectSize(TEST_OBJECT);
+ List<Object[]> result = new ArrayList<>();
+ for (KindData k : PRIMITIVE_KIND_DATA) {
+ long lastValidOffset = instanceSize - (k.kind.getByteCount());
+ result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset, false});
+ result.add(new Object[] {k.kind, TEST_CONSTANT, (long) -1, true});
+ result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset + 1, true});
+ result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset + 100, true});
+ }
+ return result.toArray(new Object[result.size()][]);
+ }
+
+ @DataProvider(name = "outOfBoundsStaticFields")
+ public static Object[][] getOutOfBoundsInstanceFieldReads() {
+ long staticsSize = WHITE_BOX.getObjectSize(TEST_OBJECT.getClass());
+ List<Object[]> result = new ArrayList<>();
+ for (KindData k : PRIMITIVE_KIND_DATA) {
+ long lastValidOffset = staticsSize - (k.kind.getByteCount());
+ result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset, false});
+ result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, (long) -1, true});
+ result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset + 1, true});
+ result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset + 100, true});
+ }
+ return result.toArray(new Object[result.size()][]);
}
@DataProvider(name = "negative")
@@ -108,6 +114,7 @@
new Object[]{JavaKind.Illegal, JavaConstant.INT_1}};
}
+
private static class TestClass {
public final boolean booleanField = true;
public final byte byteField = 2;
@@ -117,6 +124,43 @@
public final double doubleField = 6.0d;
public final float floatField = 7.0f;
public final char charField = 'a';
- public final String stringField = "abc";
+ public final String objectField = "abc";
+
+ public static final boolean booleanStaticField = true;
+ public static final byte byteStaticField = 2;
+ public static final short shortStaticField = 3;
+ public static final int intStaticField = 4;
+ public static final long longStaticField = 5L;
+ public static final double doubleStaticField = 6.0d;
+ public static final float floatStaticField = 7.0f;
+ public static final char charStaticField = 'a';
+ public static final String objectStaticField = "abc";
+ }
+
+
+ static class KindData {
+ final JavaKind kind;
+ final Field instanceField;
+ final Field staticField;
+ final long instanceFieldOffset;
+ final long staticFieldOffset;
+ final JavaConstant instanceFieldValue;
+ final JavaConstant staticFieldValue;
+ KindData(JavaKind kind, Object testObject) {
+ this.kind = kind;
+ try {
+ Class<?> c = testObject.getClass();
+ instanceField = c.getDeclaredField(kind.getJavaName() + "Field");
+ staticField = c.getDeclaredField(kind.getJavaName() + "StaticField");
+ instanceField.setAccessible(true);
+ staticField.setAccessible(true);
+ instanceFieldOffset = UNSAFE.objectFieldOffset(instanceField);
+ staticFieldOffset = UNSAFE.staticFieldOffset(staticField);
+ instanceFieldValue = JavaConstant.forBoxedPrimitive(instanceField.get(testObject));
+ staticFieldValue = JavaConstant.forBoxedPrimitive(staticField.get(null));
+ } catch (Exception e) {
+ throw new Error("TESTBUG for kind " + kind, e);
+ }
+ }
}
}
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -31,12 +31,19 @@
* jdk.internal.vm.ci/jdk.vm.ci.runtime
* jdk.internal.vm.ci/jdk.vm.ci.hotspot
* java.base/jdk.internal.misc
- * @run testng/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run testng/othervm -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* jdk.vm.ci.hotspot.test.MemoryAccessProviderTest
*/
package jdk.vm.ci.hotspot.test;
+import sun.hotspot.WhiteBox;
+
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MemoryAccessProvider;
@@ -59,7 +66,27 @@
@Test(dataProvider = "negative", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
public void testNegativeReadPrimitiveConstant(JavaKind kind, Constant base) {
- PROVIDER.readPrimitiveConstant(kind, base, 0L, kind == null ? 0 : kind.getBitCount());
+ PROVIDER.readPrimitiveConstant(kind, base, 0L, kind == null ? 0 : kind.getByteCount() / 8);
+ }
+
+ @Test(dataProvider = "outOfBoundsInstanceFields", dataProviderClass = MemoryAccessProviderData.class)
+ public void testReadPrimitiveInstanceFieldOutOfBounds(JavaKind kind, Constant base, Long offset, boolean isOutOfBounds) {
+ try {
+ PROVIDER.readPrimitiveConstant(kind, base, offset, kind.getByteCount() * 8);
+ Assert.assertFalse(isOutOfBounds);
+ } catch (IllegalArgumentException iae) {
+ Assert.assertTrue(isOutOfBounds);
+ }
+ }
+
+ @Test(dataProvider = "outOfBoundsStaticFields", dataProviderClass = MemoryAccessProviderData.class)
+ public void testReadPrimitiveStaticFieldOutOFBounds(JavaKind kind, Constant base, Long offset, boolean isOutOfBounds) {
+ try {
+ PROVIDER.readPrimitiveConstant(kind, base, offset, kind.getByteCount() * 8);
+ Assert.assertFalse(isOutOfBounds);
+ } catch (IllegalArgumentException iae) {
+ Assert.assertTrue(isOutOfBounds);
+ }
}
@Test(dataProvider = "positiveObject", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
@@ -87,7 +114,7 @@
Assert.assertNull(PROVIDER.readObjectConstant(base, offset + 1), "Expected null");
}
- @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class)
+ @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
public void testNegativeReadObjectConstantPrimitiveBase(JavaKind kind, Constant base, Long offset, Object expected, int bitsCount) {
Assert.assertNull(PROVIDER.readObjectConstant(base, offset), "Expected null");
}
--- a/hotspot/test/compiler/patches/java.base/java/lang/Helper.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/compiler/patches/java.base/java/lang/Helper.java Mon Apr 24 21:34:23 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
@@ -73,4 +73,84 @@
StringUTF16.getChars(value, srcBegin, srcEnd, dst, dstBegin);
return dst;
}
+
+ public static void putCharSB(byte[] val, int index, int c) {
+ StringUTF16.putCharSB(val, index, c);
+ }
+
+ public static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
+ StringUTF16.putCharsSB(val, index, ca, off, end);
+ }
+
+ public static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
+ StringUTF16.putCharsSB(val, index, s, off, end);
+ }
+
+ public static int codePointAtSB(byte[] val, int index, int end) {
+ return StringUTF16.codePointAtSB(val, index, end);
+ }
+
+ public static int codePointBeforeSB(byte[] val, int index) {
+ return StringUTF16.codePointBeforeSB(val, index);
+ }
+
+ public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) {
+ return StringUTF16.codePointCountSB(val, beginIndex, endIndex);
+ }
+
+ public static int getChars(int i, int begin, int end, byte[] value) {
+ return StringUTF16.getChars(i, begin, end, value);
+ }
+
+ public static int getChars(long l, int begin, int end, byte[] value) {
+ return StringUTF16.getChars(l, begin, end, value);
+ }
+
+ public static boolean contentEquals(byte[] v1, byte[] v2, int len) {
+ return StringUTF16.contentEquals(v1, v2, len);
+ }
+
+ public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
+ return StringUTF16.contentEquals(value, cs, len);
+ }
+
+ public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
+ return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4);
+ }
+
+ public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) {
+ return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4, c5);
+ }
+
+ public static char charAt(byte[] value, int index) {
+ return StringUTF16.charAt(value, index);
+ }
+
+ public static void reverse(byte[] value, int count) {
+ StringUTF16.reverse(value, count);
+ }
+
+ public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
+ StringUTF16.inflate(src, srcOff, dst, dstOff, len);
+ }
+
+ public static int indexOf(byte[] src, int srcCount,
+ byte[] tgt, int tgtCount, int fromIndex) {
+ return StringUTF16.indexOf(src, srcCount, tgt, tgtCount, fromIndex);
+ }
+
+ public static int indexOfLatin1(byte[] src, int srcCount,
+ byte[] tgt, int tgtCount, int fromIndex) {
+ return StringUTF16.indexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
+ }
+ public static int lastIndexOf(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
+ int srcCount = StringUTF16.length(src); // ignored
+ return StringUTF16.lastIndexOf(src, srcCount, tgt, tgtCount, fromIndex);
+ }
+
+ public static int lastIndexOfLatin1(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
+ int srcCount = StringUTF16.length(src); // ignored
+ return StringUTF16.lastIndexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
+ }
+
}
--- a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,13 @@
/*
* @test TestPrintGCDetailsVerbose
- * @bug 8016740
+ * @bug 8016740 8177963
* @summary Tests that jvm with maximally verbose GC logging does not crash when ParOldGC has no memory
* @key gc
* @requires vm.gc.Parallel
* @modules java.base/jdk.internal.misc
* @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose
+ * @run main/othervm -Xmx50m -XX:+UseParallelGC -XX:GCTaskTimeStampEntries=1 -Xlog:gc*=trace TestPrintGCDetailsVerbose
*/
public class TestPrintGCDetailsVerbose {
--- a/hotspot/test/native/runtime/test_globals.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/native/runtime/test_globals.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -53,7 +53,7 @@
}
TEST_VM(FlagGuard, uintx_flag) {
- TEST_FLAG(GCTaskTimeStampEntries, uintx, 1337);
+ TEST_FLAG(GCTaskTimeStampEntries, uint, 1337);
}
TEST_VM(FlagGuard, size_t_flag) {
--- a/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm Mon Apr 24 21:34:23 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,7 +26,6 @@
// to create a sub-type of jdk.internal.reflect.MethodAccessorImpl in order
// to bypass Reflection.getCallerClass. That should fail with an IAE.
//
- import java.lang.reflect.Module;
class fakeMethodAccessor extends jdk.internal.reflect.MethodAccessorImpl {
public static void main(String[] a) throws Exception {
fakeMethodAccessor f = new fakeMethodAccessor();
@@ -60,11 +59,11 @@
astore_1;
getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
ldc class java/lang/String;
- invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/reflect/Module;";
+ invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/Module;";
ldc String "jdk.internal.misc";
ldc class FakeMethodAccessor;
- invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/reflect/Module;";
- invokevirtual Method java/lang/reflect/Module.isExported:"(Ljava/lang/String;Ljava/lang/reflect/Module;)Z";
+ invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/Module;";
+ invokevirtual Method java/lang/Module.isExported:"(Ljava/lang/String;Ljava/lang/Module;)Z";
invokevirtual Method java/io/PrintStream.println:"(Z)V";
return;
}
--- a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
return m;
}
}
- throw new RuntimeException("Failed to find method " + name + " in java.lang.reflect.Module");
+ throw new RuntimeException("Failed to find method " + name + " in java.lang.Module");
}
// Throw RuntimeException if getSystemPackageLocation() does not return
--- a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
// Start the process, get the pid and then wait for the test to finish
Process process = builder.start();
- long pid = process.getPid();
+ long pid = process.pid();
int retval = process.waitFor();
// make sure the SEGVOverflow test crashed
--- a/hotspot/test/runtime/modules/AccModuleTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccModuleTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,8 +28,6 @@
* @run main AccModuleTest
*/
-import java.io.File;
-
public class AccModuleTest {
public static void main(String args[]) throws Throwable {
--- a/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java Mon Apr 24 21:34:23 2017 +0200
@@ -39,8 +39,6 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -58,7 +56,7 @@
public class AccessExportTwice {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -87,7 +85,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_first_mod, descriptor_second_mod);
// Resolves "first_mod"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("first_mod"));
@@ -96,8 +94,8 @@
map.put("first_mod", MySameClassLoader.loader1);
map.put("second_mod", MySameClassLoader.loader1);
- // Create Layer that contains first_mod & second_mod
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains first_mod & second_mod
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("first_mod") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("second_mod") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java Mon Apr 24 21:34:23 2017 +0200
@@ -39,8 +39,6 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -56,7 +54,7 @@
public class AccessReadTwice {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -85,7 +83,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_first_mod, descriptor_second_mod);
// Resolves "first_mod" and "second_mod"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
@@ -95,8 +93,8 @@
map.put("first_mod", loader);
map.put("second_mod", loader);
- // Create Layer that contains first_mod & second_mod
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains first_mod & second_mod
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("first_mod") == loader);
assertTrue(layer.findLoader("second_mod") == loader);
--- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
//
public class CheckRead {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -100,7 +99,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -110,8 +109,8 @@
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1x, m2x and m3x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x, m2x and m3x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
//
public class DiffCL_CheckRead {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -100,7 +99,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -110,8 +109,8 @@
map.put("m2x", MyDiffClassLoader.loader2);
map.put("m3x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x, m2x and m3x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x, m2x and m3x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,7 +38,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
//
public class DiffCL_ExpQualOther {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -102,7 +101,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -112,8 +111,8 @@
map.put("m2x", MyDiffClassLoader.loader2);
map.put("m3x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -58,7 +57,7 @@
//
public class DiffCL_ExpQualToM1 {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
//
public class DiffCL_ExpUnqual {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -98,8 +97,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -58,7 +57,7 @@
//
public class DiffCL_PkgNotExp {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java Mon Apr 24 21:34:23 2017 +0200
@@ -42,8 +42,6 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -68,7 +66,7 @@
//
public class DiffCL_Umod {
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1x is a strict module and has not established
@@ -89,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -102,8 +100,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
@@ -138,7 +136,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -151,8 +149,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
@@ -187,7 +185,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -200,8 +198,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,7 +38,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -63,7 +62,7 @@
//
public class DiffCL_UmodUpkg {
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1x is a strict module and has not established
@@ -84,7 +83,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
@@ -133,7 +132,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -146,8 +145,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,7 +38,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
//
public class ExpQualOther {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -102,7 +101,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -112,8 +111,8 @@
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -48,7 +47,7 @@
public class ExpQualToM1 {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -78,7 +77,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -87,8 +86,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -48,7 +47,7 @@
public class ExpUnqual {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -78,7 +77,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -87,8 +86,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java Mon Apr 24 21:34:23 2017 +0200
@@ -41,8 +41,6 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -61,7 +59,7 @@
public class ExportAllUnnamed {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -90,7 +88,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -99,8 +97,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -58,7 +57,7 @@
//
public class PkgNotExp {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x and m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x and m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java Mon Apr 24 21:34:23 2017 +0200
@@ -39,11 +39,9 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Module;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -68,7 +66,7 @@
//
public class Umod {
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1x is a strict module and has not established
@@ -89,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -99,8 +97,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", loader);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
@@ -135,7 +133,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -145,8 +143,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", loader);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
@@ -181,7 +179,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -191,8 +189,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", loader);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,7 +38,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
//
public class UmodDiffCL_ExpQualOther {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -98,8 +97,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,7 +38,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
//
public class UmodDiffCL_ExpUnqual {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -98,8 +97,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
//
public class UmodDiffCL_PkgNotExp {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java Mon Apr 24 21:34:23 2017 +0200
@@ -40,8 +40,6 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -63,7 +61,7 @@
//
public class UmodUPkg {
- // Create Layers over the boot layer to test different
+ // Create layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1x is a strict module and has not established
@@ -84,7 +82,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -94,8 +92,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", loader);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
@@ -130,7 +128,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -140,8 +138,8 @@
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1x", loader);
- // Create Layer that contains m1x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,7 +38,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -60,7 +59,7 @@
//
public class UmodUpkgDiffCL_ExpQualOther {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -89,7 +88,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -98,8 +97,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
//
public class UmodUpkgDiffCL_NotExp {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,12 +58,12 @@
//
public class UmodUpkg_ExpQualOther {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1x (need to define m1x to establish the Layer successfully)
+ // Define module: m1x (need to define m1x to establish the layer successfully)
// Can read: java.base, m2x, m3x
// Packages: none
// Packages exported: none
@@ -98,7 +97,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -108,8 +107,8 @@
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1x, m2x and m3x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x, m2x and m3x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -57,7 +56,7 @@
//
public class UmodUpkg_NotExp {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -86,7 +85,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -95,8 +94,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x and m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x and m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,12 +58,12 @@
//
public class Umod_ExpQualOther {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1x (need to define m1x to establish the Layer successfully)
+ // Define module: m1x (need to define m1x to establish the layer successfully)
// Can read: java.base, m2x, m3x
// Packages: none
// Packages exported: none
@@ -98,7 +97,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -108,8 +107,8 @@
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1x, m2x and m3x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x, m2x and m3x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -59,7 +58,7 @@
public class Umod_ExpUnqual {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -88,7 +87,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -97,8 +96,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,7 +37,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -57,7 +56,7 @@
//
public class Umod_PkgNotExp {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -86,7 +85,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -95,8 +94,8 @@
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1x and m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x and m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java Mon Apr 24 21:34:23 2017 +0200
@@ -22,7 +22,6 @@
*/
package p1;
-import java.lang.reflect.*;
import p2.c2;
public class c1ReadEdge {
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java Mon Apr 24 21:34:23 2017 +0200
@@ -22,7 +22,6 @@
*/
package p1;
-import java.lang.reflect.*;
import myloaders.MyDiffClassLoader;
import p2.c2;
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,6 @@
/*
* package p3;
- * import java.lang.reflect.*;
* public class c3ReadEdge {
* public c3ReadEdge() {
* // Establish read edge from module m1x, where c3ReadEdge is defined,
@@ -75,14 +74,14 @@
Utf8 "java/lang/Object"; // #28 at 0xBC
Utf8 "java/lang/Class"; // #29 at 0xCF
Utf8 "getModule"; // #30 at 0xE1
- Utf8 "()Ljava/lang/reflect/Module;"; // #31 at 0xED
+ Utf8 "()Ljava/lang/Module;"; // #31 at 0xED
Utf8 "getClassLoader"; // #32 at 0x010C
Utf8 "()Ljava/lang/ClassLoader;"; // #33 at 0x011D
Utf8 "java/lang/ClassLoader"; // #34 at 0x0139
Utf8 "getUnnamedModule"; // #35 at 0x0151
- Utf8 "java/lang/reflect/Module"; // #36 at 0x0164
+ Utf8 "java/lang/Module"; // #36 at 0x0164
Utf8 "addReads"; // #37 at 0x017F
- Utf8 "(Ljava/lang/reflect/Module;)Ljava/lang/reflect/Module;"; // #38 at 0x018A
+ Utf8 "(Ljava/lang/Module;)Ljava/lang/Module;"; // #38 at 0x018A
Utf8 "method4"; // #39 at 0x01C3
} // Constant Pool
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,6 @@
/*
* package p3;
- * import java.lang.reflect.*;
* import myloaders.MyDiffClassLoader;
*
* public class c3ReadEdgeDiffLoader {
@@ -100,14 +99,14 @@
Utf8 "java/lang/Object"; // #31 at 0xDD
Utf8 "java/lang/Class"; // #32 at 0xF0
Utf8 "getModule"; // #33 at 0x0102
- Utf8 "()Ljava/lang/reflect/Module;"; // #34 at 0x010E
+ Utf8 "()Ljava/lang/Module;"; // #34 at 0x010E
Utf8 "java/lang/ClassLoader"; // #35 at 0x012D
Utf8 "getSystemClassLoader"; // #36 at 0x0145
Utf8 "()Ljava/lang/ClassLoader;"; // #37 at 0x015C
Utf8 "getUnnamedModule"; // #38 at 0x0178
- Utf8 "java/lang/reflect/Module"; // #39 at 0x018B
+ Utf8 "java/lang/Module"; // #39 at 0x018B
Utf8 "addReads"; // #40 at 0x01A6
- Utf8 "(Ljava/lang/reflect/Module;)Ljava/lang/reflect/Module;"; // #41 at 0x01B1
+ Utf8 "(Ljava/lang/Module;)Ljava/lang/Module;"; // #41 at 0x01B1
Utf8 "myloaders/MyDiffClassLoader"; // #42 at 0x01EA
Utf8 "loader2"; // #43 at 0x0208
Utf8 "Lmyloaders/MyDiffClassLoader;"; // #44 at 0x0212
--- a/hotspot/test/runtime/modules/AccessCheck/p4/c4.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheck/p4/c4.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,8 +25,6 @@
package p4;
-import java.lang.reflect.Module;
-
public class c4 {
// Add a read edge from c4's module to given module m
public void addReads(Module m) {
--- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java Mon Apr 24 21:34:23 2017 +0200
@@ -21,7 +21,6 @@
* questions.
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
/*
@@ -31,7 +30,7 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckAllUnnamed
@@ -45,10 +44,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlM = jlObject.getModule();
+ assertNotNull(jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for AccessCheckWorks and assume it's also used to
// load class p2.c2.
@@ -58,13 +57,13 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlM);
// Define a module for p2.
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlM);
try {
ModuleHelper.AddModuleExportsToAllUnnamed((Module)null, "p2");
--- a/hotspot/test/runtime/modules/AccessCheckExp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckExp.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,13 +28,12 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckExp
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class AccessCheckExp {
@@ -44,10 +43,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for AccessCheckExp and assume it's also used to
// load classes p1.c1 and p2.c2.
@@ -57,13 +56,13 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
// Define a module for p2.
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,13 +27,12 @@
* @library /test/lib ..
* @compile p2/c2.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckJavaBase
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class AccessCheckJavaBase {
--- a/hotspot/test/runtime/modules/AccessCheckRead.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckRead.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,13 +28,12 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckRead
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class AccessCheckRead {
@@ -44,10 +43,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for AccessCheckRead and assume it's also used to
// load classes p1.c1 and p2.c2.
@@ -57,13 +56,13 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
// Define a module for p2.
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/AccessCheckSuper.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckSuper.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,13 +28,12 @@
* @compile p2/c2.java
* @compile p3/c3.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckSuper
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class AccessCheckSuper {
--- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java Mon Apr 24 21:34:23 2017 +0200
@@ -21,7 +21,6 @@
* questions.
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
/*
@@ -31,7 +30,7 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckUnnamed
@@ -44,10 +43,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for AccessCheckWorks and assume it's also used to
// load class p2.c2.
@@ -57,7 +56,7 @@
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
// p1.c1's ctor tries to call a method in p2.c2. This should fail because
// p1 is in the unnamed module and p2.c2 is not unqualifiedly exported.
--- a/hotspot/test/runtime/modules/AccessCheckWorks.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/AccessCheckWorks.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,13 +28,12 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 AccessCheckWorks
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class AccessCheckWorks {
@@ -45,10 +44,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for AccessCheckWorks and assume it's also used to
// load classes p1.c1 and p2.c2.
@@ -58,13 +57,13 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
// Define a module for p2.
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/CCE_module_msg.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/CCE_module_msg.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,14 +28,13 @@
* @compile p2/c2.java
* @compile p4/c4.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 CCE_module_msg
*/
import java.io.*;
-import java.lang.reflect.Module;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Path;
@@ -73,10 +72,10 @@
}
public static void invalidClassToString() throws Throwable {
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for CCE_module_msg and assume it's also used to
// load classes p1.c1 and p2.c2.
@@ -86,7 +85,7 @@
Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
try {
ModuleHelper.AddModuleExportsToAll(m2x, "p2");
@@ -105,10 +104,10 @@
}
public static void invalidClassToStringCustomLoader() throws Throwable {
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Create a customer class loader to load class p4/c4.
URL[] urls = new URL[] { CLASSES_DIR.toUri().toURL() };
--- a/hotspot/test/runtime/modules/ExportTwice.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/ExportTwice.java Mon Apr 24 21:34:23 2017 +0200
@@ -28,13 +28,12 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 ExportTwice
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class ExportTwice {
@@ -46,10 +45,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x, m3x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for ExportTwice and assume it's also used to
// load classes p1.c1 and p2.c2.
@@ -59,19 +58,19 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
// Define a module for p2.
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
// Define a module for p3.
m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
assertNotNull(m3x, "Module should not be null");
ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
- ModuleHelper.AddReadsModule(m3x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m3x, jlObject_jlM);
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java Mon Apr 24 21:34:23 2017 +0200
@@ -30,11 +30,10 @@
* @build sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @compile/module=java.base java/lang/ModuleHelper.java
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExportToAllUnnamed
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class JVMAddModuleExportToAllUnnamed {
@@ -44,10 +43,10 @@
public static void main(String args[]) throws Throwable {
Object m1x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for JVMAddModuleExportToAllUnnamed and assume it's also used to
// load class p1.c1.
@@ -57,7 +56,7 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
--- a/hotspot/test/runtime/modules/JVMAddModuleExports.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java Mon Apr 24 21:34:23 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,13 +26,12 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib ..
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 JVMAddModuleExports
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
public class JVMAddModuleExports {
--- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java Mon Apr 24 21:34:23 2017 +0200
@@ -21,7 +21,6 @@
* questions.
*/
-import java.lang.reflect.Module;
import static jdk.test.lib.Asserts.*;
/*
@@ -31,7 +30,7 @@
* @compile p2/c2.java
* @compile p1/c1.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 JVMAddModuleExportsToAll
@@ -45,10 +44,10 @@
public static void main(String args[]) throws Throwable {
Object m1x, m2x, m3x;
- // Get the java.lang.reflect.Module object for module java.base.
+ // Get the java.lang.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
- Object jlObject_jlrM = jlObject.getModule();
- assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null");
+ Object jlObject_jlM = jlObject.getModule();
+ assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null");
// Get the class loader for JVMAddModuleExportsToAll and assume it's also used to
// load class p2.c2.
@@ -58,13 +57,13 @@
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
- ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlM);
// Define a module for p2.
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlM);
try {
ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
@@ -80,7 +79,7 @@
// Expected
}
- try { // Expect IAE when passing a ClassLoader object instead of a java.lang.reflect.Module object.
+ try { // Expect IAE when passing a ClassLoader object instead of a java.lang.Module object.
ModuleHelper.AddModuleExportsToAll(this_cldr, "p2");
throw new RuntimeException("Failed to get the expected IAE for bad module");
} catch(IllegalArgumentException e) {
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java Mon Apr 24 21:34:23 2017 +0200
@@ -26,7 +26,7 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib ..
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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
--- a/hotspot/test/runtime/modules/JVMAddReadsModule.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMAddReadsModule.java Mon Apr 24 21:34:23 2017 +0200
@@ -26,7 +26,7 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib ..
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 JVMAddReadsModule
--- a/hotspot/test/runtime/modules/JVMDefineModule.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMDefineModule.java Mon Apr 24 21:34:23 2017 +0200
@@ -26,7 +26,7 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib ..
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 JVMDefineModule
@@ -78,7 +78,7 @@
ModuleHelper.DefineModule(new Object(), "9.0", "mymodule/here", new String[] { "mypackage1" });
throw new RuntimeException("Failed to get expected IAE or NPE for bad module");
} catch(IllegalArgumentException e) {
- if (!e.getMessage().contains("module is not an instance of type java.lang.reflect.Module")) {
+ if (!e.getMessage().contains("module is not an instance of type java.lang.Module")) {
throw new RuntimeException("Failed to get expected IAE message for bad module: " + e.getMessage());
}
}
--- a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,7 +27,7 @@
* @library /test/lib ..
* @compile p2/c2.java
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 JVMGetModuleByPkgName
@@ -35,7 +35,6 @@
import static jdk.test.lib.Asserts.*;
import java.lang.ClassLoader;
-import java.lang.reflect.Module;
public class JVMGetModuleByPkgName {
--- a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,7 +27,7 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib ..
* @build sun.hotspot.WhiteBox
- * @compile/module=java.base java/lang/reflect/ModuleHelper.java
+ * @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 -Xmx64m -Xmx64m LoadUnloadModuleStress 15000
--- a/hotspot/test/runtime/modules/ModuleHelper.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/ModuleHelper.java Mon Apr 24 21:34:23 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
@@ -23,7 +23,6 @@
import java.net.URI;
import java.lang.module.ModuleDescriptor;
-import java.lang.reflect.Module;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -41,19 +40,19 @@
public static void AddModuleExports(Object from, String pkg, Object to) throws Throwable {
WhiteBox wb = WhiteBox.getWhiteBox();
wb.AddModuleExports(from, pkg, to);
- java.lang.reflect.ModuleHelper.addExportsNoSync((Module)from, pkg, (Module)to);
+ java.lang.ModuleHelper.addExportsNoSync((Module)from, pkg, (Module)to);
}
public static void AddReadsModule(Object from, Object to) throws Throwable {
WhiteBox wb = WhiteBox.getWhiteBox();
wb.AddReadsModule(from, to);
- java.lang.reflect.ModuleHelper.addReadsNoSync((Module)from, (Module)to);
+ 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.reflect.ModuleHelper.addPackageNoSync((Module)m, pkg);
+ java.lang.ModuleHelper.addPackageNoSync((Module)m, pkg);
}
public static Module GetModuleByPackageName(Object ldr, String pkg) throws Throwable {
@@ -64,13 +63,13 @@
public static void AddModuleExportsToAllUnnamed(Object m, String pkg) throws Throwable {
WhiteBox wb = WhiteBox.getWhiteBox();
wb.AddModuleExportsToAllUnnamed(m, pkg);
- //java.lang.reflect.ModuleHelper.addExportsToAllUnnamedNoSync((Module)m, pkg);
+ //java.lang.ModuleHelper.addExportsToAllUnnamedNoSync((Module)m, pkg);
}
public static void AddModuleExportsToAll(Object m, String pkg) throws Throwable {
WhiteBox wb = WhiteBox.getWhiteBox();
wb.AddModuleExportsToAll(m, pkg);
- java.lang.reflect.ModuleHelper.addExportsNoSync((Module)m, pkg, (Module)null);
+ java.lang.ModuleHelper.addExportsNoSync((Module)m, pkg, (Module)null);
}
public static Module ModuleObject(String name, ClassLoader loader, String[] pkgs) throws Throwable {
@@ -87,7 +86,7 @@
ModuleDescriptor.newModule(name).packages(pkg_set).build();
URI uri = URI.create("module:/" + name);
- return java.lang.reflect.ModuleHelper.newModule(loader, descriptor);
+ return java.lang.ModuleHelper.newModule(loader, descriptor);
}
}
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,7 +25,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -47,7 +46,7 @@
//
public class ModuleNonBuiltinCLMain {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -90,7 +89,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -103,8 +102,8 @@
map.put("m2x", cl2);
map.put("m3x", cl3);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == cl1);
assertTrue(layer.findLoader("m2x") == cl2);
assertTrue(layer.findLoader("m3x") == cl3);
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,7 +25,6 @@
import static jdk.test.lib.Asserts.*;
-import java.lang.reflect.Layer;
import java.lang.module.Configuration;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
@@ -45,7 +44,7 @@
//
public class ModuleSameCLMain {
- // Create a Layer over the boot layer.
+ // Create a layer over the boot layer.
// Define modules within this layer to test access between
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
@@ -75,7 +74,7 @@
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1x"
- Configuration cf = Layer.boot()
+ Configuration cf = ModuleLayer.boot()
.configuration()
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
@@ -85,8 +84,8 @@
map.put("m1x", cl1);
map.put("m2x", cl1);
- // Create Layer that contains m1x & m2x
- Layer layer = Layer.boot().defineModules(cf, map::get);
+ // Create layer that contains m1x & m2x
+ ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1x") == cl1);
assertTrue(layer.findLoader("m2x") == cl1);
assertTrue(layer.findLoader("java.base") == null);
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java Mon Apr 24 21:34:23 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,9 +25,7 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
import java.lang.reflect.Method;
-import java.lang.reflect.Module;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
@@ -44,7 +42,7 @@
public static void main(String[] args) throws Exception {
ModuleFinder finder = ModuleFinder.of(MODS_DIR);
- Layer layerBoot = Layer.boot();
+ ModuleLayer layerBoot = ModuleLayer.boot();
Configuration cf = layerBoot
.configuration()
@@ -58,7 +56,7 @@
Callable<Void> task = new Callable<Void>() {
@Override
public Void call() throws Exception {
- Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
+ ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
Module transletModule = layer.findModule(MODULE_NAME).get();
testModule.addExports("test", transletModule);
Class<?> c = layer.findLoader(MODULE_NAME).loadClass("translet.Main");
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java Mon Apr 24 21:34:23 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,9 +25,7 @@
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
import java.lang.reflect.Method;
-import java.lang.reflect.Module;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
@@ -44,7 +42,7 @@
public static void main(String[] args) throws Exception {
ModuleFinder finder = ModuleFinder.of(MODS_DIR);
- Layer layerBoot = Layer.boot();
+ ModuleLayer layerBoot = ModuleLayer.boot();
Configuration cf = layerBoot
.configuration()
@@ -59,7 +57,7 @@
Callable<Void> task = new Callable<Void>() {
@Override
public Void call() throws Exception {
- Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
+ ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl);
Module transletModule = layer.findModule(MODULE_NAME).get();
testModule.addExports("test", transletModule);
testModule.addReads(transletModule);
--- a/hotspot/test/runtime/modules/getModuleJNI/GetModule.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/runtime/modules/getModuleJNI/GetModule.java Mon Apr 24 21:34:23 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,7 +26,6 @@
* @run main/native GetModule
*/
-import java.lang.reflect.Module;
import java.lang.management.LockInfo;
public class GetModule {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.lang.module.ModuleDescriptor;
+
+/**
+ * A helper class intended to be injected into java.lang using the
+ * java --patch-module option. The helper class provides access to package private
+ * methods in java.lang.Module.
+ */
+
+public final class ModuleHelper {
+
+ private ModuleHelper() { }
+
+ /**
+ * Creates a named module but without defining the module to the VM.
+ */
+ public static Module newModule(ClassLoader loader, ModuleDescriptor descriptor) {
+ return new Module(loader, descriptor);
+ }
+
+ /**
+ * Updates module {@code from} to that it reads module {@code to} without
+ * notifying the VM.
+ */
+ public static void addReadsNoSync(Module from, Module to) {
+ from.implAddReadsNoSync(to);
+ }
+
+ /**
+ * Updates module {@code from} so that it exports package {@code pkg}
+ * to module {@code to} but without notifying the VM. If {@code to} is
+ * {@code null} then the package is exported unconditionally.
+ */
+ public static void addExportsNoSync(Module from, String pkg, Module to) {
+ if (to == null) {
+ from.implAddExportsNoSync(pkg);
+ } else {
+ from.implAddExportsNoSync(pkg, to);
+ }
+ }
+
+ /**
+ * Adds a package to a module without notifying the VM.
+ */
+ public static void addPackageNoSync(Module m, String pkg) {
+ m.implAddPackageNoSync(pkg);
+ }
+
+}
--- a/hotspot/test/runtime/modules/java.base/java/lang/reflect/ModuleHelper.java Mon Apr 24 12:08:09 2017 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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.reflect;
-
-import java.lang.module.ModuleDescriptor;
-
-/**
- * A helper class intended to be injected into java.lang.reflect using the
- * java --patch-module option. The helper class provides access to package private
- * methods in java.lang.reflect.Module.
- */
-
-public final class ModuleHelper {
-
- private ModuleHelper() { }
-
- /**
- * Creates a named module but without defining the module to the VM.
- */
- public static Module newModule(ClassLoader loader, ModuleDescriptor descriptor) {
- return new Module(loader, descriptor);
- }
-
- /**
- * Updates module {@code from} to that it reads module {@code to} without
- * notifying the VM.
- */
- public static void addReadsNoSync(Module from, Module to) {
- from.implAddReadsNoSync(to);
- }
-
- /**
- * Updates module {@code from} so that it exports package {@code pkg}
- * to module {@code to} but without notifying the VM. If {@code to} is
- * {@code null} then the package is exported unconditionally.
- */
- public static void addExportsNoSync(Module from, String pkg, Module to) {
- from.implAddExportsNoSync(pkg, to);
- }
-
- /**
- * 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/attach/AttachSetGetFlag.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java Mon Apr 24 21:34:23 2017 +0200
@@ -80,7 +80,7 @@
try {
waitForReady(target);
- int pid = (int)target.getPid();
+ int pid = (int)target.pid();
HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString());
@@ -116,7 +116,7 @@
try {
waitForReady(target);
- int pid = (int)target.getPid();
+ int pid = (int)target.pid();
HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString());
--- a/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java Mon Apr 24 21:34:23 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
@@ -21,8 +21,6 @@
* questions.
*/
-import java.lang.reflect.Module;
-import java.lang.reflect.Layer;
import java.util.Set;
import java.util.HashSet;
@@ -35,10 +33,10 @@
public static void main(String[] args) throws InterruptedException {
- int modCount = Layer.boot().modules().size();
+ int modCount = ModuleLayer.boot().modules().size();
// Send all modules names via the process output
- for (Module mod : Layer.boot().modules()) {
+ for (Module mod : ModuleLayer.boot().modules()) {
String info = String.format("module %s", mod.getName());
write(info);
}
--- a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java Mon Apr 24 21:34:23 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
@@ -31,7 +31,6 @@
*/
import java.io.PrintStream;
-import java.lang.reflect.Module;
public class AddModuleExportsAndOpensTest {
--- a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c Mon Apr 24 21:34:23 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
@@ -47,7 +47,7 @@
#define FAILED 2
static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
static jvmtiEnv *jvmti = NULL;
static jint result = PASSED;
@@ -97,7 +97,7 @@
}
static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
jclass cls = NULL;
cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -127,7 +127,7 @@
if (mIsExported == NULL) {
const char* sign = "(Ljava/lang/String;)Z";
const char* name = open ? "isOpen" : "isExported";
- mIsExported = get_method(env, jlrM(env), name, sign);
+ mIsExported = get_method(env, jlM(env), name, sign);
}
jstr = JNI_ENV_PTR(env)->NewStringUTF(JNI_ENV_ARG(env, pkg));
res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
@@ -143,9 +143,9 @@
jboolean res = JNI_FALSE;
if (mIsExportedTo == NULL) {
- const char* sign = "(Ljava/lang/String;Ljava/lang/reflect/Module;)Z";
+ const char* sign = "(Ljava/lang/String;Ljava/lang/Module;)Z";
const char* name = open ? "isOpen" : "isExported";
- mIsExportedTo = get_method(env, jlrM(env), name, sign);
+ mIsExportedTo = get_method(env, jlM(env), name, sign);
}
jstr = JNI_ENV_PTR(env)->NewStringUTF(JNI_ENV_ARG(env, pkg));
res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
--- a/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java Mon Apr 24 21:34:23 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
@@ -32,7 +32,6 @@
import java.io.PrintStream;
import java.lang.instrument.Instrumentation;
-import java.lang.reflect.Module;
public class AddModuleReadsTest {
--- a/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c Mon Apr 24 21:34:23 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
@@ -47,7 +47,7 @@
#define FAILED 2
static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
static jvmtiEnv *jvmti = NULL;
static jint result = PASSED;
@@ -96,7 +96,7 @@
}
static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
jclass cls = NULL;
cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -123,8 +123,8 @@
jboolean res = JNI_FALSE;
if (mCanRead == NULL) {
- const char* sign = "(Ljava/lang/reflect/Module;)Z";
- mCanRead = get_method(env, jlrM(env), "canRead", sign);
+ const char* sign = "(Ljava/lang/Module;)Z";
+ mCanRead = get_method(env, jlM(env), "canRead", sign);
}
res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
mCanRead, to_module);
--- a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java Mon Apr 24 21:34:23 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
@@ -34,7 +34,6 @@
import java.io.PrintStream;
import java.lang.TestProvider;
-import java.lang.reflect.Module;
public class AddModuleUsesAndProvidesTest {
--- a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c Mon Apr 24 21:34:23 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
@@ -47,7 +47,7 @@
#define FAILED 2
static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
static jvmtiEnv *jvmti = NULL;
static jint result = PASSED;
@@ -97,7 +97,7 @@
}
static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
jclass cls = NULL;
cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -125,7 +125,7 @@
if (mCanUse == NULL) {
const char* sign = "(Ljava/lang/Class;)Z";
- mCanUse = get_method(env, jlrM(env), "canUse", sign);
+ mCanUse = get_method(env, jlM(env), "canUse", sign);
}
res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module),
mCanUse, service);
--- a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java Mon Apr 24 21:34:23 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
@@ -28,8 +28,6 @@
* @run main/othervm -agentlib:JvmtiGetAllModulesTest JvmtiGetAllModulesTest
*
*/
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.lang.module.ModuleReference;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReader;
@@ -79,15 +77,15 @@
final String MY_MODULE_NAME = "myModule";
// Verify that JVMTI reports exactly the same info as Java regarding the named modules
- Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI());
+ Asserts.assertEquals(ModuleLayer.boot().modules(), getModulesJVMTI());
// Load a new named module
ModuleDescriptor descriptor = ModuleDescriptor.newModule(MY_MODULE_NAME).build();
ModuleFinder finder = finderOf(descriptor);
ClassLoader loader = new ClassLoader() {};
- Configuration parent = Layer.boot().configuration();
+ Configuration parent = ModuleLayer.boot().configuration();
Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
- Layer my = Layer.boot().defineModules(cf, m -> loader);
+ ModuleLayer my = ModuleLayer.boot().defineModules(cf, m -> loader);
// Verify that the loaded module is indeed reported by JVMTI
Set<Module> jvmtiModules = getModulesJVMTI();
--- a/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c Mon Apr 24 21:34:23 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
@@ -53,7 +53,7 @@
return NULL;
}
- array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/reflect/Module"), NULL);
+ array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/Module"), NULL);
for (i = 0; i < modules_count; ++i) {
(*env)->SetObjectArrayElement(env, array, i, modules_ptr[i]);
--- a/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c Mon Apr 24 21:34:23 2017 +0200
@@ -47,7 +47,7 @@
#define FAILED 2
static const char *EXC_CNAME = "java/lang/Exception";
-static const char* MOD_CNAME = "Ljava/lang/reflect/Module;";
+static const char* MOD_CNAME = "Ljava/lang/Module;";
static jvmtiEnv *jvmti = NULL;
static jint result = PASSED;
@@ -115,7 +115,7 @@
}
static
-jclass jlrM(JNIEnv *env) {
+jclass jlM(JNIEnv *env) {
jclass cls = NULL;
cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME));
@@ -142,7 +142,7 @@
jobject loader = NULL;
if (cl_method == NULL) {
- cl_method = get_method(env, jlrM(env), "getClassLoader", "()Ljava/lang/ClassLoader;");
+ cl_method = get_method(env, jlM(env), "getClassLoader", "()Ljava/lang/ClassLoader;");
}
loader = (jobject)JNI_ENV_PTR(env)->CallObjectMethod(JNI_ENV_ARG(env, module), cl_method);
return loader;
@@ -157,7 +157,7 @@
const char *nstr = NULL;
if (method == NULL) {
- method = get_method(env, jlrM(env), "getName", "()Ljava/lang/String;");
+ method = get_method(env, jlM(env), "getName", "()Ljava/lang/String;");
}
jstr = (jstring)JNI_ENV_PTR(env)->CallObjectMethod(JNI_ENV_ARG(env, module), method);
if (jstr != NULL) {
--- a/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java Mon Apr 24 21:34:23 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
@@ -60,7 +60,7 @@
return;
}
- long ourPid = ProcessHandle.current().getPid();
+ long ourPid = ProcessHandle.current().pid();
// The string we are expecting in the debugd ouput
String golden = String.format(GOLDEN, ourPid);
--- a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
thread.start();
// Run jstack tool and collect the output
- JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+ JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
ToolResults results = jstackTool.measure();
// Analyze the jstack output for the correct thread type
--- a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@
debuggee.start();
// Collect output from the jstack tool
- JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+ JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
ToolResults results1 = jstackTool.measure();
// Go to method b()
--- a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
thread.start();
// Run jstack tool and collect the output
- JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+ JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
ToolResults results = jstackTool.measure();
// Analyze the jstack output for the strange thread name
--- a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
debuggee.start();
// Collect output from the jstack tool
- JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+ JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
ToolResults results1 = jstackTool.measure();
// Go to method b()
--- a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -105,7 +105,7 @@
waitThread.start();
// Collect output from the jstack tool
- JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+ JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
ToolResults results = jstackTool.measure();
// Analyze the jstack output for the patterns needed
--- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
public static void main(String[] args) throws Exception {
// We will be running "jstat -gc" tool
- JstatGcCapacityTool jstatGcTool = new JstatGcCapacityTool(ProcessHandle.current().getPid());
+ JstatGcCapacityTool jstatGcTool = new JstatGcCapacityTool(ProcessHandle.current().pid());
// Run once and get the results asserting that they are reasonable
JstatGcCapacityResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
public static void main(String[] args) throws Exception {
// We will be running "jstat -gc" tool
- JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().getPid());
+ JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().pid());
// Run once and get the results asserting that they are reasonable
JstatGcCauseResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,6 +38,6 @@
public class GcCauseTest02 {
public static void main(String[] args) throws Exception {
- new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().getPid())).run();
+ new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().pid())).run();
}
}
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
public static void main(String[] args) throws Exception {
// We will be running "jstat -gc" tool
- JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().getPid());
+ JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().pid());
System.gc();
--- a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
public static void main(String[] args) throws Exception {
// We will be running "jstat -gc" tool
- JstatGcNewTool jstatGcTool = new JstatGcNewTool(ProcessHandle.current().getPid());
+ JstatGcNewTool jstatGcTool = new JstatGcNewTool(ProcessHandle.current().pid());
// Run once and get the results asserting that they are reasonable
JstatGcNewResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
public static void main(String[] args) throws Exception {
// We will be running "jstat -gc" tool
- JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().getPid());
+ JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().pid());
// Run once and get the results asserting that they are reasonable
JstatGcResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java Mon Apr 24 21:34:23 2017 +0200
@@ -38,6 +38,6 @@
public class GcTest02 {
public static void main(String[] args) throws Exception {
- new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().getPid())).run();
+ new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().pid())).run();
}
}
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java Mon Apr 24 12:08:09 2017 -0400
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java Mon Apr 24 21:34:23 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
@@ -151,8 +151,9 @@
if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
try {
Class<?> aClass = loader.loadClass(name);
- if (name != "sun.reflect.misc.Trampoline"
- && name != "sun.tools.jconsole.OutputViewer") { // workaround for JDK-8159155
+ if (!"sun.reflect.misc.Trampoline".equals(name)
+ // workaround for JDK-8159155
+ && !"sun.tools.jconsole.OutputViewer".equals(name)) {
UNSAFE.ensureClassInitialized(aClass);
}
CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name);
--- a/jaxp/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -408,3 +408,5 @@
d02b6fbcab06c59a5f5a4a6736bd4ec6d2567855 jdk-9+162
92a38c75cd277d8b11f4382511a62087044659a1 jdk-9+163
6dc790a4e8310c86712cfdf7561a9820818546e6 jdk-9+164
+55419603989707ec50c84bb379bbdc1adeec3ab2 jdk-9+165
+8d3febd5c9d82e49f3e6e5f8eb10f959e7b50f83 jdk-9+166
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java Mon Apr 24 21:34:23 2017 +0200
@@ -99,7 +99,7 @@
= com.sun.org.apache.bcel.internal.Constants.ACC_STATIC;
public static final String MODULE_SIG
- = "Ljava/lang/reflect/Module;";
+ = "Ljava/lang/Module;";
public static final String CLASS_SIG
= "Ljava/lang/Class;";
public static final String STRING_SIG
@@ -255,7 +255,7 @@
public static final String CLASS_CLASS
= "java.lang.Class";
public static final String MODULE_CLASS
- = "java.lang.reflect.Module";
+ = "java.lang.Module";
public static final String STRING_CLASS
= "java.lang.String";
public static final String OBJECT_CLASS
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -43,8 +43,6 @@
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.lang.module.ModuleReader;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.security.AccessController;
import java.security.CodeSigner;
import java.security.CodeSource;
@@ -435,13 +433,13 @@
}
};
- Layer bootLayer = Layer.boot();
+ ModuleLayer bootLayer = ModuleLayer.boot();
Configuration cf = bootLayer.configuration()
.resolve(finder, ModuleFinder.of(), Set.of(mn));
- PrivilegedAction<Layer> pa = () -> bootLayer.defineModules(cf, name -> loader);
- Layer layer = AccessController.doPrivileged(pa);
+ PrivilegedAction<ModuleLayer> pa = () -> bootLayer.defineModules(cf, name -> loader);
+ ModuleLayer layer = AccessController.doPrivileged(pa);
Module m = layer.findModule(mn).get();
assert m.getLayer() == layer;
--- a/jaxp/test/TEST.ROOT Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/test/TEST.ROOT Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b04
+requiredVersion=4.2 b07
# Use new module options
useNewOptions=true
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,7 +24,6 @@
package jdk.testlibrary;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -60,7 +59,6 @@
} else {
executable = JDKToolFinder.getTestJDKTool(tool);
}
- vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
}
/**
--- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, 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
@@ -256,24 +256,7 @@
* @return Process id
*/
public static long getProcessId() {
- return ProcessHandle.current().getPid();
- }
-
- /**
- * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
- *
- * @return String[] with platform specific arguments, empty if there are
- * none
- */
- public static String[] getPlatformSpecificVMArgs() {
- String osName = System.getProperty("os.name");
- String dataModel = System.getProperty("sun.arch.data.model");
-
- if (osName.equals("SunOS") && dataModel.equals("64")) {
- return new String[] { "-d64" };
- }
-
- return new String[] {};
+ return ProcessHandle.current().pid();
}
/**
@@ -283,8 +266,7 @@
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
- public static ProcessBuilder createJavaProcessBuilder(String... command)
- throws Exception {
+ public static ProcessBuilder createJavaProcessBuilder(String... command) {
return createJavaProcessBuilder(false, command);
}
@@ -297,12 +279,11 @@
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
- public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
+ public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
String javapath = JDKToolFinder.getJDKTool("java");
ArrayList<String> args = new ArrayList<>();
args.add(javapath);
- Collections.addAll(args, getPlatformSpecificVMArgs());
if (addTestVmAndJavaOptions) {
// -cp is needed to make sure the same classpath is used whether the test is
@@ -542,8 +523,8 @@
}
@Override
- public long getPid() {
- return p.getPid();
+ public long pid() {
+ return p.pid();
}
@Override
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,8 +27,6 @@
import java.io.StringReader;
import java.io.StringWriter;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -52,7 +50,7 @@
* @summary test customized provider wraps the built-in system-default implementation of JAXP factories
*/
public class DefaultFactoryWrapperTest {
- private static final Module XML_MODULE = Layer.boot().findModule("java.xml").get();
+ private static final Module XML_MODULE = ModuleLayer.boot().findModule("java.xml").get();
private static final String PROVIDER_PACKAGE = "xwp";
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -29,9 +29,7 @@
import java.lang.System;
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
import java.lang.reflect.Method;
-import java.lang.reflect.Module;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Collections;
@@ -95,23 +93,23 @@
*/
public void testOneLayer() throws Exception {
ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
- Configuration cf1 = Layer.boot().configuration()
+ Configuration cf1 = ModuleLayer.boot().configuration()
.resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
- Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
+ ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl);
ClassLoader cl1 = layer1.findLoader("test");
Method m = cl1.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
for (String service : services1) {
Object o = m.invoke(null, service);
- Layer providerLayer = o.getClass().getModule().getLayer();
+ ModuleLayer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer1);
}
for (String service : services2) {
Object o = m.invoke(null, service);
- Layer providerLayer = o.getClass().getModule().getLayer();
- assertSame(providerLayer, Layer.boot());
+ ModuleLayer providerLayer = o.getClass().getModule().getLayer();
+ assertSame(providerLayer, ModuleLayer.boot());
}
}
@@ -125,26 +123,26 @@
*/
public void testTwoLayer() throws Exception {
ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
- Configuration cf1 = Layer.boot().configuration()
+ Configuration cf1 = ModuleLayer.boot().configuration()
.resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
- Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
+ ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl);
ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test"));
- Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
+ ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
ClassLoader cl2 = layer2.findLoader("test");
Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
for (String service : services1) {
Object o = m.invoke(null, service);
- Layer providerLayer = o.getClass().getModule().getLayer();
+ ModuleLayer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer1);
}
for (String service : services2) {
Object o = m.invoke(null, service);
- Layer providerLayer = o.getClass().getModule().getLayer();
+ ModuleLayer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer2);
}
@@ -159,26 +157,26 @@
*/
public void testTwoLayerWithDuplicate() throws Exception {
ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1, MOD_DIR2);
- Configuration cf1 = Layer.boot().configuration()
+ Configuration cf1 = ModuleLayer.boot().configuration()
.resolveAndBind(finder1, ModuleFinder.of(), Set.of("test"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
- Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
+ ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl);
ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test"));
- Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
+ ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
ClassLoader cl2 = layer2.findLoader("test");
Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
for (String service : services1) {
Object o = m.invoke(null, service);
- Layer providerLayer = o.getClass().getModule().getLayer();
+ ModuleLayer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer1);
}
for (String service : services2) {
Object o = m.invoke(null, service);
- Layer providerLayer = o.getClass().getModule().getLayer();
+ ModuleLayer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer2);
}
--- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,8 +24,6 @@
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import java.lang.module.ModuleDescriptor.Provides;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -38,7 +36,7 @@
* @param args, the names of provider modules, which have been loaded
*/
public static void main(String[] args) throws Exception {
- Module xml = Layer.boot().findModule("java.xml").get();
+ Module xml = ModuleLayer.boot().findModule("java.xml").get();
Set<String> allServices = new HashSet<>(Arrays.asList(expectedAllServices));
if (!allServices.equals(xml.getDescriptor().uses()))
@@ -46,7 +44,7 @@
+ xml.getDescriptor().uses());
long violationCount = Stream.of(args)
- .map(xmlProviderName -> Layer.boot().findModule(xmlProviderName).get())
+ .map(xmlProviderName -> ModuleLayer.boot().findModule(xmlProviderName).get())
.mapToLong(
// services provided by the implementation in provider module
provider -> provider.getDescriptor().provides().stream()
--- a/jaxws/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxws/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -411,3 +411,5 @@
b8aebe5292f23689f97cb8e66a9f327834dd43e6 jdk-9+162
3890f96e8995be8c84f330d1f65269b03ac36b24 jdk-9+163
1a52de2da827459e866fd736f9e9c62eb2ecd6bb jdk-9+164
+a987401bac0d528475e57732c9d5d93f4405804c jdk-9+165
+b1f30c27367bd286fa4eb8a767335e917a5b5b82 jdk-9+166
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java Mon Apr 24 21:34:23 2017 +0200
@@ -26,6 +26,7 @@
package com.sun.xml.internal.ws.addressing;
import com.sun.xml.internal.ws.api.server.*;
+import com.sun.xml.internal.ws.api.server.Module;
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java Mon Apr 24 21:34:23 2017 +0200
@@ -155,12 +155,10 @@
}
private InputStream inputStream() throws IOException {
- java.lang.reflect.Module module = resolvingClass.getModule();
- if (module != null) {
- InputStream stream = module.getResourceAsStream(path);
- if (stream != null) {
- return stream;
- }
+ java.lang.Module module = resolvingClass.getModule();
+ InputStream stream = module.getResourceAsStream(path);
+ if (stream != null) {
+ return stream;
}
throw new ServerRtException("cannot.load.wsdl", path);
}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java Mon Apr 24 21:34:23 2017 +0200
@@ -234,17 +234,15 @@
}
private static InputStream moduleResource(Class resolvingClass, String name) {
- java.lang.reflect.Module module = resolvingClass.getModule();
- if (module != null) {
- try {
- InputStream stream = module.getResourceAsStream(name);
- if (stream != null) {
- return stream;
- }
- } catch(IOException e) {
- throw new UtilException("util.failed.to.find.handlerchain.file",
- resolvingClass.getName(), name);
+ Module module = resolvingClass.getModule();
+ try {
+ InputStream stream = module.getResourceAsStream(name);
+ if (stream != null) {
+ return stream;
}
+ } catch(IOException e) {
+ throw new UtilException("util.failed.to.find.handlerchain.file",
+ resolvingClass.getName(), name);
}
return null;
}
--- a/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md Mon Apr 24 12:08:09 2017 -0400
+++ b/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md Mon Apr 24 21:34:23 2017 +0200
@@ -3,7 +3,7 @@
### RelaxNG Datatype License
<pre>
-Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
+Copyright (c) 2005, 2010 Thai Open Source Software Center Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
--- a/jdk/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -409,3 +409,4 @@
50171f8c47961710cbf87aead6f03fa431d8d240 jdk-9+163
6dea581453d7c0e767e3169cfec8b423a381e71d jdk-9+164
a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165
+5d2b48f1f0a322aca719b49ff02ab421705bffc7 jdk-9+166
--- a/jdk/make/data/charsetmapping/stdcs-linux Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/make/data/charsetmapping/stdcs-linux Mon Apr 24 21:34:23 2017 +0200
@@ -24,3 +24,5 @@
JIS_X_0212
JIS_X_0208_Solaris
JIS_X_0212_Solaris
+MS932
+SJIS # SJIS must go together with MS932 to support sun.nio.cs.map
--- a/jdk/src/java.base/linux/native/libnio/ch/EPoll.c Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/linux/native/libnio/ch/EPoll.c Mon Apr 24 21:34:23 2017 +0200
@@ -95,9 +95,3 @@
}
return res;
}
-
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_EPoll_close0(JNIEnv *env, jclass c, jint epfd) {
- int res;
- RESTARTABLE(close(epfd), res);
-}
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +42,10 @@
* @author Andreas Sterbenz
* @since 1.4.2
*/
-final class CounterMode extends FeedbackCipher {
+class CounterMode extends FeedbackCipher {
// current counter value
- private final byte[] counter;
+ final byte[] counter;
// encrypted bytes of the previous counter value
private final byte[] encryptedCounter;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java Mon Apr 24 21:34:23 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
@@ -29,52 +29,43 @@
package com.sun.crypto.provider;
-import java.security.*;
-import javax.crypto.*;
+import javax.crypto.IllegalBlockSizeException;
import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE;
/**
* This class represents the GCTR function defined in NIST 800-38D
- * under section 6.5. It needs to be constructed w/ an initialized
- * cipher object, and initial counter block(ICB). Given an input X
- * of arbitrary length, it processes and returns an output which has
- * the same length as X. The invariants of this class are:
- *
- * (1) The length of intialCounterBlk (and also of its clones, e.g.,
- * fields counter and counterSave) is equal to AES_BLOCK_SIZE.
- *
- * (2) After construction, the field counter never becomes null, it
- * always contains a byte array of length AES_BLOCK_SIZE.
+ * under section 6.5. With a given cipher object and initial counter
+ * block, a counter mode operation is performed. Blocksize is limited
+ * to 16 bytes.
*
* If any invariant is broken, failures can occur because the
* AESCrypt.encryptBlock method can be intrinsified on the HotSpot VM
* (see JDK-8067648 for details).
*
+ * The counter mode operations can be intrinsified and parallelized
+ * by using CounterMode.implCrypt() if HotSpot VM supports it on the
+ * architecture.
+ *
* <p>This function is used in the implementation of GCM mode.
*
* @since 1.8
*/
-final class GCTR {
-
- // these fields should not change after the object has been constructed
- private final SymmetricCipher aes;
- private final byte[] icb;
+final class GCTR extends CounterMode {
- // the current counter value
- private byte[] counter;
-
- // needed for save/restore calls
- private byte[] counterSave = null;
-
- // NOTE: cipher should already be initialized
GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) {
- this.aes = cipher;
+ super(cipher);
if (initialCounterBlk.length != AES_BLOCK_SIZE) {
throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length +
") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")");
}
- this.icb = initialCounterBlk;
- this.counter = icb.clone();
+
+ iv = initialCounterBlk;
+ reset();
+ }
+
+ @Override
+ String getFeedback() {
+ return "GCTR";
}
// input must be multiples of 128-bit blocks when calling update
@@ -89,23 +80,11 @@
throw new RuntimeException("output buffer too small");
}
- byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
-
- int numOfCompleteBlocks = inLen / AES_BLOCK_SIZE;
- for (int i = 0; i < numOfCompleteBlocks; i++) {
- aes.encryptBlock(counter, 0, encryptedCntr, 0);
- for (int n = 0; n < AES_BLOCK_SIZE; n++) {
- int index = (i * AES_BLOCK_SIZE + n);
- out[outOfs + index] =
- (byte) ((in[inOfs + index] ^ encryptedCntr[n]));
- }
- GaloisCounterMode.increment32(counter);
- }
- return inLen;
+ return encrypt(in, inOfs, inLen, out, outOfs);
}
// input can be arbitrary size when calling doFinal
- protected int doFinal(byte[] in, int inOfs, int inLen, byte[] out,
+ int doFinal(byte[] in, int inOfs, int inLen, byte[] out,
int outOfs) throws IllegalBlockSizeException {
try {
if (inLen < 0) {
@@ -118,7 +97,7 @@
if (lastBlockSize != 0) {
// do the last partial block
byte[] encryptedCntr = new byte[AES_BLOCK_SIZE];
- aes.encryptBlock(counter, 0, encryptedCntr, 0);
+ embeddedCipher.encryptBlock(counter, 0, encryptedCntr, 0);
for (int n = 0; n < lastBlockSize; n++) {
out[outOfs + completeBlkLen + n] =
(byte) ((in[inOfs + completeBlkLen + n] ^
@@ -131,28 +110,4 @@
}
return inLen;
}
-
- /**
- * Resets the content of this object to when it's first constructed.
- */
- void reset() {
- System.arraycopy(icb, 0, counter, 0, icb.length);
- counterSave = null;
- }
-
- /**
- * Save the current content of this object.
- */
- void save() {
- this.counterSave = this.counter.clone();
- }
-
- /**
- * Restores the content of this object to the previous saved one.
- */
- void restore() {
- if (this.counterSave != null) {
- this.counter = this.counterSave;
- }
- }
}
--- a/jdk/src/java.base/share/classes/java/io/FilePermission.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/io/FilePermission.java Mon Apr 24 21:34:23 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
@@ -209,6 +209,10 @@
private static final Path here = builtInFS.getPath(
GetPropertyAction.privilegedGetProperty("user.dir"));
+ private static final Path EMPTY_PATH = builtInFS.getPath("");
+ private static final Path DASH_PATH = builtInFS.getPath("-");
+ private static final Path DOTDOT_PATH = builtInFS.getPath("..");
+
/**
* A private constructor that clones some and updates some,
* always with a different name.
@@ -341,7 +345,7 @@
.normalize();
// lastName should always be non-null now
Path lastName = npath.getFileName();
- if (lastName != null && lastName.toString().equals("-")) {
+ if (lastName != null && lastName.equals(DASH_PATH)) {
directory = true;
recursive = !rememberStar;
npath = npath.getParent();
@@ -679,23 +683,76 @@
* @return the depth in between
*/
private static int containsPath(Path p1, Path p2) {
- Path p;
- try {
- p = p2.relativize(p1).normalize();
- if (p.getName(0).toString().isEmpty()) {
- return 0;
- } else {
- for (Path item: p) {
- String s = item.toString();
- if (!s.equals("..")) {
- return -1;
- }
- }
- return p.getNameCount();
- }
- } catch (IllegalArgumentException iae) {
+
+ // Two paths must have the same root. For example,
+ // there is no contains relation between any two of
+ // "/x", "x", "C:/x", "C:x", and "//host/share/x".
+ if (!Objects.equals(p1.getRoot(), p2.getRoot())) {
return -1;
}
+
+ // Empty path (i.e. "." or "") is a strange beast,
+ // because its getNameCount()==1 but getName(0) is null.
+ // It's better to deal with it separately.
+ if (p1.equals(EMPTY_PATH)) {
+ if (p2.equals(EMPTY_PATH)) {
+ return 0;
+ } else if (p2.getName(0).equals(DOTDOT_PATH)) {
+ // "." contains p2 iif p2 has no "..". Since a
+ // a normalized path can only have 0 or more
+ // ".." at the beginning. We only need to look
+ // at the head.
+ return -1;
+ } else {
+ // and the distance is p2's name count. i.e.
+ // 3 between "." and "a/b/c".
+ return p2.getNameCount();
+ }
+ } else if (p2.equals(EMPTY_PATH)) {
+ int c1 = p1.getNameCount();
+ if (!p1.getName(c1 - 1).equals(DOTDOT_PATH)) {
+ // "." is inside p1 iif p1 is 1 or more "..".
+ // For the same reason above, we only need to
+ // look at the tail.
+ return -1;
+ }
+ // and the distance is the count of ".."
+ return c1;
+ }
+
+ // Good. No more empty paths.
+
+ // Common heads are removed
+
+ int c1 = p1.getNameCount();
+ int c2 = p2.getNameCount();
+
+ int n = Math.min(c1, c2);
+ int i = 0;
+ while (i < n) {
+ if (!p1.getName(i).equals(p2.getName(i)))
+ break;
+ i++;
+ }
+
+ // for p1 containing p2, p1 must be 0-or-more "..",
+ // and p2 cannot have "..". For the same reason, we only
+ // check tail of p1 and head of p2.
+ if (i < c1 && !p1.getName(c1 - 1).equals(DOTDOT_PATH)) {
+ return -1;
+ }
+
+ if (i < c2 && p2.getName(i).equals(DOTDOT_PATH)) {
+ return -1;
+ }
+
+ // and the distance is the name counts added (after removing
+ // the common heads).
+
+ // For example: p1 = "../../..", p2 = "../a".
+ // After removing the common heads, they become "../.." and "a",
+ // and the distance is (3-1)+(2-1) = 3.
+ return c1 - i + c2 - i;
}
/**
--- a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java Mon Apr 24 21:34:23 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
@@ -307,6 +307,8 @@
* sequence.
*/
public int codePointAt(int index) {
+ int count = this.count;
+ byte[] value = this.value;
checkIndex(index, count);
if (isLatin1()) {
return value[index] & 0xff;
@@ -560,11 +562,7 @@
val[count++] = 'l';
val[count++] = 'l';
} else {
- checkOffset(count + 4, val.length >> 1);
- StringUTF16.putChar(val, count++, 'n');
- StringUTF16.putChar(val, count++, 'u');
- StringUTF16.putChar(val, count++, 'l');
- StringUTF16.putChar(val, count++, 'l');
+ count = StringUTF16.putCharsAt(val, count, 'n', 'u', 'l', 'l');
}
this.count = count;
return this;
@@ -695,18 +693,9 @@
}
} else {
if (b) {
- checkOffset(count + 4, val.length >> 1);
- StringUTF16.putChar(val, count++, 't');
- StringUTF16.putChar(val, count++, 'r');
- StringUTF16.putChar(val, count++, 'u');
- StringUTF16.putChar(val, count++, 'e');
+ count = StringUTF16.putCharsAt(val, count, 't', 'r', 'u', 'e');
} else {
- checkOffset(count + 5, val.length >> 1);
- StringUTF16.putChar(val, count++, 'f');
- StringUTF16.putChar(val, count++, 'a');
- StringUTF16.putChar(val, count++, 'l');
- StringUTF16.putChar(val, count++, 's');
- StringUTF16.putChar(val, count++, 'e');
+ count = StringUTF16.putCharsAt(val, count, 'f', 'a', 'l', 's', 'e');
}
}
this.count = count;
@@ -755,16 +744,15 @@
* @return a reference to this object.
*/
public AbstractStringBuilder append(int i) {
+ int count = this.count;
int spaceNeeded = count + Integer.stringSize(i);
ensureCapacityInternal(spaceNeeded);
if (isLatin1()) {
Integer.getChars(i, spaceNeeded, value);
} else {
- byte[] val = this.value;
- checkOffset(spaceNeeded, val.length >> 1);
- Integer.getCharsUTF16(i, spaceNeeded, val);
+ StringUTF16.getChars(i, count, spaceNeeded, value);
}
- count = spaceNeeded;
+ this.count = spaceNeeded;
return this;
}
@@ -781,16 +769,15 @@
* @return a reference to this object.
*/
public AbstractStringBuilder append(long l) {
+ int count = this.count;
int spaceNeeded = count + Long.stringSize(l);
ensureCapacityInternal(spaceNeeded);
if (isLatin1()) {
Long.getChars(l, spaceNeeded, value);
} else {
- byte[] val = this.value;
- checkOffset(spaceNeeded, val.length >> 1);
- Long.getCharsUTF16(l, spaceNeeded, val);
+ StringUTF16.getChars(l, count, spaceNeeded, value);
}
- count = spaceNeeded;
+ this.count = spaceNeeded;
return this;
}
@@ -843,6 +830,7 @@
* greater than {@code end}.
*/
public AbstractStringBuilder delete(int start, int end) {
+ int count = this.count;
if (end > count) {
end = count;
}
@@ -850,7 +838,7 @@
int len = end - start;
if (len > 0) {
shift(end, -len);
- count -= len;
+ this.count = count - len;
}
return this;
}
@@ -925,6 +913,7 @@
* greater than {@code end}.
*/
public AbstractStringBuilder replace(int start, int end, String str) {
+ int count = this.count;
if (end > count) {
end = count;
}
@@ -933,7 +922,7 @@
int newCount = count + len - (end - start);
ensureCapacityInternal(newCount);
shift(end, newCount - count);
- count = newCount;
+ this.count = newCount;
putStringAt(start, str);
return this;
}
@@ -1500,40 +1489,11 @@
val[k] = cj;
}
} else {
- checkOffset(count, val.length >> 1);
- boolean hasSurrogates = false;
- for (int j = (n-1) >> 1; j >= 0; j--) {
- int k = n - j;
- char cj = StringUTF16.getChar(val, j);
- char ck = StringUTF16.getChar(val, k);
- StringUTF16.putChar(val, j, ck);
- StringUTF16.putChar(val, k, cj);
- if (Character.isSurrogate(cj) ||
- Character.isSurrogate(ck)) {
- hasSurrogates = true;
- }
- }
- if (hasSurrogates) {
- reverseAllValidSurrogatePairs(val, count);
- }
+ StringUTF16.reverse(val, count);
}
return this;
}
- /** Outlined helper method for reverse() */
- private void reverseAllValidSurrogatePairs(byte[] val, int count) {
- for (int i = 0; i < count - 1; i++) {
- char c2 = StringUTF16.getChar(val, i);
- if (Character.isLowSurrogate(c2)) {
- char c1 = StringUTF16.getChar(val, i + 1);
- if (Character.isHighSurrogate(c1)) {
- StringUTF16.putChar(val, i++, c1);
- StringUTF16.putChar(val, i, c2);
- }
- }
- }
- }
-
/**
* Returns a string representing the data in this sequence.
* A new {@code String} object is allocated and initialized to
@@ -1682,6 +1642,7 @@
}
private final void appendChars(char[] s, int off, int end) {
+ int count = this.count;
if (isLatin1()) {
byte[] val = this.value;
for (int i = off, j = count; i < end; i++) {
@@ -1689,17 +1650,17 @@
if (StringLatin1.canEncode(c)) {
val[j++] = (byte)c;
} else {
- count = j;
+ this.count = count = j;
inflate();
StringUTF16.putCharsSB(this.value, j, s, i, end);
- count += end - i;
+ this.count = count + end - i;
return;
}
}
} else {
StringUTF16.putCharsSB(this.value, count, s, off, end);
}
- count += end - off;
+ this.count = count + end - off;
}
private final void appendChars(CharSequence s, int off, int end) {
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -386,7 +386,7 @@
}
/** byte[]/UTF16 version */
- static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int offset, int len) {
+ private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int offset, int len) {
int charPos = offset + len;
int radix = 1 << shift;
int mask = radix - 1;
@@ -442,7 +442,7 @@
return new String(buf, LATIN1);
} else {
byte[] buf = new byte[size * 2];
- getCharsUTF16(i, size, buf);
+ StringUTF16.getChars(i, size, buf);
return new String(buf, UTF16);
}
}
@@ -516,49 +516,6 @@
return charPos;
}
- /**
- * This is a variant of {@link #getChars(int, int, byte[])}, but for
- * UTF-16 coder.
- *
- * @param i value to convert
- * @param index next index, after the least significant digit
- * @param buf target buffer, UTF16-coded.
- * @return index of the most significant digit or minus sign, if present
- */
- static int getCharsUTF16(int i, int index, byte[] buf) {
- int q, r;
- int charPos = index;
-
- boolean negative = (i < 0);
- if (!negative) {
- i = -i;
- }
-
- // Get 2 digits/iteration using ints
- while (i <= -100) {
- q = i / 100;
- r = (q * 100) - i;
- i = q;
- StringUTF16.putChar(buf, --charPos, DigitOnes[r]);
- StringUTF16.putChar(buf, --charPos, DigitTens[r]);
- }
-
- // We know there are at most two digits left at this point.
- q = i / 10;
- r = (q * 10) - i;
- StringUTF16.putChar(buf, --charPos, '0' + r);
-
- // Whatever left is the remaining digit.
- if (q < 0) {
- StringUTF16.putChar(buf, --charPos, '0' - q);
- }
-
- if (negative) {
- StringUTF16.putChar(buf, --charPos, '-');
- }
- return charPos;
- }
-
// Left here for compatibility reasons, see JDK-8143900.
static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
99999999, 999999999, Integer.MAX_VALUE };
--- a/jdk/src/java.base/share/classes/java/lang/Long.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -414,7 +414,7 @@
}
/** byte[]/UTF16 version */
- static void formatUnsignedLong0UTF16(long val, int shift, byte[] buf, int offset, int len) {
+ private static void formatUnsignedLong0UTF16(long val, int shift, byte[] buf, int offset, int len) {
int charPos = offset + len;
int radix = 1 << shift;
int mask = radix - 1;
@@ -475,7 +475,7 @@
return new String(buf, LATIN1);
} else {
byte[] buf = new byte[size * 2];
- getCharsUTF16(i, size, buf);
+ StringUTF16.getChars(i, size, buf);
return new String(buf, UTF16);
}
}
@@ -562,61 +562,6 @@
}
/**
- * This is a variant of {@link #getChars(long, int, byte[])}, but for
- * UTF-16 coder.
- *
- * @param i value to convert
- * @param index next index, after the least significant digit
- * @param buf target buffer, UTF16-coded.
- * @return index of the most significant digit or minus sign, if present
- */
- static int getCharsUTF16(long i, int index, byte[] buf) {
- long q;
- int r;
- int charPos = index;
-
- boolean negative = (i < 0);
- if (!negative) {
- i = -i;
- }
-
- // Get 2 digits/iteration using longs until quotient fits into an int
- while (i <= Integer.MIN_VALUE) {
- q = i / 100;
- r = (int)((q * 100) - i);
- i = q;
- StringUTF16.putChar(buf, --charPos, Integer.DigitOnes[r]);
- StringUTF16.putChar(buf, --charPos, Integer.DigitTens[r]);
- }
-
- // Get 2 digits/iteration using ints
- int q2;
- int i2 = (int)i;
- while (i2 <= -100) {
- q2 = i2 / 100;
- r = (q2 * 100) - i2;
- i2 = q2;
- StringUTF16.putChar(buf, --charPos, Integer.DigitOnes[r]);
- StringUTF16.putChar(buf, --charPos, Integer.DigitTens[r]);
- }
-
- // We know there are at most two digits left at this point.
- q2 = i2 / 10;
- r = (q2 * 10) - i2;
- StringUTF16.putChar(buf, --charPos, '0' + r);
-
- // Whatever left is the remaining digit.
- if (q2 < 0) {
- StringUTF16.putChar(buf, --charPos, '0' - q2);
- }
-
- if (negative) {
- StringUTF16.putChar(buf, --charPos, '-');
- }
- return charPos;
- }
-
- /**
* Returns the string representation size for a given long value.
*
* @param x long value
--- a/jdk/src/java.base/share/classes/java/lang/Process.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java Mon Apr 24 21:34:23 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
@@ -80,10 +80,10 @@
*
* <p>Subclasses of Process should override the {@link #onExit()} and
* {@link #toHandle()} methods to provide a fully functional Process including the
- * {@link #getPid() process id},
- * {@link #info() information about the process},
- * {@link #children() direct children}, and
- * {@link #descendants() direct children plus descendants of those children} of the process.
+ * {@linkplain #pid() process id},
+ * {@linkplain #info() information about the process},
+ * {@linkplain #children() direct children}, and
+ * {@linkplain #descendants() direct children plus descendants of those children} of the process.
* Delegating to the underlying Process or ProcessHandle is typically
* easiest and most efficient.
*
@@ -237,14 +237,14 @@
/**
* Kills the process.
* Whether the process represented by this {@code Process} object is
- * {@link #supportsNormalTermination normally terminated} or not is
+ * {@linkplain #supportsNormalTermination normally terminated} or not is
* implementation dependent.
* Forcible process destruction is defined as the immediate termination of a
* process, whereas normal termination allows the process to shut down cleanly.
* If the process is not alive, no action is taken.
* <p>
* The {@link java.util.concurrent.CompletableFuture} from {@link #onExit} is
- * {@link java.util.concurrent.CompletableFuture#complete completed}
+ * {@linkplain java.util.concurrent.CompletableFuture#complete completed}
* when the process has terminated.
*/
public abstract void destroy();
@@ -257,7 +257,7 @@
* If the process is not alive, no action is taken.
* <p>
* The {@link java.util.concurrent.CompletableFuture} from {@link #onExit} is
- * {@link java.util.concurrent.CompletableFuture#complete completed}
+ * {@linkplain java.util.concurrent.CompletableFuture#complete completed}
* when the process has terminated.
* <p>
* Invoking this method on {@code Process} objects returned by
@@ -335,15 +335,15 @@
*
* @implSpec
* The implementation of this method returns the process id as:
- * {@link #toHandle toHandle().getPid()}.
+ * {@link #toHandle toHandle().pid()}.
*
* @return the native process id of the process
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
* @since 9
*/
- public long getPid() {
- return toHandle().getPid();
+ public long pid() {
+ return toHandle().pid();
}
/**
@@ -357,9 +357,9 @@
* <p>
* Calling {@code onExit().get()} waits for the process to terminate and returns
* the Process. The future can be used to check if the process is
- * {@link java.util.concurrent.CompletableFuture#isDone done} or to
- * {@link java.util.concurrent.CompletableFuture#get() wait} for it to terminate.
- * {@link java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
+ * {@linkplain java.util.concurrent.CompletableFuture#isDone done} or to
+ * {@linkplain java.util.concurrent.CompletableFuture#get() wait} for it to terminate.
+ * {@linkplain java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
* the CompletableFuture does not affect the Process.
* <p>
* Processes returned from {@link ProcessBuilder#start} override the
@@ -389,7 +389,7 @@
* {@code waitFor} is interrupted, the thread's interrupt status is preserved.
* <p>
* When {@link #waitFor()} returns successfully the CompletableFuture is
- * {@link java.util.concurrent.CompletableFuture#complete completed} regardless
+ * {@linkplain java.util.concurrent.CompletableFuture#complete completed} regardless
* of the exit status of the process.
*
* This implementation may consume a lot of memory for thread stacks if a
@@ -463,7 +463,7 @@
* This implementation throws an instance of
* {@link java.lang.UnsupportedOperationException} and performs no other action.
* Subclasses should override this method to provide a ProcessHandle for the
- * process. The methods {@link #getPid}, {@link #info}, {@link #children},
+ * process. The methods {@link #pid}, {@link #info}, {@link #children},
* and {@link #descendants}, unless overridden, operate on the ProcessHandle.
*
* @return Returns a ProcessHandle for the Process
@@ -500,10 +500,10 @@
/**
* Returns a snapshot of the direct children of the process.
* The parent of a direct child process is the process.
- * Typically, a process that is {@link #isAlive not alive} has no children.
+ * Typically, a process that is {@linkplain #isAlive not alive} has no children.
* <p>
* <em>Note that processes are created and terminate asynchronously.
- * There is no guarantee that a process is {@link #isAlive alive}.
+ * There is no guarantee that a process is {@linkplain #isAlive alive}.
* </em>
*
* @implSpec
@@ -526,10 +526,10 @@
* Returns a snapshot of the descendants of the process.
* The descendants of a process are the children of the process
* plus the descendants of those children, recursively.
- * Typically, a process that is {@link #isAlive not alive} has no children.
+ * Typically, a process that is {@linkplain #isAlive not alive} has no children.
* <p>
* <em>Note that processes are created and terminate asynchronously.
- * There is no guarantee that a process is {@link #isAlive alive}.
+ * There is no guarantee that a process is {@linkplain #isAlive alive}.
* </em>
*
* @implSpec
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, 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
@@ -104,7 +104,7 @@
* @throws UnsupportedOperationException if the implementation
* does not support this operation
*/
- long getPid();
+ long pid();
/**
* Returns an {@code Optional<ProcessHandle>} for an existing native process.
@@ -383,7 +383,7 @@
/**
* Returns a hash code value for this ProcessHandle.
* The hashcode value follows the general contract for {@link Object#hashCode()}.
- * The value is a function of the {@link #getPid getPid()} value and
+ * The value is a function of the {@link #pid pid()} value and
* may be a function of additional information to uniquely identify the process.
* If two ProcessHandles are equal according to the {@link #equals(Object) equals}
* method, then calling the hashCode method on each of the two objects
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -35,11 +35,7 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
import java.util.stream.Stream;
@@ -176,7 +172,7 @@
throw new IllegalStateException("onExit for current process not allowed");
}
- return ProcessHandleImpl.completion(getPid(), false)
+ return ProcessHandleImpl.completion(pid(), false)
.handleAsync((exitStatus, unusedThrowable) -> this);
}
@@ -259,7 +255,7 @@
* @return the native process ID
*/
@Override
- public long getPid() {
+ public long pid() {
return pid;
}
--- a/jdk/src/java.base/share/classes/java/lang/String.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/String.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1064,11 +1064,7 @@
if (!isLatin1()) { // utf16 str and latin1 abs can never be "equal"
return false;
}
- for (int i = 0; i < len; i++) {
- if ((char)(v1[i] & 0xff) != StringUTF16.getChar(v2, i)) {
- return false;
- }
- }
+ return StringUTF16.contentEquals(v1, v2, len);
}
return true;
}
@@ -1120,10 +1116,8 @@
}
}
} else {
- for (int i = 0; i < n; i++) {
- if (StringUTF16.getChar(val, i) != cs.charAt(i)) {
- return false;
- }
+ if (!StringUTF16.contentEquals(val, cs, n)) {
+ return false;
}
}
return true;
@@ -1734,6 +1728,9 @@
if (tgtCount == 0) {
return fromIndex;
}
+ if (tgtCount > srcCount) {
+ return -1;
+ }
if (srcCoder == tgtCoder) {
return srcCoder == LATIN1
? StringLatin1.indexOf(src, srcCount, tgt, tgtCount, fromIndex)
@@ -1792,7 +1789,7 @@
* is the string being searched for.
*
* @param src the characters being searched.
- * @param srcCoder coder handles the mapping between bytes/chars
+ * @param srcCoder coder handles the mapping between bytes/chars
* @param srcCount count of the source string.
* @param tgt the characters being searched for.
* @param fromIndex the index to begin searching from.
@@ -1807,12 +1804,12 @@
* consistency, don't check for null str.
*/
int rightIndex = srcCount - tgtCount;
+ if (fromIndex > rightIndex) {
+ fromIndex = rightIndex;
+ }
if (fromIndex < 0) {
return -1;
}
- if (fromIndex > rightIndex) {
- fromIndex = rightIndex;
- }
/* Empty string always matches. */
if (tgtCount == 0) {
return fromIndex;
@@ -1825,31 +1822,8 @@
if (srcCoder == LATIN1) { // && tgtCoder == UTF16
return -1;
}
- // srcCoder == UTF16 && tgtCoder == LATIN1
- int min = tgtCount - 1;
- int i = min + fromIndex;
- int strLastIndex = tgtCount - 1;
-
- char strLastChar = (char)(tgt[strLastIndex] & 0xff);
- startSearchForLastChar:
- while (true) {
- while (i >= min && StringUTF16.getChar(src, i) != strLastChar) {
- i--;
- }
- if (i < min) {
- return -1;
- }
- int j = i - 1;
- int start = j - strLastIndex;
- int k = strLastIndex - 1;
- while (j > start) {
- if (StringUTF16.getChar(src, j--) != (tgt[k--] & 0xff)) {
- i--;
- continue startSearchForLastChar;
- }
- }
- return start + 1;
- }
+ // srcCoder == UTF16 && tgtCoder == LATIN1
+ return StringUTF16.lastIndexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
}
/**
@@ -3078,7 +3052,8 @@
*/
static void checkIndex(int index, int length) {
if (index < 0 || index >= length) {
- throw new StringIndexOutOfBoundsException("index " + index);
+ throw new StringIndexOutOfBoundsException("index " + index +
+ ",length " + length);
}
}
@@ -3116,7 +3091,7 @@
* If {@code begin} is negative, {@code begin} is greater than
* {@code end}, or {@code end} is greater than {@code length}.
*/
- private static void checkBoundsBeginEnd(int begin, int end, int length) {
+ static void checkBoundsBeginEnd(int begin, int end, int length) {
if (begin < 0 || begin > end || end > length) {
throw new StringIndexOutOfBoundsException(
"begin " + begin + ", end " + end + ", length " + length);
--- a/jdk/src/java.base/share/classes/java/lang/StringConcatHelper.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/StringConcatHelper.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -293,7 +293,7 @@
if (coder == String.LATIN1) {
return Integer.getChars(value, index, buf);
} else {
- return Integer.getCharsUTF16(value, index, buf);
+ return StringUTF16.getChars(value, index, buf);
}
}
@@ -311,7 +311,7 @@
if (coder == String.LATIN1) {
return Long.getChars(value, index, buf);
} else {
- return Long.getCharsUTF16(value, index, buf);
+ return StringUTF16.getChars(value, index, buf);
}
}
--- a/jdk/src/java.base/share/classes/java/lang/StringLatin1.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/StringLatin1.java Mon Apr 24 21:34:23 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
@@ -36,7 +36,6 @@
import static java.lang.String.LATIN1;
import static java.lang.String.UTF16;
import static java.lang.String.checkOffset;
-import static java.lang.String.checkBoundsOffCount;
final class StringLatin1 {
@@ -566,11 +565,7 @@
// inflatedCopy byte[] -> byte[]
@HotSpotIntrinsicCandidate
public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
- // We need a range check here because 'putChar' has no checks
- checkBoundsOffCount(dstOff << 1, len << 1, dst.length);
- for (int i = 0; i < len; i++) {
- StringUTF16.putChar(dst, dstOff++, src[srcOff++] & 0xff);
- }
+ StringUTF16.inflate(src, srcOff, dst, dstOff, len);
}
static class CharsSpliterator implements Spliterator.OfInt {
--- a/jdk/src/java.base/share/classes/java/lang/StringUTF16.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/StringUTF16.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,12 +30,11 @@
import java.util.Spliterator;
import java.util.function.IntConsumer;
import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.DontInline;
import static java.lang.String.UTF16;
import static java.lang.String.LATIN1;
-import static java.lang.String.checkIndex;
-import static java.lang.String.checkOffset;
-import static java.lang.String.checkBoundsOffCount;
final class StringUTF16 {
@@ -51,33 +50,37 @@
}
@HotSpotIntrinsicCandidate
- public static void putChar(byte[] val, int index, int c) {
+ // intrinsic performs no bounds checks
+ static void putChar(byte[] val, int index, int c) {
+ assert index >= 0 && index < length(val) : "Trusted caller missed bounds check";
index <<= 1;
val[index++] = (byte)(c >> HI_BYTE_SHIFT);
val[index] = (byte)(c >> LO_BYTE_SHIFT);
}
@HotSpotIntrinsicCandidate
- public static char getChar(byte[] val, int index) {
+ // intrinsic performs no bounds checks
+ static char getChar(byte[] val, int index) {
+ assert index >= 0 && index < length(val) : "Trusted caller missed bounds check";
index <<= 1;
return (char)(((val[index++] & 0xff) << HI_BYTE_SHIFT) |
((val[index] & 0xff) << LO_BYTE_SHIFT));
}
- public static char charAt(byte[] value, int index) {
- if (index < 0 || index >= value.length >> 1) {
- throw new StringIndexOutOfBoundsException(index);
- }
- return getChar(value, index);
- }
-
public static int length(byte[] value) {
return value.length >> 1;
}
- public static int codePointAt(byte[] value, int index, int end) {
+ private static int codePointAt(byte[] value, int index, int end, boolean checked) {
+ assert index < end;
+ if (checked) {
+ checkIndex(index, value);
+ }
char c1 = getChar(value, index);
if (Character.isHighSurrogate(c1) && ++index < end) {
+ if (checked) {
+ checkIndex(index, value);
+ }
char c2 = getChar(value, index);
if (Character.isLowSurrogate(c2)) {
return Character.toCodePoint(c1, c2);
@@ -86,10 +89,22 @@
return c1;
}
- public static int codePointBefore(byte[] value, int index) {
- char c2 = getChar(value, --index);
+ public static int codePointAt(byte[] value, int index, int end) {
+ return codePointAt(value, index, end, false /* unchecked */);
+ }
+
+ private static int codePointBefore(byte[] value, int index, boolean checked) {
+ --index;
+ if (checked) {
+ checkIndex(index, value);
+ }
+ char c2 = getChar(value, index);
if (Character.isLowSurrogate(c2) && index > 0) {
- char c1 = getChar(value, --index);
+ --index;
+ if (checked) {
+ checkIndex(index, value);
+ }
+ char c1 = getChar(value, index);
if (Character.isHighSurrogate(c1)) {
return Character.toCodePoint(c1, c2);
}
@@ -97,11 +112,19 @@
return c2;
}
- public static int codePointCount(byte[] value, int beginIndex, int endIndex) {
+ public static int codePointBefore(byte[] value, int index) {
+ return codePointBefore(value, index, false /* unchecked */);
+ }
+
+ private static int codePointCount(byte[] value, int beginIndex, int endIndex, boolean checked) {
+ assert beginIndex <= endIndex;
int count = endIndex - beginIndex;
- for (int i = beginIndex; i < endIndex; ) {
+ int i = beginIndex;
+ if (checked && i < endIndex) {
+ checkBoundsBeginEnd(i, endIndex, value);
+ }
+ for (; i < endIndex - 1; ) {
if (Character.isHighSurrogate(getChar(value, i++)) &&
- i < endIndex &&
Character.isLowSurrogate(getChar(value, i))) {
count--;
i++;
@@ -110,6 +133,10 @@
return count;
}
+ public static int codePointCount(byte[] value, int beginIndex, int endIndex) {
+ return codePointCount(value, beginIndex, endIndex, false /* unchecked */);
+ }
+
public static char[] toChars(byte[] value) {
char[] dst = new char[value.length >> 1];
getChars(value, 0, dst.length, dst, 0);
@@ -162,7 +189,7 @@
@HotSpotIntrinsicCandidate
public static int compress(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
// We need a range check here because 'getChar' has no checks
- checkBoundsOffCount(srcOff << 1, len << 1, src.length);
+ checkBoundsOffCount(srcOff, len, src);
for (int i = 0; i < len; i++) {
char c = getChar(src, srcOff);
if (c > 0xFF) {
@@ -212,7 +239,7 @@
public static void getChars(byte[] value, int srcBegin, int srcEnd, char dst[], int dstBegin) {
// We need a range check here because 'getChar' has no checks
if (srcBegin < srcEnd) {
- checkBoundsOffCount(srcBegin << 1, (srcEnd - srcBegin) << 1, value.length);
+ checkBoundsOffCount(srcBegin, srcEnd - srcBegin, value);
}
for (int i = srcBegin; i < srcEnd; i++) {
dst[dstBegin++] = getChar(value, i);
@@ -319,14 +346,25 @@
if (str.length == 0) {
return 0;
}
- if (value.length == 0) {
+ if (value.length < str.length) {
return -1;
}
- return indexOf(value, length(value), str, length(str), 0);
+ return indexOfUnsafe(value, length(value), str, length(str), 0);
}
@HotSpotIntrinsicCandidate
public static int indexOf(byte[] value, int valueCount, byte[] str, int strCount, int fromIndex) {
+ checkBoundsBeginEnd(fromIndex, valueCount, value);
+ checkBoundsBeginEnd(0, strCount, str);
+ return indexOfUnsafe(value, valueCount, str, strCount, fromIndex);
+ }
+
+
+ private static int indexOfUnsafe(byte[] value, int valueCount, byte[] str, int strCount, int fromIndex) {
+ assert fromIndex >= 0;
+ assert strCount > 0;
+ assert strCount <= length(str);
+ assert valueCount >= strCount;
char first = getChar(str, 0);
int max = (valueCount - strCount);
for (int i = fromIndex; i <= max; i++) {
@@ -348,6 +386,7 @@
return -1;
}
+
/**
* Handles indexOf Latin1 substring in UTF16 string.
*/
@@ -356,14 +395,24 @@
if (str.length == 0) {
return 0;
}
- if (value.length == 0) {
+ if (length(value) < str.length) {
return -1;
}
- return indexOfLatin1(value, length(value), str, str.length, 0);
+ return indexOfLatin1Unsafe(value, length(value), str, str.length, 0);
}
@HotSpotIntrinsicCandidate
public static int indexOfLatin1(byte[] src, int srcCount, byte[] tgt, int tgtCount, int fromIndex) {
+ checkBoundsBeginEnd(fromIndex, srcCount, src);
+ String.checkBoundsBeginEnd(0, tgtCount, tgt.length);
+ return indexOfLatin1Unsafe(src, srcCount, tgt, tgtCount, fromIndex);
+ }
+
+ public static int indexOfLatin1Unsafe(byte[] src, int srcCount, byte[] tgt, int tgtCount, int fromIndex) {
+ assert fromIndex >= 0;
+ assert tgtCount > 0;
+ assert tgtCount <= tgt.length;
+ assert srcCount >= tgtCount;
char first = (char)(tgt[0] & 0xff);
int max = (srcCount - tgtCount);
for (int i = fromIndex; i <= max; i++) {
@@ -389,6 +438,11 @@
@HotSpotIntrinsicCandidate
private static int indexOfChar(byte[] value, int ch, int fromIndex, int max) {
+ checkBoundsBeginEnd(fromIndex, max, value);
+ return indexOfCharUnsafe(value, ch, fromIndex, max);
+ }
+
+ private static int indexOfCharUnsafe(byte[] value, int ch, int fromIndex, int max) {
for (int i = fromIndex; i < max; i++) {
if (getChar(value, i) == ch) {
return i;
@@ -404,6 +458,7 @@
if (Character.isValidCodePoint(ch)) {
final char hi = Character.highSurrogate(ch);
final char lo = Character.lowSurrogate(ch);
+ checkBoundsBeginEnd(fromIndex, max, value);
for (int i = fromIndex; i < max - 1; i++) {
if (getChar(value, i) == hi && getChar(value, i + 1 ) == lo) {
return i;
@@ -413,13 +468,21 @@
return -1;
}
+ // srcCoder == UTF16 && tgtCoder == UTF16
public static int lastIndexOf(byte[] src, int srcCount,
byte[] tgt, int tgtCount, int fromIndex) {
+ assert fromIndex >= 0;
+ assert tgtCount > 0;
+ assert tgtCount <= length(tgt);
int min = tgtCount - 1;
int i = min + fromIndex;
int strLastIndex = tgtCount - 1;
+
+ checkIndex(strLastIndex, tgt);
char strLastChar = getChar(tgt, strLastIndex);
+ checkIndex(i, src);
+
startSearchForLastChar:
while (true) {
while (i >= min && getChar(src, i) != strLastChar) {
@@ -509,6 +572,9 @@
public static boolean regionMatchesCI(byte[] value, int toffset,
byte[] other, int ooffset, int len) {
int last = toffset + len;
+ assert toffset >= 0 && ooffset >= 0;
+ assert ooffset + len <= length(other);
+ assert last <= length(value);
while (toffset < last) {
char c1 = getChar(value, toffset++);
char c2 = getChar(other, ooffset++);
@@ -599,6 +665,8 @@
private static String toLowerCaseEx(String str, byte[] value,
byte[] result, int first, Locale locale,
boolean localeDependent) {
+ assert(result.length == value.length);
+ assert(first >= 0);
int resultOffset = first;
int length = value.length >> 1;
int srcCount;
@@ -633,6 +701,8 @@
System.arraycopy(result, 0, result2, 0, resultOffset << 1);
result = result2;
}
+ assert resultOffset >= 0;
+ assert resultOffset + mapLen <= length(result);
for (int x = 0; x < mapLen; ++x) {
putChar(result, resultOffset++, lowerCharArray[x]);
}
@@ -697,6 +767,8 @@
byte[] result, int first,
Locale locale, boolean localeDependent)
{
+ assert(result.length == value.length);
+ assert(first >= 0);
int resultOffset = first;
int length = value.length >> 1;
int srcCount;
@@ -733,10 +805,12 @@
byte[] result2 = newBytesFor((result.length >> 1) + mapLen - srcCount);
System.arraycopy(result, 0, result2, 0, resultOffset << 1);
result = result2;
- }
- for (int x = 0; x < mapLen; ++x) {
+ }
+ assert resultOffset >= 0;
+ assert resultOffset + mapLen <= length(result);
+ for (int x = 0; x < mapLen; ++x) {
putChar(result, resultOffset++, upperCharArray[x]);
- }
+ }
}
}
return newString(result, 0, resultOffset);
@@ -757,7 +831,7 @@
null;
}
- public static void putChars(byte[] val, int index, char[] str, int off, int end) {
+ private static void putChars(byte[] val, int index, char[] str, int off, int end) {
while (off < end) {
putChar(val, index++, str[off++]);
}
@@ -927,35 +1001,172 @@
////////////////////////////////////////////////////////////////
public static void putCharSB(byte[] val, int index, int c) {
- checkIndex(index, val.length >> 1);
+ checkIndex(index, val);
putChar(val, index, c);
}
public static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
- checkOffset(index + end - off, val.length >> 1);
+ checkBoundsBeginEnd(index, index + end - off, val);
putChars(val, index, ca, off, end);
}
public static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
- checkOffset(index + end - off, val.length >> 1);
+ checkBoundsBeginEnd(index, index + end - off, val);
for (int i = off; i < end; i++) {
putChar(val, index++, s.charAt(i));
}
}
public static int codePointAtSB(byte[] val, int index, int end) {
- checkOffset(end, val.length >> 1);
- return codePointAt(val, index, end);
+ return codePointAt(val, index, end, true /* checked */);
}
public static int codePointBeforeSB(byte[] val, int index) {
- checkOffset(index, val.length >> 1);
- return codePointBefore(val, index);
+ return codePointBefore(val, index, true /* checked */);
}
public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) {
- checkOffset(endIndex, val.length >> 1);
- return codePointCount(val, beginIndex, endIndex);
+ return codePointCount(val, beginIndex, endIndex, true /* checked */);
+ }
+
+ public static int getChars(int i, int begin, int end, byte[] value) {
+ checkBoundsBeginEnd(begin, end, value);
+ int pos = getChars(i, end, value);
+ assert begin == pos;
+ return pos;
+ }
+
+ public static int getChars(long l, int begin, int end, byte[] value) {
+ checkBoundsBeginEnd(begin, end, value);
+ int pos = getChars(l, end, value);
+ assert begin == pos;
+ return pos;
+ }
+
+ public static boolean contentEquals(byte[] v1, byte[] v2, int len) {
+ checkBoundsOffCount(0, len, v2);
+ for (int i = 0; i < len; i++) {
+ if ((char)(v1[i] & 0xff) != getChar(v2, i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
+ checkOffset(len, value);
+ for (int i = 0; i < len; i++) {
+ if (getChar(value, i) != cs.charAt(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
+ int end = i + 4;
+ checkBoundsBeginEnd(i, end, value);
+ putChar(value, i++, c1);
+ putChar(value, i++, c2);
+ putChar(value, i++, c3);
+ putChar(value, i++, c4);
+ assert(i == end);
+ return end;
+ }
+
+ public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) {
+ int end = i + 5;
+ checkBoundsBeginEnd(i, end, value);
+ putChar(value, i++, c1);
+ putChar(value, i++, c2);
+ putChar(value, i++, c3);
+ putChar(value, i++, c4);
+ putChar(value, i++, c5);
+ assert(i == end);
+ return end;
+ }
+
+ public static char charAt(byte[] value, int index) {
+ checkIndex(index, value);
+ return getChar(value, index);
+ }
+
+ public static void reverse(byte[] val, int count) {
+ checkOffset(count, val);
+ int n = count - 1;
+ boolean hasSurrogates = false;
+ for (int j = (n-1) >> 1; j >= 0; j--) {
+ int k = n - j;
+ char cj = getChar(val, j);
+ char ck = getChar(val, k);
+ putChar(val, j, ck);
+ putChar(val, k, cj);
+ if (Character.isSurrogate(cj) ||
+ Character.isSurrogate(ck)) {
+ hasSurrogates = true;
+ }
+ }
+ if (hasSurrogates) {
+ reverseAllValidSurrogatePairs(val, count);
+ }
+ }
+
+ /** Outlined helper method for reverse() */
+ private static void reverseAllValidSurrogatePairs(byte[] val, int count) {
+ for (int i = 0; i < count - 1; i++) {
+ char c2 = getChar(val, i);
+ if (Character.isLowSurrogate(c2)) {
+ char c1 = getChar(val, i + 1);
+ if (Character.isHighSurrogate(c1)) {
+ putChar(val, i++, c1);
+ putChar(val, i, c2);
+ }
+ }
+ }
+ }
+
+ // inflatedCopy byte[] -> byte[]
+ public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
+ // We need a range check here because 'putChar' has no checks
+ checkBoundsOffCount(dstOff, len, dst);
+ for (int i = 0; i < len; i++) {
+ putChar(dst, dstOff++, src[srcOff++] & 0xff);
+ }
+ }
+
+ // srcCoder == UTF16 && tgtCoder == LATIN1
+ public static int lastIndexOfLatin1(byte[] src, int srcCount,
+ byte[] tgt, int tgtCount, int fromIndex) {
+ assert fromIndex >= 0;
+ assert tgtCount > 0;
+ assert tgtCount <= tgt.length;
+ int min = tgtCount - 1;
+ int i = min + fromIndex;
+ int strLastIndex = tgtCount - 1;
+
+ char strLastChar = (char)(tgt[strLastIndex] & 0xff);
+
+ checkIndex(i, src);
+
+ startSearchForLastChar:
+ while (true) {
+ while (i >= min && getChar(src, i) != strLastChar) {
+ i--;
+ }
+ if (i < min) {
+ return -1;
+ }
+ int j = i - 1;
+ int start = j - strLastIndex;
+ int k = strLastIndex - 1;
+ while (j > start) {
+ if (getChar(src, j--) != (tgt[k--] & 0xff)) {
+ i--;
+ continue startSearchForLastChar;
+ }
+ }
+ return start + 1;
+ }
}
////////////////////////////////////////////////////////////////
@@ -975,4 +1186,123 @@
}
static final int MAX_LENGTH = Integer.MAX_VALUE >> 1;
+
+ // Used by trusted callers. Assumes all necessary bounds checks have
+ // been done by the caller.
+
+ /**
+ * This is a variant of {@link Integer#getChars(int, int, byte[])}, but for
+ * UTF-16 coder.
+ *
+ * @param i value to convert
+ * @param index next index, after the least significant digit
+ * @param buf target buffer, UTF16-coded.
+ * @return index of the most significant digit or minus sign, if present
+ */
+ static int getChars(int i, int index, byte[] buf) {
+ int q, r;
+ int charPos = index;
+
+ boolean negative = (i < 0);
+ if (!negative) {
+ i = -i;
+ }
+
+ // Get 2 digits/iteration using ints
+ while (i <= -100) {
+ q = i / 100;
+ r = (q * 100) - i;
+ i = q;
+ putChar(buf, --charPos, Integer.DigitOnes[r]);
+ putChar(buf, --charPos, Integer.DigitTens[r]);
+ }
+
+ // We know there are at most two digits left at this point.
+ q = i / 10;
+ r = (q * 10) - i;
+ putChar(buf, --charPos, '0' + r);
+
+ // Whatever left is the remaining digit.
+ if (q < 0) {
+ putChar(buf, --charPos, '0' - q);
+ }
+
+ if (negative) {
+ putChar(buf, --charPos, '-');
+ }
+ return charPos;
+ }
+
+ /**
+ * This is a variant of {@link Long#getChars(long, int, byte[])}, but for
+ * UTF-16 coder.
+ *
+ * @param i value to convert
+ * @param index next index, after the least significant digit
+ * @param buf target buffer, UTF16-coded.
+ * @return index of the most significant digit or minus sign, if present
+ */
+ static int getChars(long i, int index, byte[] buf) {
+ long q;
+ int r;
+ int charPos = index;
+
+ boolean negative = (i < 0);
+ if (!negative) {
+ i = -i;
+ }
+
+ // Get 2 digits/iteration using longs until quotient fits into an int
+ while (i <= Integer.MIN_VALUE) {
+ q = i / 100;
+ r = (int)((q * 100) - i);
+ i = q;
+ putChar(buf, --charPos, Integer.DigitOnes[r]);
+ putChar(buf, --charPos, Integer.DigitTens[r]);
+ }
+
+ // Get 2 digits/iteration using ints
+ int q2;
+ int i2 = (int)i;
+ while (i2 <= -100) {
+ q2 = i2 / 100;
+ r = (q2 * 100) - i2;
+ i2 = q2;
+ putChar(buf, --charPos, Integer.DigitOnes[r]);
+ putChar(buf, --charPos, Integer.DigitTens[r]);
+ }
+
+ // We know there are at most two digits left at this point.
+ q2 = i2 / 10;
+ r = (q2 * 10) - i2;
+ putChar(buf, --charPos, '0' + r);
+
+ // Whatever left is the remaining digit.
+ if (q2 < 0) {
+ putChar(buf, --charPos, '0' - q2);
+ }
+
+ if (negative) {
+ putChar(buf, --charPos, '-');
+ }
+ return charPos;
+ }
+ // End of trusted methods.
+
+ public static void checkIndex(int off, byte[] val) {
+ String.checkIndex(off, length(val));
+ }
+
+ public static void checkOffset(int off, byte[] val) {
+ String.checkOffset(off, length(val));
+ }
+
+ public static void checkBoundsBeginEnd(int begin, int end, byte[] val) {
+ String.checkBoundsBeginEnd(begin, end, length(val));
+ }
+
+ public static void checkBoundsOffCount(int offset, int count, byte[] val) {
+ String.checkBoundsOffCount(offset, count, length(val));
+ }
+
}
--- a/jdk/src/java.base/share/classes/java/lang/System.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Mon Apr 24 21:34:23 2017 +0200
@@ -1766,6 +1766,7 @@
* @since 1.1
*/
@Deprecated(since="1.2", forRemoval=true)
+ @SuppressWarnings("removal")
public static void runFinalizersOnExit(boolean value) {
Runtime.runFinalizersOnExit(value);
}
--- a/jdk/src/java.base/share/classes/java/net/ContentHandler.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/net/ContentHandler.java Mon Apr 24 21:34:23 2017 +0200
@@ -37,10 +37,10 @@
* application calls the {@code getContent} method in class
* {@code URL} or in {@code URLConnection}.
* The application's content handler factory (an instance of a class that
- * implements the interface {@code ContentHandlerFactory} set
- * up by a call to {@code setContentHandler}) is
- * called with a {@code String} giving the MIME type of the
- * object being received on the socket. The factory returns an
+ * implements the interface {@code ContentHandlerFactory} set up by a call to
+ * {@link URLConnection#setContentHandlerFactory(ContentHandlerFactory)
+ * setContentHandlerFactory} is called with a {@code String} giving the
+ * MIME type of the object being received on the socket. The factory returns an
* instance of a subclass of {@code ContentHandler}, and its
* {@code getContent} method is called to create the object.
* <p>
@@ -99,7 +99,8 @@
* representation of an object, this method reads that stream and
* creates an object that matches one of the types specified.
*
- * The default implementation of this method should call getContent()
+ * The default implementation of this method should call
+ * {@link #getContent(URLConnection)}
* and screen the return type for a match of the suggested types.
*
* @param urlc a URL connection.
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java Mon Apr 24 21:34:23 2017 +0200
@@ -876,7 +876,7 @@
* Sets the value of the {@code doInput} field for this
* {@code URLConnection} to the specified value.
* <p>
- * A URL connection can be used for input and/or output. Set the DoInput
+ * A URL connection can be used for input and/or output. Set the doInput
* flag to true if you intend to use the URL connection for input,
* false if not. The default is true.
*
@@ -906,7 +906,7 @@
* Sets the value of the {@code doOutput} field for this
* {@code URLConnection} to the specified value.
* <p>
- * A URL connection can be used for input and/or output. Set the DoOutput
+ * A URL connection can be used for input and/or output. Set the doOutput
* flag to true if you intend to use the URL connection for output,
* false if not. The default is false.
*
@@ -972,7 +972,7 @@
* Returns the default value of the {@code allowUserInteraction}
* field.
* <p>
- * Ths default is "sticky", being a part of the static state of all
+ * This default is "sticky", being a part of the static state of all
* URLConnections. This flag applies to the next, and all following
* URLConnections that are created.
*
@@ -993,7 +993,7 @@
* "reload" button in a browser). If the UseCaches flag on a connection
* is true, the connection is allowed to use whatever caches it can.
* If false, caches are to be ignored.
- * The default value comes from DefaultUseCaches, which defaults to
+ * The default value comes from defaultUseCaches, which defaults to
* true. A default value can also be set per-protocol using
* {@link #setDefaultUseCaches(String,boolean)}.
*
@@ -1252,7 +1252,7 @@
* application. It can be called at most once by an application.
* <p>
* The {@code ContentHandlerFactory} instance is used to
- * construct a content handler from a content type
+ * construct a content handler from a content type.
* <p>
* If there is a security manager, this method first calls
* the security manager's {@code checkSetFactory} method
--- a/jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java Mon Apr 24 21:34:23 2017 +0200
@@ -385,7 +385,7 @@
}
if (obj instanceof ValueRange) {
ValueRange other = (ValueRange) obj;
- return minSmallest == other.minSmallest && minLargest == other.minLargest &&
+ return minSmallest == other.minSmallest && minLargest == other.minLargest &&
maxSmallest == other.maxSmallest && maxLargest == other.maxLargest;
}
return false;
@@ -398,8 +398,9 @@
*/
@Override
public int hashCode() {
- long hash = minSmallest + minLargest << 16 + minLargest >> 48 + maxSmallest << 32 +
- maxSmallest >> 32 + maxLargest << 48 + maxLargest >> 16;
+ long hash = minSmallest + (minLargest << 16) + (minLargest >> 48) +
+ (maxSmallest << 32) + (maxSmallest >> 32) + (maxLargest << 48) +
+ (maxLargest >> 16);
return (int) (hash ^ (hash >>> 32));
}
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java Mon Apr 24 21:34:23 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
@@ -617,7 +617,7 @@
}
@Override
- public long getPid() {
+ public long pid() {
return pid;
}
--- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java Mon Apr 24 21:34:23 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
@@ -523,7 +523,7 @@
@Override
public CompletableFuture<Process> onExit() {
- return ProcessHandleImpl.completion(getPid(), false)
+ return ProcessHandleImpl.completion(pid(), false)
.handleAsync((exitStatus, unusedThrowable) -> this);
}
@@ -550,8 +550,8 @@
private static native void terminateProcess(long handle);
@Override
- public long getPid() {
- return processHandle.getPid();
+ public long pid() {
+ return processHandle.pid();
}
private static native int getProcessId0(long handle);
@@ -572,7 +572,7 @@
@Override
public String toString() {
int exitCode = getExitCodeProcess(handle);
- return new StringBuilder("Process[pid=").append(getPid())
+ return new StringBuilder("Process[pid=").append(pid())
.append(", exitValue=").append(exitCode == STILL_ACTIVE ? "\"not exited\"" : exitCode)
.append("]").toString();
}
--- a/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.datatransfer/share/classes/java/awt/datatransfer/DataFlavor.java Mon Apr 24 21:34:23 2017 +0200
@@ -211,6 +211,9 @@
* representationClass = java.awt.Image
* mimeType = "image/x-java-image"
* </pre>
+ * Will be {@code null} if {@code java.awt.Image} is not visible, the
+ * {@code java.desktop} module is not loaded, or the {@code java.desktop}
+ * module is not in the run-time image.
*/
public static final DataFlavor imageFlavor = createConstant("image/x-java-image; class=java.awt.Image", "Image");
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java Mon Apr 24 21:34:23 2017 +0200
@@ -78,7 +78,7 @@
return "THUMB_START";
} else if (hit == WINDOW_TITLE_BAR_HEIGHT) {
return "WINDOW_TITLE_BAR_HEIGHT";
- } else if (hit == THUMB_START) {
+ } else if (hit == ANIMATION_FRAME) {
return "ANIMATION_FRAME";
}
return getClass().getSimpleName();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,24 @@
import java.awt.PopupMenu;
import java.awt.Toolkit;
import java.awt.Window;
-import java.awt.desktop.*;
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppForegroundListener;
+import java.awt.desktop.AppHiddenListener;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesEvent;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIEvent;
+import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesEvent;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.QuitResponse;
+import java.awt.desktop.QuitStrategy;
+import java.awt.desktop.ScreenSleepListener;
+import java.awt.desktop.SystemEventListener;
+import java.awt.desktop.SystemSleepListener;
+import java.awt.desktop.UserSessionListener;
import java.beans.Beans;
import javax.swing.JMenuBar;
@@ -108,10 +125,10 @@
*
* @see AppForegroundListener
* @see AppHiddenListener
- * @see AppReOpenedListener
- * @see AppScreenSleepListener
- * @see AppSystemSleepListener
- * @see AppUserSessionListener
+ * @see AppReopenedListener
+ * @see ScreenSleepListener
+ * @see SystemSleepListener
+ * @see UserSessionListener
*
* @param listener
* @since Java for Mac OS X 10.6 Update 3
@@ -126,10 +143,10 @@
*
* @see AppForegroundListener
* @see AppHiddenListener
- * @see AppReOpenedListener
- * @see AppScreenSleepListener
- * @see AppSystemSleepListener
- * @see AppUserSessionListener
+ * @see AppReopenedListener
+ * @see ScreenSleepListener
+ * @see SystemSleepListener
+ * @see UserSessionListener
*
* @param listener
* @since Java for Mac OS X 10.6 Update 3
@@ -144,7 +161,7 @@
*
* Setting the {@link AboutHandler} to {@code null} reverts it to the default Cocoa About window.
*
- * @param aboutHandler the handler to respond to the {@link AboutHandler#handleAbout()} message
+ * @param aboutHandler the handler to respond to the {@link AboutHandler#handleAbout} message
* @since Java for Mac OS X 10.6 Update 3
* @since Java for Mac OS X 10.5 Update 8
*/
@@ -167,7 +184,7 @@
/**
* Installs the handler which is notified when the application is asked to open a list of files.
- * The {@link OpenFilesHandler#openFiles(AppEvent.OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
+ * The {@link OpenFilesHandler#openFiles(OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
*
* @param openFileHandler
@@ -180,7 +197,7 @@
/**
* Installs the handler which is notified when the application is asked to print a list of files.
- * The {@link PrintFilesHandler#printFiles(AppEvent.PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
+ * The {@link PrintFilesHandler#printFiles(PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
*
* @param printFileHandler
@@ -193,10 +210,10 @@
/**
* Installs the handler which is notified when the application is asked to open a URL.
- * The {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleURLTypes} array present in it's Info.plist.
+ * The {@link OpenURIHandler#openURI(OpenURIEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleURLTypes} array present in it's Info.plist.
* See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleURLTypes} key to your app's Info.plist.
*
- * Setting the handler to {@code null} causes all {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be enqueued until another handler is set.
+ * Setting the handler to {@code null} causes all {@link OpenURIHandler#openURI(OpenURIEvent)} requests to be enqueued until another handler is set.
*
* @param openURIHandler
* @since Java for Mac OS X 10.6 Update 3
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,26 @@
package com.apple.eawt;
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppForegroundListener;
+import java.awt.desktop.AppHiddenListener;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.ScreenSleepListener;
+import java.awt.desktop.SystemEventListener;
+import java.awt.desktop.SystemSleepListener;
+import java.awt.desktop.UserSessionListener;
+
/**
* An abstract adapter class for receiving {@code ApplicationEvents}.
*
* ApplicationEvents are deprecated. Use individual app event listeners or handlers instead.
*
- * @see Application#addAppEventListener(AppEventListener)
+ * @see Application#addAppEventListener(SystemEventListener)
*
* @see AboutHandler
* @see PreferencesHandler
@@ -39,14 +53,14 @@
* @see PrintFilesHandler
* @see QuitHandler
*
- * @see AppReOpenedListener
+ * @see AppReopenedListener
* @see AppForegroundListener
* @see AppHiddenListener
* @see UserSessionListener
* @see ScreenSleepListener
* @see SystemSleepListener
*
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}.
+ * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}.
* @since 1.4
*/
@SuppressWarnings("deprecation")
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,18 @@
package com.apple.eawt;
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
import java.util.EventObject;
/**
* The class of events sent to the deprecated ApplicationListener callbacks.
*
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
+ * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
* @since 1.4
*/
@Deprecated
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,25 @@
package com.apple.eawt;
+import java.awt.desktop.AboutHandler;
+import java.awt.desktop.AppForegroundListener;
+import java.awt.desktop.AppHiddenListener;
+import java.awt.desktop.AppReopenedListener;
+import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesHandler;
+import java.awt.desktop.PrintFilesHandler;
+import java.awt.desktop.QuitHandler;
+import java.awt.desktop.ScreenSleepListener;
+import java.awt.desktop.SystemEventListener;
+import java.awt.desktop.SystemSleepListener;
+import java.awt.desktop.UserSessionListener;
import java.util.EventListener;
/**
* ApplicationEvents are deprecated. Use individual AppEvent listeners or handlers instead.
*
- * @see Application#addAppEventListener(AppEventListener)
+ * @see Application#addAppEventListener(SystemEventListener)
*
* @see AboutHandler
* @see PreferencesHandler
@@ -39,7 +52,7 @@
* @see PrintFilesHandler
* @see QuitHandler
*
- * @see AppReOpenedListener
+ * @see AppReopenedListener
* @see AppForegroundListener
* @see AppHiddenListener
* @see UserSessionListener
@@ -47,7 +60,7 @@
* @see SystemSleepListener
*
* @since 1.4
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
+ * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
*/
@SuppressWarnings("deprecation")
@Deprecated
@@ -146,7 +159,7 @@
* event is sent from another application, include that code as part of this handler.
*
* @param event the Reopen Application event
- * @deprecated use {@link AppReOpenedListener}
+ * @deprecated use {@link AppReopenedListener}
*/
@Deprecated
public void handleReOpenApplication(ApplicationEvent event);
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenAdapter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenAdapter.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,15 @@
package com.apple.eawt;
+import java.awt.Window;
+
import com.apple.eawt.event.FullScreenEvent;
/**
* Abstract adapter class for receiving fullscreen events. This class is provided
* as a convenience for creating listeners.
*
- * Subclasses registered with {@link FullScreenUtilities#addFullScreenListenerTo(javax.swing.RootPaneContainer, FullScreenListener)}
+ * Subclasses registered with {@link FullScreenUtilities#addFullScreenListenerTo(Window, FullScreenListener)}
* will receive all entering/entered/exiting/exited full screen events.
*
* @see FullScreenUtilities
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,25 +37,25 @@
public interface FullScreenListener extends EventListener {
/**
* Invoked when a window has started to enter full screen.
- * @param event containing the specific window entering full screen.
+ * @param e containing the specific window entering full screen.
*/
public void windowEnteringFullScreen(final FullScreenEvent e);
/**
* Invoked when a window has fully entered full screen.
- * @param event containing the specific window which has entered full screen.
+ * @param e containing the specific window which has entered full screen.
*/
public void windowEnteredFullScreen(final FullScreenEvent e);
/**
* Invoked when a window has started to exit full screen.
- * @param event containing the specific window exiting full screen.
+ * @param e containing the specific window exiting full screen.
*/
public void windowExitingFullScreen(final FullScreenEvent e);
/**
* Invoked when a window has fully exited full screen.
- * @param event containing the specific window which has exited full screen.
+ * @param e containing the specific window which has exited full screen.
*/
public void windowExitedFullScreen(final FullScreenEvent e);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenUtilities.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/FullScreenUtilities.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
/**
* Utility class perform animated full screen actions to top-level {@link Window}s.
*
- * This class manages the relationship between {@link Windows}s and the {@link FullScreenListener}s
+ * This class manages the relationship between {@link Window}s and the {@link FullScreenListener}s
* attached to them. It's design is similar to the Java SE 6u10 {@link com.sun.awt.AWTUtilities}
* class which adds additional functionality to AWT Windows, without adding new API to the
* {@link java.awt.Window} class.
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/MacQuitResponse.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/MacQuitResponse.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,14 @@
package com.apple.eawt;
+import java.awt.desktop.QuitEvent;
+import java.awt.desktop.QuitHandler;
import java.awt.desktop.QuitResponse;
+import java.awt.desktop.QuitStrategy;
/**
* Used to respond to a request to quit the application.
- * The QuitResponse may be used after the {@link QuitHandler#handleQuitRequestWith(AppEvent.QuitEvent, MacQuitResponse)} method has returned, and may be used from any thread.
+ * The QuitResponse may be used after the {@link QuitHandler#handleQuitRequestWith(QuitEvent, QuitResponse)} method has returned, and may be used from any thread.
*
* @see Application#setQuitHandler(QuitHandler)
* @see QuitHandler
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureAdapter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureAdapter.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
* Abstract adapter class for receiving gesture events. This class is provided
* as a convenience for creating listeners.
*
- * Subclasses registered with {@link GestureUtilities#addGestureListenerTo()}
+ * Subclasses registered with {@link GestureUtilities#addGestureListenerTo}
* will receive all phase, magnification, rotation, and swipe events.
*
* @see GestureUtilities
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureEvent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GestureEvent.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package com.apple.eawt.event;
import java.awt.*;
+import java.awt.event.InputEvent;
/**
* Abstract event all gestures inherit from.
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GesturePhaseListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/GesturePhaseListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,13 +39,13 @@
public interface GesturePhaseListener extends GestureListener {
/**
* Invoked when the user has started a continuous gesture.
- * @param event representing the start of a continuous gesture.
+ * @param e representing the start of a continuous gesture.
*/
public void gestureBegan(final GesturePhaseEvent e);
/**
* Invoked when the user has stopped a continuous gesture.
- * @param event representing the end of a continuous gesture.
+ * @param e representing the end of a continuous gesture.
*/
public void gestureEnded(final GesturePhaseEvent e);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/MagnificationListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/MagnificationListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
public interface MagnificationListener extends GestureListener {
/**
* Invoked when a magnification gesture is performed by the user.
- * @param event containing the scale of the magnification.
+ * @param e containing the scale of the magnification.
*/
public void magnify(final MagnificationEvent e);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/RotationListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/RotationListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
public interface RotationListener extends GestureListener {
/**
* Invoked when a rotation gesture is performed by the user.
- * @param event containing an abstract measure of rotation.
+ * @param e containing an abstract measure of rotation.
*/
public void rotate(final RotationEvent e);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/SwipeListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/event/SwipeListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,25 +38,25 @@
public interface SwipeListener extends GestureListener {
/**
* Invoked when an upwards swipe gesture is performed by the user.
- * @param event representing the occurrence of a swipe.
+ * @param e representing the occurrence of a swipe.
*/
public void swipedUp(final SwipeEvent e);
/**
* Invoked when a downward swipe gesture is performed by the user.
- * @param event representing the occurrence of a swipe.
+ * @param e representing the occurrence of a swipe.
*/
public void swipedDown(final SwipeEvent e);
/**
* Invoked when a leftward swipe gesture is performed by the user.
- * @param event representing the occurrence of a swipe.
+ * @param e representing the occurrence of a swipe.
*/
public void swipedLeft(final SwipeEvent e);
/**
* Invoked when a rightward swipe gesture is performed by the user.
- * @param event representing the occurrence of a swipe.
+ * @param e representing the occurrence of a swipe.
*/
public void swipedRight(final SwipeEvent e);
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3732,7 +3732,6 @@
* <p>
* This should be used if the ActionMap can be shared.
*
- * @param c JComponent to install the ActionMap on.
* @param loaderClass Class object that gets loadActionMap invoked
* on.
* @param defaultsKey Key to use to defaults table to check for
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuPropertyListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuPropertyListener.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
/**
* This method gets called when a bound property is changed.
- * @param evt A PropertyChangeEvent object describing the event source
+ * @param e A PropertyChangeEvent object describing the event source
* and the property that has changed.
*/
public void propertyChange(final PropertyChangeEvent e) {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -232,6 +232,7 @@
private volatile boolean isInFullScreen;
private volatile boolean isIconifyAnimationActive;
+ private volatile boolean isZoomed;
private Window target;
private LWWindowPeer peer;
@@ -506,7 +507,7 @@
private boolean isMaximized() {
return undecorated ? this.normalBounds != null
- : CWrapper.NSWindow.isZoomed(getNSWindowPtr());
+ : isZoomed;
}
private void maximize() {
@@ -974,6 +975,7 @@
protected void deliverMoveResizeEvent(int x, int y, int width, int height,
boolean byUser) {
+ isZoomed = CWrapper.NSWindow.isZoomed(getNSWindowPtr());
checkZoom();
final Rectangle oldB = nativeBounds;
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m Mon Apr 24 21:34:23 2017 +0200
@@ -376,7 +376,7 @@
static JNF_MEMBER_CACHE(jm_getMaxPage, sjc_CPrinterJob, "getMaxPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
- static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
+ static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormat", "(I)Ljava/awt/print/PageFormat;");
NSMutableDictionary* printingDictionary = [dst dictionary];
@@ -412,7 +412,7 @@
[printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
[printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
- jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat);
+ jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat, (jint)0);
if (page != NULL) {
javaPageFormatToNSPrintInfo(env, NULL, page, dst);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
import java.awt.*;
+import javax.swing.JRootPane;
+
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
@@ -323,7 +325,7 @@
* is thrown.
* <p>If the window is a {@code Frame} or a {@code Dialog}, the window must
* be undecorated prior to enabling the per-pixel translucency effect (see
- * {@link Frame#setUndecorated()} and/or {@link Dialog#setUndecorated()}).
+ * {@link Frame#setUndecorated} and/or {@link Dialog#setUndecorated}).
* If the window becomes decorated through a subsequent call to the
* corresponding {@code setUndecorated()} method, the per-pixel
* translucency effect will be disabled and the opaque property reset to
@@ -431,7 +433,7 @@
* </ul>
* <p>
* The most common example when the 'mixing-cutout' shape is needed is a
- * glass pane component. The {@link JRootPane#setGlassPane()} method
+ * glass pane component. The {@link JRootPane#setGlassPane} method
* automatically sets the <i>empty-shape</i> as the 'mixing-cutout' shape
* for the given glass pane component. If a developer needs some other
* 'mixing-cutout' shape for the glass pane (which is rare), this must be
--- a/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@
*
* The returned value is not valid until the peer has been created. Before
* invoking this method a developer must call the {@link Window#pack()},
- * {@link Window#setVisible()}, or some other method that creates the peer.
+ * {@link Window#setVisible}, or some other method that creates the peer.
*
* @param window the window to get the security warning size for
*
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/PaletteBuilder.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/PaletteBuilder.java Mon Apr 24 21:34:23 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
@@ -84,10 +84,8 @@
* is unable to create approximation of {@code src}
* and {@code canCreatePalette} returns {@code false}.
*
- * @see createIndexColorModel
- *
- * @see canCreatePalette
- *
+ * @see #createIndexColorModel
+ * @see #canCreatePalette
*/
public static RenderedImage createIndexedImage(RenderedImage src) {
PaletteBuilder pb = new PaletteBuilder(src);
@@ -107,10 +105,8 @@
* is unable to create approximation of {@code img}
* and {@code canCreatePalette} returns {@code false}.
*
- * @see createIndexedImage
- *
- * @see canCreatePalette
- *
+ * @see #createIndexedImage
+ * @see #canCreatePalette
*/
public static IndexColorModel createIndexColorModel(RenderedImage img) {
PaletteBuilder pb = new PaletteBuilder(img);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SingleTileRenderedImage.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SingleTileRenderedImage.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, 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
@@ -41,7 +41,7 @@
* and a ColorModel.
*
* @param ras A Raster that will define tile (0, 0) of the image.
- * @param cm A ColorModel that will serve as the image's
+ * @param colorModel A ColorModel that will serve as the image's
* ColorModel.
*/
public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java Mon Apr 24 21:34:23 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
@@ -729,7 +729,8 @@
/**
* Writes any extension blocks, the Image Descriptor, and the image data
*
- * @param iioimage The image and image metadata.
+ * @param image The image.
+ * @param imageMetadata The image metadata.
* @param param The write parameters.
* @param globalColorTable The Global Color Table.
* @param sourceBounds The source region.
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java Mon Apr 24 21:34:23 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
@@ -99,7 +99,7 @@
* of the list if it is present, and any JFXX or APP2ICC marker
* segments are subordinate to the JFIF marker segment. This
* list is package visible so that the writer can access it.
- * @see #MarkerSegment
+ * @see MarkerSegment
*/
List<MarkerSegment> markerSequence = new ArrayList<>();
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java Mon Apr 24 21:34:23 2017 +0200
@@ -74,13 +74,13 @@
/**
* ImageWriteParam for JPEG writer.
- * May be initialized by {@link #initJPEGWriter()}.
+ * May be initialized by {@link #initJPEGWriter}.
*/
protected JPEGImageWriteParam JPEGParam = null;
/**
* The JPEG writer.
- * May be initialized by {@link #initJPEGWriter()}.
+ * May be initialized by {@link #initJPEGWriter}.
*/
protected ImageWriter JPEGWriter = null;
@@ -95,7 +95,7 @@
* Stream metadata equivalent to a tables-only stream such as in
* the {@code JPEGTables}. Default value is {@code null}.
* This should be set by any subclass which sets
- * {@link writeAbbreviatedStream} to {@code true}.
+ * {@link #writeAbbreviatedStream} to {@code true}.
*/
protected IIOMetadata JPEGStreamMetadata = null;
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java Mon Apr 24 21:34:23 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
@@ -1322,7 +1322,7 @@
* Sets the index of the planar configuration band to be decoded. This value
* is ignored for chunky (interleaved) images.
*
- * @param the index of the planar band to decode
+ * @param planarBand the index of the planar band to decode
*/
public void setPlanarBand(int planarBand) { this.planarBand = planarBand; }
@@ -2069,7 +2069,7 @@
* <p> The default implementation calls {@code decodeRaw(byte[] b,
* ...)} and copies the resulting data into {@code f}.
*
- * @param f a {@code double} array to be written.
+ * @param d a {@code double} array to be written.
* @param dstOffset the starting offset in {@code f} to be
* written.
* @param bitsPerPixel the number of bits for each pixel.
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriter.java Mon Apr 24 21:34:23 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
@@ -58,8 +58,6 @@
*
* The encoding process may clip, subsample using the parameters
* specified in the {@code ImageWriteParam}.
- *
- * @see com.sun.media.imageio.plugins.WBMPImageWriteParam
*/
public class WBMPImageWriter extends ImageWriter {
/** The output stream to write into */
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorType.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorType.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -138,9 +138,9 @@
* arguments to scale.
*
* @param color Color to alter
- * @param hFactory Amount to scale the hue
+ * @param hFactor Amount to scale the hue
* @param lFactor Amount to scale the lightness
- * @param sFactory Amount to sacle saturation
+ * @param sFactor Amount to sacle saturation
* @return newly created color
*/
static Color adjustColor(Color color, float hFactor, float lFactor,
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
* render the text as html nor will it offset by the insets of the
* component.
*
- * @param ss SynthContext
+ * @param context SynthContext
* @param g Graphics used to render string in.
* @param text Text to render
* @param bounds Bounds of the text to be drawn.
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -319,7 +319,7 @@
* insets will be placed in it, otherwise a new Insets object will be
* created and returned.
*
- * @param context SynthContext identifying requestor
+ * @param state SynthContext identifying requestor
* @param insets Where to place Insets
* @return Insets.
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifGraphicsUtils.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2008, 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
@@ -89,7 +89,6 @@
* <b>drawStringInRect()</b> does not clip to the rectangle, but instead
* uses this rectangle and the desired justification to compute the point
* at which to begin drawing the text.
- * @see #drawString
*/
public static void drawStringInRect(Graphics g, String aString, int x, int y,
int width, int height, int justification) {
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,7 +127,7 @@
*
* @param part a <code>Part</code>
* @param state a <code>String</code>
- * @param attributeKey a <code>String</code>
+ * @param prop a <code>String</code>
* @return a <code>String</code> or null if key is not found
* in the current style
*
@@ -172,7 +172,6 @@
/** Get a named <code>Dimension</code> value from the current style
*
- * @param key a <code>String</code>
* @return a <code>Dimension</code> or null if key is not found
* in the current style
*
@@ -189,7 +188,6 @@
/** Get a named <code>Point</code> (e.g. a location or an offset) value
* from the current style
*
- * @param key a <code>String</code>
* @return a <code>Point</code> or null if key is not found
* in the current style
*
@@ -205,7 +203,6 @@
/** Get a named <code>Insets</code> value from the current style
*
- * @param key a <code>String</code>
* @return an <code>Insets</code> object or null if key is not found
* in the current style
*
@@ -223,7 +220,6 @@
/** Get a named <code>Color</code> value from the current style
*
- * @param part a <code>Part</code>
* @return a <code>Color</code> or null if key is not found
* in the current style
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMixer.java Mon Apr 24 21:34:23 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
@@ -90,7 +90,7 @@
/**
* Constructs a new AbstractMixer.
- * @param mixer the mixer with which this line is associated
+ * @param mixerInfo the mixer with which this line is associated
* @param controls set of supported controls
*/
protected AbstractMixer(Mixer.Info mixerInfo,
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioSynthesizer.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import java.util.Map;
+import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Synthesizer;
import javax.sound.sampled.AudioFormat;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java Mon Apr 24 21:34:23 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
@@ -163,7 +163,6 @@
* rllong
* Protected helper method to read 64 bits and changing the order of
* each bytes.
- * @param DataInputStream
* @return 32 bits swapped value.
* @exception IOException
*/
@@ -187,7 +186,6 @@
/**
* big2little
* Protected helper method to swap the order of bytes in a 32 bit int
- * @param int
* @return 32 bits swapped value
*/
final int big2little(int i) {
@@ -207,7 +205,6 @@
/**
* rlshort
* Protected helper method to read 16 bits value. Swap high with low byte.
- * @param DataInputStream
* @return the swapped value.
* @exception IOException
*/
@@ -229,7 +226,6 @@
/**
* big2little
* Protected helper method to swap the order of bytes in a 16 bit short
- * @param int
* @return 16 bits swapped value
*/
final short big2littleShort(short i) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileWriter.java Mon Apr 24 21:34:23 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
@@ -69,7 +69,6 @@
* rllong
* Protected helper method to read 64 bits and changing the order of
* each bytes.
- * @param DataInputStream
* @return 32 bits swapped value.
* @exception IOException
*/
@@ -93,7 +92,6 @@
/**
* big2little
* Protected helper method to swap the order of bytes in a 32 bit int
- * @param int
* @return 32 bits swapped value
*/
final int big2little(int i) {
@@ -113,7 +111,6 @@
/**
* rlshort
* Protected helper method to read 16 bits value. Swap high with low byte.
- * @param DataInputStream
* @return the swapped value.
* @exception IOException
*/
@@ -135,7 +132,6 @@
/**
* big2little
* Protected helper method to swap the order of bytes in a 16 bit short
- * @param int
* @return 16 bits swapped value
*/
final short big2littleShort(short i) {
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Toolkit.java Mon Apr 24 21:34:23 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
@@ -54,7 +54,7 @@
/**
* Swaps bytes.
- * @throws ArrayOutOfBoundsException if len is not a multiple of 2.
+ * @throws ArrayIndexOutOfBoundsException if len is not a multiple of 2.
*/
static void getByteSwapped(byte[] b, int off, int len) {
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java Mon Apr 24 21:34:23 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
@@ -58,6 +58,7 @@
import javax.accessibility.*;
import java.applet.Applet;
import javax.swing.JComponent;
+import javax.swing.JRootPane;
import sun.awt.ComponentFactory;
import sun.security.action.GetPropertyAction;
@@ -6232,7 +6233,7 @@
/**
* Indicates whether a class or its superclasses override coalesceEvents.
* Must be called with lock on coalesceMap and privileged.
- * @see checkCoalescing
+ * @see #checkCoalescing
*/
private static boolean isCoalesceEventsOverriden(Class<?> clazz) {
assert Thread.holdsLock(coalesceMap);
@@ -10406,7 +10407,7 @@
* </ul>
* <p>
* The most common example when the 'mixing-cutout' shape is needed is a
- * glass pane component. The {@link JRootPane#setGlassPane()} method
+ * glass pane component. The {@link JRootPane#setGlassPane} method
* automatically sets the <i>empty-shape</i> as the 'mixing-cutout' shape
* for the given glass pane component. If a developer needs some other
* 'mixing-cutout' shape for the glass pane (which is rare), this must be
--- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java Mon Apr 24 21:34:23 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
@@ -25,9 +25,12 @@
package java.awt;
+import java.awt.desktop.AboutEvent;
import java.awt.desktop.AboutHandler;
import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIEvent;
import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesEvent;
import java.awt.desktop.PreferencesHandler;
import java.awt.desktop.PrintFilesHandler;
import java.awt.desktop.QuitHandler;
@@ -42,8 +45,9 @@
import java.net.URISyntaxException;
import java.net.URL;
+import javax.swing.JMenuBar;
+
import sun.awt.SunToolkit;
-import javax.swing.JMenuBar;
import sun.security.util.SecurityConstants;
/**
--- a/jdk/src/java.desktop/share/classes/java/awt/Font.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/Font.java Mon Apr 24 21:34:23 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
@@ -41,6 +41,7 @@
import java.security.PrivilegedExceptionAction;
import java.text.AttributedCharacterIterator.Attribute;
import java.text.CharacterIterator;
+import java.util.EventListener;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
--- a/jdk/src/java.desktop/share/classes/java/awt/Menu.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/Menu.java Mon Apr 24 21:34:23 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
@@ -29,7 +29,9 @@
import java.awt.peer.MenuPeer;
import java.io.IOException;
import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.Vector;
import javax.accessibility.Accessible;
--- a/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/MenuBar.java Mon Apr 24 21:34:23 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
@@ -29,7 +29,9 @@
import java.awt.peer.MenuBarPeer;
import java.io.IOException;
import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.Vector;
import javax.accessibility.Accessible;
--- a/jdk/src/java.desktop/share/classes/java/awt/PaintContext.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/PaintContext.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2007, 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,8 +25,10 @@
package java.awt;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.ColorModel;
import java.awt.image.Raster;
-import java.awt.image.ColorModel;
/**
* The {@code PaintContext} interface defines the encapsulated
--- a/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/SystemTray.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, 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,15 +25,17 @@
package java.awt;
-import java.util.Vector;
+import java.awt.event.ActionListener;
import java.awt.peer.SystemTrayPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import sun.awt.AppContext;
-import sun.awt.SunToolkit;
-import sun.awt.HeadlessToolkit;
+import java.util.Vector;
+
import sun.awt.AWTAccessor;
import sun.awt.AWTPermissions;
+import sun.awt.AppContext;
+import sun.awt.HeadlessToolkit;
+import sun.awt.SunToolkit;
/**
* The {@code SystemTray} class represents the system tray for a
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java Mon Apr 24 21:34:23 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
@@ -451,7 +451,7 @@
*
* @param s the error message
* @param e the original exception
- * @throws the new AWTError including the cause (the original exception)
+ * @throws AWTError the new AWTError including the cause (the original exception)
*/
private static void newAWTError(Throwable e, String s) {
AWTError newAWTError = new AWTError(s);
--- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java Mon Apr 24 21:34:23 2017 +0200
@@ -1081,7 +1081,7 @@
* when loading this profile.
* If deferring is enabled, then the deferred activation
* code will take care of access privileges.
- * @see activateDeferredProfile()
+ * @see #activateDeferredProfile()
*/
static ICC_Profile getDeferredInstance(ProfileDeferralInfo pdi) {
if (!ProfileDeferralMgr.deferring) {
--- a/jdk/src/java.desktop/share/classes/java/awt/desktop/FilesEvent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/desktop/FilesEvent.java Mon Apr 24 21:34:23 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
@@ -42,7 +42,6 @@
/**
* Constructs a {@code FilesEvent}
* @param files files
- * @param searchTerm searchTerm
*/
FilesEvent(final List<File> files) {
this.files = files;
--- a/jdk/src/java.desktop/share/classes/java/awt/font/CharArrayIterator.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/CharArrayIterator.java Mon Apr 24 21:34:23 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
@@ -47,7 +47,7 @@
* Sets the position to getBeginIndex() and returns the character at that
* position.
* @return the first character in the text, or DONE if the text is empty
- * @see getBeginIndex
+ * @see #getBeginIndex
*/
public char first() {
@@ -59,7 +59,7 @@
* Sets the position to getEndIndex()-1 (getEndIndex() if the text is empty)
* and returns the character at that position.
* @return the last character in the text, or DONE if the text is empty
- * @see getEndIndex
+ * @see #getEndIndex
*/
public char last() {
@@ -76,7 +76,7 @@
* Gets the character at the current position (as returned by getIndex()).
* @return the character at the current position or DONE if the current
* position is off the end of the text.
- * @see getIndex
+ * @see #getIndex
*/
public char current() {
--- a/jdk/src/java.desktop/share/classes/java/awt/peer/DesktopPeer.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/peer/DesktopPeer.java Mon Apr 24 21:34:23 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
@@ -24,18 +24,21 @@
*/
package java.awt.peer;
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
import java.awt.Desktop.Action;
import java.awt.desktop.AboutHandler;
-import java.awt.desktop.SystemEventListener;
import java.awt.desktop.OpenFilesHandler;
+import java.awt.desktop.OpenURIEvent;
import java.awt.desktop.OpenURIHandler;
+import java.awt.desktop.PreferencesEvent;
import java.awt.desktop.PreferencesHandler;
import java.awt.desktop.PrintFilesHandler;
import java.awt.desktop.QuitHandler;
import java.awt.desktop.QuitStrategy;
+import java.awt.desktop.SystemEventListener;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+
import javax.swing.JMenuBar;
/**
@@ -162,7 +165,7 @@
* the default behavior
*
* @param preferencesHandler the handler to respond to the
- * {@link java.awt.desktop.PreferencesHandler#handlePreferences(java.awt.PreferencesEvent) }
+ * {@link java.awt.desktop.PreferencesHandler#handlePreferences(PreferencesEvent) }
*/
default void setPreferencesHandler(final PreferencesHandler preferencesHandler) {
}
@@ -191,7 +194,7 @@
* open a URL.
*
* Setting the handler to {@code null} causes all
- * {@link OpenURIHandler#openURI(AppEvent.OpenURIEvent)} requests to be
+ * {@link OpenURIHandler#openURI(OpenURIEvent)} requests to be
* enqueued until another handler is set.
*
* @param openURIHandler handler
--- a/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java Mon Apr 24 21:34:23 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,12 +27,12 @@
import java.awt.AWTError;
import java.awt.HeadlessException;
-import java.util.Enumeration;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.StreamPrintServiceFactory;
+import javax.print.attribute.AttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.standard.Media;
import javax.print.attribute.standard.MediaPrintableArea;
@@ -40,8 +40,6 @@
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
-import sun.security.action.GetPropertyAction;
-
/**
* The {@code PrinterJob} class is the principal class that controls
* printing. An application calls methods in this class to set up a job,
--- a/jdk/src/java.desktop/share/classes/java/beans/ChangeListenerMap.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/java/beans/ChangeListenerMap.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 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
@@ -39,8 +39,8 @@
* for the {@link PropertyChangeSupport PropertyChangeSupport} class
* and the {@link VetoableChangeSupport VetoableChangeSupport} class.
*
- * @see PropertyChangeListenerMap
- * @see VetoableChangeListenerMap
+ * @see PropertyChangeSupport.PropertyChangeListenerMap
+ * @see VetoableChangeSupport.VetoableChangeListenerMap
*
* @author Sergey A. Malenkov
*/
--- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Mon Apr 24 21:34:23 2017 +0200
@@ -413,7 +413,7 @@
*
* @see #addPropertyChangeListener
* @see #removePropertyChangeListener
- * @see #firePropertyChangeListener
+ * @see #firePropertyChange
*/
private PropertyChangeSupport accessibleChangeSupport = null;
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java Mon Apr 24 21:34:23 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
@@ -24,7 +24,9 @@
*/
package javax.print.attribute.standard;
+import javax.print.DocFlavor;
import javax.print.attribute.Attribute;
+import javax.print.attribute.AttributeSet;
import javax.print.attribute.DocAttribute;
import javax.print.attribute.PrintJobAttribute;
import javax.print.attribute.PrintRequestAttribute;
--- a/jdk/src/java.desktop/share/classes/javax/swing/Action.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/Action.java Mon Apr 24 21:34:23 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
@@ -384,8 +384,8 @@
* @param sender the object to check, can be null
* @return {@code true} if the action should be performed with the sender
* object, must be false if the action is disabled.
- * @see isEnabled
- * @see setEnabled
+ * @see #isEnabled
+ * @see #setEnabled
*/
default boolean accept(Object sender) {
return isEnabled();
--- a/jdk/src/java.desktop/share/classes/javax/swing/ActionPropertyChangeListener.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ActionPropertyChangeListener.java Mon Apr 24 21:34:23 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
@@ -45,7 +45,7 @@
* a strong reference will be held to the containing class, which in most
* cases defeats the purpose of this class.
*
- * @param T the type of JComponent the underlying Action is attached to
+ * @param <T> the type of JComponent the underlying Action is attached to
*
* @author Georges Saab
* @see AbstractButton
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Mon Apr 24 21:34:23 2017 +0200
@@ -3733,7 +3733,11 @@
* Fire PropertyChange listener, if one is registered,
* when focus events happen
* @since 1.3
+ * @deprecated This class is no longer used or needed.
+ * {@code java.awt.Component.AccessibleAWTComponent} provides
+ * the same functionality and it is handled in {@Component}.
*/
+ @Deprecated
protected class AccessibleFocusHandler implements FocusListener {
public void focusGained(FocusEvent event) {
if (accessibleContext != null) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java Mon Apr 24 21:34:23 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
@@ -1202,7 +1202,7 @@
* on the new <code>JFormattedTextField</code>.
*
* @param spinner the spinner whose model <code>this</code> editor will monitor
- * @param decimalFormatPattern the initial pattern for the
+ * @param format the initial pattern for the
* <code>DecimalFormat</code> object that's used to display
* and parse the value of the text field.
* @exception IllegalArgumentException if the spinners model is not
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java Mon Apr 24 21:34:23 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
@@ -1783,7 +1783,7 @@
*
* @param axis may be either X_AXIS or Y_AXIS
* @param len specifies where a break is desired in the span
- * @param the current allocation of the view
+ * @param a the current allocation of the view
* @return the fragment of the view that represents the given span
* if the view can be broken, otherwise null
*/
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,6 @@
* <p>
* This should be used if the ActionMap can be shared.
*
- * @param c JComponent to install the ActionMap on.
* @param loaderClass Class object that gets loadActionMap invoked
* on.
* @param defaultsKey Key to use to defaults table to check for
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFontDesktopProperty.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2009, 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
@@ -65,8 +65,6 @@
* Creates a MetalFontDesktopProperty.
*
* @param key Key used in looking up desktop value.
- * @param toolkit Toolkit used to fetch property from, can be null
- * in which default will be used.
* @param type Type of font being used, corresponds to MetalTheme font
* type.
*/
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java Mon Apr 24 21:34:23 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
@@ -338,7 +338,7 @@
* and sets this value; the default is null, implying a native operating
* system window title pane.
*
- * @param content the <code>JComponent</code> to use for the window title pane.
+ * @param titlePane the <code>JComponent</code> to use for the window title pane.
*/
private void setTitlePane(JRootPane root, JComponent titlePane) {
JLayeredPane layeredPane = root.getLayeredPane();
@@ -434,7 +434,7 @@
/**
* Returns the amount of space the layout would like to have.
*
- * @param the Container for which this layout manager is being used
+ * @param parent the Container for which this layout manager is being used
* @return a Dimension object containing the layout's preferred size
*/
public Dimension preferredLayoutSize(Container parent) {
@@ -486,7 +486,7 @@
/**
* Returns the minimum amount of space the layout needs.
*
- * @param the Container for which this layout manager is being used
+ * @param parent the Container for which this layout manager is being used
* @return a Dimension object containing the layout's minimum size
*/
public Dimension minimumLayoutSize(Container parent) {
@@ -537,7 +537,7 @@
/**
* Returns the maximum amount of space the layout can use.
*
- * @param the Container for which this layout manager is being used
+ * @param target the Container for which this layout manager is being used
* @return a Dimension object containing the layout's maximum size
*/
public Dimension maximumLayoutSize(Container target) {
@@ -601,7 +601,7 @@
* Instructs the layout manager to perform the layout for the specified
* container.
*
- * @param the Container for which this layout manager is being used
+ * @param parent the Container for which this layout manager is being used
*/
public void layoutContainer(Container parent) {
JRootPane root = (JRootPane) parent;
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java Mon Apr 24 21:34:23 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
@@ -934,9 +934,7 @@
* <p>The actual code path for determining the proper state is the same as
* in Synth.</p>
*
- * @param ctx
* @param lastState a 1 element array, allowing me to do pass-by-reference.
- * @return
*/
private RuntimeState getNextState(RuntimeState[] states,
int[] lastState,
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java Mon Apr 24 21:34:23 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
@@ -2179,9 +2179,6 @@
/**
* Create this action with the appropriate identifier.
- * @param nm the name of the action, Action.NAME.
- * @param select whether to extend the selection when
- * changing the caret position.
*/
SelectWordAction() {
super(selectWordAction);
@@ -2209,9 +2206,6 @@
/**
* Create this action with the appropriate identifier.
- * @param nm the name of the action, Action.NAME.
- * @param select whether to extend the selection when
- * changing the caret position.
*/
SelectLineAction() {
super(selectLineAction);
@@ -2239,9 +2233,6 @@
/**
* Create this action with the appropriate identifier.
- * @param nm the name of the action, Action.NAME.
- * @param select whether to extend the selection when
- * changing the caret position.
*/
SelectParagraphAction() {
super(selectParagraphAction);
@@ -2269,9 +2260,6 @@
/**
* Create this action with the appropriate identifier.
- * @param nm the name of the action, Action.NAME.
- * @param select whether to extend the selection when
- * changing the caret position.
*/
SelectAllAction() {
super(selectAllAction);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultStyledDocument.java Mon Apr 24 21:34:23 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
@@ -1797,8 +1797,6 @@
/**
* Pushes a new element onto the stack that represents
* the current path.
- * @param record Whether or not the push should be
- * recorded as an element change or not.
* @param isFracture true if pushing on an element that was created
* as the result of a fracture.
*/
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter1.java Mon Apr 24 21:34:23 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
@@ -198,7 +198,7 @@
* @param v the view
* @param p0 the location in the model where the
* fragment should start its representation >= 0
- * @param pos the graphic location along the axis that the
+ * @param x the graphic location along the axis that the
* broken view would occupy >= 0; this may be useful for
* things like tab calculations
* @param len specifies the distance into the view
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphPainter2.java Mon Apr 24 21:34:23 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
@@ -193,7 +193,7 @@
* @param v the view to find the model location to break at.
* @param p0 the location in the model where the
* fragment should start it's representation >= 0.
- * @param pos the graphic location along the axis that the
+ * @param x the graphic location along the axis that the
* broken view would occupy >= 0. This may be useful for
* things like tab calculations.
* @param len specifies the distance into the view
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java Mon Apr 24 21:34:23 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
@@ -899,7 +899,6 @@
/**
* Range represented by a row in the paragraph is only
* a subset of the total range of the paragraph element.
- * @see View#getRange
*/
public int getStartOffset() {
int offs = Integer.MAX_VALUE;
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java Mon Apr 24 21:34:23 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
@@ -510,8 +510,8 @@
* Provides a mapping from the view coordinate space to the logical
* coordinate space of the model.
*
- * @param fx the X coordinate >= 0
- * @param fy the Y coordinate >= 0
+ * @param x the X coordinate >= 0
+ * @param y the Y coordinate >= 0
* @param a the allocated region to render into
* @return the location within the model that best represents the
* given point in the view >= 0
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/TextLayoutStrategy.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/TextLayoutStrategy.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, 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
@@ -88,9 +88,8 @@
* Gives notification from the document that attributes were changed
* in a location that this view is responsible for.
*
- * @param changes the change information from the associated document
- * @param a the current allocation of the view
- * @param f the factory to use to rebuild if the view has children
+ * @param e the change information from the associated document
+ * @param alloc the current allocation of the view inside of the insets.
* @see View#changedUpdate
*/
public void changedUpdate(FlowView fv, DocumentEvent e, Rectangle alloc) {
@@ -117,9 +116,9 @@
* views or view fragments) and follow that with bidi reordering
* of the unidirectional view fragments.
*
- * @param row the row to fill in with views. This is assumed
+ * @param rowIndex the row to fill in with views. This is assumed
* to be empty on entry.
- * @param pos The current position in the children of
+ * @param p0 The current position in the children of
* this views element from which to start.
* @return the position to start the next row
*/
@@ -157,7 +156,7 @@
* calculated by the LineBreakMeasurer, this is implemented
* to do nothing.
*
- * @param r the row to adjust to the current layout
+ * @param rowIndex the row to adjust to the current layout
* span.
* @param desiredSpan the current layout span >= 0
* @param x the location r starts at.
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java Mon Apr 24 21:34:23 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
@@ -1245,7 +1245,7 @@
*
* @param v View to query
* @param pos the position to convert >= 0
- * @param a the allocated region to render into
+ * @param alloc the allocated region to render into
* @param direction the direction from the current position that can
* be thought of as the arrow keys typically found on a keyboard;
* this may be one of the following:
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java Mon Apr 24 21:34:23 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
@@ -948,7 +948,6 @@
* Returns the size of a font from the passed in string.
*
* @param size CSS string describing font size
- * @param baseFontSize size to use for relative units.
*/
float getPointSize(String size, StyleSheet ss) {
int relSize, absSize, diff, index;
@@ -1658,8 +1657,8 @@
* value, this method returns a CssValue object to associate with the
* CSS attribute.
*
- * @param the CSS.Attribute
- * @param a String containing the value associated HTML.Attribtue.
+ * @param cssAttr the CSS.Attribute
+ * @param htmlAttrValue a String containing the value associated HTML.Attribute.
*/
Object getCssValue(CSS.Attribute cssAttr, String htmlAttrValue) {
CssValue value = (CssValue)valueConvertor.get(cssAttr);
@@ -1670,7 +1669,7 @@
/**
* Maps an HTML.Attribute object to its appropriate CSS.Attributes.
*
- * @param HTML.Attribute
+ * @param hAttr HTML.Attribute
* @return CSS.Attribute[]
*/
private CSS.Attribute[] getCssAttribute(HTML.Attribute hAttr) {
@@ -1685,7 +1684,7 @@
* based on the tag associated with the attribute and the
* value of the attribute.
*
- * @param AttributeSet containing HTML attributes.
+ * @param tag the AttributeSet containing HTML attributes.
* @return CSS.Attribute mapping for HTML.Attribute.ALIGN.
*/
private CSS.Attribute getCssAlignAttribute(HTML.Tag tag,
@@ -1711,7 +1710,7 @@
/**
* Fetches the tag associated with the HTML AttributeSet.
*
- * @param AttributeSet containing the HTML attributes.
+ * @param htmlAttrSet the AttributeSet containing the HTML attributes.
* @return HTML.Tag
*/
private HTML.Tag getHTMLTag(AttributeSet htmlAttrSet) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Mon Apr 24 21:34:23 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
@@ -209,7 +209,7 @@
* Creates a component for an <INPUT> element based on the
* value of the "type" attribute.
*
- * @param set of attributes associated with the <INPUT> element.
+ * @param attr set of attributes associated with the <INPUT> element.
* @param model the value of the StyleConstants.ModelAttribute
* @return the component.
*/
@@ -653,8 +653,6 @@
* action.
*
* @param buffer the buffer that contains that data to submit
- * @param targetElement the element that triggered the
- * form submission
*/
private void getFormData(StringBuilder buffer) {
Element formE = getFormElement();
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java Mon Apr 24 21:34:23 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
@@ -143,8 +143,7 @@
* contains it is editable. And then proceeds to call
* the superclass to do the paint().
*
- * @param parent View
- * @see text.ComponentView#paint
+ * @see javax.swing.text.ComponentView#paint
*/
public void paint(Graphics g, Shape allocation) {
@@ -289,8 +288,6 @@
* firing the event to the outermost JEditorPane, this
* method also invokes the setPage() method and explicitly
* replaces the current document with the destination url.
- *
- * @param HyperlinkEvent
*/
public void hyperlinkUpdate(HyperlinkEvent evt) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/NoFramesView.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/NoFramesView.java Mon Apr 24 21:34:23 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
@@ -59,7 +59,7 @@
* @param g the rendering surface to use
* @param allocation the allocated region to render into
* @see #isVisible
- * @see text.ParagraphView#paint
+ * @see javax.swing.text.ParagraphView#paint
*/
public void paint(Graphics g, Shape allocation) {
Container host = getContainer();
@@ -126,7 +126,7 @@
* typically the view is told to render into the span
* that is returned, although there is no guarantee;
* the parent may choose to resize or break the view
- * @see text.ParagraphView#getPreferredSpan
+ * @see javax.swing.text.ParagraphView#getPreferredSpan
*/
public float getPreferredSpan(int axis) {
if (!visible) {
@@ -143,7 +143,7 @@
* @param axis may be either <code>View.X_AXIS</code> or
* <code>View.Y_AXIS</code>
* @return the minimum span the view can be rendered into
- * @see text.ParagraphView#getMinimumSpan
+ * @see javax.swing.text.ParagraphView#getMinimumSpan
*/
public float getMinimumSpan(int axis) {
if (!visible) {
@@ -160,7 +160,7 @@
* @param axis may be either <code>View.X_AXIS</code> or
* <code>View.Y_AXIS</code>
* @return the maximum span the view can be rendered into
- * @see text.ParagraphView#getMaximumSpan
+ * @see javax.swing.text.ParagraphView#getMaximumSpan
*/
public float getMaximumSpan(int axis) {
if (!visible) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java Mon Apr 24 21:34:23 2017 +0200
@@ -2119,8 +2119,11 @@
}
/* To account for extra read()'s that happened */
- for (int j = 0; j < i; j++) {
- addString(charsToAdd[j]);
+ if (i > 0) {
+ for (int j = 0; j < i; j++) {
+ addString(charsToAdd[j]);
+ }
+ continue;
}
switch (ch) {
case -1:
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFGenerator.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFGenerator.java Mon Apr 24 21:34:23 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
@@ -42,12 +42,8 @@
* <p>Note that this is a lossy conversion since RTF's model of
* text does not exactly correspond with LightText's.
*
- * @see LTAttributedText
- * @see LTRTFFilter
- * @see LTTextAcceptor
* @see java.io.OutputStream
*/
-
class RTFGenerator extends Object
{
/* These dictionaries map Colors, font names, or Style objects
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFParser.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFParser.java Mon Apr 24 21:34:23 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
@@ -32,11 +32,11 @@
* and passes a stream of control words, text, and begin/end group
* indications to its subclass.
*
- * Normally programmers will only use <b>RTFFilter</b>, a subclass of this class that knows what to
+ * Normally programmers will only use <b>RTFReader</b>, a subclass of this class that knows what to
* do with the tokens this class parses.
*
* @see AbstractFilter
- * @see RTFFilter
+ * @see RTFReader
*/
abstract class RTFParser extends AbstractFilter
{
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletSecurity.java Mon Apr 24 21:34:23 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
@@ -109,7 +109,8 @@
/**
* get the current (first) instance of an AppletClassLoader on the stack.
*/
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({"deprecation",
+ "removal"}) // SecurityManager.currentClassLoader()
private AppletClassLoader currentAppletClassLoader()
{
// try currentClassLoader first
@@ -298,7 +299,8 @@
* @exception SecurityException if the caller does not have
* permission to access the AWT event queue.
*/
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({"deprecation",
+ "removal"}) // SecurityManager.checkAwtEventQueueAccess
public void checkAwtEventQueueAccess() {
AppContext appContext = AppContext.getAppContext();
AppletClassLoader appletClassLoader = currentAppletClassLoader();
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java Mon Apr 24 21:34:23 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
@@ -24,14 +24,16 @@
*/
package sun.awt.image;
+
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.Raster;
-import java.awt.image.WritableRaster;
import java.awt.image.RasterFormatException;
import java.awt.image.SampleModel;
-import java.awt.image.MultiPixelPackedSampleModel;
-import java.awt.image.DataBufferByte;
-import java.awt.Rectangle;
-import java.awt.Point;
+import java.awt.image.WritableRaster;
/**
* This class is useful for describing 1, 2, or 4 bit image data
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -153,11 +153,11 @@
* The specified {@code src} {@link Shape} is widened according
* to the parameters specified by the {@link BasicStroke} object.
* Adjustments are made to the path as appropriate for the
- * {@link VALUE_STROKE_NORMALIZE} hint if the {@code normalize}
- * boolean parameter is true.
+ * {@link java.awt.RenderingHints#VALUE_STROKE_NORMALIZE} hint if the
+ * {@code normalize} boolean parameter is true.
* Adjustments are made to the path as appropriate for the
- * {@link VALUE_ANTIALIAS_ON} hint if the {@code antialias}
- * boolean parameter is true.
+ * {@link java.awt.RenderingHints#VALUE_ANTIALIAS_ON} hint if the
+ * {@code antialias} boolean parameter is true.
* <p>
* The geometry of the widened path is forwarded to the indicated
* {@link PathConsumer2D} object as it is calculated.
--- a/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java Mon Apr 24 21:34:23 2017 +0200
@@ -886,14 +886,6 @@
}
}
- protected PageFormat getPageFormatFromAttributes() {
- if (attributes == null || attributes.isEmpty()) {
- return null;
- }
- return attributeToPageFormat(getPrintService(), this.attributes);
- }
-
-
/**
* Presents the user a dialog for changing properties of the
* print job interactively.
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp Mon Apr 24 21:34:23 2017 +0200
@@ -239,7 +239,9 @@
fullScreenExclusiveModeState = FALSE;
m_winSizeMove = FALSE;
- prevScaleRec = { -1, -1, -1 };
+ prevScaleRec.screen = -1;
+ prevScaleRec.scaleX = -1.0f;
+ prevScaleRec.scaleY = -1.0f;
}
AwtWindow::~AwtWindow()
--- a/jdk/src/java.se.ee/share/classes/module-info.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/java.se.ee/share/classes/module-info.java Mon Apr 24 21:34:23 2017 +0200
@@ -32,7 +32,8 @@
* @moduleGraph
* @since 9
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // java.corba and other modules
module java.se.ee {
requires transitive java.se;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package jdk.incubator.http;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.net.InetSocketAddress;
import java.net.ProxySelector;
import java.net.SocketPermission;
@@ -64,6 +65,9 @@
final HttpRequestImpl request;
final HttpClientImpl client;
volatile ExchangeImpl<T> exchImpl;
+ // used to record possible cancellation raised before the exchImpl
+ // has been established.
+ private volatile IOException failed;
final List<SocketPermission> permissions = new LinkedList<>();
final AccessControlContext acc;
final MultiExchange<?,T> multi;
@@ -143,14 +147,80 @@
}
public void cancel() {
+ // cancel can be called concurrently before or at the same time
+ // that the exchange impl is being established.
+ // In that case we won't be able to propagate the cancellation
+ // right away
if (exchImpl != null) {
exchImpl.cancel();
+ } else {
+ // no impl - can't cancel impl yet.
+ // call cancel(IOException) instead which takes care
+ // of race conditions between impl/cancel.
+ cancel(new IOException("Request cancelled"));
}
}
public void cancel(IOException cause) {
- if (exchImpl != null) {
- exchImpl.cancel(cause);
+ // If the impl is non null, propagate the exception right away.
+ // Otherwise record it so that it can be propagated once the
+ // exchange impl has been established.
+ ExchangeImpl<?> impl = exchImpl;
+ if (impl != null) {
+ // propagate the exception to the impl
+ impl.cancel(cause);
+ } else {
+ try {
+ // no impl yet. record the exception
+ failed = cause;
+ // now call checkCancelled to recheck the impl.
+ // if the failed state is set and the impl is not null, reset
+ // the failed state and propagate the exception to the impl.
+ checkCancelled(false);
+ } catch (IOException x) {
+ // should not happen - we passed 'false' above
+ throw new UncheckedIOException(x);
+ }
+ }
+ }
+
+ // This method will raise an exception if one was reported and if
+ // it is possible to do so. If the exception can be raised, then
+ // the failed state will be reset. Otherwise, the failed state
+ // will persist until the exception can be raised and the failed state
+ // can be cleared.
+ // Takes care of possible race conditions.
+ private void checkCancelled(boolean throwIfNoImpl) throws IOException {
+ ExchangeImpl<?> impl = null;
+ IOException cause = null;
+ if (failed != null) {
+ synchronized(this) {
+ cause = failed;
+ impl = exchImpl;
+ if (throwIfNoImpl || impl != null) {
+ // The exception will be raised by one of the two methods
+ // below: reset the failed state.
+ failed = null;
+ }
+ }
+ }
+ if (cause == null) return;
+ if (impl != null) {
+ // The exception is raised by propagating it to the impl.
+ impl.cancel(cause);
+ } else if (throwIfNoImpl) {
+ // The exception is raised by throwing it immediately
+ throw cause;
+ } else {
+ Log.logTrace("Exchange: request [{0}/timeout={1}ms] no impl is set."
+ + "\n\tCan''t cancel yet with {2}",
+ request.uri(),
+ request.duration() == null ? -1 :
+ // calling duration.toMillis() can throw an exception.
+ // this is just debugging, we don't care if it overflows.
+ (request.duration().getSeconds() * 1000
+ + request.duration().getNano() / 1000000),
+ cause);
}
}
@@ -191,10 +261,26 @@
}
}
+ // get/set the exchange impl, solving race condition issues with
+ // potential concurrent calls to cancel() or cancel(IOException)
+ private void establishExchange(HttpConnection connection)
+ throws IOException, InterruptedException
+ {
+ // check if we have been cancelled first.
+ checkCancelled(true);
+ // not yet cancelled: create/get a new impl
+ exchImpl = ExchangeImpl.get(this, connection);
+ // recheck for cancelled, in case of race conditions
+ checkCancelled(true);
+ // now we're good to go. because exchImpl is no longer null
+ // cancel() will be able to propagate directly to the impl
+ // after this point.
+ }
+
private Response responseImpl0(HttpConnection connection)
throws IOException, InterruptedException
{
- exchImpl = ExchangeImpl.get(this, connection);
+ establishExchange(connection);
exchImpl.setClientForRequest(requestProcessor);
if (request.expectContinue()) {
Log.logTrace("Sending Expect: 100-Continue");
@@ -257,7 +343,7 @@
CompletableFuture<Response> responseAsyncImpl0(HttpConnection connection) {
try {
- exchImpl = ExchangeImpl.get(this, connection);
+ establishExchange(connection);
} catch (IOException | InterruptedException e) {
return MinimalFuture.failedFuture(e);
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,9 +46,12 @@
class Http1Exchange<T> extends ExchangeImpl<T> {
final HttpRequestImpl request; // main request
- final List<CompletableFuture<?>> operations; // used for cancel
+ private final List<CompletableFuture<?>> operations; // used for cancel
final Http1Request requestAction;
- volatile Http1Response<T> response;
+ private volatile Http1Response<T> response;
+ // use to record possible cancellation raised before any operation
+ // has been initiated.
+ private IOException failed;
final HttpConnection connection;
final HttpClientImpl client;
final Executor executor;
@@ -70,7 +73,7 @@
this.request = exchange.request();
this.client = exchange.client();
this.executor = exchange.executor();
- this.operations = Collections.synchronizedList(new LinkedList<>());
+ this.operations = new LinkedList<>();
this.buffer = exchange.getBuffer();
if (connection != null) {
this.connection = connection;
@@ -186,9 +189,22 @@
}
connection.close();
int count = 0;
- for (CompletableFuture<?> cf : operations) {
- cf.completeExceptionally(cause);
- count++;
+ if (operations.isEmpty()) {
+ failed = cause;
+ Log.logTrace("Http1Exchange: request [{0}/timeout={1}ms] no pending operation."
+ + "\n\tCan''t cancel yet with {2}",
+ request.uri(),
+ request.duration() == null ? -1 :
+ // calling duration.toMillis() can throw an exception.
+ // this is just debugging, we don't care if it overflows.
+ (request.duration().getSeconds() * 1000
+ + request.duration().getNano() / 1000000),
+ cause);
+ } else {
+ for (CompletableFuture<?> cf : operations) {
+ cf.completeExceptionally(cause);
+ count++;
+ }
}
Log.logError("Http1Exchange.cancel: count=" + count);
}
@@ -206,8 +222,24 @@
CompletableFuture<Response> cf =
connection.whenReceivingResponse()
.thenCompose((v) -> getResponseAsyncImpl(executor));
-
- operations.add(cf);
+ IOException cause;
+ synchronized(this) {
+ operations.add(cf);
+ cause = failed;
+ failed = null;
+ }
+ if (cause != null) {
+ Log.logTrace("Http1Exchange: request [{0}/timeout={1}ms]"
+ + "\n\tCompleting exceptionally with {2}\n",
+ request.uri(),
+ request.duration() == null ? -1 :
+ // calling duration.toMillis() can throw an exception.
+ // this is just debugging, we don't care if it overflows.
+ (request.duration().getSeconds() * 1000
+ + request.duration().getNano() / 1000000),
+ cause);
+ cf.completeExceptionally(cause);
+ }
return cf;
}
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpClientImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -582,12 +582,14 @@
// Timers are implemented through timed Selector.select() calls.
synchronized void registerTimer(TimeoutEvent event) {
+ Log.logTrace("Registering timer {0}", event);
timeouts.add(event);
selmgr.wakeupSelector();
}
synchronized void cancelTimer(TimeoutEvent event) {
- timeouts.stream().filter(e -> e == event).forEach(timeouts::remove);
+ Log.logTrace("Canceling timer {0}", event);
+ timeouts.remove(event);
}
/**
@@ -595,23 +597,61 @@
* returns the amount of time, in milliseconds, until the next earliest
* event. A return value of 0 means that there are no events.
*/
- private synchronized long purgeTimeoutsAndReturnNextDeadline() {
- if (timeouts.isEmpty())
- return 0L;
+ private long purgeTimeoutsAndReturnNextDeadline() {
+ long diff = 0L;
+ List<TimeoutEvent> toHandle = null;
+ int remaining = 0;
+ // enter critical section to retrieve the timeout event to handle
+ synchronized(this) {
+ if (timeouts.isEmpty()) return 0L;
+
+ Instant now = Instant.now();
+ Iterator<TimeoutEvent> itr = timeouts.iterator();
+ while (itr.hasNext()) {
+ TimeoutEvent event = itr.next();
+ diff = now.until(event.deadline(), ChronoUnit.MILLIS);
+ if (diff <= 0) {
+ itr.remove();
+ toHandle = (toHandle == null) ? new ArrayList<>() : toHandle;
+ toHandle.add(event);
+ } else {
+ break;
+ }
+ }
+ remaining = timeouts.size();
+ }
- Instant now = Instant.now();
- Iterator<TimeoutEvent> itr = timeouts.iterator();
- while (itr.hasNext()) {
- TimeoutEvent event = itr.next();
- long diff = now.until(event.deadline(), ChronoUnit.MILLIS);
- if (diff <= 0) {
- itr.remove();
- event.handle(); // TODO: release lock.
- } else {
- return diff;
+ // can be useful for debugging
+ if (toHandle != null && Log.trace()) {
+ Log.logTrace("purgeTimeoutsAndReturnNextDeadline: handling "
+ + (toHandle == null ? 0 : toHandle.size()) + " events, "
+ + "remaining " + remaining
+ + ", next deadline: " + (diff < 0 ? 0L : diff));
+ }
+
+ // handle timeout events out of critical section
+ if (toHandle != null) {
+ Throwable failed = null;
+ for (TimeoutEvent event : toHandle) {
+ try {
+ Log.logTrace("Firing timer {0}", event);
+ event.handle();
+ } catch (Error | RuntimeException e) {
+ // Not expected. Handle remaining events then throw...
+ // If e is an OOME or SOE it might simply trigger a new
+ // error from here - but in this case there's not much we
+ // could do anyway. Just let it flow...
+ if (failed == null) failed = e;
+ else failed.addSuppressed(e);
+ Log.logTrace("Failed to handle event {0}: {1}", event, e);
+ }
}
+ if (failed instanceof Error) throw (Error) failed;
+ if (failed instanceof RuntimeException) throw (RuntimeException) failed;
}
- return 0L;
+
+ // return time to wait until next event. 0L if there's no more events.
+ return diff < 0 ? 0L : diff;
}
// used for the connection window
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/MultiExchange.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/MultiExchange.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -357,9 +357,5 @@
public void handle() {
cancel(new HttpTimeoutException("request timed out"));
}
- @Override
- public String toString() {
- return "[deadline = " + deadline() + "]";
- }
}
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
*/
class PlainHttpConnection extends HttpConnection implements AsyncConnection {
- protected SocketChannel chan;
+ protected final SocketChannel chan;
private volatile boolean connected;
private boolean closed;
@@ -100,6 +100,7 @@
chan.finishConnect();
} catch (IOException e) {
cf.completeExceptionally(e);
+ return;
}
connected = true;
cf.complete(null);
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Stream.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -670,11 +670,21 @@
@Override
CompletableFuture<Response> getResponseAsync(Executor executor) {
- CompletableFuture<Response> cf;
+ CompletableFuture<Response> cf = null;
+ // The code below deals with race condition that can be caused when
+ // completeResponse() is being called before getResponseAsync()
synchronized (response_cfs) {
if (!response_cfs.isEmpty()) {
+ // This CompletableFuture was created by completeResponse().
+ // it will be already completed.
cf = response_cfs.remove(0);
+ // if we find a cf here it should be already completed.
+ // finding a non completed cf should not happen. just assert it.
+ assert cf.isDone() : "Removing uncompleted response: could cause code to hang!";
} else {
+ // getResponseAsync() is called first. Create a CompletableFuture
+ // that will be completed by completeResponse() when
+ // completeResponse() is called.
cf = new MinimalFuture<>();
response_cfs.add(cf);
}
@@ -708,7 +718,7 @@
cf.complete(resp);
response_cfs.remove(cf);
return;
- }
+ } // else we found the previous response: just leave it alone.
}
cf = MinimalFuture.completedFuture(resp);
Log.logTrace("Created completed future (streamid={0}): {1}",
@@ -742,10 +752,13 @@
*/
void completeResponseExceptionally(Throwable t) {
synchronized (response_cfs) {
- for (CompletableFuture<Response> cf : response_cfs) {
+ // use index to avoid ConcurrentModificationException
+ // caused by removing the CF from within the loop.
+ for (int i = 0; i < response_cfs.size(); i++) {
+ CompletableFuture<Response> cf = response_cfs.get(i);
if (!cf.isDone()) {
cf.completeExceptionally(t);
- response_cfs.remove(cf);
+ response_cfs.remove(i);
return;
}
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/TimeoutEvent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/TimeoutEvent.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,10 +27,11 @@
import java.time.Duration;
import java.time.Instant;
+import java.util.concurrent.atomic.AtomicLong;
/**
* Timeout event notified by selector thread. Executes the given handler if
- * the timer not cancelled first.
+ * the timer not canceled first.
*
* Register with {@link HttpClientImpl#registerTimer(TimeoutEvent)}.
*
@@ -38,6 +39,10 @@
*/
abstract class TimeoutEvent implements Comparable<TimeoutEvent> {
+ private static final AtomicLong COUNTER = new AtomicLong();
+ // we use id in compareTo to make compareTo consistent with equals
+ // see TimeoutEvent::compareTo below;
+ private final long id = COUNTER.incrementAndGet();
private final Instant deadline;
TimeoutEvent(Duration duration) {
@@ -52,6 +57,24 @@
@Override
public int compareTo(TimeoutEvent other) {
- return this.deadline.compareTo(other.deadline);
+ if (other == this) return 0;
+ // if two events have the same deadline, but are not equals, then the
+ // smaller is the one that was created before (has the smaller id).
+ // This is arbitrary and we don't really care which is smaller or
+ // greater, but we need a total order, so two events with the
+ // same deadline cannot compare == 0 if they are not equals.
+ final int compareDeadline = this.deadline.compareTo(other.deadline);
+ if (compareDeadline == 0 && !this.equals(other)) {
+ long diff = this.id - other.id; // should take care of wrap around
+ if (diff < 0) return -1;
+ else if (diff > 0) return 1;
+ else assert false : "Different events with same id and deadline";
+ }
+ return compareDeadline;
+ }
+
+ @Override
+ public String toString() {
+ return "TimeoutEvent[id=" + id + ", deadline=" + deadline + "]";
}
}
--- a/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.internal.jvmstat/share/classes/module-info.java Mon Apr 24 21:34:23 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
@@ -23,6 +23,12 @@
* questions.
*/
+/**
+ * Defines an internal API for monitoring a HotSpot Java Virtual Machine using
+ * its shared memory instrumentation buffer
+ *
+ * @since 9
+ */
module jdk.internal.jvmstat {
exports sun.jvmstat.monitor to
jdk.attach,
--- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Mon Apr 24 21:34:23 2017 +0200
@@ -264,9 +264,8 @@
}
public boolean previousSnippet() {
- for (int i = index() - 1; i >= 0; i--) {
- if (get(i) instanceof NarrowingHistoryLine) {
- moveTo(i);
+ while (previous()) {
+ if (current() instanceof NarrowingHistoryLine) {
return true;
}
}
@@ -275,19 +274,17 @@
}
public boolean nextSnippet() {
- for (int i = index() + 1; i < size(); i++) {
- if (get(i) instanceof NarrowingHistoryLine) {
- moveTo(i);
+ boolean success = false;
+
+ while (next()) {
+ success = true;
+
+ if (current() instanceof NarrowingHistoryLine) {
return true;
}
}
- if (index() < size()) {
- moveToEnd();
- return true;
- }
-
- return false;
+ return success;
}
public final void load(Iterable<? extends String> originalHistory) {
--- a/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java Mon Apr 24 21:34:23 2017 +0200
@@ -47,8 +47,6 @@
* object was constructed. The value of the VM option
* may be changed after the {@code VMOption} object was constructed,
*
- * @see <a href="{@docRoot}/../../../../technotes/guides/vm/index.html">
- * Java Virtual Machine</a>
* @author Mandy Chung
* @since 1.6
*/
--- a/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java Mon Apr 24 21:34:23 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
@@ -71,6 +71,7 @@
*/
@Deprecated(since="9", forRemoval=true)
+@SuppressWarnings("removal")
public class PolicyTool {
// for i18n
@@ -879,7 +880,8 @@
* The Permission contains the (Type, Name, Action) triplet.
*
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class PolicyEntry {
private CodeSource codesource;
@@ -1019,7 +1021,8 @@
/**
* The main window for the PolicyTool
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class ToolWindow extends JFrame {
// use serialVersionUID from JDK 1.2.2 for interoperability
private static final long serialVersionUID = 5682568601210376777L;
@@ -1553,7 +1556,8 @@
/**
* General dialog window
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class ToolDialog extends JDialog {
// use serialVersionUID from JDK 1.2.2 for interoperability
private static final long serialVersionUID = -372244357011301190L;
@@ -2917,7 +2921,8 @@
/**
* Event handler for the PolicyTool window
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class ToolWindowListener implements WindowListener {
private PolicyTool tool;
@@ -2962,7 +2967,8 @@
/**
* Event handler for the Policy List
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class PolicyListListener extends MouseAdapter implements ActionListener {
private PolicyTool tool;
@@ -2992,7 +2998,8 @@
/**
* Event handler for the File Menu
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class FileMenuListener implements ActionListener {
private PolicyTool tool;
@@ -3091,7 +3098,8 @@
/**
* Event handler for the main window buttons and Edit Menu
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class MainWindowListener implements ActionListener {
private PolicyTool tool;
@@ -3167,7 +3175,8 @@
* if edit is FALSE, then we are ADDing a new PolicyEntry,
* so we only need to update the GUI listing.
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class AddEntryDoneButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3234,7 +3243,8 @@
/**
* Event handler for ChangeKeyStoreOKButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class ChangeKeyStoreOKButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3281,7 +3291,8 @@
/**
* Event handler for AddPrinButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class AddPrinButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3307,7 +3318,8 @@
/**
* Event handler for AddPermButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class AddPermButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3333,7 +3345,8 @@
/**
* Event handler for AddPrinOKButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class NewPolicyPrinOKButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3397,7 +3410,8 @@
/**
* Event handler for AddPermOKButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class NewPolicyPermOKButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3461,7 +3475,8 @@
/**
* Event handler for RemovePrinButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class RemovePrinButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3497,7 +3512,8 @@
/**
* Event handler for RemovePermButton button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class RemovePermButtonListener implements ActionListener {
private PolicyTool tool;
@@ -3540,7 +3556,8 @@
* GUI listing. If the user is editing an existing PolicyEntry, we
* update both the GUI listing and the actual PolicyEntry.
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class EditPrinButtonListener extends MouseAdapter implements ActionListener {
private PolicyTool tool;
@@ -3587,7 +3604,8 @@
* GUI listing. If the user is editing an existing PolicyEntry, we
* update both the GUI listing and the actual PolicyEntry.
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class EditPermButtonListener extends MouseAdapter implements ActionListener {
private PolicyTool tool;
@@ -3628,7 +3646,8 @@
/**
* Event handler for Principal Popup Menu
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class PrincipalTypeMenuListener implements ItemListener {
private ToolDialog td;
@@ -3680,7 +3699,8 @@
/**
* Event handler for Permission Popup Menu
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class PermissionMenuListener implements ItemListener {
private ToolDialog td;
@@ -3755,7 +3775,8 @@
/**
* Event handler for Permission Name Popup Menu
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class PermissionNameMenuListener implements ItemListener {
private ToolDialog td;
@@ -3909,7 +3930,8 @@
/**
* Event handler for UserSaveYes button
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class UserSaveYesButtonListener implements ActionListener {
private ToolDialog us;
@@ -3964,7 +3986,8 @@
/**
* Event handler for UserSaveNoButton
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class UserSaveNoButtonListener implements ActionListener {
private PolicyTool tool;
@@ -4013,7 +4036,8 @@
/**
* Event handler for ConfirmRemovePolicyEntryOKButtonListener
*/
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class ConfirmRemovePolicyEntryOKButtonListener implements ActionListener {
private PolicyTool tool;
@@ -4169,7 +4193,8 @@
}
}
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class AuthPerm extends Perm {
AuthPerm() {
super(javax.security.auth.AuthPermission.class,
@@ -4242,7 +4267,8 @@
}
}
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class URLPerm extends Perm {
URLPerm() {
super(java.net.URLPermission.class,
@@ -4407,7 +4433,8 @@
}
}
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class RuntimePerm extends Perm {
RuntimePerm() {
super(java.lang.RuntimePermission.class,
@@ -4448,7 +4475,8 @@
}
}
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "removal"}) // PolicyTool
class SecurityPerm extends Perm {
SecurityPerm() {
super(java.security.SecurityPermission.class,
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/SolarisLoginModule.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/SolarisLoginModule.java Mon Apr 24 21:34:23 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
@@ -66,6 +66,7 @@
private boolean debug = true;
// SolarisSystem to retrieve underlying system info
+ @SuppressWarnings("removal")
private SolarisSystem ss;
// the authentication status
@@ -73,9 +74,13 @@
private boolean commitSucceeded = false;
// Underlying system info
+ @SuppressWarnings("removal")
private SolarisPrincipal userPrincipal;
+ @SuppressWarnings("removal")
private SolarisNumericUserPrincipal UIDPrincipal;
+ @SuppressWarnings("removal")
private SolarisNumericGroupPrincipal GIDPrincipal;
+ @SuppressWarnings("removal")
private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups =
new LinkedList<>();
@@ -121,6 +126,7 @@
* @return true in all cases (this {@code LoginModule}
* should not be ignored).
*/
+ @SuppressWarnings("removal")
public boolean login() throws LoginException {
long[] solarisGroups = null;
@@ -234,6 +240,7 @@
* @return false if this LoginModule's own login and/or commit attempts
* failed, and true otherwise.
*/
+ @SuppressWarnings("removal")
public boolean abort() throws LoginException {
if (debug) {
System.out.println("\t\t[SolarisLoginModule]: " +
@@ -271,6 +278,7 @@
* @return true in all cases (this {@code LoginModule}
* should not be ignored).
*/
+ @SuppressWarnings("removal")
public boolean logout() throws LoginException {
if (debug) {
System.out.println("\t\t[SolarisLoginModule]: " +
--- a/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
* with {@link StackWalker.StackFrame#getDeclaringClass} instead.
*/
@Deprecated(forRemoval=true)
+ @SuppressWarnings("removal") // Reflection.getCallerClass
public static Class<?> getCallerClass(int depth) {
if (depth < 0)
throw new InternalError("depth must be positive");
--- a/jdk/test/ProblemList.txt Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/ProblemList.txt Mon Apr 24 21:34:23 2017 +0200
@@ -124,6 +124,7 @@
# jdk_lang
java/lang/StringCoding/CheckEncodings.sh 7008363 generic-all
+java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java 8178776 generic-all
jdk/internal/misc/JavaLangAccess/NewUnsafeString.java 8176188 generic-all
@@ -170,8 +171,6 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
-java/net/httpclient/TimeoutOrdering.java 8170940 solaris-all,windows-all
-
############################################################################
# jdk_nio
@@ -257,8 +256,7 @@
tools/jimage/JImageListTest.java 8170120 generic-all
tools/jimage/JImageVerifyTest.java 8170120 generic-all
-
-tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java 8169971 windows-x64
+tools/jimage/VerifyJimage.java 8178776 generic-all
tools/jar/multiRelease/RuntimeTest.java 8173905 generic-all
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, 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
@@ -23,13 +23,11 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.List;
import java.util.Map;
import jdk.testlibrary.ProcessTools;
import com.sun.jdi.Bootstrap;
-import com.sun.jdi.ThreadReference;
import com.sun.jdi.VirtualMachine;
import com.sun.jdi.connect.AttachingConnector;
import com.sun.jdi.connect.Connector;
@@ -86,7 +84,7 @@
is.read();
// Attach a debugger
- tryDebug(p.getPid());
+ tryDebug(p.pid());
} finally {
p.destroyForcibly();
}
--- a/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java Mon Apr 24 21:34:23 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
@@ -67,15 +67,19 @@
robot.waitForIdle();
AtomicReference<Rectangle> frameBounds = new AtomicReference<>();
+ AtomicReference<Insets> frameInsets = new AtomicReference<>();
AtomicReference<Dimension> button1Size = new AtomicReference<>();
SwingUtilities.invokeAndWait(() -> {
frameBounds.set(frame1.getBounds());
+ frameInsets.set(frame1.getInsets());
button1Size.set(jButton1.getSize());
});
//point mouse to center of top-left Component (button1)
- robot.mouseMove(frameBounds.get().x + button1Size.get().width / 2,
- frameBounds.get().y + button1Size.get().height / 2);
+ robot.mouseMove(frameBounds.get().x + frameInsets.get().left +
+ button1Size.get().width / 2,
+ frameBounds.get().y + frameInsets.get().top +
+ button1Size.get().height / 2);
AtomicReference<Point> pFalse = new AtomicReference<>();
AtomicReference<Point> pTrue = new AtomicReference<>();
@@ -108,10 +112,12 @@
System.out.println("Test stage completed: Container.getMousePosition(boolean) returned null result outside Container. Passed.");
//point mouse in place free from child components (right-botton component)
- robot.mouseMove(frameBounds.get().x + centerC4.get().x,
- frameBounds.get().y + centerC4.get().y);
+ robot.mouseMove(frameBounds.get().x + frameInsets.get().left +
+ centerC4.get().x,
+ frameBounds.get().y + frameInsets.get().top +
+ centerC4.get().y);
- robot.delay(3000);
+ robot.waitForIdle();
SwingUtilities.invokeAndWait(() -> {
pFalse.set(contentPane.getMousePosition(false));
pTrue.set(frame1.getMousePosition(true));
@@ -123,7 +129,8 @@
}
System.out.println("Test stage completed: Container.getMousePosition(boolean) returned non-null results inside Container. Passed.");
- if (pTrue.get().x != centerC4.get().x || pTrue.get().y != centerC4.get().y) {
+ if (pTrue.get().x != frameInsets.get().left + centerC4.get().x ||
+ pTrue.get().y != frameInsets.get().top + centerC4.get().y) {
throw new RuntimeException("Test failed: Container.getMousePosition(true) returned incorrect result inside Container.");
}
System.out.println("Test stage completed: Container.getMousePosition(true) returned correct result inside Container. Passed.");
--- a/jdk/test/java/awt/TextField/DisabledUndoTest/DisabledUndoTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/awt/TextField/DisabledUndoTest/DisabledUndoTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,7 +24,7 @@
/*
* @test
* @key headful
- * @bug 4302718 6753165
+ * @bug 4302718 6753165 8177386
* @summary verifies that undo does not work in a disabled TextField on windows
* @requires (os.family == "windows")
* @run main/manual DisabledUndoTest
@@ -42,12 +42,12 @@
private static void init() throws Exception {
String[] instructions
- = {
- "1.Type a few symbols in the textfield.",
- "2.Then click the button Disable textfield to disable the textfield.",
- "3.Right-click on the textfield to invoke context menu and select \"Undo\".",
- "4.Verify that the symbols you typed are NOT undone.",
- "5.If they are not, press Pass, else press Fail."
+ = {
+ "1.Type a few symbols in the textfield.",
+ "2.Right-click on the textfield to invoke context menu and select \"Undo\". Make sure the typed symbol is undone.",
+ "3.Then click the button Disable textfield to disable the textfield.",
+ "4.Right-click on the textfield to invoke context menu.Verify that Undo option is disabled in context menu and you can't undo the text",
+ "5.If they are not, press Pass, else press Fail."
};
Sysout.createDialog();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/WindowDeadlockTest/WindowDeadlockTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,72 @@
+/*
+ * 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 8176490
+ * @summary Tests that there is no hang or deadlock when the visibility
+ * of parent and child windows is changed.
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main/timeout=20 WindowDeadlockTest
+ */
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Robot;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class WindowDeadlockTest {
+ public static void main(String[] args) throws Exception {
+ Robot robot = Util.createRobot();
+
+ Frame main = new Frame("Main");
+ main.setBounds(0, 0, 200, 100);
+ main.setVisible(true);
+
+ Dialog first = new Dialog(main, "First");
+ first.setBounds(250, 0, 200, 100);
+ first.setVisible(true);
+
+ Dialog second = new Dialog(first, "Second");
+ second.setBounds(0, 150, 200, 100);
+ second.setVisible(true);
+
+ Util.waitForIdle(robot);
+ robot.delay(2000);
+
+ Dialog third = new Dialog(first, "Third", false);
+ third.setBounds(250, 150, 200, 100);
+ third.setVisible(true);
+ first.setVisible(false); // the hang takes place here
+
+ Util.waitForIdle(robot);
+ robot.delay(2000);
+
+ third.dispose();
+ second.dispose();
+ first.dispose();
+ main.dispose();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PageFormat/WrongPaperPrintingTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,238 @@
+/*
+ * 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 8167102
+ @summary PrintRequestAttributeSet breaks page size set using PageFormat
+ @run main/manual WrongPaperPrintingTest
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.Size2DSyntax;
+import javax.print.attribute.standard.Chromaticity;
+import javax.print.attribute.standard.MediaSize;
+import javax.print.attribute.standard.MediaSizeName;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+import javax.swing.WindowConstants;
+
+public class WrongPaperPrintingTest implements Printable {
+ private static final CountDownLatch testEndedSignal = new CountDownLatch(1);
+ private static final int testTimeout = 300000;
+ private static volatile String testFailureMsg;
+ private static volatile boolean testPassed;
+ private static volatile boolean testFinished;
+
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(() -> createAndShowTestDialog());
+
+ try {
+ if (!testEndedSignal.await(testTimeout, TimeUnit.MILLISECONDS)) {
+ throw new RuntimeException(String.format(
+ "Test timeout '%d ms' elapsed.", testTimeout));
+ }
+ if (!testPassed) {
+ String failureMsg = testFailureMsg;
+ if ((failureMsg != null) && (!failureMsg.trim().isEmpty())) {
+ throw new RuntimeException(failureMsg);
+ } else {
+ throw new RuntimeException("Test failed.");
+ }
+ }
+ } catch (InterruptedException ie) {
+ throw new RuntimeException(ie);
+ } finally {
+ testFinished = true;
+ }
+ }
+
+ private static void doTest() {
+ PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+ aset.add(Chromaticity.MONOCHROME);
+
+ MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5);
+ float[] size = isoA5Size.getSize(Size2DSyntax.INCH);
+ Paper paper = new Paper();
+ paper.setSize(size[0] * 72.0, size[1] * 72.0);
+ paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0);
+ PageFormat pf = new PageFormat();
+ pf.setPaper(paper);
+
+ PrinterJob job = PrinterJob.getPrinterJob();
+ job.setPrintable(new WrongPaperPrintingTest(), job.validatePage(pf));
+ if (job.printDialog()) {
+ try {
+ job.print(aset);
+ } catch (PrinterException pe) {
+ throw new RuntimeException(pe);
+ }
+ }
+ }
+
+ private static void pass() {
+ testPassed = true;
+ testEndedSignal.countDown();
+ }
+
+ private static void fail(String failureMsg) {
+ testFailureMsg = failureMsg;
+ testPassed = false;
+ testEndedSignal.countDown();
+ }
+
+ private static String convertMillisToTimeStr(int millis) {
+ if (millis < 0) {
+ return "00:00:00";
+ }
+ int hours = millis / 3600000;
+ int minutes = (millis - hours * 3600000) / 60000;
+ int seconds = (millis - hours * 3600000 - minutes * 60000) / 1000;
+ return String.format("%02d:%02d:%02d", hours, minutes, seconds);
+ }
+
+ private static void createAndShowTestDialog() {
+ String description =
+ " To run this test it is required to have a virtual PDF\r\n" +
+ " printer or any other printer supporting A5 paper size.\r\n" +
+ "\r\n" +
+ " 1. Verify that NOT A5 paper size is set as default for the\r\n" +
+ " printer to be used.\r\n" +
+ " 2. Click on \"Start Test\" button.\r\n" +
+ " 3. In the shown print dialog select the printer and click\r\n" +
+ " on \"Print\" button.\r\n" +
+ " 4. Verify that a page with a drawn rectangle is printed on\r\n" +
+ " a paper of A5 size which is (5.8 x 8.3 in) or\r\n" +
+ " (148 x 210 mm).\r\n" +
+ "\r\n" +
+ " If the printed page size is correct, click on \"PASS\"\r\n" +
+ " button, otherwise click on \"FAIL\" button.";
+
+ final JDialog dialog = new JDialog();
+ dialog.setTitle("WrongPaperPrintingTest");
+ dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ dialog.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ dialog.dispose();
+ fail("Main dialog was closed.");
+ }
+ });
+
+ final JLabel testTimeoutLabel = new JLabel(String.format(
+ "Test timeout: %s", convertMillisToTimeStr(testTimeout)));
+ final long startTime = System.currentTimeMillis();
+ final Timer timer = new Timer(0, null);
+ timer.setDelay(1000);
+ timer.addActionListener((e) -> {
+ int leftTime = testTimeout - (int)(System.currentTimeMillis() - startTime);
+ if ((leftTime < 0) || testFinished) {
+ timer.stop();
+ dialog.dispose();
+ }
+ testTimeoutLabel.setText(String.format(
+ "Test timeout: %s", convertMillisToTimeStr(leftTime)));
+ });
+ timer.start();
+
+ JTextArea textArea = new JTextArea(description);
+ textArea.setEditable(false);
+
+ final JButton testButton = new JButton("Start Test");
+ final JButton passButton = new JButton("PASS");
+ final JButton failButton = new JButton("FAIL");
+ testButton.addActionListener((e) -> {
+ testButton.setEnabled(false);
+ new Thread(() -> {
+ try {
+ doTest();
+
+ SwingUtilities.invokeLater(() -> {
+ passButton.setEnabled(true);
+ failButton.setEnabled(true);
+ });
+ } catch (Throwable t) {
+ t.printStackTrace();
+ dialog.dispose();
+ fail("Exception occurred in a thread executing the test.");
+ }
+ }).start();
+ });
+ passButton.setEnabled(false);
+ passButton.addActionListener((e) -> {
+ dialog.dispose();
+ pass();
+ });
+ failButton.setEnabled(false);
+ failButton.addActionListener((e) -> {
+ dialog.dispose();
+ fail("Size of a printed page is wrong.");
+ });
+
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ JPanel labelPanel = new JPanel(new FlowLayout());
+ labelPanel.add(testTimeoutLabel);
+ mainPanel.add(labelPanel, BorderLayout.NORTH);
+ mainPanel.add(textArea, BorderLayout.CENTER);
+ JPanel buttonPanel = new JPanel(new FlowLayout());
+ buttonPanel.add(testButton);
+ buttonPanel.add(passButton);
+ buttonPanel.add(failButton);
+ mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+ dialog.add(mainPanel);
+
+ dialog.pack();
+ dialog.setVisible(true);
+ }
+
+ @Override
+ public int print(Graphics g, PageFormat pf, int pageIndex)
+ throws PrinterException {
+ if (pageIndex == 0) {
+ g.setColor(Color.RED);
+ g.drawRect((int)pf.getImageableX(), (int)pf.getImageableY(),
+ (int)pf.getImageableWidth(), (int)pf.getImageableHeight());
+ return Printable.PAGE_EXISTS;
+ } else {
+ return Printable.NO_SUCH_PAGE;
+ }
+ }
+}
--- a/jdk/test/java/io/FilePermission/Correctness.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/io/FilePermission/Correctness.java Mon Apr 24 21:34:23 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
@@ -89,12 +89,14 @@
//check("/-", "-");
try {
- // containsPath is broken on Windows.
containsMethod = FilePermission.class.getDeclaredMethod(
"containsPath", Path.class, Path.class);
containsMethod.setAccessible(true);
System.out.println();
+ // The 1st 2 args of contains() must be normalized paths.
+ // When FilePermission::containsPath is called by implies,
+ // paths have already been normalized.
contains("x", "x", 0);
contains("x", "x/y", 1);
contains("x", "x/y/z", 2);
@@ -160,7 +162,7 @@
}
}
- static void check(String s1, String s2, boolean expected) {
+ static void check0(String s1, String s2, boolean expected) {
FilePermission fp1 = new FilePermission(s1, "read");
FilePermission fp2 = new FilePermission(s2, "read");
boolean b = fp1.implies(fp2);
@@ -173,6 +175,16 @@
}
}
+ static void check(String s1, String s2, boolean expected) {
+ check0(s1, s2, expected);
+ if (isWindows) {
+ check0("C:" + s1, s2, false);
+ check0(s1, "C:" + s2, false);
+ check0("C:" + s1, "D:" + s2, false);
+ check0("C:" + s1, "C:" + s2, expected);
+ }
+ }
+
static void check(String s1, String s2) {
check(s1, s2, true);
}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, 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
@@ -311,7 +311,7 @@
if (action.equals("sleep")) {
Thread.sleep(10 * 60 * 1000L);
} else if (action.equals("pid")) {
- System.out.println(ProcessHandle.current().getPid());
+ System.out.println(ProcessHandle.current().pid());
} else if (action.equals("testIO")) {
String expected = "standard input";
char[] buf = new char[expected.length()+1];
@@ -1235,7 +1235,7 @@
Process p = pb.start();
String s = commandOutput(p);
long actualPid = Long.valueOf(s.trim());
- long expectedPid = p.getPid();
+ long expectedPid = p.pid();
equal(actualPid, expectedPid);
} catch (Throwable t) {
unexpected(t);
@@ -1245,7 +1245,7 @@
// Test the default implementation of Process.getPid
DelegatingProcess p = new DelegatingProcess(null);
THROWS(UnsupportedOperationException.class,
- () -> p.getPid(),
+ () -> p.pid(),
() -> p.toHandle(),
() -> p.supportsNormalTermination(),
() -> p.children(),
@@ -2243,7 +2243,7 @@
// Child process waits until it gets input
String s = p.toString();
check(s.contains("not exited"));
- check(s.contains("pid=" + p.getPid() + ","));
+ check(s.contains("pid=" + p.pid() + ","));
new PrintStream(p.getOutputStream()).print("standard input");
p.getOutputStream().close();
@@ -2251,7 +2251,7 @@
// Check the toString after it exits
int exitValue = p.waitFor();
s = p.toString();
- check(s.contains("pid=" + p.getPid() + ","));
+ check(s.contains("pid=" + p.pid() + ","));
check(s.contains("exitValue=" + exitValue) &&
!s.contains("not exited"));
}
--- a/jdk/test/java/lang/ProcessBuilder/PipelineTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessBuilder/PipelineTest.java Mon Apr 24 21:34:23 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
@@ -212,7 +212,7 @@
static void print(ProcessHandle p) {
System.out.printf("process: pid: %d, info: %s%n",
- p.getPid(), p.info());
+ p.pid(), p.info());
}
// Check various aspects of the processes
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
! new File("/bin/ps").canExecute())
return;
System.out.println("Looks like a Unix system.");
- long mypid = ProcessHandle.current().getPid();
+ long mypid = ProcessHandle.current().pid();
System.out.printf("mypid: %d%n", mypid);
final Runtime rt = Runtime.getRuntime();
@@ -65,7 +65,7 @@
Process p = rt.exec(TrueCommand);
ProcessHandle pp = p.toHandle().parent().orElse(null);
- System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
+ System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.pid(), pp);
p.waitFor();
// Count all the zombies that are children of this Java process
--- a/jdk/test/java/lang/ProcessHandle/Basic.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessHandle/Basic.java Mon Apr 24 21:34:23 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
@@ -66,13 +66,13 @@
public static void test2() {
try {
ProcessHandle self = ProcessHandle.current();
- long pid = self.getPid(); // known native process id
+ long pid = self.pid(); // known native process id
Optional<ProcessHandle> self1 = ProcessHandle.of(pid);
assertEquals(self1.get(), self,
- "ProcessHandle.of(x.getPid()) should be equal getPid() %d: %d");
+ "ProcessHandle.of(x.pid()) should be equal pid() %d: %d");
Optional<ProcessHandle> ph = ProcessHandle.of(pid);
- assertEquals(pid, ph.get().getPid());
+ assertEquals(pid, ph.get().pid());
} finally {
// Cleanup any left over processes
ProcessHandle.current().children().forEach(ProcessHandle::destroy);
@@ -98,7 +98,7 @@
Process p = new ProcessBuilder("sleep", "0").start();
p.waitFor();
- long deadPid = p.getPid();
+ long deadPid = p.pid();
p = null; // Forget the process
Optional<ProcessHandle> t = ProcessHandle.of(deadPid);
--- a/jdk/test/java/lang/ProcessHandle/JavaChild.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessHandle/JavaChild.java Mon Apr 24 21:34:23 2017 +0200
@@ -159,7 +159,7 @@
*/
CompletableFuture<String> forEachOutputLine(Consumer<String> consumer) {
final CompletableFuture<String> future = new CompletableFuture<>();
- String name = "OutputLineReader-" + getPid();
+ String name = "OutputLineReader-" + pid();
Thread t = new Thread(() -> {
try (BufferedReader reader = outputReader()) {
String line;
@@ -167,7 +167,7 @@
consumer.accept(line);
}
} catch (IOException | RuntimeException ex) {
- consumer.accept("IOE (" + getPid() + "):" + ex.getMessage());
+ consumer.accept("IOE (" + pid() + "):" + ex.getMessage());
future.completeExceptionally(ex);
}
future.complete("success");
@@ -327,7 +327,7 @@
try {
p.getOutputStream().close();
} catch (IOException ie) {
- sendResult("stdin_closing", p.getPid(),
+ sendResult("stdin_closing", p.pid(),
"exception", ie.getMessage());
}
}
@@ -352,9 +352,9 @@
"children to terminate%n");
children.removeAll(completedChildren);
for (JavaChild c : children) {
- sendResult("stdin_noterm", c.getPid());
+ sendResult("stdin_noterm", c.pid());
System.err.printf(" Process not terminated: " +
- "pid: %d%n", c.getPid());
+ "pid: %d%n", c.pid());
}
System.exit(2);
}
@@ -386,11 +386,11 @@
System.arraycopy(args, nextArg, subargs, 0, subargs.length);
for (int i = 0; i < ncount; i++) {
JavaChild p = spawnJavaChild(subargs);
- sendResult(action, p.getPid());
+ sendResult(action, p.pid());
p.forEachOutputLine(JavaChild::sendRaw);
p.onJavaChildExit().thenAccept((p1) -> {
int excode = p1.exitValue();
- sendResult("child_exit", p1.getPid(), excode);
+ sendResult("child_exit", p1.pid(), excode);
completedChildren.add(p1);
});
children.add(p); // Add child to spawned list
@@ -410,7 +410,7 @@
if (p.isAlive()) {
sentCount++;
// overwrite with current pid
- result[0] = Long.toString(p.getPid());
+ result[0] = Long.toString(p.pid());
sendResult(action, result);
p.sendAction(args[nextArg], subargs);
}
@@ -426,7 +426,7 @@
// ignoring those that are not alive
for (JavaChild p : children) {
if (p.isAlive()) {
- sendResult(action, p.getPid());
+ sendResult(action, p.pid());
p.getOutputStream().close();
}
}
@@ -505,7 +505,7 @@
String command;
Object[] results;
Event(String command, Object... results) {
- this(self.getPid(), ++commandSeq, command, results);
+ this(self.pid(), ++commandSeq, command, results);
}
Event(long pid, int seq, String command, Object... results) {
this.pid = pid;
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -104,7 +104,7 @@
JavaChild proc = JavaChild.spawnJavaChild("stdin");
procHandle = proc.toHandle();
- printf(" spawned: %d%n", proc.getPid());
+ printf(" spawned: %d%n", proc.pid());
proc.forEachOutputLine((s) -> {
String[] split = s.trim().split(" ");
@@ -235,7 +235,7 @@
} while (!"pid".equals(split[1]));
// Tell B to wait for A's pid
- B.sendAction("waitpid", A.getPid());
+ B.sendAction("waitpid", A.pid());
// Wait a bit to see if B will prematurely report the termination of A
try {
--- a/jdk/test/java/lang/ProcessHandle/ProcessUtil.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessHandle/ProcessUtil.java Mon Apr 24 21:34:23 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
@@ -199,7 +199,7 @@
*/
static void printProcess(ProcessHandle ph, String prefix) {
printf("%spid %s, alive: %s; parent: %s, %s%n", prefix,
- ph.getPid(), ph.isAlive(), ph.parent(), ph.info());
+ ph.pid(), ph.isAlive(), ph.parent(), ph.info());
}
/**
--- a/jdk/test/java/lang/ProcessHandle/TreeTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java Mon Apr 24 21:34:23 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
@@ -73,7 +73,7 @@
try {
ProcessHandle self = ProcessHandle.current();
- printf("self pid: %d%n", self.getPid());
+ printf("self pid: %d%n", self.pid());
printDeep(self, "");
for (int i = 0; i < MAXCHILDREN; i++) {
@@ -154,7 +154,7 @@
JavaChild p1 = JavaChild.spawnJavaChild("stdin");
ProcessHandle p1Handle = p1.toHandle();
- printf(" p1 pid: %d%n", p1.getPid());
+ printf(" p1 pid: %d%n", p1.pid());
// Gather the PIDs from the output of the spawing process
p1.forEachOutputLine((s) -> {
@@ -206,7 +206,7 @@
// show the complete list of children (for debug)
List<ProcessHandle> descendants = getDescendants(p1Handle);
printf(" descendants: %s%n",
- descendants.stream().map(p -> p.getPid())
+ descendants.stream().map(p -> p.pid())
.collect(Collectors.toList()));
// Verify that all spawned children show up in the descendants List
@@ -252,7 +252,7 @@
JavaChild p1 = JavaChild.spawnJavaChild("stdin");
ProcessHandle p1Handle = p1.toHandle();
- printf(" p1: %s%n", p1.getPid());
+ printf(" p1: %s%n", p1.pid());
int newChildren = 3;
CountDownLatch spawnCount = new CountDownLatch(newChildren);
@@ -356,11 +356,11 @@
parent[sortindex[i]] = processes[sortindex[i]].parent().orElse(null);
}
Arrays.sort(sortindex, (i1, i2) -> {
- int cmp = Long.compare((parent[i1] == null ? 0L : parent[i1].getPid()),
- (parent[i2] == null ? 0L : parent[i2].getPid()));
+ int cmp = Long.compare((parent[i1] == null ? 0L : parent[i1].pid()),
+ (parent[i2] == null ? 0L : parent[i2].pid()));
if (cmp == 0) {
- cmp = Long.compare((processes[i1] == null ? 0L : processes[i1].getPid()),
- (processes[i2] == null ? 0L : processes[i2].getPid()));
+ cmp = Long.compare((processes[i1] == null ? 0L : processes[i1].pid()),
+ (processes[i2] == null ? 0L : processes[i2].pid()));
}
return cmp;
});
@@ -397,7 +397,7 @@
ProcessHandle p1Handle = p1.toHandle();
printf("Spawning %d x %d x %d processes, pid: %d%n",
- factor, factor, factor, p1.getPid());
+ factor, factor, factor, p1.pid());
// Start the first tier of subprocesses
p1.sendAction("spawn", factor, "stdin");
@@ -448,7 +448,7 @@
List<ProcessHandle> subprocesses = getDescendants(p1Handle);
printf(" descendants: %s%n",
- subprocesses.stream().map(p -> p.getPid())
+ subprocesses.stream().map(p -> p.pid())
.collect(Collectors.toList()));
p1.getOutputStream().close(); // Close stdin for the controlling p1
--- a/jdk/test/java/lang/Runtime/exec/SleepyCat.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/lang/Runtime/exec/SleepyCat.java Mon Apr 24 21:34:23 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
@@ -80,10 +80,10 @@
for (Process p : pids) {
if (p == null)
continue;
- String[] pfiles = {"pfiles", Long.toString(p.getPid())};
+ String[] pfiles = {"pfiles", Long.toString(p.pid())};
fds = new ProcessBuilder(pfiles).inheritIO().start();
fds.waitFor();
- String[] pstack = {"pstack", Long.toString(p.getPid())};
+ String[] pstack = {"pstack", Long.toString(p.pid())};
fds = new ProcessBuilder(pstack).inheritIO().start();
fds.waitFor();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/Base.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,273 @@
+/*
+ * 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * Base class for tests.
+ * The tests focuse on that LoggerFinder works well in jigsaw environment,
+ * i.e. make sure correct Logger can be retrieved,
+ * also verify that basic functionality of retrieved Logger's works well.
+ *
+ * Note: As the test will take long time, to avoid timeout,
+ * split it as several tests, this class is the base class for tests.
+ */
+public class Base {
+ protected static final String JAVA_HOME = System.getProperty("java.home");
+ protected static final Path JDK_IMAGE = Paths.get(JAVA_HOME);
+ protected static final Path JMODS = Paths.get(JAVA_HOME, "jmods");
+
+ protected static final String TEST_SRC = System.getProperty("test.src");
+
+ // logger client to get logger from java.base module, it should get a lazy logger
+ // which wraps the underlying real logger implementation
+ protected static final Path SRC_PATCHED_USAGE =
+ Paths.get(TEST_SRC, "patched_usage", "java.base");
+ protected static final Path DEST_PATCHED_USAGE = Paths.get("patched_usage", "java.base");
+ protected static final Path SRC_PATCHED_CLIENT = Paths.get(TEST_SRC, "patched_client");
+ protected static final Path DEST_PATCHED_CLIENT = Paths.get("patched_client");
+
+ // logger client to get logger from bootclasspath/a, it should get a lazy logger
+ // which wraps the underlying real logger implementation
+ protected static final Path SRC_BOOT_USAGE = Paths.get(TEST_SRC, "boot_usage");
+ protected static final Path DEST_BOOT_USAGE = Paths.get("boot_usage");
+ protected static final Path SRC_BOOT_CLIENT = Paths.get(TEST_SRC, "boot_client");
+ protected static final Path DEST_BOOT_CLIENT = Paths.get("boot_client");
+
+ // logger provider in named module m.l.a
+ protected static final Path SRC_NAMED_LOGGER = Paths.get(TEST_SRC, "named_logger");
+ protected static final Path DEST_NAMED_LOGGER = Paths.get("mods_named_logger");
+
+ // logger provider in unnamed module
+ protected static final Path SRC_UNNAMED_LOGGER = Paths.get(TEST_SRC, "unnamed_logger");
+ protected static final Path DEST_UNNAMED_LOGGER = Paths.get("cp_unnamed_logger");
+ protected static final Path SRC_UNNAMED_LOGGER_SERVICE_FILE =
+ SRC_UNNAMED_LOGGER.resolve("META-INF/services/java.lang.System$LoggerFinder");
+ protected static final Path DEST_UNNAMED_LOGGER_SERVICE_DIR =
+ DEST_UNNAMED_LOGGER.resolve("META-INF/services");
+ protected static final Path DEST_UNNAMED_LOGGER_SERVICE_FILE =
+ DEST_UNNAMED_LOGGER.resolve("META-INF/services/java.lang.System$LoggerFinder");
+
+ // logger client in named module m.t.a
+ protected static final Path SRC_NAMED_CLIENT = Paths.get(TEST_SRC, "named_client");
+ protected static final Path DEST_NAMED_CLIENT = Paths.get("mods_named_client");
+
+ // logger client in unnamed module
+ protected static final Path SRC_UNNAMED_CLIENT = Paths.get(TEST_SRC, "unnamed_client");
+ protected static final Path DEST_UNNAMED_CLIENT = Paths.get("cp_unnamed_client");
+
+ // customized image with only module java.base
+ protected static final Path IMAGE = Paths.get("image");
+ // customized image with java.base and logger provider module m.l.a
+ protected static final Path IMAGE_LOGGER = Paths.get("image_logger");
+ // customized image with module java.base and logger client module m.t.a
+ protected static final Path IMAGE_CLIENT = Paths.get("image_client");
+ // customized image with module java.base, logger provider module m.l.a
+ // and logger client module m.t.a
+ protected static final Path IMAGE_CLIENT_LOGGER = Paths.get("image_all");
+
+ // lazy logger class which wraps the underlying real logger implementation
+ protected static final String LAZY_LOGGER =
+ "jdk.internal.logger.LazyLoggers$JdkLazyLogger";
+ // JUL logger class which wraps java.util.logging.Logger
+ protected static final String JUL_LOGGER =
+ "sun.util.logging.internal.LoggingProviderImpl$JULWrapper";
+ // default simple logger class when no logger provider can be found
+ protected static final String SIMPLE_LOGGER =
+ "jdk.internal.logger.SimpleConsoleLogger";
+ // logger class in named module m.l.a
+ protected static final String LOGGER_A = "pkg.a.l.LoggerA";
+ // logger class in unnamed module m.l.b
+ protected static final String LOGGER_B = "pkg.b.l.LoggerB";
+
+ // logger client in named module
+ protected static final String CLIENT_A = "m.t.a/pkg.a.t.TestA";
+ // logger client in unnamed module
+ protected static final String CLIENT_B = "pkg.b.t.TestB";
+ // logger client which gets logger through boot class BootUsage
+ protected static final String BOOT_CLIENT = "BootClient";
+ // logger client which gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ protected static final String PATCHED_CLIENT = "PatchedClient";
+
+ protected void setupAllClient() throws Throwable {
+ // compiles logger client which will get logger through patched
+ // class java.base/java.lang.PatchedUsage
+ compile(SRC_BOOT_USAGE, DEST_BOOT_USAGE);
+ compile(SRC_BOOT_CLIENT, DEST_BOOT_CLIENT,
+ "--class-path", DEST_BOOT_USAGE.toString());
+
+ // compiles logger client which will get logger through boot
+ // class BootUsage
+ compile(SRC_PATCHED_USAGE, DEST_PATCHED_USAGE,
+ "--patch-module", "java.base=" + SRC_PATCHED_USAGE.toString());
+ compile(SRC_PATCHED_CLIENT, DEST_PATCHED_CLIENT,
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString());
+
+ // compiles logger client in unnamed module
+ compile(SRC_UNNAMED_CLIENT, DEST_UNNAMED_CLIENT,
+ "--source-path", SRC_UNNAMED_CLIENT.toString());
+
+ // compiles logger client in named module m.t.a
+ compile(SRC_NAMED_CLIENT, DEST_NAMED_CLIENT,
+ "--module-source-path", SRC_NAMED_CLIENT.toString());
+ }
+
+ protected void setupNamedLogger() throws Throwable {
+ // compiles logger provider in named module m.l.a
+ compile(SRC_NAMED_LOGGER, DEST_NAMED_LOGGER,
+ "--module-source-path", SRC_NAMED_LOGGER.toString());
+ }
+
+ protected void setupUnnamedLogger() throws Throwable {
+ // compiles logger provider in unnamed module
+ compile(SRC_UNNAMED_LOGGER, DEST_UNNAMED_LOGGER,
+ "--source-path", SRC_UNNAMED_LOGGER.toString());
+ Files.createDirectories(DEST_UNNAMED_LOGGER_SERVICE_DIR);
+ Files.copy(SRC_UNNAMED_LOGGER_SERVICE_FILE, DEST_UNNAMED_LOGGER_SERVICE_FILE,
+ StandardCopyOption.REPLACE_EXISTING);
+ }
+
+ protected boolean checkJMODS() throws Throwable {
+ // if $JAVA_HOME/jmods does not exist, skip below steps
+ // as there is no way to build customized images by jlink
+ if (Files.notExists(JMODS)) {
+ System.err.println("Skip tests which require image");
+ return false;
+ }
+ return true;
+ }
+
+ protected void setupJavaBaseImage() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // build image with just java.base module
+ String mpath = JMODS.toString();
+ execTool("jlink",
+ "--module-path", mpath,
+ "--add-modules", "java.base",
+ "--output", IMAGE.toString());
+ }
+
+ protected void setupLoggerImage() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // build image with java.base + m.l.a modules
+ String mpath = DEST_NAMED_LOGGER.toString() + File.pathSeparator + JMODS.toString();
+ execTool("jlink",
+ "--module-path", mpath,
+ "--add-modules", "m.l.a",
+ "--output", IMAGE_LOGGER.toString());
+ }
+
+ protected void setupClientImage() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // build image with java.base + m.t.a modules
+ String mpath = DEST_NAMED_CLIENT.toString() + File.pathSeparator + JMODS.toString();
+ execTool("jlink",
+ "--module-path", mpath,
+ "--add-modules", "m.t.a",
+ "--output", IMAGE_CLIENT.toString());
+ }
+
+ protected void setupFullImage() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // build image with java.base + m.l.a + m.t.a modules
+ String mpath = DEST_NAMED_LOGGER.toString() + File.pathSeparator
+ + DEST_NAMED_CLIENT.toString() + File.pathSeparator + JMODS.toString();
+ execTool("jlink",
+ "--module-path", mpath,
+ "--add-modules", "m.l.a,m.t.a",
+ "--output", IMAGE_CLIENT_LOGGER.toString());
+
+ }
+
+ protected static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+
+ /*
+ * run test with supplied java image which could be jdk image or customized image
+ */
+ protected void runTest(Path image, String... opts) throws Throwable {
+ String[] options = Stream.concat(Stream.of(getJava(image)), Stream.of(opts))
+ .toArray(String[]::new);
+
+ ProcessBuilder pb = new ProcessBuilder(options);
+ int exitValue = executeCommand(pb).outputTo(System.out)
+ .errorTo(System.err)
+ .getExitValue();
+ assertTrue(exitValue == 0);
+ }
+
+ private void compile(Path src, Path dest, String... params) throws Throwable {
+ assertTrue(CompilerUtils.compile(src, dest, params));
+ }
+
+ private String getJava(Path image) {
+ boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+ Path java = image.resolve("bin").resolve(isWindows ? "java.exe" : "java");
+ if (Files.notExists(java))
+ throw new RuntimeException(java + " not found");
+ return java.toAbsolutePath().toString();
+ }
+
+ private void execTool(String tool, String... args) throws Throwable {
+ String path = JDKToolFinder.getJDKTool(tool);
+ List<String> commands = new ArrayList<>();
+ commands.add(path);
+ Stream.of(args).forEach(commands::add);
+ ProcessBuilder pb = new ProcessBuilder(commands);
+
+ int exitValue = executeCommand(pb).outputTo(System.out)
+ .errorTo(System.out)
+ .shouldNotContain("no module is recorded in hash")
+ .getExitValue();
+ assertTrue(exitValue == 0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ * 1. logger provider is the default one supplied by java.base,
+ * 2. clients are in named/unnamed module,
+ * patched system module, or Xbootclasspath
+ * This test does not require existence of java.logging module,
+ * but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm JDKLoggerForImageTest
+ */
+
+public class JDKLoggerForImageTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ JDKLoggerForImageTest t = new JDKLoggerForImageTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+
+ setupJavaBaseImage();
+ }
+
+ private void test() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // logger client is in named module m.t.a
+ runTest(IMAGE,
+ "--module-path", DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "system", SIMPLE_LOGGER);
+ // logger client is in unnamed module
+ runTest(IMAGE,
+ "--class-path", DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "system", SIMPLE_LOGGER);
+ // logger client gets logger through boot class BootUsage
+ runTest(IMAGE,
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ "--class-path", DEST_BOOT_CLIENT.toString(),
+ BOOT_CLIENT, "system", SIMPLE_LOGGER);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(IMAGE,
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ "--class-path", DEST_PATCHED_CLIENT.toString(),
+ PATCHED_CLIENT, "system", SIMPLE_LOGGER);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules java.logging
+ * @modules jdk.compiler
+ * @summary Test cases which run against the JDK image, check the situation where
+ * 1. logger provider is the default one supplied by the JDK,
+ * 2. clients are in named/unnamed module,
+ * patched system module, or Xbootclasspath
+ * This test DOES require existence of java.logging module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm JDKLoggerForJDKTest
+ */
+
+public class JDKLoggerForJDKTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ JDKLoggerForJDKTest t = new JDKLoggerForJDKTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+ }
+
+ private void test() throws Throwable {
+ // logger client is in named module m.t.a
+ runTest(JDK_IMAGE,
+ "--module-path", DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "system", JUL_LOGGER);
+ // logger client is in unnamed module
+ runTest(JDK_IMAGE,
+ "--class-path", DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "system", JUL_LOGGER);
+ // logger client gets logger through boot class BootUsage
+ runTest(JDK_IMAGE,
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ "--class-path", DEST_BOOT_CLIENT.toString(),
+ BOOT_CLIENT, "system", LAZY_LOGGER, JUL_LOGGER);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(JDK_IMAGE,
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ "--class-path", DEST_PATCHED_CLIENT.toString(),
+ PATCHED_CLIENT, "system", LAZY_LOGGER, JUL_LOGGER);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java Mon Apr 24 21:34:23 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. 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ * 1. logger providers are in the customized image too,
+ * 2. clients are in named/unnamed module, image,
+ * patched system module, or Xbootclasspath
+ * This test does not require existence of java.logging module,
+ * but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm LoggerInImageTest
+ */
+
+public class LoggerInImageTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ LoggerInImageTest t = new LoggerInImageTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+
+ setupNamedLogger();
+
+ setupLoggerImage();
+ setupFullImage();
+ }
+
+ private void test() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // logger client is in named module m.t.a which is also in customized image
+ runTest(IMAGE_CLIENT_LOGGER,
+ "-m", CLIENT_A, "named", LOGGER_A);
+ // logger client in named module m.t.a
+ runTest(IMAGE_LOGGER,
+ "--module-path", DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "named", LOGGER_A);
+ // logger client is in unnamed module
+ runTest(IMAGE_LOGGER,
+ "--class-path", DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "named", LOGGER_A);
+ // logger client gets logger through boot class BootUsage
+ runTest(IMAGE_LOGGER,
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ "--class-path", DEST_BOOT_CLIENT.toString(),
+ BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(IMAGE_LOGGER,
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ "--class-path", DEST_PATCHED_CLIENT.toString(),
+ PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ * 1. logger providers are in named module,
+ * 2. clients are in named/unnamed module, image,
+ * patched system module, or Xbootclasspath
+ * This test does not require existence of java.logging module,
+ * but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm NamedLoggerForImageTest
+ */
+
+public class NamedLoggerForImageTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ NamedLoggerForImageTest t = new NamedLoggerForImageTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+
+ setupNamedLogger();
+
+ setupJavaBaseImage();
+ setupClientImage();
+ }
+
+ private void test() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // logger client is in named module m.t.a
+ runTest(IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "named", LOGGER_A);
+ // logger client is in unnamed module
+ runTest(IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "--class-path", DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "named", LOGGER_A);
+ // logger client is in named module m.t.a which is in customized image
+ runTest(IMAGE_CLIENT,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "-m", CLIENT_A, "named", LOGGER_A);
+ // logger client gets logger through boot class BootUsage
+ runTest(IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ "--class-path", DEST_BOOT_CLIENT.toString(),
+ BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ "--class-path", DEST_PATCHED_CLIENT.toString(),
+ PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against the JDK image, check the situation where
+ * 1. logger providers are in named module,
+ * 2. clients are in named/unnamed module,
+ * patched system module, or Xbootclasspath
+ * This test does not require existence of java.logging module,
+ * but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm NamedLoggerForJDKTest
+ */
+
+public class NamedLoggerForJDKTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ NamedLoggerForJDKTest t = new NamedLoggerForJDKTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+
+ setupNamedLogger();
+ }
+
+ private void test() throws Throwable {
+ // logger client is in named module m.t.a
+ runTest(JDK_IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "named", LOGGER_A);
+ // logger client is in unnamed module
+ runTest(JDK_IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "--class-path", DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "named", LOGGER_A);
+ // logger client gets logger through boot class BootUsage
+ runTest(JDK_IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ "--class-path", DEST_BOOT_CLIENT.toString(),
+ BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(JDK_IMAGE,
+ "--module-path", DEST_NAMED_LOGGER.toString(),
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ "--class-path", DEST_PATCHED_CLIENT.toString(),
+ PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against customized image, check the situation where
+ * 1. logger providers are in unnamed module,
+ * 2. clients are in named/unnamed module, image,
+ * patched system module, or Xbootclasspath
+ * This test does not require existence of java.logging module,
+ * but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm UnnamedLoggerForImageTest
+ */
+
+public class UnnamedLoggerForImageTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ UnnamedLoggerForImageTest t = new UnnamedLoggerForImageTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+
+ setupUnnamedLogger();
+
+ setupJavaBaseImage();
+ setupClientImage();
+ }
+
+ private void test() throws Throwable {
+ if (!checkJMODS()) {
+ return;
+ }
+
+ // logger client is in unnamed module
+ runTest(IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "unnamed", LOGGER_B);
+ // logger client is in named module m.t.a
+ runTest(IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString(),
+ "--module-path", DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "unnamed", LOGGER_B);
+ // logger client is in named module m.t.a which is in customized image
+ runTest(IMAGE_CLIENT,
+ "--class-path", DEST_UNNAMED_LOGGER.toString(),
+ "-m", CLIENT_A, "unnamed", LOGGER_B);
+ // logger client gets logger through boot class BootUsage
+ runTest(IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_BOOT_CLIENT.toString(),
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_PATCHED_CLIENT.toString(),
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.
+ */
+
+import java.io.File;
+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.List;
+import java.util.stream.Stream;
+
+import jdk.testlibrary.JDKToolFinder;
+
+import static jdk.testlibrary.ProcessTools.executeCommand;
+
+/*
+ * @test
+ * @modules jdk.compiler
+ * @summary Test cases which run against the JDK image, check the situation where
+ * 1. logger providers are in unnamed module,
+ * 2. clients are in named/unnamed module,
+ * patched system module, or Xbootclasspath
+ * This test does not require existence of java.logging module,
+ * but require jdk.compiler module
+ * @library /lib/testlibrary
+ * @build Base CompilerUtils jdk.testlibrary.*
+ * @run main/othervm UnnamedLoggerForJDKTest
+ */
+
+public class UnnamedLoggerForJDKTest extends Base {
+
+ public static void main(String args[]) throws Throwable {
+ UnnamedLoggerForJDKTest t = new UnnamedLoggerForJDKTest();
+ t.setup();
+ t.test();
+ }
+
+ private void setup() throws Throwable {
+ setupAllClient();
+
+ setupUnnamedLogger();
+ }
+
+ private void test() throws Throwable {
+ // logger client is in named module m.t.a
+ runTest(JDK_IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString(),
+ "--module-path", DEST_NAMED_CLIENT.toString(),
+ "-m", CLIENT_A, "unnamed", LOGGER_B);
+ // logger client is also in unnamed module
+ runTest(JDK_IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_UNNAMED_CLIENT.toString(),
+ CLIENT_B, "unnamed", LOGGER_B);
+ // logger client gets logger through boot class BootUsage
+ runTest(JDK_IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_BOOT_CLIENT.toString(),
+ "-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),
+ BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+ // logger client gets logger through patched class
+ // java.base/java.lang.PatchedUsage
+ runTest(JDK_IMAGE,
+ "--class-path", DEST_UNNAMED_LOGGER.toString()
+ + File.pathSeparator + DEST_PATCHED_CLIENT.toString(),
+ "--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),
+ PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_B);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/boot_client/BootClient.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ */
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in Xbootclasspath
+ */
+public final class BootClient {
+
+ public static void main(String[] args) throws Exception {
+ assertTrue(args.length >= 2);
+ String loggerMode = args[0];
+ String loggerClassName = args[1];
+ String underlyingLoggerClassName = args.length >= 3 ? args[2] : null;
+
+ testLogger(loggerMode, loggerClassName, underlyingLoggerClassName);
+ testLog(underlyingLoggerClassName);
+ }
+
+ /*
+ * Tests System.getLogger(String) get expected logger.
+ */
+ private static void testLogger(String loggerMode, String loggerClassName,
+ String underlyingLoggerClassName) {
+ String name = "test.boot";
+ Logger logger = getLogger(name);
+ printLogger(logger);
+
+ final Module lm = logger.getClass().getModule();
+ final ClassLoader loggerCL = lm.getClassLoader();
+ if (loggerMode.equals("system")) {
+ assertTrue(lm.isNamed());
+ assertTrue(loggerCL == null);
+ } else if(loggerMode.equals("unnamed")) {
+ assertTrue(!lm.isNamed());
+ assertTrue(loggerCL != null);
+ } else {
+ throw new RuntimeException("wrong parameter");
+ }
+
+ assertTrue(loggerClassName.equals(logger.getClass().getName()));
+ if (underlyingLoggerClassName != null) {
+ String loggerName = logger.getName();
+ if (underlyingLoggerClassName.equals(
+ "sun.util.logging.internal.LoggingProviderImpl$JULWrapper")) {
+ assertTrue(loggerName.equals(name));
+ } else {
+ assertTrue(loggerName.equals(underlyingLoggerClassName));
+ }
+ }
+ }
+
+ /*
+ * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+ * System.getLogger(String) works well.
+ */
+ private static void testLog(String underlyingLoggerClassName) throws Exception {
+ if (underlyingLoggerClassName == null) {
+ return;
+ }
+
+ if (underlyingLoggerClassName.equals("pkg.a.l.LoggerA")
+ || underlyingLoggerClassName.equals("pkg.b.l.LoggerB")) {
+
+ String name = "test.boot.logger";
+ String plainMsg = "this is test log message #1";
+ ResourceBundle rb = new MyResourcesBoot();
+ Throwable ex = new Throwable("this is an expected exception to be logged");
+ Class<?> clazz = Class.forName(underlyingLoggerClassName);
+ Method method = clazz.getMethod("checkLog", String.class,
+ System.Logger.Level.class,
+ ResourceBundle.class, String.class,
+ Throwable.class, Object[].class);
+
+ Logger logger = getLogger(name);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName()
+ .equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+ assertTrue(logger.getName().equals(underlyingLoggerClassName));
+ logger.log(Logger.Level.WARNING, plainMsg);
+ boolean pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesBoot.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(!pass);
+
+ logger = getLogger(name, rb);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName()
+ .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+ assertTrue(logger.getName().equals(underlyingLoggerClassName));
+ logger.log(Logger.Level.INFO, MyResourcesBoot.KEY);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesBoot.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ }
+ }
+
+ private static class MyResourcesBoot extends ListResourceBundle {
+ static final String KEY = "this is the key in MyResourcesBoot";
+ static final String VALUE = "THIS IS THE VALUE IN MyResourcesBoot";
+
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ {KEY, VALUE}
+ };
+ }
+ }
+
+ private static Logger getLogger(String name) {
+ return BootUsage.getLogger(name);
+ }
+
+ private static Logger getLogger(String name, ResourceBundle rb) {
+ return BootUsage.getLogger(name, rb);
+ }
+
+ private static void printLogger(Logger logger) {
+ System.err.println("logger name: " + logger.getName()
+ + ", logger class: " + logger.getClass());
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/boot_usage/BootUsage.java Mon Apr 24 21:34:23 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. 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.
+ */
+
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+
+/*
+ * BootUsage is put to Xbootclasspath, it will be used by
+ * BootClient to test when logger client is in boot classpath
+ */
+public final class BootUsage {
+
+ public static Logger getLogger(String name) {
+ check();
+ return System.getLogger(name);
+ }
+
+ public static Logger getLogger(String name, ResourceBundle rb) {
+ check();
+ return System.getLogger(name, rb);
+ }
+
+ private static void check() {
+ final Module m = BootUsage.class.getModule();
+ final ClassLoader moduleCL = m.getClassLoader();
+ assertTrue(!m.isNamed());
+ assertTrue(moduleCL == null);
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_client/m.t.a/module-info.java Mon Apr 24 21:34:23 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. 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.
+ */
+
+module m.t.a {
+ exports pkg.a.t;
+ uses System.LoggerFinder;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_client/m.t.a/pkg/a/t/TestA.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,157 @@
+/*
+ * 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 pkg.a.t;
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in named module m.l.a
+ */
+public class TestA {
+
+ public static void main(String[] args) throws Exception {
+ assertTrue(args.length == 2);
+ String loggerMode = args[0];
+ String loggerClassName = args[1];
+
+ testLogger(loggerMode, loggerClassName);
+ testLog(loggerClassName);
+ }
+
+ /*
+ * Tests System.getLogger(String) get expected logger.
+ */
+ private static void testLogger(String loggerMode, String loggerClassName) {
+ final Module m = TestA.class.getModule();
+ final ClassLoader moduleCL = m.getClassLoader();
+ assertTrue(m.isNamed());
+ assertTrue(moduleCL != null);
+
+ String name = "test.a";
+ Logger logger = getLogger(name);
+ printLogger(logger);
+
+ final Module lm = logger.getClass().getModule();
+ final ClassLoader loggerCL = lm.getClassLoader();
+ if (loggerMode.equals("system")) {
+ assertTrue(lm.isNamed());
+ assertTrue(loggerCL == null);
+ } else if(loggerMode.equals("named")) {
+ assertTrue(lm.isNamed());
+ assertTrue(loggerCL != null);
+ } else if(loggerMode.equals("unnamed")) {
+ assertTrue(!lm.isNamed());
+ assertTrue(loggerCL != null);
+ } else {
+ throw new RuntimeException("wrong parameter");
+ }
+
+ assertTrue(loggerClassName.equals(logger.getClass().getName()));
+ assertTrue(!loggerClassName.equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+ }
+
+ /*
+ * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+ * System.getLogger(String) works well.
+ */
+ private static void testLog(String loggerClassName) throws Exception {
+ if (loggerClassName.equals("pkg.a.l.LoggerA")
+ || loggerClassName.equals("pkg.b.l.LoggerB")) {
+
+ String name = "test.a.A";
+ String plainMsg = "this is test log message #1";
+ ResourceBundle rb = new MyResourcesA();
+ Throwable ex = new Throwable("this is an expected exception to be logged");
+ Class<?> clazz = Class.forName(loggerClassName);
+ Method method = clazz.getMethod("checkLog", String.class,
+ System.Logger.Level.class,
+ ResourceBundle.class, String.class,
+ Throwable.class, Object[].class);
+
+ Logger logger = getLogger(name);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName().equals(loggerClassName));
+ assertTrue(logger.getName().equals(loggerClassName));
+ logger.log(Logger.Level.WARNING, plainMsg);
+ boolean pass = (boolean)method.invoke(null, name,
+ Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesA.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(!pass);
+
+ logger = getLogger(name, rb);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName()
+ .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+ assertTrue(logger.getName().equals(loggerClassName));
+ logger.log(Logger.Level.INFO, MyResourcesA.KEY);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesA.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ }
+ }
+
+ private static class MyResourcesA extends ListResourceBundle {
+ static final String KEY = "this is the key in MyResourcesA";
+ static final String VALUE = "THIS IS THE VALUE IN MyResourcesA";
+
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ {KEY, VALUE}
+ };
+ }
+ }
+
+ private static Logger getLogger(String name) {
+ return System.getLogger(name);
+ }
+
+ private static Logger getLogger(String name, ResourceBundle rb) {
+ return System.getLogger(name, rb);
+ }
+
+ private static void printLogger(Logger logger) {
+ System.err.println("logger name: " + logger.getName()
+ + ", logger class: " + logger.getClass());
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/module-info.java Mon Apr 24 21:34:23 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. 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.
+ */
+
+module m.l.a {
+ opens pkg.a.l;
+ provides java.lang.System.LoggerFinder with pkg.a.p.LoggerFinderA;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/l/LoggerA.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,129 @@
+/*
+ * 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 pkg.a.l;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
+import java.util.ResourceBundle;
+
+public class LoggerA implements System.Logger {
+
+ // ---- test utility fields and methods ----
+
+ private static Map<String, LoggerA> map = new HashMap<>();
+
+ public static LoggerA getLogger(String name) {
+ return map.computeIfAbsent(name, (n) -> new LoggerA());
+ }
+
+ public static boolean checkLog(String name, Level level, ResourceBundle bundle,
+ String format, Throwable throwable, Object... params) {
+ LoggerA logger = map.get(name);
+ LogEvent event = new LogEvent(level, bundle, format, null, params);
+ for (LogEvent l : logger.queue) {
+ if (l.equals(event)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // ---- logger implementation ----
+
+ private Queue<LogEvent> queue = new LinkedList<>();
+
+ @Override
+ public String getName() {
+ return this.getClass().getName();
+ }
+
+ @Override
+ public boolean isLoggable(Level level) {
+ return true;
+ }
+
+ @Override
+ public void log(Level level, ResourceBundle bundle, String format, Object... params) {
+ String msg = bundle != null ? bundle.getString(format) : format;
+ log(new LogEvent(level, bundle, msg, null, params));
+ }
+
+ @Override
+ public void log(Level level, ResourceBundle bundle, String format, Throwable throwable) {
+ String msg = bundle != null ? bundle.getString(format) : format;
+ log(new LogEvent(level, bundle, msg, throwable, (Object)null));
+ }
+
+ void log(LogEvent l) {
+ print(l);
+ queue.add(l);
+ }
+
+ private void print(LogEvent l) {
+ System.err.println("LoggerA Message"+ l);
+ }
+
+ public Queue<LogEvent> getLogEvent() {
+ return queue;
+ }
+
+ public static class LogEvent {
+ public LogEvent(Level level, ResourceBundle bundle, String format,
+ Throwable throwable, Object... params) {
+ this.level = level;
+ this.bundle = bundle;
+ this.format = format;
+ this.throwable = throwable;
+ this.params = params;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof LogEvent) {
+ LogEvent e = (LogEvent)o;
+ return level == e.level
+ && bundle == e.bundle
+ && format == e.format
+ && params == e.params;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("[level: %s, bundle: %s, format: %s, throwable: %s, object: %s]",
+ level, bundle, format, throwable, params);
+ }
+
+ private Level level;
+ private ResourceBundle bundle;
+ private String format;
+ private Throwable throwable;
+ private Object[] params;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/named_logger/m.l.a/pkg/a/p/LoggerFinderA.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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 pkg.a.p;
+
+import pkg.a.l.LoggerA;
+
+public class LoggerFinderA extends System.LoggerFinder {
+ @Override
+ public System.Logger getLogger(String name, Module module) {
+ return LoggerA.getLogger(name);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/patched_client/PatchedClient.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ */
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in patched module
+ */
+public class PatchedClient {
+
+ public static void main(String[] args) throws Exception {
+ assertTrue(args.length >= 2);
+ String loggerMode = args[0];
+ String loggerClassName = args[1];
+ String underlyingLoggerClassName = args.length >= 3 ? args[2] : null;
+
+ testLogger(loggerMode, loggerClassName, underlyingLoggerClassName);
+ testLog(underlyingLoggerClassName);
+ }
+
+ /*
+ * Tests System.getLogger(String) get expected logger.
+ */
+ private static void testLogger(String loggerMode, String loggerClassName,
+ String underlyingLoggerClassName) {
+ String name = "test.patched";
+ Logger logger = getLogger(name);
+ printLogger(logger);
+
+ final Module lm = logger.getClass().getModule();
+ final ClassLoader loggerCL = lm.getClassLoader();
+ if (loggerMode.equals("system")) {
+ assertTrue(lm.isNamed());
+ assertTrue(loggerCL == null);
+ } else if(loggerMode.equals("unnamed")) {
+ assertTrue(!lm.isNamed());
+ assertTrue(loggerCL != null);
+ } else {
+ throw new RuntimeException("wrong parameter");
+ }
+
+ assertTrue(loggerClassName.equals(logger.getClass().getName()));
+ if (underlyingLoggerClassName != null) {
+ String loggerName = logger.getName();
+ if (underlyingLoggerClassName.equals(
+ "sun.util.logging.internal.LoggingProviderImpl$JULWrapper")) {
+ assertTrue(loggerName.equals(name));
+ } else {
+ assertTrue(loggerName.equals(underlyingLoggerClassName));
+ }
+ }
+ }
+
+ /*
+ * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+ * System.getLogger(String) works well.
+ */
+ private static void testLog(String underlyingLoggerClassName) throws Exception {
+ if (underlyingLoggerClassName == null) {
+ return;
+ }
+
+ if (underlyingLoggerClassName.equals("pkg.a.l.LoggerA")
+ || underlyingLoggerClassName.equals("pkg.b.l.LoggerB")) {
+
+ String name = "test.patched.logger";
+ String plainMsg = "this is test log message #1";
+ ResourceBundle rb = new MyResourcesPatched();
+ Throwable ex = new Throwable("this is an expected exception to be logged");
+ Class<?> clazz = Class.forName(underlyingLoggerClassName);
+ Method method = clazz.getMethod("checkLog", String.class,
+ System.Logger.Level.class,
+ ResourceBundle.class, String.class,
+ Throwable.class, Object[].class);
+
+ Logger logger = getLogger(name);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName()
+ .equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+ assertTrue(logger.getName().equals(underlyingLoggerClassName));
+ logger.log(Logger.Level.WARNING, plainMsg);
+ boolean pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesPatched.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(!pass);
+
+ logger = getLogger(name, rb);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName()
+ .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+ assertTrue(logger.getName().equals(underlyingLoggerClassName));
+ logger.log(Logger.Level.INFO, MyResourcesPatched.KEY);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesPatched.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ }
+ }
+
+ private static class MyResourcesPatched extends ListResourceBundle {
+ static final String KEY = "this is the key in MyResourcesPatched";
+ static final String VALUE = "THIS IS THE VALUE IN MyResourcesPatched";
+
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ {KEY, VALUE}
+ };
+ }
+ }
+
+ private static Logger getLogger(String name) {
+ return PatchedUsage.getLogger(name);
+ }
+
+ private static Logger getLogger(String name, ResourceBundle rb) {
+ return PatchedUsage.getLogger(name, rb);
+ }
+
+ private static void printLogger(Logger logger) {
+ System.err.println("logger name: " + logger.getName()
+ + ", logger class: " + logger.getClass());
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/patched_usage/java.base/java/lang/PatchedUsage.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * 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 java.lang;
+
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+
+/*
+ * PatchedUsage is patched into java.base, it will be used by
+ * PatchedClient to test when logger client is in patched module
+ */
+public class PatchedUsage {
+
+ public static Logger getLogger(String name) {
+ check();
+ return System.getLogger(name);
+ }
+
+ public static Logger getLogger(String name, ResourceBundle rb) {
+ check();
+ return System.getLogger(name, rb);
+ }
+
+ private static void check() {
+ final Module m = PatchedUsage.class.getModule();
+ final ClassLoader moduleCL = m.getClassLoader();
+ assertTrue(m.isNamed());
+ assertTrue(moduleCL == null);
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_client/pkg/b/t/TestB.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,156 @@
+/*
+ * 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 pkg.b.t;
+
+import java.lang.reflect.Method;
+import java.lang.System.Logger;
+import java.util.ResourceBundle;
+import java.util.ListResourceBundle;
+
+/*
+ * Tests when logger client is in unnamed module
+ */
+public class TestB {
+
+ public static void main(String[] args) throws Exception {
+ assertTrue(args.length == 2);
+ String loggerMode = args[0];
+ String loggerClassName = args[1];
+
+ testLogger(loggerMode, loggerClassName);
+ testLog(loggerClassName);
+ }
+
+ /*
+ * Tests System.getLogger(String) get expected logger.
+ */
+ private static void testLogger(String loggerMode, String loggerClassName) {
+ final Module m = TestB.class.getModule();
+ final ClassLoader moduleCL = m.getClassLoader();
+ assertTrue(!m.isNamed());
+ assertTrue(moduleCL != null);
+
+ String name = "test.b";
+ Logger logger = getLogger(name);
+ printLogger(logger);
+
+ final Module lm = logger.getClass().getModule();
+ final ClassLoader loggerCL = lm.getClassLoader();
+ if (loggerMode.equals("system")) {
+ assertTrue(lm.isNamed());
+ assertTrue(loggerCL == null);
+ } else if(loggerMode.equals("named")) {
+ assertTrue(lm.isNamed());
+ assertTrue(loggerCL != null);
+ } else if(loggerMode.equals("unnamed")) {
+ assertTrue(!lm.isNamed());
+ assertTrue(loggerCL != null);
+ } else {
+ throw new RuntimeException("wrong parameter");
+ }
+
+ assertTrue(loggerClassName.equals(logger.getClass().getName()));
+ assertTrue(!loggerClassName.equals("jdk.internal.logger.LazyLoggers$JdkLazyLogger"));
+ }
+
+ /*
+ * Tests Logger retrieved by System.getLogger(String, ResourceBundle) and
+ * System.getLogger(String) works well.
+ */
+ private static void testLog(String loggerClassName) throws Exception {
+ if (loggerClassName.equals("pkg.a.l.LoggerA")
+ || loggerClassName.equals("pkg.b.l.LoggerB")) {
+
+ String name = "test.b.B";
+ String plainMsg = "this is test log message #1";
+ ResourceBundle rb = new MyResourcesB();
+ Throwable ex = new Throwable("this is an expected exception to be logged");
+ Class<?> clazz = Class.forName(loggerClassName);
+ Method method = clazz.getMethod("checkLog", String.class,
+ System.Logger.Level.class,
+ ResourceBundle.class, String.class,
+ Throwable.class, Object[].class);
+
+ Logger logger = getLogger(name);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName().equals(loggerClassName));
+ assertTrue(logger.getName().equals(loggerClassName));
+ logger.log(Logger.Level.WARNING, plainMsg);
+ boolean pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesB.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(!pass);
+
+ logger = getLogger(name, rb);
+ printLogger(logger);
+ assertTrue(logger.getClass().getName()
+ .equals("jdk.internal.logger.LocalizedLoggerWrapper"));
+ assertTrue(logger.getName().equals(loggerClassName));
+ logger.log(Logger.Level.INFO, MyResourcesB.KEY);
+ pass = (boolean)method.invoke(null, name, Logger.Level.INFO,
+ rb, MyResourcesB.VALUE, (Throwable)null,
+ (Object)null);
+ assertTrue(pass);
+ pass = (boolean)method.invoke(null, name, Logger.Level.WARNING,
+ null, plainMsg, ex, (Object)null);
+ assertTrue(pass);
+ }
+ }
+
+ private static class MyResourcesB extends ListResourceBundle {
+ static final String KEY = "this is the key in MyResourcesB";
+ static final String VALUE = "THIS IS THE VALUE IN MyResourcesB";
+
+ @Override
+ protected Object[][] getContents() {
+ return new Object[][] {
+ {KEY, VALUE}
+ };
+ }
+ }
+
+ private static Logger getLogger(String name) {
+ return System.getLogger(name);
+ }
+
+ private static Logger getLogger(String name, ResourceBundle rb) {
+ return System.getLogger(name, rb);
+ }
+
+ private static void printLogger(Logger logger) {
+ System.err.println("logger name: " + logger.getName()
+ + ", logger class: " + logger.getClass());
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, but get false.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_logger/META-INF/services/java.lang.System$LoggerFinder Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,1 @@
+pkg.b.p.LoggerFinderB
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/l/LoggerB.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,123 @@
+/*
+ * 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 pkg.b.l;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
+import java.util.ResourceBundle;
+
+public class LoggerB implements System.Logger {
+
+ // ---- test utility fields and methods ----
+
+ private static Map<String, LoggerB> map = new HashMap<>();
+
+ public static LoggerB getLogger(String name) {
+ return map.computeIfAbsent(name, (n) -> new LoggerB());
+ }
+
+ public static boolean checkLog(String name, Level level, ResourceBundle bundle,
+ String format, Throwable throwable, Object... params) {
+ LoggerB logger = map.get(name);
+ LogEvent event = new LogEvent(level, bundle, format, null, params);
+ for (LogEvent l : logger.queue) {
+ if (l.equals(event)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // ---- logger implementation ----
+
+ private Queue<LogEvent> queue = new LinkedList<>();
+
+ @Override
+ public String getName() {
+ return this.getClass().getName();
+ }
+
+ @Override
+ public boolean isLoggable(Level level) {
+ return true;
+ }
+
+ @Override
+ public void log(Level level, ResourceBundle bundle, String format, Object... params) {
+ String msg = bundle != null ? bundle.getString(format) : format;
+ log(new LogEvent(level, bundle, msg, null, params));
+ }
+
+ @Override
+ public void log(Level level, ResourceBundle bundle, String format, Throwable throwable) {
+ String msg = bundle != null ? bundle.getString(format) : format;
+ log(new LogEvent(level, bundle, msg, throwable, (Object)null));
+ }
+
+ void log(LogEvent l) {
+ print(l);
+ queue.add(l);
+ }
+
+ private void print(LogEvent l) {
+ System.err.println("LoggerB Message"+ l);
+ }
+
+ public Queue<LogEvent> getLogEvent() {
+ return queue;
+ }
+
+ public static class LogEvent {
+ public LogEvent(Level level, ResourceBundle bundle, String format,
+ Throwable throwable, Object... params) {
+ this.level = level;
+ this.bundle = bundle;
+ this.format = format;
+ this.throwable = throwable;
+ this.params = params;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof LogEvent) {
+ LogEvent e = (LogEvent)o;
+ return level == e.level
+ && bundle == e.bundle
+ && format == e.format
+ && params == e.params;
+ }
+ return false;
+ }
+
+ private Level level;
+ private ResourceBundle bundle;
+ private String format;
+ private Throwable throwable;
+ private Object[] params;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/System/LoggerFinder/modules/unnamed_logger/pkg/b/p/LoggerFinderB.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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 pkg.b.p;
+
+import pkg.b.l.LoggerB;
+
+public class LoggerFinderB extends System.LoggerFinder {
+ @Override
+ public System.Logger getLogger(String name, Module module) {
+ return LoggerB.getLogger(name);
+ }
+}
--- a/jdk/test/java/net/Inet6Address/B6206527.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/Inet6Address/B6206527.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,10 +25,14 @@
* @test 1.1 05/01/05
* @bug 6206527
* @summary "cannot assign address" when binding ServerSocket on Suse 9
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main B6206527
*/
import java.net.*;
import java.util.*;
+import jdk.testlibrary.NetworkConfiguration;
public class B6206527 {
@@ -53,21 +57,12 @@
ss.bind(new InetSocketAddress(addr, 0));
}
- public static Inet6Address getLocalAddr () throws Exception {
- Enumeration e = NetworkInterface.getNetworkInterfaces();
- while (e.hasMoreElements()) {
- NetworkInterface ifc = (NetworkInterface) e.nextElement();
- Enumeration addrs = ifc.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress a = (InetAddress)addrs.nextElement();
- if (a instanceof Inet6Address) {
- Inet6Address ia6 = (Inet6Address) a;
- if (ia6.isLinkLocalAddress()) {
- return ia6;
- }
- }
- }
- }
- return null;
+ public static Inet6Address getLocalAddr() throws Exception {
+ Optional<Inet6Address> oaddr = NetworkConfiguration.probe()
+ .ip6Addresses()
+ .filter(a -> a.isLinkLocalAddress())
+ .findFirst();
+
+ return oaddr.orElseGet(() -> null);
}
}
--- a/jdk/test/java/net/Inet6Address/B6558853.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/Inet6Address/B6558853.java Mon Apr 24 21:34:23 2017 +0200
@@ -21,43 +21,42 @@
* questions.
*/
-/**
+/*
* @test
* @bug 6558853
* @summary getHostAddress() on connections using IPv6 link-local addrs should have zone id
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main B6558853
*/
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.*;
-import java.util.Enumeration;
+import java.util.Optional;
+import jdk.testlibrary.NetworkConfiguration;
public class B6558853 implements Runnable {
private InetAddress addr = null;
private int port = 0;
public static void main(String[] args) throws Exception {
- ServerSocket ss = new ServerSocket(0);
- int port = ss.getLocalPort();
- Enumeration<NetworkInterface> l = NetworkInterface.getNetworkInterfaces();
- InetAddress dest = null;
- while (l.hasMoreElements() && dest == null) {
- NetworkInterface nif = l.nextElement();
- if (!nif.isUp())
- continue;
+ Optional<Inet6Address> oaddr = NetworkConfiguration.probe()
+ .ip6Addresses()
+ .filter(a -> a.isLinkLocalAddress())
+ .findFirst();
- for (InterfaceAddress a : nif.getInterfaceAddresses()) {
- if (a.getAddress() instanceof Inet6Address) {
- Inet6Address a6 = (Inet6Address) a.getAddress();
- if (a6.isLinkLocalAddress()) {
- dest = a6;
- }
- break;
- }
- }
+ if (!oaddr.isPresent()) {
+ System.out.println("No suitable interface found. Exiting.");
+ return;
}
+
+ Inet6Address dest = oaddr.get();
System.out.println("Using " + dest);
- if (dest != null) {
+
+ try (ServerSocket ss = new ServerSocket(0)) {
+ int port = ss.getLocalPort();
B6558853 test = new B6558853(dest, port);
Thread thread = new Thread(test);
thread.start();
--- a/jdk/test/java/net/InetAddress/CheckJNI.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/InetAddress/CheckJNI.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,11 +24,15 @@
/* @test
@bug 4889870 4890033
@summary java -Xcheck:jni failing in net code on Solaris / [Datagram]Socket.getLocalAddress() failure
+ @library /lib/testlibrary
+ @build jdk.testlibrary.NetworkConfiguration
@run main/othervm -Xcheck:jni CheckJNI
*/
import java.net.*;
import java.util.*;
+import java.util.stream.Collectors;
+import jdk.testlibrary.NetworkConfiguration;
public class CheckJNI {
static Socket s;
@@ -49,32 +53,23 @@
dg2 = new DatagramSocket (0, InetAddress.getByName ("127.0.0.1"));
testDatagrams (dg1, dg2);
- /* Use NetworkInterface to find link local IPv6 addrs to test */
-
- Enumeration ifs = NetworkInterface.getNetworkInterfaces();
- server = new ServerSocket (0);
+ /* Find link local IPv6 addrs to test */
+ List<Inet6Address> addrs = NetworkConfiguration.probe()
+ .ip6Addresses()
+ .filter(Inet6Address::isLinkLocalAddress)
+ .collect(Collectors.toList());
- while (ifs.hasMoreElements()) {
- NetworkInterface nif = (NetworkInterface)ifs.nextElement();
- if (!nif.isUp())
- continue;
- Enumeration addrs = nif.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress addr = (InetAddress) addrs.nextElement();
- if (addr instanceof Inet6Address) {
- Inet6Address ia6 = (Inet6Address) addr;
- if (ia6.isLinkLocalAddress()) {
- System.out.println ("Testing IPv6 Socket");
- s = new Socket (ia6, server.getLocalPort());
- s.close();
+ server = new ServerSocket(0);
+ for (Inet6Address ia6 : addrs) {
+ System.out.println("Address:" + ia6);
+ System.out.println("Testing IPv6 Socket");
+ s = new Socket(ia6, server.getLocalPort());
+ s.close();
- System.out.println ("Testing IPv6 DatagramSocket");
- dg1 = new DatagramSocket (0, ia6);
- dg2 = new DatagramSocket (0, ia6);
- testDatagrams (dg1, dg2);
- }
- }
- }
+ System.out.println("Testing IPv6 DatagramSocket");
+ dg1 = new DatagramSocket(0, ia6);
+ dg2 = new DatagramSocket(0, ia6);
+ testDatagrams(dg1, dg2);
}
server.close();
System.out.println ("OK");
--- a/jdk/test/java/net/MulticastSocket/B6427403.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/MulticastSocket/B6427403.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,15 +23,12 @@
/*
* @test
- *
* @bug 6427403
- *
* @summary java.net.MulticastSocket.joinGroup() reports 'socket closed'
- *
*/
import java.net.*;
import java.io.*;
-import java.util.*;
+
public class B6427403 {
public static void main( String[] args ) throws IOException {
InetAddress lh = InetAddress.getLocalHost();
@@ -39,4 +36,4 @@
ms.joinGroup( InetAddress.getByName("224.80.80.80") );
ms.close();
}
-}
+}
\ No newline at end of file
--- a/jdk/test/java/net/MulticastSocket/JoinGroup.java Mon Apr 24 12:08:09 2017 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 4091811 4148753
- * @summary Test java.net.MulticastSocket joinGroup and leaveGroup
- *
- */
-
-import java.io.*;
-import java.net.*;
-
-
-public class JoinGroup {
-
- public static void main(String args[]) throws Exception {
- MulticastSocket soc = null;
- InetAddress sin = null;
-
- soc = new MulticastSocket();
- sin = InetAddress.getByName("224.80.80.80");
- soc.joinGroup(sin);
- soc.leaveGroup(sin);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/MulticastSocket/JoinLeave.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4091811 4148753 4102731
+ * @summary Test java.net.MulticastSocket joinGroup and leaveGroup
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main JoinLeave
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.InetAddress;
+import java.net.MulticastSocket;
+import java.net.NetworkInterface;
+import jdk.testlibrary.NetworkConfiguration;
+
+public class JoinLeave {
+
+ public static void main(String args[]) throws IOException {
+ InetAddress ip4Group = InetAddress.getByName("224.80.80.80");
+ InetAddress ip6Group = InetAddress.getByName("ff02::a");
+
+ NetworkConfiguration nc = NetworkConfiguration.probe();
+ nc.ip4MulticastInterfaces().forEach(nic -> joinLeave(ip4Group, nic));
+ nc.ip6MulticastInterfaces().forEach(nic -> joinLeave(ip6Group, nic));
+ }
+
+ static void joinLeave(InetAddress group, NetworkInterface nif)
+ {
+ System.out.println("Joining:" + group + " on " + nif);
+ try (MulticastSocket soc = new MulticastSocket()) {
+ soc.setNetworkInterface(nif);
+ soc.joinGroup(group);
+ soc.leaveGroup(group);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
--- a/jdk/test/java/net/MulticastSocket/Leave.java Mon Apr 24 12:08:09 2017 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 4102731
- * @summary Test the java.net.multicastsocket.leave method
- *
- */
-
-import java.net.*;
-import java.io.*;
-
-public class Leave {
-
- public static void main(String args[]) throws Exception {
- MulticastSocket socket = null;
- InetAddress mca = null;
-
- mca = InetAddress.getByName("224.80.80.80");
- socket = new MulticastSocket();
- socket.joinGroup(mca);
- socket.leaveGroup(mca);
- socket.close();
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/NetworkConfigurationProbe.java Mon Apr 24 21:34:23 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
+ * @summary NOT A TEST. Captures the network interface configuration.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main NetworkConfigurationProbe
+ */
+
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.NetworkInterface;
+import jdk.testlibrary.NetworkConfiguration;
+import static java.util.stream.Collectors.joining;
+import static java.lang.System.out;
+
+/**
+ * Not a test. Captures the network interface configuration.
+ */
+public class NetworkConfigurationProbe {
+
+ public static void main(String... args) throws Exception {
+ NetworkConfiguration.printSystemConfiguration(out);
+
+ NetworkConfiguration nc = NetworkConfiguration.probe();
+ String list;
+ list = nc.ip4MulticastInterfaces()
+ .map(NetworkInterface::getName)
+ .collect(joining(" "));
+ out.println("ip4MulticastInterfaces: " + list);
+
+ list = nc.ip4Addresses()
+ .map(Inet4Address::toString)
+ .collect(joining(" "));
+ out.println("ip4Addresses: " + list);
+
+ list = nc.ip6MulticastInterfaces()
+ .map(NetworkInterface::getName)
+ .collect(joining(" "));
+ out.println("ip6MulticastInterfaces: " + list);
+
+ list = nc.ip6Addresses()
+ .map(Inet6Address::toString)
+ .collect(joining(" "));
+ out.println("ip6Addresses: " + list);
+ }
+}
--- a/jdk/test/java/net/Socket/LinkLocal.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/Socket/LinkLocal.java Mon Apr 24 21:34:23 2017 +0200
@@ -26,9 +26,15 @@
* @bug 4469866
* @summary Connecting to a link-local IPv6 address should not
* causes a SocketException to be thrown.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main LinkLocal
*/
+import jdk.testlibrary.NetworkConfiguration;
+
import java.net.*;
-import java.util.Enumeration;
+import java.util.List;
+import java.util.stream.Collectors;
public class LinkLocal {
@@ -134,22 +140,13 @@
* IPv6 address.
*/
if (args.length == 0) {
- Enumeration nifs = NetworkInterface.getNetworkInterfaces();
- while (nifs.hasMoreElements()) {
- NetworkInterface ni = (NetworkInterface)nifs.nextElement();
- if (!ni.isUp())
- continue;
+ List<Inet6Address> addrs = NetworkConfiguration.probe()
+ .ip6Addresses()
+ .filter(Inet6Address::isLinkLocalAddress)
+ .collect(Collectors.toList());
- Enumeration addrs = ni.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress addr = (InetAddress)addrs.nextElement();
-
- if (addr instanceof Inet6Address &&
- addr.isLinkLocalAddress()) {
-
- TestAddress(addr);
- }
- }
+ for (Inet6Address addr : addrs) {
+ TestAddress(addr);
}
}
--- a/jdk/test/java/net/SocketPermission/SocketPermissionTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/SocketPermission/SocketPermissionTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,13 +25,17 @@
* @test
* @bug 8047031
* @summary SocketPermission tests for legacy socket types
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
* @run testng/othervm SocketPermissionTest
*/
+
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.MulticastSocket;
+import java.net.NetworkInterface;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketPermission;
@@ -44,11 +48,14 @@
import java.security.Policy;
import java.security.PrivilegedExceptionAction;
import java.security.ProtectionDomain;
+import java.util.Optional;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+
import static org.testng.Assert.*;
+import static jdk.testlibrary.NetworkConfiguration.probe;
import static java.nio.charset.StandardCharsets.UTF_8;
public class SocketPermissionTest {
@@ -210,12 +217,17 @@
new SocketPermission(addr, "listen,resolve"),
new SocketPermission("229.227.226.221", "connect,accept"));
- // Positive
- AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
- s.joinGroup(group);
- s.leaveGroup(group);
- return null;
- }, acc);
+ // Positive ( requires a functional network interface )
+ Optional<NetworkInterface> onif = probe().ip4MulticastInterfaces().findFirst();
+ if (!onif.isPresent()) {
+ s.setNetworkInterface(onif.get());
+
+ AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
+ s.joinGroup(group);
+ s.leaveGroup(group);
+ return null;
+ }, acc);
+ }
// Negative
try {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/SmallTimeout.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.URI;
+import jdk.incubator.http.HttpClient;
+import jdk.incubator.http.HttpRequest;
+import jdk.incubator.http.HttpResponse;
+import jdk.incubator.http.HttpTimeoutException;
+import java.time.Duration;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import static java.lang.System.out;
+import static jdk.incubator.http.HttpResponse.BodyHandler.discard;
+
+/**
+ * @test
+ * @bug 8178147
+ * @summary Ensures that small timeouts do not cause hangs due to race conditions
+ * @run main/othervm SmallTimeout
+ */
+
+// To enable logging use. Not enabled by default as it changes the dynamics
+// of the test.
+// @run main/othervm -Djdk.httpclient.HttpClient.log=all,frames:all SmallTimeout
+
+public class SmallTimeout {
+
+ static int[] TIMEOUTS = {2, 1, 3, 2, 100, 1};
+
+ // A queue for placing timed out requests so that their order can be checked.
+ static LinkedBlockingQueue<HttpRequest> queue = new LinkedBlockingQueue<>();
+
+ static volatile boolean error;
+
+ public static void main(String[] args) throws Exception {
+ HttpClient client = HttpClient.newHttpClient();
+
+ try (ServerSocket ss = new ServerSocket(0, 20)) {
+ int port = ss.getLocalPort();
+ URI uri = new URI("http://127.0.0.1:" + port + "/");
+
+ HttpRequest[] requests = new HttpRequest[TIMEOUTS.length];
+
+ out.println("--- TESTING Async");
+ for (int i = 0; i < TIMEOUTS.length; i++) {
+ requests[i] = HttpRequest.newBuilder(uri)
+ .timeout(Duration.ofMillis(TIMEOUTS[i]))
+ .GET()
+ .build();
+
+ final HttpRequest req = requests[i];
+ CompletableFuture<HttpResponse<Object>> response = client
+ .sendAsync(req, discard(null))
+ .whenComplete((HttpResponse<Object> r, Throwable t) -> {
+ if (r != null) {
+ out.println("Unexpected response: " + r);
+ error = true;
+ }
+ if (t != null) {
+ if (!(t.getCause() instanceof HttpTimeoutException)) {
+ out.println("Wrong exception type:" + t.toString());
+ Throwable c = t.getCause() == null ? t : t.getCause();
+ c.printStackTrace();
+ error = true;
+ } else {
+ out.println("Caught expected timeout: " + t.getCause());
+ }
+ }
+ if (t == null && r == null) {
+ out.println("Both response and throwable are null!");
+ error = true;
+ }
+ queue.add(req);
+ });
+ }
+ System.out.println("All requests submitted. Waiting ...");
+
+ checkReturn(requests);
+
+ if (error)
+ throw new RuntimeException("Failed. Check output");
+
+ // Repeat blocking in separate threads. Use queue to wait.
+ out.println("--- TESTING Sync");
+
+ // For running blocking response tasks
+ ExecutorService executor = Executors.newCachedThreadPool();
+
+ for (int i = 0; i < TIMEOUTS.length; i++) {
+ requests[i] = HttpRequest.newBuilder(uri)
+ .timeout(Duration.ofMillis(TIMEOUTS[i]))
+ .GET()
+ .build();
+
+ final HttpRequest req = requests[i];
+ executor.execute(() -> {
+ try {
+ client.send(req, discard(null));
+ } catch (HttpTimeoutException e) {
+ out.println("Caught expected timeout: " + e);
+ queue.offer(req);
+ } catch (IOException | InterruptedException ee) {
+ Throwable c = ee.getCause() == null ? ee : ee.getCause();
+ c.printStackTrace();
+ error = true;
+ }
+ });
+ }
+ System.out.println("All requests submitted. Waiting ...");
+
+ checkReturn(requests);
+
+ executor.shutdownNow();
+
+ if (error)
+ throw new RuntimeException("Failed. Check output");
+
+ } finally {
+ ((ExecutorService) client.executor()).shutdownNow();
+ }
+ }
+
+ static void checkReturn(HttpRequest[] requests) throws InterruptedException {
+ // wait for exceptions and check order
+ for (int j = 0; j < TIMEOUTS.length; j++) {
+ HttpRequest req = queue.take();
+ out.println("Got request from queue " + req + ", order: " + getRequest(req, requests));
+ }
+ out.println("Return ok");
+ }
+
+ /** Returns the index of the request in the array. */
+ static String getRequest(HttpRequest req, HttpRequest[] requests) {
+ for (int i=0; i<requests.length; i++) {
+ if (req == requests[i]) {
+ return "r" + i;
+ }
+ }
+ throw new AssertionError("Unknown request: " + req);
+ }
+}
--- a/jdk/test/java/net/httpclient/TimeoutOrdering.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/httpclient/TimeoutOrdering.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,9 @@
* @run main/othervm TimeoutOrdering
*/
+// To enable logging use
+// @run main/othervm -Djdk.httpclient.HttpClient.log=all,frames:all TimeoutOrdering
+
public class TimeoutOrdering {
// The assumption is that 5 secs is sufficiently large enough, without being
@@ -81,6 +84,8 @@
if (t != null) {
if (!(t.getCause() instanceof HttpTimeoutException)) {
out.println("Wrong exception type:" + t.toString());
+ Throwable c = t.getCause() == null ? t : t.getCause();
+ c.printStackTrace();
error = true;
} else {
out.println("Caught expected timeout: " + t.getCause());
@@ -116,6 +121,8 @@
out.println("Caught expected timeout: " + e);
queue.offer(req);
} catch (IOException | InterruptedException ee) {
+ Throwable c = ee.getCause() == null ? ee : ee.getCause();
+ c.printStackTrace();
error = true;
}
});
--- a/jdk/test/java/net/ipv6tests/B6521014.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/ipv6tests/B6521014.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,13 +25,15 @@
* @test
* @bug 6521014 6543428
* @summary IOException thrown when Socket tries to bind to an local IPv6 address on SuSE Linux
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.NetworkConfiguration
+ * @run main B6521014
*/
-
import java.net.*;
import java.io.*;
import java.util.*;
-
+import jdk.testlibrary.NetworkConfiguration;
/*
*
@@ -52,38 +54,26 @@
*/
public class B6521014 {
- static InetAddress sin;
-
- static Inet6Address getLocalAddr () throws Exception {
- Enumeration e = NetworkInterface.getNetworkInterfaces();
- while (e.hasMoreElements()) {
- NetworkInterface ifc = (NetworkInterface) e.nextElement();
- if (!ifc.isUp())
- continue;
- Enumeration addrs = ifc.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress a = (InetAddress)addrs.nextElement();
- if (a instanceof Inet6Address) {
- Inet6Address ia6 = (Inet6Address) a;
- if (ia6.isLinkLocalAddress()) {
- // remove %scope suffix
- return (Inet6Address)InetAddress.getByAddress(ia6.getAddress());
- }
- }
- }
+ static Inet6Address removeScope(Inet6Address addr) {
+ try {
+ return (Inet6Address)InetAddress.getByAddress(addr.getAddress());
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
}
- return null;
}
- static void test1() throws Exception {
- ServerSocket ssock;
- Socket sock;
- int port;
+ static Optional<Inet6Address> getLocalAddr() throws Exception {
+ return NetworkConfiguration.probe()
+ .ip6Addresses()
+ .filter(Inet6Address::isLinkLocalAddress)
+ .map(B6521014::removeScope)
+ .findFirst();
+ }
- ssock = new ServerSocket(0);
- port = ssock.getLocalPort();
- sock = new Socket();
- try {
+ static void test1(Inet6Address sin) throws Exception {
+ try (ServerSocket ssock = new ServerSocket(0);
+ Socket sock = new Socket()) {
+ int port = ssock.getLocalPort();
sock.connect(new InetSocketAddress(sin, port), 100);
} catch (SocketTimeoutException e) {
// time out exception is okay
@@ -91,36 +81,29 @@
}
}
- static void test2() throws Exception {
- Socket sock;
- ServerSocket ssock;
- int port;
-
- ssock = new ServerSocket(0);
- ssock.setSoTimeout(100);
- port = ssock.getLocalPort();
- sock = new Socket();
- sock.bind(new InetSocketAddress(sin, 0));
- try {
+ static void test2(Inet6Address sin) throws Exception {
+ try (ServerSocket ssock = new ServerSocket(0);
+ Socket sock = new Socket()) {
+ int port = ssock.getLocalPort();
+ ssock.setSoTimeout(100);
+ sock.bind(new InetSocketAddress(sin, 0));
sock.connect(new InetSocketAddress(sin, port), 100);
- } catch (SocketTimeoutException e) {
+ } catch (SocketTimeoutException expected) {
// time out exception is okay
System.out.println("timed out when connecting.");
}
}
public static void main(String[] args) throws Exception {
- sin = getLocalAddr();
- if (sin == null) {
+ Optional<Inet6Address> oaddr = getLocalAddr();
+ if (!oaddr.isPresent()) {
System.out.println("Cannot find a link-local address.");
return;
}
- try {
- test1();
- test2();
- } catch (IOException e) {
- throw new RuntimeException("Test failed: cannot create socket.", e);
- }
+ Inet6Address addr = oaddr.get();
+ System.out.println("Using " + addr);
+ test1(addr);
+ test2(addr);
}
}
--- a/jdk/test/java/net/ipv6tests/Tests.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/net/ipv6tests/Tests.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,7 +27,10 @@
public class Tests {
- static boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+ static final boolean isWindows =
+ System.getProperty("os.name").startsWith("Windows");
+ static final boolean isMacOS =
+ System.getProperty("os.name").contains("OS X");
/**
* performs a simple exchange of data between the two sockets
@@ -278,6 +281,8 @@
String dName = nic.getDisplayName();
if (dName != null && dName.contains("Teredo"))
continue;
+ } else if (isMacOS && nic.getName().contains("awdl")) {
+ continue;
}
try {
if (nic.isUp() && !nic.isLoopback())
--- a/jdk/test/java/security/SignedObject/Chain.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/security/SignedObject/Chain.java Mon Apr 24 21:34:23 2017 +0200
@@ -33,7 +33,6 @@
/*
* @test
* @bug 8050374
- * @key intermittent
* @summary Verify a chain of signed objects
*/
public class Chain {
--- a/jdk/test/java/util/logging/LoggingDeadlock2.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/java/util/logging/LoggingDeadlock2.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -263,7 +263,7 @@
sleep(ms);
System.err.println("Timeout reached: " + ms);
if (process.isAlive()) {
- long pid = process.getPid();
+ long pid = process.pid();
ProcessBuilder jstack = new ProcessBuilder(jstackExe, String.valueOf(pid));
System.err.println("Dumping subprocess stack: " + pid);
Process p = jstack.inheritIO().start();
--- a/jdk/test/javax/sound/midi/Devices/InitializationHang.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/midi/Devices/InitializationHang.java Mon Apr 24 21:34:23 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
@@ -24,18 +24,21 @@
import java.awt.Toolkit;
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
/**
* @test
* @bug 8068412
- * @key headful
- * @author Sergey Bylokhov
*/
public final class InitializationHang {
- public static void main(final String[] argv) throws Exception {
- MidiSystem.getReceiver();
- Toolkit.getDefaultToolkit();
+ public static void main(final String[] argv) {
+ try {
+ MidiSystem.getReceiver();
+ Toolkit.getDefaultToolkit();
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ }
}
}
--- a/jdk/test/javax/sound/midi/Sequencer/SeqRecordDoesNotCopy.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/midi/Sequencer/SeqRecordDoesNotCopy.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
import javax.sound.midi.MidiEvent;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Receiver;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
@@ -34,12 +35,18 @@
* @test
* @bug 5048381
* @summary Sequencer doesn't create distinct messages when recording events.
- * @key headful
*/
public class SeqRecordDoesNotCopy {
- public static void main(String argv[]) throws Exception {
- Sequencer s = MidiSystem.getSequencer();
- s.open();
+
+ public static void main(String argv[]) {
+ Sequencer s = null;
+ try {
+ s = MidiSystem.getSequencer();
+ s.open();
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ return;
+ }
try {
Sequence seq = new Sequence(Sequence.PPQ, 384, 2);
s.setSequence(seq);
@@ -86,7 +93,7 @@
} catch (Exception e) {
System.out.println("Unexpected Exception: "+e);
//e.printStackTrace();
- throw new Exception("Test FAILED!");
+ throw new RuntimeException("Test FAILED!");
} finally {
s.close();
}
--- a/jdk/test/javax/sound/midi/Sequencer/SeqRecordsRealTimeEvents.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/midi/Sequencer/SeqRecordsRealTimeEvents.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
import javax.sound.midi.MidiEvent;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Receiver;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
@@ -34,12 +35,18 @@
* @test
* @bug 5048381
* @summary Sequencer records real time messages into the sequence
- * @key headful
*/
public class SeqRecordsRealTimeEvents {
- public static void main(String argv[]) throws Exception {
- Sequencer s = MidiSystem.getSequencer();
- s.open();
+
+ public static void main(String argv[]) {
+ Sequencer s = null;
+ try {
+ s = MidiSystem.getSequencer();
+ s.open();
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ return;
+ }
try {
Sequence seq = new Sequence(Sequence.PPQ, 384, 2);
s.setSequence(seq);
@@ -90,7 +97,7 @@
} catch (Exception e) {
System.out.println("Unexpected Exception: "+e);
//e.printStackTrace();
- throw new Exception("Test FAILED!");
+ throw new RuntimeException("Test FAILED!");
} finally {
s.close();
}
--- a/jdk/test/javax/sound/midi/Sequencer/SeqStartRecording.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/midi/Sequencer/SeqStartRecording.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,25 +22,32 @@
*/
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequencer;
/**
* @test
* @bug 5001943
* @summary Sequencer.startRecording throws unexpected NPE
- * @key headful
*/
public class SeqStartRecording {
- public static void main(String argv[]) throws Exception {
- Sequencer seq = MidiSystem.getSequencer();
- seq.open();
+
+ public static void main(String argv[]) {
+ Sequencer seq = null;
+ try {
+ seq = MidiSystem.getSequencer();
+ seq.open();
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ return;
+ }
try {
seq.startRecording();
System.out.println("Test passed.");
} catch (NullPointerException npe) {
System.out.println("Caught NPE: "+npe);
npe.printStackTrace();
- throw new Exception("Test FAILED!");
+ throw new RuntimeException("Test FAILED!");
} catch (Exception e) {
System.out.println("Unexpected Exception: "+e);
e.printStackTrace();
--- a/jdk/test/javax/sound/midi/Synthesizer/bug4685396.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/midi/Synthesizer/bug4685396.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
import javax.sound.midi.Instrument;
import javax.sound.midi.MidiSystem;
+import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Soundbank;
import javax.sound.midi.Synthesizer;
@@ -31,7 +32,6 @@
* @bug 4685396
* @summary Tests that Synthesizer.remapInstrument works
* @run main bug4685396
- * @key headful
*/
public class bug4685396 {
@@ -49,8 +49,7 @@
boolean reloadInstr, // reload all instruments?
boolean unloadFrom, // unload "from" instrument?
boolean unloadTo // unload "to" instrument?
- ) throws Exception
- {
+ ) throws MidiUnavailableException {
log("Starting test: reloadInstr=" + reloadInstr
+ ", unloadFrom=" + unloadFrom
+ ", unloadTo=" + unloadTo
@@ -164,6 +163,9 @@
boolean success = false;
try {
success = test(reloadInstr, unloadFrom, unloadTo);
+ } catch (final MidiUnavailableException ignored) {
+ // the test is not applicable
+ success = true;
} catch (Exception ex) {
log("Exception: " + ex.toString());
}
@@ -171,7 +173,7 @@
return success;
}
- public static void main(String args[]) throws Exception {
+ public static void main(String args[]) {
boolean failed = false;
if (!runTest(true, false, false))
failed = true;
--- a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java Mon Apr 24 21:34:23 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
@@ -36,7 +36,6 @@
* @bug 4946913
* @summary DirectClip doesn't kill the thread correctly, sometimes
* @run main/othervm ClipCloseLoss
- * @key headful
*/
public class ClipCloseLoss {
static int frameCount = 441000; // lets say 10 seconds
--- a/jdk/test/javax/sound/sampled/Clip/bug5070081.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/sampled/Clip/bug5070081.java Mon Apr 24 21:34:23 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
@@ -21,17 +21,19 @@
* questions.
*/
+import java.util.concurrent.TimeUnit;
+
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
+import javax.sound.sampled.LineUnavailableException;
/*
* @test
* @bug 5070081
* @summary Tests that javax.sound.sampled.Clip does not loses position through
* stop/start
- * @key headful
*/
public class bug5070081 {
@@ -43,10 +45,15 @@
static boolean test() throws Exception {
DataLine.Info info = new DataLine.Info(Clip.class, format);
- Clip clip = (Clip)AudioSystem.getLine(info);
- clip.open(format, soundData, 0, soundData.length);
-
+ Clip clip = null;
boolean bSuccess = true;
+ try {
+ clip = (Clip) AudioSystem.getLine(info);
+ clip.open(format, soundData, 0, soundData.length);
+ } catch (LineUnavailableException | IllegalArgumentException ignored) {
+ // the test is not applicable
+ return bSuccess;
+ }
long nLengthMS = clip.getMicrosecondLength()/1000;
@@ -56,18 +63,22 @@
clip.start(); // start playing
Thread.sleep(1000); // wait a sec
- long time1 = System.currentTimeMillis();
+ long time1 = currentTimeMillis();
long pos1 = clip.getFramePosition(); // store the position
- System.out.println(" Position before stop: " + pos1);
clip.stop(); // and then stop
long pos2 = clip.getFramePosition(); // 2nd try
- long time2 = System.currentTimeMillis();
+ long time2 = currentTimeMillis();
+
+ System.out.println(" Position before stop: " + pos1);
System.out.println(" Position after stop: " + pos2);
- System.out.println(" d(time): " + Math.abs(time2-time1) + " ms;"
- + "d(clip pos): " + Math.abs(pos2 - pos1) + " ms.");
+ long timeDiff = Math.abs(time2 - time1);
+ // sample rate is 22050 per second, so 22.05 per ms
+ long posDiff = (long) (Math.abs(pos2 - pos1) / 22.05);
+ System.out.println(" d(time): " + timeDiff + " ms;"
+ + "d(clip pos time): " + posDiff + " ms.");
- long nDerivation = Math.abs(pos2 - pos1) - Math.abs(time2-time1);
+ long nDerivation = posDiff - timeDiff;
// add 50 ms for deviation (delay for stopping and errors due timer precision)
if (nDerivation > 50) {
System.out.println(" ERROR(1): The deviation is too much: " + nDerivation + " ms");
@@ -104,4 +115,8 @@
System.out.println("Test passed sucessfully");
}
+
+ private static long currentTimeMillis() {
+ return TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
+ }
}
--- a/jdk/test/javax/sound/sampled/DataLine/LongFramePosition.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/sampled/DataLine/LongFramePosition.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
* @test
* @bug 5049129
* @summary DataLine.getLongFramePosition
- * @key headful
*/
public class LongFramePosition {
@@ -59,12 +58,12 @@
} finally {
sdl.close();
}
- } catch(LineUnavailableException e){
+ } catch (LineUnavailableException | IllegalArgumentException e) {
System.out.println(e);
System.out.println("Cannot execute test.");
return;
}
- if (failed) throw new Exception("Test FAILED!");
+ if (failed) throw new RuntimeException("Test FAILED!");
System.out.println("Test Passed.");
}
}
--- a/jdk/test/javax/sound/sampled/DirectAudio/bug6372428.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/sound/sampled/DirectAudio/bug6372428.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
* @summary playback and capture doesn't interrupt after terminating thread that
* calls start()
* @run main bug6372428
- * @key headful
*/
public class bug6372428 {
public bug6372428() {
--- a/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/swing/JPopupMenu/4458079/bug4458079.java Mon Apr 24 21:34:23 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
@@ -33,25 +33,26 @@
*/
import java.awt.Robot;
-import java.awt.Toolkit;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.KeyEvent;
-import java.util.ArrayList;
public class bug4458079 extends JFrame implements PopupMenuListener {
public JMenu menu;
static volatile boolean itemASelected = false;
public static void main(String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.waitForIdle();
+ // move mouse outside menu to prevent auto selection
+ robot.mouseMove(100,100);
+
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
new bug4458079().createAndShowGUI();
}
});
- Robot robot = new Robot();
- robot.waitForIdle();
robot.setAutoDelay(50);
@@ -84,6 +85,7 @@
setSize(300, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
+ setLocationRelativeTo(null);
setVisible(true);
}
--- a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
robot.setAutoDelay(50);
+ // move mouse outside menu to prevent auto selection
+ robot.mouseMove(100,100);
SwingUtilities.invokeAndWait(new Runnable() {
@@ -147,6 +149,7 @@
focusable = new JButton("Set Focus Here");
frame.add(focusable);
frame.pack();
+ frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
--- a/jdk/test/javax/swing/plaf/metal/MetalBumps/Test6657026.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/javax/swing/plaf/metal/MetalBumps/Test6657026.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,8 +29,6 @@
* @modules java.desktop/sun.awt
*/
-import sun.awt.SunToolkit;
-
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
@@ -42,9 +40,12 @@
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.text.AttributedCharacterIterator;
-import javax.swing.Icon;
+
+import javax.swing.JToolBar;
import javax.swing.plaf.metal.MetalBorders.ToolBarBorder;
+import sun.awt.SunToolkit;
+
public class Test6657026 extends ToolBarBorder implements Runnable {
public static void main(String[] args) throws Exception {
@@ -63,8 +64,8 @@
private void test() {
MyGraphics mg = new MyGraphics();
- Icon icon = bumps;
- icon.paintIcon(mg.component, mg, 0, 0);
+ ToolBarBorder border = new ToolBarBorder();
+ border.paintBorder(mg.component, mg, 0, 0, 10, 10);
if (mg.image != null) {
boolean failed = true;
int value = mg.image.getRGB(0, 0);
@@ -86,7 +87,7 @@
private static class MyGraphics extends Graphics {
- private final Component component = new Component() {};
+ private final Component component = new JToolBar() {};
private BufferedImage image;
public Graphics create() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/HtmlCommentTagParseTest.java Mon Apr 24 21:34:23 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.
+*/
+
+import javax.swing.*;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+
+/* @test
+ @bug 8177450
+ @summary javax.swing.text.html.parser.Parser parseScript ignores a character after commend end
+ @author Mikhail Cherkasov
+ @run main HtmlCommentTagParseTest
+*/
+public class HtmlCommentTagParseTest {
+ private static volatile boolean failed = false;
+ public static void main(String[] args) throws IOException, InvocationTargetException, InterruptedException {
+ SwingUtilities.invokeAndWait(() -> {
+ MyParser cb = new MyParser();
+ HTMLEditorKit htmlKit = new HTMLEditorKit();
+ HTMLDocument htmlDoc = (HTMLDocument)
+ htmlKit.createDefaultDocument();
+ FileReader reader = null;
+ try {
+ reader = new FileReader(getDirURL() + "test.html");
+ htmlDoc.getParser().parse(reader, cb, true);
+ if(failed) {
+ throw new RuntimeException("Test failed");
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ }
+ private static String getDirURL() {
+ return new File(System.getProperty("test.src", ".")).getAbsolutePath() +
+ File.separator;
+ }
+
+ private static class MyParser extends HTMLEditorKit.ParserCallback {
+ @Override
+ public void handleError(String errorMsg, int pos) {
+ failed = errorMsg.contains("eof.script");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/test.html Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,5 @@
+<html>
+<body>
+<script><!-- --></script>
+</body>
+</html>
\ No newline at end of file
--- a/jdk/test/jdk/internal/jline/extra/HistoryTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/jdk/internal/jline/extra/HistoryTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8178821
* @summary Test Completion
* @modules jdk.internal.le/jdk.internal.jline
* jdk.internal.le/jdk.internal.jline.console
@@ -152,6 +153,15 @@
complete.set(true); history.add("}");
previousSnippetAndAssert(history, "void test() { /*after full*/");
+ nextSnippetAndAssert(history, "");
+
+ assertFalse(history.nextSnippet());
+
+ while (history.previousSnippet())
+ ;
+
+ while (history.nextSnippet())
+ ;
}
private void previousAndAssert(EditingHistory history, String expected) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,267 @@
+/*
+ * 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 jdk.testlibrary;
+
+import java.io.PrintStream;
+import java.io.UncheckedIOException;
+import java.io.IOException;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import static java.net.NetworkInterface.getNetworkInterfaces;
+import static java.util.Collections.list;
+
+/**
+ * Helper class for retrieving network interfaces and local addresses
+ * suitable for testing.
+ */
+public class NetworkConfiguration {
+
+ static final boolean isWindows =
+ System.getProperty("os.name").startsWith("Windows");
+ static final boolean isMacOS =
+ System.getProperty("os.name").contains("OS X");
+
+ private Map<NetworkInterface,List<Inet4Address>> ip4Interfaces;
+ private Map<NetworkInterface,List<Inet6Address>> ip6Interfaces;
+
+ private NetworkConfiguration(Map<NetworkInterface,List<Inet4Address>> ip4Interfaces,
+ Map<NetworkInterface,List<Inet6Address>> ip6Interfaces)
+ {
+ this.ip4Interfaces = ip4Interfaces;
+ this.ip6Interfaces = ip6Interfaces;
+ }
+
+ /**
+ * Returns a stream of interfaces suitable for functional tests.
+ */
+ public Stream<NetworkInterface> interfaces() {
+ return Stream.concat(ip4Interfaces(), ip6Interfaces())
+ .distinct();
+ }
+
+ /**
+ * Returns a stream of interfaces suitable for IPv4 functional tests.
+ */
+ public Stream<NetworkInterface> ip4Interfaces() {
+ return ip4Interfaces.keySet().stream()
+ .filter(NetworkConfiguration::isNotExcludedInterface)
+ .filter(hasIp4Addresses);
+ }
+
+ /**
+ * Returns a stream of interfaces suitable for IPv6 functional tests.
+ */
+ public Stream<NetworkInterface> ip6Interfaces() {
+ return ip6Interfaces.keySet().stream()
+ .filter(NetworkConfiguration::isNotExcludedInterface)
+ .filter(hasIp6Addresses);
+ }
+
+ private static boolean isNotExcludedInterface(NetworkInterface nif) {
+ if (isMacOS && nif.getName().contains("awdl"))
+ return false;
+ String dName = nif.getDisplayName();
+ if (isWindows && dName != null && dName.contains("Teredo"))
+ return false;
+ return true;
+ }
+
+ private final Predicate<NetworkInterface> hasIp4Addresses = nif -> {
+ Optional<?> addr = ip4Interfaces.get(nif).stream()
+ .filter(a -> !a.isAnyLocalAddress())
+ .findAny();
+
+ return addr.isPresent();
+ };
+
+ private final Predicate<NetworkInterface> hasIp6Addresses = nif -> {
+ Optional<?> addr = ip6Interfaces.get(nif).stream()
+ .filter(a -> !a.isAnyLocalAddress())
+ .findAny();
+
+ return addr.isPresent();
+ };
+
+
+ /**
+ * Returns a stream of interfaces suitable for IPv4 multicast tests.
+ */
+ public Stream<NetworkInterface> ip4MulticastInterfaces() {
+ return ip4Interfaces().filter(supportsIp4Multicast);
+ }
+
+ /**
+ * Returns a stream of interfaces suitable for IPv6 multicast tests.
+ */
+ public Stream<NetworkInterface> ip6MulticastInterfaces() {
+ return ip6Interfaces().filter(supportsIp6Multicast);
+ }
+
+ private final Predicate<NetworkInterface> supportsIp4Multicast = nif -> {
+ try {
+ if (!nif.supportsMulticast() || nif.isLoopback())
+ return false;
+
+ Optional<?> addr = ip4Interfaces.get(nif).stream()
+ .filter(a -> !a.isAnyLocalAddress())
+ .findAny();
+
+ return addr.isPresent();
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ };
+
+ private final Predicate<NetworkInterface> supportsIp6Multicast = nif -> {
+ try {
+ if (!nif.supportsMulticast() || nif.isLoopback())
+ return false;
+
+ Optional<?> addr = ip6Interfaces.get(nif).stream()
+ .filter(a -> !a.isAnyLocalAddress())
+ .findAny();
+
+ return addr.isPresent();
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ };
+
+ /**
+ * Returns all addresses on all "functional" interfaces.
+ */
+ public Stream<InetAddress> addresses(NetworkInterface nif) {
+ return Stream.concat(ip4Interfaces.get(nif).stream(),
+ ip6Interfaces.get(nif).stream());
+ }
+
+ /**
+ * Returns all IPv4 addresses on all "functional" interfaces.
+ */
+ public Stream<Inet4Address> ip4Addresses() {
+ return ip4Interfaces().flatMap(nif -> ip4Addresses(nif));
+ }
+
+ /**
+ * Returns all IPv6 addresses on all "functional" interfaces.
+ */
+ public Stream<Inet6Address> ip6Addresses() {
+ return ip6Interfaces().flatMap(nif -> ip6Addresses(nif));
+ }
+
+ /**
+ * Returns all IPv4 addresses the given interface.
+ */
+ public Stream<Inet4Address> ip4Addresses(NetworkInterface nif) {
+ return ip4Interfaces.get(nif).stream();
+ }
+
+ /**
+ * Returns all IPv6 addresses for the given interface.
+ */
+ public Stream<Inet6Address> ip6Addresses(NetworkInterface nif) {
+ return ip6Interfaces.get(nif).stream();
+ }
+
+ /**
+ * Return a NetworkConfiguration instance.
+ */
+ public static NetworkConfiguration probe() throws IOException {
+ Map<NetworkInterface, List<Inet4Address>> ip4Interfaces = new HashMap<>();
+ Map<NetworkInterface, List<Inet6Address>> ip6Interfaces = new HashMap<>();
+
+ List<NetworkInterface> nifs = list(getNetworkInterfaces());
+ for (NetworkInterface nif : nifs) {
+ // ignore interfaces that are down
+ if (!nif.isUp() || nif.isPointToPoint())
+ continue;
+
+ List<Inet4Address> ip4Addresses = new LinkedList<>();
+ List<Inet6Address> ip6Addresses = new LinkedList<>();
+ ip4Interfaces.put(nif, ip4Addresses);
+ ip6Interfaces.put(nif, ip6Addresses);
+ for (InetAddress addr : list(nif.getInetAddresses())) {
+ if (addr instanceof Inet4Address)
+ ip4Addresses.add((Inet4Address)addr);
+ else if (addr instanceof Inet6Address)
+ ip6Addresses.add((Inet6Address)addr);
+ }
+ }
+ return new NetworkConfiguration(ip4Interfaces, ip6Interfaces);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ interfaces().forEach(nif -> sb.append(interfaceInformation(nif)));
+ return sb.toString();
+ }
+
+ /** Returns detailed information for the given interface. */
+ public static String interfaceInformation(NetworkInterface nif) {
+ StringBuilder sb = new StringBuilder();
+ try {
+ sb.append("Display name: " + nif.getDisplayName() + "\n");
+ sb.append("Name: " + nif.getName() + "\n");
+ for (InetAddress inetAddress : list(nif.getInetAddresses()))
+ sb.append("InetAddress: " + inetAddress + "\n");
+ sb.append("Up? " + nif.isUp() + "\n");
+ sb.append("Loopback? " + nif.isLoopback() + "\n");
+ sb.append("PointToPoint? " + nif.isPointToPoint() + "\n");
+ sb.append("Supports multicast? " + nif.supportsMulticast() + "\n");
+ sb.append("Virtual? " + nif.isVirtual() + "\n");
+ sb.append("Hardware address: " +
+ Arrays.toString(nif.getHardwareAddress()) + "\n");
+ sb.append("MTU: " + nif.getMTU() + "\n");
+ sb.append("Index: " + nif.getIndex() + "\n");
+ sb.append("\n");
+ return sb.toString();
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ /** Prints all the system interface information to the give stream. */
+ public static void printSystemConfiguration(PrintStream out) {
+ try {
+ out.println("*** all system network interface configuration ***");
+ List<NetworkInterface> nifs = list(getNetworkInterfaces());
+ for (NetworkInterface nif : nifs)
+ out.print(interfaceInformation(nif));
+ out.println("*** end ***");
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessThread.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
import java.io.PrintWriter;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
/**
@@ -195,7 +194,7 @@
* @return The PID associated with this process runnable
*/
public long getPid() throws InterruptedException {
- return getProcess().getPid();
+ return getProcess().pid();
}
public void sendMessage(String message) throws InterruptedException {
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Mon Apr 24 21:34:23 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
@@ -256,7 +256,7 @@
* @return Process id
*/
public static long getProcessId() {
- return ProcessHandle.current().getPid();
+ return ProcessHandle.current().pid();
}
/**
@@ -523,8 +523,8 @@
}
@Override
- public long getPid() {
- return p.getPid();
+ public long pid() {
+ return p.pid();
}
@Override
--- a/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, 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
@@ -144,7 +144,7 @@
System.out.println("Attaching test manager:");
System.out.println("=========================");
- System.out.println(" PID : " + serverPrc.getPid());
+ System.out.println(" PID : " + serverPrc.pid());
System.out.println(" shutdown port : " + port.get());
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -152,7 +152,7 @@
TEST_CLASSPATH,
"--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
- String.valueOf(serverPrc.getPid()),
+ String.valueOf(serverPrc.pid()),
port.get(),
"true"
);
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, 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
@@ -129,7 +129,7 @@
System.out.println("Attaching test manager:");
System.out.println("=========================");
- System.out.println(" PID : " + serverPrc.getPid());
+ System.out.println(" PID : " + serverPrc.pid());
System.out.println(" shutdown port : " + port.get());
ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
@@ -137,7 +137,7 @@
TEST_CLASSPATH,
"--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED",
"TestManager",
- String.valueOf(serverPrc.getPid()),
+ String.valueOf(serverPrc.pid()),
port.get(),
"true"
);
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, 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
@@ -346,7 +346,7 @@
throw new BindException("Starting process failed due to " +
"the requested port not being available");
}
- pid = p.getPid();
+ pid = p.pid();
} catch (TimeoutException e) {
if (p != null) {
p.destroy();
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Mon Apr 24 21:34:23 2017 +0200
@@ -31,9 +31,9 @@
* @bug 6216082
* @summary Redirect problem with HttpsURLConnection using a proxy
* @modules java.base/sun.net.www
- * @library ..
+ * @library .. /lib/testlibrary
* @build HttpCallback TestHttpsServer ClosedChannelList
- * HttpTransaction TunnelProxy
+ * HttpTransaction TunnelProxy jdk.testlibrary.NetworkConfiguration
* @key intermittent
* @run main/othervm B6216082
*/
@@ -43,6 +43,8 @@
import javax.net.ssl.*;
import java.util.*;
+import jdk.testlibrary.NetworkConfiguration;
+
public class B6216082 {
static SimpleHttpTransaction httpTrans;
static TestHttpsServer server;
@@ -118,21 +120,17 @@
}
public static InetAddress getNonLoAddress() throws Exception {
- NetworkInterface loNIC = NetworkInterface.getByInetAddress(InetAddress.getByName("localhost"));
- Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
- while (nics.hasMoreElements()) {
- NetworkInterface nic = nics.nextElement();
- if (!nic.getName().equalsIgnoreCase(loNIC.getName())) {
- Enumeration<InetAddress> addrs = nic.getInetAddresses();
- while (addrs.hasMoreElements()) {
- InetAddress addr = addrs.nextElement();
- if (!addr.isLoopbackAddress())
- return addr;
- }
- }
- }
+ InetAddress lh = InetAddress.getByName("localhost");
+ NetworkInterface loNIC = NetworkInterface.getByInetAddress(lh);
- return null;
+ NetworkConfiguration nc = NetworkConfiguration.probe();
+ Optional<InetAddress> oaddr = nc.interfaces()
+ .filter(nif -> !nif.getName().equalsIgnoreCase(loNIC.getName()))
+ .flatMap(nif -> nc.addresses(nif))
+ .filter(a -> !a.isLoopbackAddress())
+ .findFirst();
+
+ return oaddr.orElseGet(() -> null);
}
public static void startHttpServer() throws IOException {
--- a/jdk/test/sun/security/krb5/auto/Basic.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/security/krb5/auto/Basic.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,50 +23,18 @@
/*
* @test
- * @bug 7152176 8164437
+ * @bug 7152176
* @summary More krb5 tests
- * @library /test/lib
* @compile -XDignore.symbol.file Basic.java
* @run main/othervm Basic
*/
-import jdk.test.lib.process.ProcessTools;
import sun.security.jgss.GSSUtil;
-import java.util.List;
-import java.util.stream.Stream;
-
+// The basic krb5 test skeleton you can copy from
public class Basic {
- public static void main(String[] args) throws Throwable {
-
- if (args.length == 0) { // jtreg launched here
-
- // With all modules
- test("jdk.security.jgss");
-
- // With limited modules
- List<String> cmd = ProcessTools.createJavaProcessBuilder().command();
- Stream.of(jdk.internal.misc.VM.getRuntimeArguments())
- .filter(arg -> arg.startsWith("--add-exports=") ||
- arg.startsWith("--add-opens="))
- .forEach(cmd::add);
- cmd.addAll(List.of(
- "-Dtest.src=" + System.getProperty("test.src"),
- "--add-modules",
- "java.base,java.security.jgss,jdk.security.auth",
- "--limit-modules",
- "java.security.jgss,jdk.security.auth",
- "Basic",
- "launched-limited"));
- ProcessTools.executeCommand(cmd.toArray(new String[cmd.size()]))
- .shouldHaveExitValue(0);
- } else { // Launched by ProcessTools above, with limited modules.
- test("java.security.jgss");
- }
- }
-
- static void test(String expected) throws Exception {
+ public static void main(String[] args) throws Exception {
new OneKDC(null).writeJAASConf();
@@ -92,12 +60,5 @@
b.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
Context.handshake(s2, b);
-
- // Bonus test for 8164437.
- String moduleName = c.x().getClass().getModule().getName();
- if (!moduleName.equals(expected)) {
- throw new Exception("Expected: " + expected
- + ". Actual: " + moduleName);
- }
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ModuleName.java Mon Apr 24 21:34:23 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 8164437
+ * @summary GSSContext type when jdk.security.jgss is not available
+ * @library /test/lib
+ * @compile -XDignore.symbol.file ModuleName.java
+ * @run main/othervm ModuleName
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import sun.security.jgss.GSSUtil;
+
+import java.util.List;
+import java.util.stream.Stream;
+
+public class ModuleName {
+
+ public static void main(String[] args) throws Throwable {
+
+ if (args.length == 0) { // jtreg launched here
+
+ // With all modules
+ test("jdk.security.jgss");
+
+ // With limited modules
+ List<String> cmd = ProcessTools.createJavaProcessBuilder().command();
+ Stream.of(jdk.internal.misc.VM.getRuntimeArguments())
+ .filter(arg -> arg.startsWith("--add-exports=") ||
+ arg.startsWith("--add-opens="))
+ .forEach(cmd::add);
+ cmd.addAll(List.of(
+ "-Dtest.src=" + System.getProperty("test.src"),
+ "--add-modules",
+ "java.base,java.security.jgss,jdk.security.auth",
+ "--limit-modules",
+ "java.security.jgss,jdk.security.auth",
+ "ModuleName",
+ "launched-limited"));
+ ProcessTools.executeCommand(cmd.toArray(new String[cmd.size()]))
+ .shouldHaveExitValue(0);
+ } else { // Launched by ProcessTools above, with limited modules.
+ test("java.security.jgss");
+ }
+ }
+
+ static void test(String expected) throws Exception {
+
+ new OneKDC(null).writeJAASConf();
+
+ Context c = Context.fromJAAS("client");
+ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+
+ String moduleName = c.x().getClass().getModule().getName();
+ if (!moduleName.equals(expected)) {
+ throw new Exception("Expected: " + expected
+ + ". Actual: " + moduleName);
+ }
+ }
+}
--- a/jdk/test/sun/tools/jps/LingeredApp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/tools/jps/LingeredApp.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -141,7 +141,7 @@
if (appProcess == null) {
throw new RuntimeException("Process is not alive");
}
- return appProcess.getPid();
+ return appProcess.pid();
}
/**
--- a/jdk/test/sun/tools/jstat/JStatInterval.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/sun/tools/jstat/JStatInterval.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, 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
@@ -36,11 +36,8 @@
import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
public class JStatInterval {
private static final String READY = "READY";
@@ -88,7 +85,7 @@
throw new Error("Unable to start the monitored application.");
}
- String pidStr = String.valueOf(app.getPid());
+ String pidStr = String.valueOf(app.pid());
JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jstat");
l.addToolArg("-compiler");
l.addToolArg(pidStr);
--- a/jdk/test/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/jdk/test/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java Mon Apr 24 21:34:23 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,16 +26,15 @@
* @bug 8156499
* @summary Test image creation from Multi-Release JAR
* @author Steve Drach
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules java.base/jdk.internal.jimage
* java.base/jdk.internal.module
- * @build jdk.testlibrary.FileUtils jdk.test.lib.process.*
+ * @build jdk.test.lib.process.*
* @run testng JLinkMultiReleaseJarTest
*/
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.UncheckedIOException;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -54,10 +53,8 @@
import jdk.internal.jimage.BasicImageReader;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.FileUtils;
import org.testng.Assert;
-import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -138,23 +135,6 @@
Assert.assertEquals(rc, 0);
}
- @AfterClass
- public void close() throws IOException {
- Files.walk(userdir, 1)
- .filter(p -> !p.equals(userdir))
- .forEach(p -> {
- try {
- if (Files.isDirectory(p)) {
- FileUtils.deleteFileTreeWithRetry(p);
- } else {
- FileUtils.deleteFileIfExistsWithRetry(p);
- }
- } catch (IOException x) {
- throw new UncheckedIOException(x);
- }
- });
- }
-
@Test
public void basicTest() throws Throwable {
if (ignoreTest()) return;
--- a/langtools/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -408,3 +408,5 @@
440c45c2e8cee78f6883fa6f2505a781505f323c jdk-9+162
24582dd2649a155876de89273975ebe1adb5f18c jdk-9+163
c7f3df19667b093538c6eecb73dcb3fb531706b4 jdk-9+164
+98108b7d4cb6078773e2d27ad8471dc25d4d6124 jdk-9+165
+2a8b403a623320479705aad04ed8d78396661eb7 jdk-9+166
--- a/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,8 +23,6 @@
package crules;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -76,7 +74,7 @@
private void addExports(String moduleName, String... packageNames) {
for (String packageName : packageNames) {
try {
- Layer layer = Layer.boot();
+ ModuleLayer layer = ModuleLayer.boot();
Optional<Module> m = layer.findModule(moduleName);
if (!m.isPresent())
throw new Error("module not found: " + moduleName);
--- a/langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Mon Apr 24 21:34:23 2017 +0200
@@ -364,7 +364,8 @@
* @return a list of files or {@code null} if this location has no
* associated search path
* @throws IllegalStateException if any element of the search path
- * cannot be converted to a {@linkplain File}.
+ * cannot be converted to a {@linkplain File}, or if the search path
+ * cannot be represented as a simple series of files.
*
* @see #setLocation
* @see Path#toFile
@@ -382,6 +383,8 @@
* @param location a location
* @return a list of paths or {@code null} if this location has no
* associated search path
+ * @throws IllegalStateException if the search path cannot be represented
+ * as a simple series of paths.
*
* @see #setLocationFromPaths
* @since 9
--- a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java Mon Apr 24 21:34:23 2017 +0200
@@ -106,7 +106,7 @@
static {
Class<?> c = null;
try {
- c = Class.forName("java.lang.reflect.Module");
+ c = Class.forName("java.lang.Module");
} catch (Throwable t) {
}
useLegacy = (c == null);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java Mon Apr 24 21:34:23 2017 +0200
@@ -118,6 +118,7 @@
if (source.compareTo(Source.JDK1_9) >= 0) {
values.add(LintCategory.DEP_ANN);
}
+ values.add(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC);
values.add(LintCategory.OPENS);
values.add(LintCategory.MODULE);
values.add(LintCategory.REMOVAL);
@@ -254,6 +255,16 @@
REMOVAL("removal"),
/**
+ * Warn about use of automatic modules in the requires clauses.
+ */
+ REQUIRES_AUTOMATIC("requires-automatic"),
+
+ /**
+ * Warn about automatic modules in requires transitive.
+ */
+ REQUIRES_TRANSITIVE_AUTOMATIC("requires-transitive-automatic"),
+
+ /**
* Warn about Serializable classes that do not provide a serial version ID.
*/
SERIAL("serial"),
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Mon Apr 24 21:34:23 2017 +0200
@@ -105,7 +105,7 @@
private Env<AttrContext> env;
/** Result of method attribution. */
- private Type result;
+ Type result;
/** Cache for argument types; behavior is influences by the currrently selected cache policy. */
Map<UniquePos, ArgumentType<?>> argumentTypeCache = new LinkedHashMap<>();
@@ -215,13 +215,8 @@
processArg(that, () -> {
T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() {
@Override
- protected void attr(JCTree tree, Env<AttrContext> env) {
- //avoid speculative attribution loops
- if (!new UniquePos(tree).equals(pos)) {
- super.attr(tree, env);
- } else {
- visitTree(tree);
- }
+ protected boolean needsArgumentAttr(JCTree tree) {
+ return !new UniquePos(tree).equals(pos);
}
});
return argumentTypeFactory.apply(speculativeTree);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Apr 24 21:34:23 2017 +0200
@@ -505,9 +505,12 @@
this.checkMode = checkMode;
}
- protected void attr(JCTree tree, Env<AttrContext> env) {
- tree.accept(Attr.this);
- }
+ /**
+ * Should {@link Attr#attribTree} use the {@ArgumentAttr} visitor instead of this one?
+ * @param tree The tree to be type-checked.
+ * @return true if {@ArgumentAttr} should be used.
+ */
+ protected boolean needsArgumentAttr(JCTree tree) { return false; }
protected Type check(final DiagnosticPosition pos, final Type found) {
return chk.checkType(pos, found, pt, checkContext);
@@ -553,8 +556,8 @@
}
@Override
- protected void attr(JCTree tree, Env<AttrContext> env) {
- result = argumentAttr.attribArg(tree, env);
+ protected boolean needsArgumentAttr(JCTree tree) {
+ return true;
}
protected ResultInfo dup(Type newPt) {
@@ -644,7 +647,11 @@
try {
this.env = env;
this.resultInfo = resultInfo;
- resultInfo.attr(tree, env);
+ if (resultInfo.needsArgumentAttr(tree)) {
+ result = argumentAttr.attribArg(tree, env);
+ } else {
+ tree.accept(this);
+ }
if (tree == breakTree &&
resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
throw new BreakAttr(copyEnv(env));
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Mon Apr 24 21:34:23 2017 +0200
@@ -2107,10 +2107,32 @@
Name moduleName = tree.sym.name;
Assert.checkNonNull(moduleName);
if (lint.isEnabled(LintCategory.MODULE)) {
- String moduleNameString = moduleName.toString();
- int nameLength = moduleNameString.length();
- if (nameLength > 0 && Character.isDigit(moduleNameString.charAt(nameLength - 1))) {
- log.warning(Lint.LintCategory.MODULE, tree.qualId.pos(), Warnings.PoorChoiceForModuleName(moduleName));
+ JCExpression qualId = tree.qualId;
+ while (qualId != null) {
+ Name componentName;
+ DiagnosticPosition pos;
+ switch (qualId.getTag()) {
+ case SELECT:
+ JCFieldAccess selectNode = ((JCFieldAccess) qualId);
+ componentName = selectNode.name;
+ pos = selectNode.pos();
+ qualId = selectNode.selected;
+ break;
+ case IDENT:
+ componentName = ((JCIdent) qualId).name;
+ pos = qualId.pos();
+ qualId = null;
+ break;
+ default:
+ throw new AssertionError("Unexpected qualified identifier: " + qualId.toString());
+ }
+ if (componentName != null) {
+ String moduleNameComponentString = componentName.toString();
+ int nameLength = moduleNameComponentString.length();
+ if (nameLength > 0 && Character.isDigit(moduleNameComponentString.charAt(nameLength - 1))) {
+ log.warning(Lint.LintCategory.MODULE, pos, Warnings.PoorChoiceForModuleName(componentName));
+ }
+ }
}
}
}
@@ -3886,4 +3908,16 @@
}
}
+ void checkModuleRequires(final DiagnosticPosition pos, final RequiresDirective rd) {
+ if ((rd.module.flags() & Flags.AUTOMATIC_MODULE) != 0) {
+ deferredLintHandler.report(() -> {
+ if (rd.isTransitive() && lint.isEnabled(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC)) {
+ log.warning(pos, Warnings.RequiresTransitiveAutomatic);
+ } else if (lint.isEnabled(LintCategory.REQUIRES_AUTOMATIC)) {
+ log.warning(pos, Warnings.RequiresAutomatic);
+ }
+ });
+ }
+ }
+
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Mon Apr 24 21:34:23 2017 +0200
@@ -1075,6 +1075,7 @@
public void visitRequires(JCRequires tree) {
if (tree.directive != null && allModules().contains(tree.directive.module)) {
chk.checkDeprecated(tree.moduleName.pos(), msym, tree.directive.module);
+ chk.checkModuleRequires(tree.moduleName.pos(), tree.directive);
msym.directives = msym.directives.prepend(tree.directive);
}
}
@@ -1231,7 +1232,7 @@
case ALL_SYSTEM:
modules = new HashSet<>(syms.getAllModules())
.stream()
- .filter(systemModulePred.and(observablePred).and(noIncubatorPred));
+ .filter(systemModulePred.and(observablePred));
break;
case ALL_MODULE_PATH:
modules = new HashSet<>(syms.getAllModules())
@@ -1256,6 +1257,15 @@
result.add(syms.unnamedModule);
+ boolean hasAutomatic = result.stream().anyMatch(IS_AUTOMATIC);
+
+ if (hasAutomatic) {
+ syms.getAllModules()
+ .stream()
+ .filter(IS_AUTOMATIC)
+ .forEach(result::add);
+ }
+
String incubatingModules = result.stream()
.filter(msym -> msym.resolutionFlags.contains(ModuleResolutionFlags.WARN_INCUBATING))
.map(msym -> msym.name.toString())
@@ -1273,6 +1283,9 @@
rootModules.forEach(m -> m.version = version);
}
}
+ //where:
+ private static final Predicate<ModuleSymbol> IS_AUTOMATIC =
+ m -> (m.flags_field & Flags.AUTOMATIC_MODULE) != 0;
public boolean isInModuleGraph(ModuleSymbol msym) {
return allModules == null || allModules.contains(msym);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Mon Apr 24 21:34:23 2017 +0200
@@ -473,10 +473,14 @@
}
} else {
if (isValidFile(fname, fileKinds)) {
- RelativeFile file = new RelativeFile(subdirectory, fname);
- JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
- file.resolveAgainst(directory), userPath, file);
- resultList.append(fe);
+ try {
+ RelativeFile file = new RelativeFile(subdirectory, fname);
+ JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this,
+ file.resolveAgainst(directory), userPath, file);
+ resultList.append(fe);
+ } catch (InvalidPathException e) {
+ throw new IOException("error accessing directory " + directory + e);
+ }
}
}
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Mon Apr 24 21:34:23 2017 +0200
@@ -1282,8 +1282,7 @@
}
// finally clean up the module name
- mn = mn.replaceAll("(\\.|\\d)*$", "") // remove trailing version
- .replaceAll("[^A-Za-z0-9]", ".") // replace non-alphanumeric
+ mn = mn.replaceAll("[^A-Za-z0-9]", ".") // replace non-alphanumeric
.replaceAll("(\\.)(\\1)+", ".") // collapse repeating dots
.replaceAll("^\\.", "") // drop leading dots
.replaceAll("\\.$", ""); // drop trailing dots
@@ -1350,6 +1349,7 @@
private class ModuleSourcePathLocationHandler extends BasicLocationHandler {
private ModuleTable moduleTable;
+ private List<Path> paths;
ModuleSourcePathLocationHandler() {
super(StandardLocation.MODULE_SOURCE_PATH,
@@ -1369,11 +1369,15 @@
}
Map<String, List<Path>> map = new LinkedHashMap<>();
+ List<Path> noSuffixPaths = new ArrayList<>();
+ boolean anySuffix = false;
final String MARKER = "*";
for (String seg: segments) {
int markStart = seg.indexOf(MARKER);
if (markStart == -1) {
- add(map, getPath(seg), null);
+ Path p = getPath(seg);
+ add(map, p, null);
+ noSuffixPaths.add(p);
} else {
if (markStart == 0 || !isSeparator(seg.charAt(markStart - 1))) {
throw new IllegalArgumentException("illegal use of " + MARKER + " in " + seg);
@@ -1388,11 +1392,20 @@
throw new IllegalArgumentException("illegal use of " + MARKER + " in " + seg);
} else {
suffix = getPath(seg.substring(markEnd + 1));
+ anySuffix = true;
}
add(map, prefix, suffix);
+ if (suffix == null) {
+ noSuffixPaths.add(prefix);
+ }
}
}
+ initModuleTable(map);
+ paths = anySuffix ? null : noSuffixPaths;
+ }
+
+ private void initModuleTable(Map<String, List<Path>> map) {
moduleTable = new ModuleTable();
map.forEach((modName, modPath) -> {
boolean hasModuleInfo = modPath.stream().anyMatch(checkModuleInfo);
@@ -1510,12 +1523,25 @@
@Override
Collection<Path> getPaths() {
- throw new UnsupportedOperationException();
+ if (paths == null) {
+ // This may occur for a complex setting with --module-source-path option
+ // i.e. one that cannot be represented by a simple series of paths.
+ throw new IllegalStateException("paths not available");
+ }
+ return paths;
}
@Override
void setPaths(Iterable<? extends Path> files) throws IOException {
- throw new UnsupportedOperationException();
+ Map<String, List<Path>> map = new LinkedHashMap<>();
+ List<Path> newPaths = new ArrayList<>();
+ for (Path file : files) {
+ add(map, file, null);
+ newPaths.add(file);
+ }
+
+ initModuleTable(map);
+ paths = Collections.unmodifiableList(newPaths);
}
@Override
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Apr 24 21:34:23 2017 +0200
@@ -1537,7 +1537,7 @@
# 0: name
compiler.warn.poor.choice.for.module.name=\
- module name {0} should avoid terminal digits
+ module name component {0} should avoid terminal digits
# 0: string
compiler.warn.incubating.modules=\
@@ -1664,6 +1664,12 @@
compiler.warn.future.attr=\
{0} attribute introduced in version {1}.{2} class files is ignored in version {3}.{4} class files
+compiler.warn.requires.automatic=\
+ requires directive for an automatic module
+
+compiler.warn.requires.transitive.automatic=\
+ requires transitive directive for an automatic module
+
# Warnings related to annotation processing
# 0: string
compiler.warn.proc.package.does.not.exist=\
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Mon Apr 24 21:34:23 2017 +0200
@@ -230,6 +230,12 @@
javac.opt.Xlint.desc.removal=\
Warn about use of API that has been marked for removal.
+javac.opt.Xlint.desc.requires-automatic=\
+ Warn about use of automatic modules in the requires clauses.
+
+javac.opt.Xlint.desc.requires-transitive-automatic=\
+ Warn about automatic modules in requires transitive.
+
javac.opt.Xlint.desc.serial=\
Warn about Serializable classes that do not provide a serial version ID. \n\
\ Also warn about access to non-public members from a serializable element.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java Mon Apr 24 21:34:23 2017 +0200
@@ -183,7 +183,7 @@
}
/**
- * Wrapper class for java.lang.reflect.Module. To materialize a handle use the static factory
+ * Wrapper class for java.lang.Module. To materialize a handle use the static factory
* methods Module#getModule(Class<?>) or Module#getUnnamedModule(ClassLoader).
*/
public static class Module {
@@ -236,9 +236,9 @@
}
// -----------------------------------------------------------------------------------------
- // on java.lang.reflect.Module
+ // on java.lang.Module
private static Method addExportsMethod = null;
- // on java.lang.reflect.Module
+ // on java.lang.Module
private static Method addUsesMethod = null;
// on java.lang.Class
private static Method getModuleMethod;
@@ -248,7 +248,7 @@
private static void init() {
if (addExportsMethod == null) {
try {
- Class<?> moduleClass = Class.forName("java.lang.reflect.Module", false, null);
+ Class<?> moduleClass = Class.forName("java.lang.Module", false, null);
addUsesMethod = moduleClass.getDeclaredMethod("addUses", new Class<?>[] { Class.class });
addExportsMethod = moduleClass.getDeclaredMethod("addExports",
new Class<?>[] { String.class, moduleClass });
@@ -318,7 +318,7 @@
}
/**
- * Wrapper class for java.lang.module.Layer.
+ * Wrapper class for java.lang.ModuleLayer.
*/
public static final class Layer {
private final Object theRealLayer;
@@ -372,7 +372,7 @@
private static void init() {
if (layerClass == null) {
try {
- layerClass = Class.forName("java.lang.reflect.Layer", false, null);
+ layerClass = Class.forName("java.lang.ModuleLayer", false, null);
bootMethod = layerClass.getDeclaredMethod("boot");
defineModulesWithOneLoaderMethod = layerClass.getDeclaredMethod("defineModulesWithOneLoader",
Configuration.getConfigurationClass(),
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Mon Apr 24 21:34:23 2017 +0200
@@ -292,7 +292,7 @@
Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
Object thisModule = getModuleMethod.invoke(getClass());
- Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
+ Class<?> moduleClass = Class.forName("java.lang.Module");
Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java Mon Apr 24 21:34:23 2017 +0200
@@ -379,7 +379,7 @@
Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
Object thisModule = getModuleMethod.invoke(getClass());
- Class<?> moduleClass = Class.forName("java.lang.reflect.Module");
+ Class<?> moduleClass = Class.forName("java.lang.Module");
Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass);
Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule");
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java Mon Apr 24 21:34:23 2017 +0200
@@ -85,7 +85,7 @@
/**
* Returns the string representation of a series of instances of
* this tag to be included in the generated output.
- * If this taglet is for an {@link #isInlineTag inline} tag} it will
+ * If this taglet is for an {@link #isInlineTag inline} tag it will
* be called once per instance of the tag, each time with a singleton list.
* Otherwise, if this tag is a block tag, it will be called once per
* comment, with a list of all the instances of the tag in a comment.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -169,11 +169,7 @@
*/
@Override
public void setSummaryColumnStyleAndScope(HtmlTree thTree) {
- if (foundNonPubConstructor) {
- thTree.addStyle(HtmlStyle.colSecond);
- } else {
- thTree.addStyle(HtmlStyle.colFirst);
- }
+ thTree.addStyle(HtmlStyle.colConstructorName);
thTree.addAttr(HtmlAttr.SCOPE, "row");
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java Mon Apr 24 21:34:23 2017 +0200
@@ -130,6 +130,7 @@
public final Content nextPackageLabel;
public final Content noFramesLabel;
public final Content noScriptMessage;
+ public final Content openModuleLabel;
public final Content overridesLabel;
public final Content overviewLabel;
public final Content packageHierarchies;
@@ -244,6 +245,7 @@
nextPackageLabel = getNonBreakContent("doclet.Next_Package");
noFramesLabel = getNonBreakContent("doclet.No_Frames");
noScriptMessage = getContent("doclet.No_Script_Message");
+ openModuleLabel = getContent("doclet.Open_Module");
overridesLabel = getContent("doclet.Overrides");
overviewLabel = getContent("doclet.Overview");
packageHierarchies = getContent("doclet.Package_Hierarchies");
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -98,19 +98,19 @@
= new TreeMap<>(utils.makeModuleComparator());
/**
- * Map of additional modules and modifiers, transitive closure, required by this module.
+ * Map of indirect modules and modifiers, transitive closure, required by this module.
*/
- private final Map<ModuleElement, Content> additionalModules
+ private final Map<ModuleElement, Content> indirectModules
= new TreeMap<>(utils.makeModuleComparator());
/**
- * Map of packages exported by this module and the modules it's been exported to.
+ * Map of packages exported by this module and the modules it has been exported to.
*/
private final Map<PackageElement, SortedSet<ModuleElement>> exportedPackages
= new TreeMap<>(utils.makePackageComparator());
/**
- * Map of opened packages by this module and the modules it's been opened to.
+ * Map of opened packages by this module and the modules it has been opened to.
*/
private final Map<PackageElement, SortedSet<ModuleElement>> openedPackages
= new TreeMap<>(utils.makePackageComparator());
@@ -121,15 +121,15 @@
private final SortedSet<PackageElement> concealedPackages = new TreeSet<>(utils.makePackageComparator());
/**
- * Map of additional modules (transitive closure) and its exported packages.
+ * Map of indirect modules (transitive closure) and their exported packages.
*/
- private final Map<ModuleElement, SortedSet<PackageElement>> additionalPackages
+ private final Map<ModuleElement, SortedSet<PackageElement>> indirectPackages
= new TreeMap<>(utils.makeModuleComparator());
/**
- * Map of additional modules (transitive closure) and its open packages.
+ * Map of indirect modules (transitive closure) and their open packages.
*/
- private final Map<ModuleElement, SortedSet<PackageElement>> additionalOpenPackages
+ private final Map<ModuleElement, SortedSet<PackageElement>> indirectOpenPackages
= new TreeMap<>(utils.makeModuleComparator());
/**
@@ -212,8 +212,10 @@
Content annotationContent = new HtmlTree(HtmlTag.P);
addAnnotationInfo(mdle, annotationContent);
div.addContent(annotationContent);
+ Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
+ ? contents.openModuleLabel : contents.moduleLabel;
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
- HtmlStyle.title, contents.moduleLabel);
+ HtmlStyle.title, label);
tHeading.addContent(Contents.SPACE);
Content moduleHead = new RawHtml(heading);
tHeading.addContent(moduleHead);
@@ -264,12 +266,12 @@
CommentHelper ch = utils.getCommentHelper(mdle);
// Get module dependencies using the module's transitive closure.
Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
- // Add all dependent modules to additional modules set. We will remove the modules,
- // listed using the requires directive, from this set to come up with the table of additional
+ // Add all dependent modules to indirect modules set. We will remove the modules,
+ // listed using the requires directive, from this set to come up with the table of indirect
// required modules.
dependentModules.forEach((module, mod) -> {
if (shouldDocument(module)) {
- additionalModules.put(module, new StringContent(mod));
+ indirectModules.put(module, new StringContent(mod));
}
});
(ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> {
@@ -278,17 +280,17 @@
if (moduleMode == ModuleMode.ALL || directive.isTransitive()) {
requires.put(m, new StringContent(utils.getModifiers(directive)));
} else {
- // For api mode, just keep the public requires in dependentModules for display of
- // additional packages in the "Packages" section.
+ // For api mode, just keep the public requires in dependentModules for display of
+ // indirect packages in the "Packages" section.
dependentModules.remove(m);
- }
- additionalModules.remove(m);
+ }
+ indirectModules.remove(m);
}
});
// Get all packages for the module and put it in the concealed packages set.
utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet()).forEach((pkg) -> {
- if (shouldDocument(pkg)) {
+ if (shouldDocument(pkg) && moduleMode == ModuleMode.ALL) {
concealedPackages.add(pkg);
}
});
@@ -307,7 +309,9 @@
if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
exportedPackages.put(p, mdleList);
}
- concealedPackages.remove(p);
+ if (moduleMode == ModuleMode.ALL) {
+ concealedPackages.remove(p);
+ }
}
});
// Get all opened packages for the module using the opens directive for the module.
@@ -320,18 +324,17 @@
mdleList.addAll(targetMdles);
}
// Qualified opens should not be displayed in the api mode. So if mdleList is empty,
- // it's opened to all modules and hence can be added.
+ // it is opened to all modules and hence can be added.
if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
openedPackages.put(p, mdleList);
}
- concealedPackages.remove(p);
+ if (moduleMode == ModuleMode.ALL) {
+ concealedPackages.remove(p);
+ }
}
});
- // Remove all the exported and opened packages so we have just the concealed packages now.
- concealedPackages.removeAll(exportedPackages.keySet());
- concealedPackages.removeAll(openedPackages.keySet());
// Get all the exported and opened packages, for the transitive closure of the module, to be displayed in
- // the additional packages tables.
+ // the indirect packages tables.
dependentModules.forEach((module, mod) -> {
SortedSet<PackageElement> pkgList = new TreeSet<>(utils.makePackageComparator());
(ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> {
@@ -343,7 +346,7 @@
// If none of the transitive modules have exported packages to be displayed, we should not be
// displaying the table and so it should not be added to the map.
if (!pkgList.isEmpty()) {
- additionalPackages.put(module, pkgList);
+ indirectPackages.put(module, pkgList);
}
SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
(ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
@@ -355,7 +358,7 @@
// If none of the transitive modules have opened packages to be displayed, we should not be
// displaying the table and so it should not be added to the map.
if (!openPkgList.isEmpty()) {
- additionalOpenPackages.put(module, openPkgList);
+ indirectOpenPackages.put(module, openPkgList);
}
});
// Get all the services listed as uses directive.
@@ -407,7 +410,7 @@
* @param section set of elements
* @return true if there are elements to be displayed
*/
- public boolean display(SortedSet<? extends Element> section) {
+ public boolean display(Set<? extends Element> section) {
return section != null && !section.isEmpty();
}
@@ -421,6 +424,25 @@
return section != null && !section.isEmpty();
}
+ /*
+ * Returns true, in API mode, if at least one type element in
+ * the typeElements set is referenced by a javadoc tag in tagsMap.
+ */
+ private boolean displayServices(Set<TypeElement> typeElements,
+ Map<TypeElement, Content> tagsMap) {
+ return typeElements != null &&
+ typeElements.stream().anyMatch((v) -> displayServiceDirective(v, tagsMap));
+ }
+
+ /*
+ * Returns true, in API mode, if the type element is referenced
+ * from a javadoc tag in tagsMap.
+ */
+ private boolean displayServiceDirective(TypeElement typeElement,
+ Map<TypeElement, Content> tagsMap) {
+ return moduleMode == ModuleMode.ALL || tagsMap.containsKey(typeElement);
+ }
+
/**
* Add the summary header.
*
@@ -471,31 +493,31 @@
* {@inheritDoc}
*/
public void addModulesSummary(Content summaryContentTree) {
- if (display(requires) || display(additionalModules)) {
+ if (display(requires) || display(indirectModules)) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
contents.navModules, li);
if (display(requires)) {
- String text = configuration.getText("doclet.Requires_Summary");
- String tableSummary = configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Requires_Summary"),
- configuration.getText("doclet.modules"));
+ String text = configuration.getText("doclet.Requires_Summary");
+ String tableSummary = configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Requires_Summary"),
+ configuration.getText("doclet.modules"));
Content table = getTableHeader(text, tableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
Content tbody = new HtmlTree(HtmlTag.TBODY);
addModulesList(requires, tbody);
table.addContent(tbody);
li.addContent(table);
}
- // Display additional modules table in both "api" and "all" mode.
- if (display(additionalModules)) {
- String amrText = configuration.getText("doclet.Additional_Modules_Required_Summary");
+ // Display indirect modules table in both "api" and "all" mode.
+ if (display(indirectModules)) {
+ String amrText = configuration.getText("doclet.Indirect_Requires_Summary");
String amrTableSummary = configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Additional_Modules_Required_Summary"),
+ configuration.getText("doclet.Indirect_Requires_Summary"),
configuration.getText("doclet.modules"));
Content amrTable = getTableHeader(amrText, amrTableSummary, HtmlStyle.requiresSummary, requiresTableHeader);
Content amrTbody = new HtmlTree(HtmlTag.TBODY);
- addModulesList(additionalModules, amrTbody);
+ addModulesList(indirectModules, amrTbody);
amrTable.addContent(amrTbody);
li.addContent(amrTable);
}
@@ -530,7 +552,7 @@
public void addPackagesSummary(Content summaryContentTree) {
if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)
- || display(additionalPackages) || display(additionalOpenPackages)) {
+ || display(indirectPackages) || display(indirectOpenPackages)) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
@@ -541,29 +563,29 @@
if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) {
addPackageSummary(tableSummary, li);
}
- if (display(additionalPackages)) {
- String aepText = configuration.getText("doclet.Additional_Exported_Packages_Summary");
- String aepTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
- configuration.getText("doclet.Additional_Exported_Packages_Summary"),
+ if (display(indirectPackages)) {
+ String aepText = configuration.getText("doclet.Indirect_Exports_Summary");
+ String aepTableSummary = configuration.getText("doclet.Indirect_Packages_Table_Summary",
+ configuration.getText("doclet.Indirect_Exports_Summary"),
configuration.getText("doclet.modules"),
configuration.getText("doclet.packages"));
Content aepTable = getTableHeader(aepText, aepTableSummary, HtmlStyle.packagesSummary,
- additionalPackagesTableHeader);
+ indirectPackagesTableHeader);
Content aepTbody = new HtmlTree(HtmlTag.TBODY);
- addAdditionalPackages(aepTbody, additionalPackages);
+ addIndirectPackages(aepTbody, indirectPackages);
aepTable.addContent(aepTbody);
li.addContent(aepTable);
}
- if (display(additionalOpenPackages)) {
- String aopText = configuration.getText("doclet.Additional_Opened_Packages_Summary");
- String aopTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary",
- configuration.getText("doclet.Additional_Opened_Packages_Summary"),
+ if (display(indirectOpenPackages)) {
+ String aopText = configuration.getText("doclet.Indirect_Opens_Summary");
+ String aopTableSummary = configuration.getText("doclet.Indirect_Packages_Table_Summary",
+ configuration.getText("doclet.Indirect_Opens_Summary"),
configuration.getText("doclet.modules"),
configuration.getText("doclet.packages"));
Content aopTable = getTableHeader(aopText, aopTableSummary, HtmlStyle.packagesSummary,
- additionalPackagesTableHeader);
+ indirectPackagesTableHeader);
Content aopTbody = new HtmlTree(HtmlTag.TBODY);
- addAdditionalPackages(aopTbody, additionalOpenPackages);
+ addIndirectPackages(aopTbody, indirectOpenPackages);
aopTable.addContent(aopTbody);
li.addContent(aopTable);
}
@@ -734,14 +756,14 @@
}
/**
- * Add the additional packages for the module being documented.
+ * Add the indirect packages for the module being documented.
*
* @param tbody the content tree to which the table will be added
- * @param ap additional packages to be added
+ * @param ip indirect packages to be added
*/
- public void addAdditionalPackages(Content tbody, Map<ModuleElement, SortedSet<PackageElement>> ap) {
+ public void addIndirectPackages(Content tbody, Map<ModuleElement, SortedSet<PackageElement>> ip) {
boolean altColor = true;
- for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ap.entrySet()) {
+ for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ip.entrySet()) {
ModuleElement m = entry.getKey();
SortedSet<PackageElement> pkgList = entry.getValue();
Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
@@ -766,14 +788,31 @@
* {@inheritDoc}
*/
public void addServicesSummary(Content summaryContentTree) {
- if (display(uses) || display(provides)) {
+
+ boolean haveUses = displayServices(uses, usesTrees);
+ boolean haveProvides = displayServices(provides.keySet(), providesTrees);
+
+ if (haveProvides || haveUses) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
contents.navServices, li);
String text;
String tableSummary;
- if (display(uses)) {
+ if (haveProvides) {
+ text = configuration.getText("doclet.Provides_Summary");
+ tableSummary = configuration.getText("doclet.Member_Table_Summary",
+ configuration.getText("doclet.Provides_Summary"),
+ configuration.getText("doclet.types"));
+ Content table = getTableHeader(text, tableSummary, HtmlStyle.providesSummary, providesTableHeader);
+ Content tbody = new HtmlTree(HtmlTag.TBODY);
+ addProvidesList(tbody);
+ if (!tbody.isEmpty()) {
+ table.addContent(tbody);
+ li.addContent(table);
+ }
+ }
+ if (haveUses){
text = configuration.getText("doclet.Uses_Summary");
tableSummary = configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Uses_Summary"),
@@ -784,19 +823,6 @@
if (!tbody.isEmpty()) {
table.addContent(tbody);
li.addContent(table);
- }
- }
- if (display(provides)) {
- text = configuration.getText("doclet.Provides_Summary");
- tableSummary = configuration.getText("doclet.Member_Table_Summary",
- configuration.getText("doclet.Provides_Summary"),
- configuration.getText("doclet.types"));
- Content table = getTableHeader(text, tableSummary, HtmlStyle.providesSummary, providesTableHeader);
- Content tbody = new HtmlTree(HtmlTag.TBODY);
- addProvidesList(tbody);
- if (!tbody.isEmpty()) {
- table.addContent(tbody);
- li.addContent(table);
}
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
@@ -816,17 +842,13 @@
HtmlTree tdSummary;
Content description;
for (TypeElement t : uses) {
- // For each uses directive in the module declaration, if we are in the "api" mode and
- // if there are service types listed using @uses javadoc tag, check if the service type in
- // the uses directive is specified using the @uses tag. If not, we do not display the
- // service type in the "api" mode.
- if (moduleMode == ModuleMode.API && display(usesTrees) && !usesTrees.containsKey(t)) {
+ if (!displayServiceDirective(t, usesTrees)) {
continue;
}
typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t));
thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, typeLinkContent);
tdSummary = new HtmlTree(HtmlTag.TD);
- tdSummary.addStyle(HtmlStyle.colLast);
+ tdSummary.addStyle(HtmlStyle.colLast);
if (display(usesTrees)) {
description = usesTrees.get(t);
if (description != null) {
@@ -835,9 +857,9 @@
}
addSummaryComment(t, tdSummary);
HtmlTree tr = HtmlTree.TR(thType);
- tr.addContent(tdSummary);
- tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
- tbody.addContent(tr);
+ tr.addContent(tdSummary);
+ tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+ tbody.addContent(tr);
altColor = !altColor;
}
}
@@ -849,18 +871,13 @@
*/
public void addProvidesList(Content tbody) {
boolean altColor = true;
- TypeElement srv;
SortedSet<TypeElement> implSet;
Content description;
for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
- srv = entry.getKey();
- // For each provides directive in the module declaration, if we are in the "api" mode and
- // if there are service types listed using @provides javadoc tag, check if the service type in
- // the provides directive is specified using the @provides tag. If not, we do not display the
- // service type in the "api" mode.
- if (moduleMode == ModuleMode.API && display(providesTrees) && !providesTrees.containsKey(srv)) {
+ TypeElement srv = entry.getKey();
+ if (!displayServiceDirective(srv, providesTrees)) {
continue;
- }
+ }
implSet = entry.getValue();
Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
HtmlTree thType = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, srvLinkContent);
@@ -975,12 +992,12 @@
? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
: contents.navModuleDescription);
addNavGap(liNav);
- liNav.addContent((display(requires) || display(additionalModules))
+ liNav.addContent((display(requires) || display(indirectModules))
? getHyperLink(SectionName.MODULES, contents.navModules)
: contents.navModules);
addNavGap(liNav);
liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages)
- || display(additionalPackages) || display(additionalOpenPackages))
+ || display(indirectPackages) || display(indirectOpenPackages))
? getHyperLink(SectionName.PACKAGES, contents.navPackages)
: contents.navPackages);
addNavGap(liNav);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Mon Apr 24 21:34:23 2017 +0200
@@ -106,7 +106,7 @@
String desc = ch.getText(itt.getDescription());
String anchorName = htmlWriter.getName(tagText);
- Content result = HtmlTree.A_ID(anchorName, new StringContent(tagText));
+ Content result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
if (configuration.createindex && !tagText.isEmpty()) {
SearchIndexItem si = new SearchIndexItem();
si.setLabel(tagText);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java Mon Apr 24 21:34:23 2017 +0200
@@ -46,6 +46,7 @@
bottomNav,
circle,
classUseContainer,
+ colConstructorName,
colFirst,
colLast,
colSecond,
@@ -98,6 +99,7 @@
rightIframe,
rowColor,
searchTagLink,
+ searchTagResult,
seeLabel,
serializedFormContainer,
simpleTagLabel,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -265,6 +265,21 @@
}
/**
+ * Generates an HTML anchor tag with a style class, id attribute and a body.
+ *
+ * @param styleClass stylesheet class for the tag
+ * @param id id for the anchor tag
+ * @param body body for the anchor tag
+ * @return an HtmlTree object
+ */
+ public static HtmlTree A_ID(HtmlStyle styleClass, String id, Content body) {
+ HtmlTree htmltree = A_ID(id, body);
+ if (styleClass != null)
+ htmltree.addStyle(styleClass);
+ return htmltree;
+ }
+
+ /**
* Generates a CAPTION tag with some content.
*
* @param body content for the tag
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java Mon Apr 24 21:34:23 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
@@ -36,7 +36,6 @@
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
-import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes;
import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes;
@@ -88,7 +87,7 @@
/**
* Header for tables displaying modules and exported packages.
*/
- protected final List<String> additionalPackagesTableHeader;
+ protected final List<String> indirectPackagesTableHeader;
/**
* Header for tables displaying types and description.
@@ -136,18 +135,18 @@
packageTableHeader.add(resources.getText("doclet.Package"));
packageTableHeader.add(resources.getText("doclet.Description"));
requiresTableHeader = new ArrayList<>();
- requiresTableHeader.add(resources.getText("doclet.Modifier"));
+ requiresTableHeader.add(resources.getText("doclet.Modifier"));
requiresTableHeader.add(resources.getText("doclet.Module"));
requiresTableHeader.add(resources.getText("doclet.Description"));
exportedPackagesTableHeader = new ArrayList<>();
exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
if (configuration.docEnv.getModuleMode() == ModuleMode.ALL) {
- exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
+ exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
}
exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
- additionalPackagesTableHeader = new ArrayList<>();
- additionalPackagesTableHeader.add(resources.getText("doclet.Module"));
- additionalPackagesTableHeader.add(resources.getText("doclet.Packages"));
+ indirectPackagesTableHeader = new ArrayList<>();
+ indirectPackagesTableHeader.add(resources.getText("doclet.From"));
+ indirectPackagesTableHeader.add(resources.getText("doclet.Packages"));
usesTableHeader = new ArrayList<>();
usesTableHeader.add(resources.getText("doclet.Type"));
usesTableHeader.add(resources.getText("doclet.Description"));
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Apr 24 21:34:23 2017 +0200
@@ -6,6 +6,7 @@
doclet.Element=Element
doclet.Package=Package
doclet.Module=Module
+doclet.Open_Module=Open Module
doclet.All_Packages=All Packages
doclet.All_Modules=All Modules
doclet.None=None
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml Mon Apr 24 21:34:23 2017 +0200
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
- Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,8 @@
<ModuleDescription/>
<ModuleTags/>
<Summary>
+ <PackagesSummary/>
<ModulesSummary/>
- <PackagesSummary/>
<ServicesSummary/>
</Summary>
</Content>
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Mon Apr 24 21:34:23 2017 +0200
@@ -86,12 +86,13 @@
doclet.javafx_tag_misuse=Tags @propertyGetter, @propertySetter and @propertyDescription can only be used in JavaFX properties getters and setters.
doclet.Package_Summary=Package Summary
doclet.Requires_Summary=Requires
-doclet.Additional_Modules_Required_Summary=Additional Modules Required
-doclet.Additional_Exported_Packages_Summary=Additional Exported Packages
-doclet.Additional_Opened_Packages_Summary=Additional Opened Packages
-doclet.Exported_Packages_Summary=Exported Packages
-doclet.Opened_Packages_Summary=Opened Packages
-doclet.Concealed_Packages_Summary=Concealed Packages
+doclet.Indirect_Requires_Summary=Indirect Requires
+doclet.Indirect_Exports_Summary=Indirect Exports
+doclet.Indirect_Opens_Summary=Indirect Opens
+doclet.Exported_Packages_Summary=Exports
+doclet.Opened_Packages_Summary=Opens
+doclet.Concealed_Packages_Summary=Concealed
+doclet.From=From
doclet.Packages_Summary=Packages
doclet.Uses_Summary=Uses
doclet.Provides_Summary=Provides
@@ -160,7 +161,7 @@
doclet.Method_Detail=Method Detail
doclet.Constructor_Detail=Constructor Detail
doclet.Deprecated=Deprecated.
-doclet.DeprecatedForRemoval=Deprecated, for removal: This API element is subject to removal in a future version.
+doclet.DeprecatedForRemoval=Deprecated, for removal: This API element is subject to removal in a future version.
doclet.Hidden=Hidden
doclet.Groupname_already_used=In -group option, groupname already used: {0}
doclet.value_tag_invalid_reference={0} (referenced by @value tag) is an unknown reference.
@@ -171,7 +172,7 @@
doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
doclet.Constants_Table_Summary={0} table, listing constant fields, and values
doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
-doclet.Additional_Packages_Table_Summary={0} table, listing {1}, and {2}
+doclet.Indirect_Packages_Table_Summary={0} table, listing {1}, and {2}
doclet.fields=fields
doclet.Fields=Fields
doclet.properties=properties
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css Mon Apr 24 21:34:23 2017 +0200
@@ -42,15 +42,14 @@
text-decoration:none;
color:#353833;
}
-a[name]:before, a[name]:target {
+a[name]:before, a[name]:target, a[id]:before, a[id]:target {
content:"";
- display:block;
- height:120px;
- margin:-120px 0 0;
-}
-a[id]:before, a[id]:target {
+ display:inline-block;
+ position:relative;
padding-top:129px;
margin-top:-129px;
+}
+.searchTagResult:before, .searchTagResult:target {
color:red;
}
pre {
@@ -540,14 +539,14 @@
text-align:left;
padding:0px 0px 12px 10px;
}
-th.colFirst, th.colSecond, th.colLast, .useSummary th, .constantsSummary th, .packagesSummary th,
+th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .useSummary th, .constantsSummary th, .packagesSummary th,
td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td {
vertical-align:top;
padding-right:0px;
padding-top:8px;
padding-bottom:3px;
}
-th.colFirst, th.colSecond, th.colLast, .constantsSummary th, .packagesSummary th {
+th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .constantsSummary th, .packagesSummary th {
background:#dee3e9;
text-align:left;
padding:8px 3px 3px 7px;
@@ -556,7 +555,7 @@
white-space:nowrap;
font-size:13px;
}
-td.colSecond, th.colSecond, td.colLast, th.colLast {
+td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colLast {
font-size:13px;
}
.constantsSummary th, .packagesSummary th {
@@ -573,8 +572,8 @@
.usesSummary td.colFirst, .usesSummary th.colFirst,
.providesSummary td.colFirst, .providesSummary th.colFirst,
.memberSummary td.colFirst, .memberSummary th.colFirst,
-.memberSummary td.colSecond, .memberSummary th.colSecond,
-.typeSummary td.colFirst{
+.memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,
+.typeSummary td.colFirst {
vertical-align:top;
}
.packagesSummary th.colLast, .packagesSummary td.colLast {
@@ -584,6 +583,8 @@
td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover,
th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover,
th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover,
+th.colConstructorName a:link, th.colConstructorName a:active, th.colConstructorName a:visited,
+th.colConstructorName a:hover,
td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover,
.constantValuesContainer td a:link, .constantValuesContainer td a:active,
.constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/JavaScriptScanner.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/JavaScriptScanner.java Mon Apr 24 21:34:23 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
@@ -95,7 +95,7 @@
case "datasrc": case "for": case "href": case "longdesc": case "profile":
case "src": case "usemap":
List<? extends DocTree> value = tree.getValue();
- if (!value.isEmpty() && value.get(0).getKind() == Kind.TEXT) {
+ if (value != null && !value.isEmpty() && value.get(0).getKind() == Kind.TEXT) {
String v = value.get(0).toString().trim().toLowerCase(Locale.ENGLISH);
if (v.startsWith("javascript:")) {
f.accept(getCurrentPath());
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Mon Apr 24 21:34:23 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
@@ -267,7 +267,17 @@
// compiler/runtime init option values
private static class Options {
- private Map<OptionKind, List<String>> optMap = new HashMap<>();
+ private final Map<OptionKind, List<String>> optMap;
+
+ // New blank Options
+ Options() {
+ optMap = new HashMap<>();
+ }
+
+ // Options as a copy
+ private Options(Options opts) {
+ optMap = new HashMap<>(opts.optMap);
+ }
private String[] selectOptions(Predicate<Entry<OptionKind, List<String>>> pred) {
return optMap.entrySet().stream()
@@ -293,17 +303,20 @@
.addAll(vals);
}
- void override(Options newer) {
+ // return a new Options, with parameter options overriding receiver options
+ Options override(Options newer) {
+ Options result = new Options(this);
newer.optMap.entrySet().stream()
.forEach(e -> {
if (e.getKey().onlyOne) {
// Only one allowed, override last
- optMap.put(e.getKey(), e.getValue());
+ result.optMap.put(e.getKey(), e.getValue());
} else {
// Additive
- addAll(e.getKey(), e.getValue());
+ result.addAll(e.getKey(), e.getValue());
}
});
+ return result;
}
}
@@ -874,7 +887,14 @@
// initialize editor settings
configEditor();
// initialize JShell instance
- resetState();
+ try {
+ resetState();
+ } catch (IllegalStateException ex) {
+ // Display just the cause (not a exception backtrace)
+ cmderr.println(ex.getMessage());
+ //abort
+ return;
+ }
// Read replay history from last jshell session into previous history
replayableHistoryPrevious = ReplayableHistory.fromPrevious(prefs);
// load snippet/command files given on command-line
@@ -1440,7 +1460,7 @@
: c.command) + " ")
.toArray(String[]::new))
.completionSuggestions(code, cursor, anchor);
- } else if (code.startsWith("/se")) {
+ } else if (code.startsWith("/se") || code.startsWith("se")) {
result = new FixedCompletionProvider(SET_SUBCOMMANDS)
.completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor);
} else {
@@ -2570,15 +2590,17 @@
}
private boolean cmdReset(String rawargs) {
+ Options oldOptions = rawargs.trim().isEmpty()? null : options;
if (!parseCommandLineLikeFlags(rawargs, new OptionParserBase())) {
return false;
}
live = false;
fluffmsg("jshell.msg.resetting.state");
- return true;
+ return doReload(null, false, oldOptions);
}
private boolean cmdReload(String rawargs) {
+ Options oldOptions = rawargs.trim().isEmpty()? null : options;
OptionParserReload ap = new OptionParserReload();
if (!parseCommandLineLikeFlags(rawargs, ap)) {
return false;
@@ -2595,7 +2617,7 @@
history = replayableHistory;
fluffmsg("jshell.err.reload.restarting.state");
}
- boolean success = doReload(history, !ap.quiet());
+ boolean success = doReload(history, !ap.quiet(), oldOptions);
if (success && ap.restore()) {
// if we are restoring from previous, then if nothing was added
// before time of exit, there is nothing to save
@@ -2622,17 +2644,32 @@
}
return false;
}
+ Options oldOptions = options;
if (!parseCommandLineLikeFlags(rawargs, new OptionParserBase())) {
return false;
}
fluffmsg("jshell.msg.set.restore");
- return doReload(replayableHistory, false);
+ return doReload(replayableHistory, false, oldOptions);
}
- private boolean doReload(ReplayableHistory history, boolean echo) {
- resetState();
- run(new ReloadIOContext(history.iterable(),
- echo ? cmdout : null));
+ private boolean doReload(ReplayableHistory history, boolean echo, Options oldOptions) {
+ if (oldOptions != null) {
+ try {
+ resetState();
+ } catch (IllegalStateException ex) {
+ currentNameSpace = mainNamespace; // back out of start-up (messages)
+ errormsg("jshell.err.restart.failed", ex.getMessage());
+ // attempt recovery to previous option settings
+ options = oldOptions;
+ resetState();
+ }
+ } else {
+ resetState();
+ }
+ if (history != null) {
+ run(new ReloadIOContext(history.iterable(),
+ echo ? cmdout : null));
+ }
return true;
}
@@ -2648,7 +2685,7 @@
errormsg("jshell.err.unexpected.at.end", ap.nonOptions(), rawargs);
return false;
}
- options.override(opts);
+ options = options.override(opts);
return true;
}
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties Mon Apr 24 21:34:23 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
@@ -77,6 +77,9 @@
jshell.err.reload.restarting.previous.state = Restarting and restoring from previous state.
jshell.err.reload.restarting.state = Restarting and restoring state.
+jshell.err.restart.failed = Restart failed: {0}\n\n\
+Reverting to previous settings and restarting...
+
jshell.msg.vars.not.active = (not-active)
jshell.err.out.of.range = Out of range
@@ -261,7 +264,7 @@
/save -history <file>\n\t\
Save the sequential history of all commands and snippets entered since jshell was launched.\n\n\
/save -start <file>\n\t\
- Save the default start-up definitions to the file.
+ Save the current start-up definitions to the file.
help.open.summary = open a file as source input
help.open.args = <file>
@@ -500,11 +503,11 @@
Shift-<tab> v\n\t\t\
After a complete expression, hold down <shift> while pressing <tab>,\n\t\t\
then release and press "v", the expression will be converted to\n\t\t\
- a variable declaration whose type is based on the type of the expression.\n\t\t\
+ a variable declaration whose type is based on the type of the expression.\n\n\
Shift-<tab> i\n\t\t\
After an unresolvable identifier, hold down <shift> while pressing <tab>,\n\t\t\
then release and press "i", and jshell will propose possible imports\n\t\t\
- which will resolve the identifier based on the content of the specified classpath.\n\t\t\
+ which will resolve the identifier based on the content of the specified classpath.
help.context.summary = the evaluation context options for /env /reload and /reset
help.context =\
@@ -928,5 +931,5 @@
/set format silent display '' \n
jshell.fix.wrong.shortcut =\
-Invalid <fix> character. Use "i" for auto-import or "v" for variable creation. For more information see:\n\
+Unexpected character after Shift-Tab. Use "i" for auto-import or "v" for variable creation. For more information see:\n\
/help shortcuts
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/FailOverExecutionControlProvider.java Mon Apr 24 21:34:23 2017 +0200
@@ -133,7 +133,10 @@
private Logger logger() {
if (logger == null) {
logger = Logger.getLogger("jdk.jshell.execution");
- logger.setLevel(Level.ALL);
+ if (logger.getLevel() == null) {
+ // Logging has not been specifically requested, turn it off
+ logger.setLevel(Level.OFF);
+ }
}
return logger;
}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiInitiator.java Mon Apr 24 21:34:23 2017 +0200
@@ -26,6 +26,8 @@
import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -146,6 +148,9 @@
*/
private VirtualMachine listenTarget(int port, List<String> remoteVMOptions) {
ListeningConnector listener = (ListeningConnector) connector;
+ // Files to collection to output of a start-up failure
+ File crashErrorFile = createTempFile("error");
+ File crashOutputFile = createTempFile("output");
try {
// Start listening, get the JDI connection address
String addr = listener.startListening(connectorArgs);
@@ -163,23 +168,57 @@
args.add(remoteAgent);
args.add("" + port);
ProcessBuilder pb = new ProcessBuilder(args);
+ pb.redirectError(crashErrorFile);
+ pb.redirectOutput(crashOutputFile);
process = pb.start();
// Accept the connection from the remote agent
vm = timedVirtualMachineCreation(() -> listener.accept(connectorArgs),
() -> process.waitFor());
+ try {
+ listener.stopListening(connectorArgs);
+ } catch (IOException | IllegalConnectorArgumentsException ex) {
+ // ignore
+ }
+ crashErrorFile.delete();
+ crashOutputFile.delete();
return vm;
} catch (Throwable ex) {
if (process != null) {
process.destroyForcibly();
}
- throw reportLaunchFail(ex, "listen");
- } finally {
try {
listener.stopListening(connectorArgs);
- } catch (IOException | IllegalConnectorArgumentsException ex) {
+ } catch (IOException | IllegalConnectorArgumentsException iex) {
// ignore
}
+ String text = readFile(crashErrorFile) + readFile(crashOutputFile);
+ crashErrorFile.delete();
+ crashOutputFile.delete();
+ if (text.isEmpty()) {
+ throw reportLaunchFail(ex, "listen");
+ } else {
+ throw new IllegalArgumentException(text);
+ }
+ }
+ }
+
+ private File createTempFile(String label) {
+ try {
+ File f = File.createTempFile("remote", label);
+ f.deleteOnExit();
+ return f;
+ } catch (IOException ex) {
+ throw new InternalError("Failed create temp ", ex);
+ }
+ }
+
+ private String readFile(File f) {
+ try {
+ return new String(Files.readAllBytes(f.toPath()),
+ StandardCharsets.UTF_8);
+ } catch (IOException ex) {
+ return "error reading " + f + " : " + ex.toString();
}
}
--- a/langtools/test/ProblemList.txt Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/ProblemList.txt Mon Apr 24 21:34:23 2017 +0200
@@ -54,7 +54,7 @@
tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java 8057687 generic-all emit correct byte code an attributes for type annotations
tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations
tools/javac/modules/T8159439/NPEForModuleInfoWithNonZeroSuperClassTest.java 8160396 generic-all current version of jtreg needs a new promotion to include lastes version of ASM
-tools/javac/platform/PlatformProviderTest.java 8176801 generic-all fails due to warnings printed to stderr
+tools/javac/lambda/speculative/T8177933.java 8178437 generic-all intermittently fails due to stack randomization
###########################################################################
#
--- a/langtools/test/TEST.ROOT Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/TEST.ROOT Mon Apr 24 21:34:23 2017 +0200
@@ -14,8 +14,8 @@
# Group definitions
groups=TEST.groups
-# Tests using jtreg 4.2 b05 features
-requiredVersion=4.2 b05
+# Tests using jtreg 4.2 b07 features
+requiredVersion=4.2 b07
# Use new module options
useNewOptions=true
--- a/langtools/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,8 +23,6 @@
package taglets;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import com.sun.javadoc.*;
--- a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,8 +23,6 @@
package testtaglets;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import com.sun.javadoc.*;
--- a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,8 +23,6 @@
package testtaglets;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import com.sun.javadoc.*;
--- a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,8 +23,6 @@
package testtaglets;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import com.sun.javadoc.*;
--- a/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,8 +23,6 @@
package taglets;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import com.sun.javadoc.*;
--- a/langtools/test/jdk/javadoc/doclet/lib/JavadocTester.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/lib/JavadocTester.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
/**
@@ -237,12 +238,23 @@
* @throws Exception if any errors occurred
*/
public void runTests() throws Exception {
+ runTests(m -> new Object[0]);
+ }
+
+ /**
+ * Run all methods annotated with @Test, followed by printSummary.
+ * Typically called on a tester object in main()
+ * @param f a function which will be used to provide arguments to each
+ * invoked method
+ * @throws Exception if any errors occurred
+ */
+ public void runTests(Function<Method, Object[]> f) throws Exception {
for (Method m: getClass().getDeclaredMethods()) {
Annotation a = m.getAnnotation(Test.class);
if (a != null) {
try {
out.println("Running test " + m.getName());
- m.invoke(this, new Object[] { });
+ m.invoke(this, f.apply(m));
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
throw (cause instanceof Exception) ? ((Exception) cause) : e;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testBadHtml/TestBadHtml.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8176901
+ * @summary The doclet should cope with bad HTML form
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestBadHtml
+ */
+
+public class TestBadHtml extends JavadocTester {
+
+ public static void main(String... args) throws Exception {
+ TestBadHtml tester = new TestBadHtml();
+ tester.runTests();
+ }
+
+ @Test
+ void testNegative() {
+ javadoc("-d", "out1",
+ "-sourcepath", testSrc,
+ "pkg1");
+
+ checkExit(Exit.ERROR);
+
+ checkOutput(Output.STDERR, false, "NullPointerException");
+ checkOutput(Output.OUT, false, "NullPointerException");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java Mon Apr 24 21:34:23 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 pkg1;
+
+/**
+ * The first sentence.
+ * <parameters the word action is crucial here object>
+ * <parameters the word cite is crucial here object>
+ * <parameters the word classid is crucial here object>
+ * <parameters the word codebase is crucial here object>
+ * <parameters the word data is crucial here object>
+ * <parameters the word datasrc is crucial here object>
+ * <parameters the word for is crucial here object>
+ * <parameters the word href is crucial here object>
+ * <parameters the word longdesc is crucial here object>
+ * <parameters the word profile is crucial here object>
+ * <parameters the word src is crucial here object>
+ * <parameters the word usemap is crucial here object>
+ */
+
+public class A {}
--- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4927552 8026567 8071982 8162674 8175200
+ * @bug 4927552 8026567 8071982 8162674 8175200 8175218
* @summary <DESC>
* @author jamieh
* @library ../lib
@@ -81,16 +81,16 @@
+ "extends java.lang.Object</pre>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public int field</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> </div>",
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public DeprecatedClassByAnnotation​()</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> </div>",
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> </div>",
"<pre>@Deprecated\n"
+ "public void method​()</pre>\n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>");
checkOutput("pkg/TestAnnotationType.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
+ "<div class=\"block\"><span class=\"deprecationComment\">annotation_test1 passes.</span></div>\n"
+ "</div>\n"
+ "<br>\n"
@@ -100,16 +100,16 @@
"<pre>@Deprecated(forRemoval=true)\n"
+ "static final int field</pre>\n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This "
- + "API element is subject to removal in a future version. </span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
+ + "API element is subject to removal in a future version.</span> <span class=\"deprecationComment\">annotation_test4 passes.</span></div>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "int required</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> "
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
+ "<span class=\"deprecationComment\">annotation_test3 passes.</span></div>",
"<pre>java.lang.String optional</pre>\n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">annotation_test2 passes.</span></div>");
checkOutput("pkg/TestClass.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
+ "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes.</span></div>\n"
+ "</div>\n"
+ "<br>\n"
@@ -118,11 +118,11 @@
+ "extends java.lang.Object</pre>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public TestClass​()</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> "
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
+ "<span class=\"deprecationComment\">class_test3 passes.</span></div>");
checkOutput("pkg/TestEnum.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
+ "<div class=\"block\"><span class=\"deprecationComment\">enum_test1 passes.</span></div>\n"
+ "</div>\n"
+ "<br>\n"
@@ -131,11 +131,11 @@
+ "extends java.lang.Enum<<a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a>></pre>",
"<pre>@Deprecated(forRemoval=true)\n"
+ "public static final <a href=\"../pkg/TestEnum.html\" title=\"enum in pkg\">TestEnum</a> FOR_REMOVAL</pre>\n"
- + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> "
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> "
+ "<span class=\"deprecationComment\">enum_test3 passes.</span></div>");
checkOutput("pkg/TestError.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
+ "<div class=\"block\"><span class=\"deprecationComment\">error_test1 passes.</span></div>\n"
+ "</div>\n"
+ "<br>\n"
@@ -144,7 +144,7 @@
+ "extends java.lang.Error</pre>");
checkOutput("pkg/TestException.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
+ "<div class=\"block\"><span class=\"deprecationComment\">exception_test1 passes.</span></div>\n"
+ "</div>\n"
+ "<br>\n"
@@ -153,7 +153,7 @@
+ "extends java.lang.Exception</pre>");
checkOutput("pkg/TestInterface.html", true,
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version. </span> \n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated, for removal: This API element is subject to removal in a future version.</span> \n"
+ "<div class=\"block\"><span class=\"deprecationComment\">interface_test1 passes.</span></div>\n"
+ "</div>\n"
+ "<br>\n"
--- a/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200
+ * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417
* @summary Test the case where the overriden method returns a different
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
@@ -43,7 +43,7 @@
@Test
void test() {
- javadoc("-d", "out",
+ javadoc("-d", "out", "-private",
"-sourcepath", testSrc,
"pkg","pkg2");
checkExit(Exit.OK);
@@ -55,7 +55,15 @@
+ "returnTypeTest</a></span>​()</code>",
// Check return type in member detail.
"<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
- + "PublicChild</a> returnTypeTest​()</pre>");
+ + "PublicChild</a> returnTypeTest​()</pre>",
+ "<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ + "<a href=\"../pkg/PublicChild.html#PublicChild--\">PublicChild</a></span>​()</code></th>");
+
+ checkOutput("pkg/PrivateParent.html", true,
+ "<td class=\"colFirst\"><code>private </code></td>\n"
+ + "<th class=\"colConstructorName\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ + "<a href=\"../pkg/PrivateParent.html#PrivateParent-int-\">PrivateParent</a></span>​(int i)</code>"
+ + "</th>");
// Legacy anchor dimensions (6290760)
checkOutput("pkg2/A.html", true,
--- a/langtools/test/jdk/javadoc/doclet/testMemberSummary/pkg/PrivateParent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/testMemberSummary/pkg/PrivateParent.java Mon Apr 24 21:34:23 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
@@ -24,6 +24,12 @@
package pkg;
class PrivateParent {
+ /**
+ * Test private constructor.
+ * @param i a test parameter.
+ */
+ private PrivateParent(int i) {
+ }
/**
* Test to make sure the member summary inherits documentation
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModuleServices.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,314 @@
+/*
+ * 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 8178067
+ * @summary tests the module's services, such as provides and uses
+ * @modules jdk.javadoc/jdk.javadoc.internal.api
+ * jdk.javadoc/jdk.javadoc.internal.tool
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * @library ../lib /tools/lib
+ * @build toolbox.ToolBox toolbox.ModuleBuilder JavadocTester
+ * @run main TestModuleServices
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.*;
+
+public class TestModuleServices extends JavadocTester {
+
+ public final ToolBox tb;
+ public static void main(String... args) throws Exception {
+ TestModuleServices tester = new TestModuleServices();
+ tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
+ }
+
+ public TestModuleServices() {
+ tb = new ToolBox();
+ }
+
+ @Test
+ public void checkUsesNoApiTagModuleModeDefault(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .comment("module m.\n@provides p1.A abc") // bogus tag
+ .uses("p1.A")
+ .uses("p1.B")
+ .exports("p1")
+ .classes("package p1; public class A {}")
+ .classes("package p1; public class B {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", false,
+ "<h3>Services</h3>");
+ }
+
+ @Test
+ public void checkUsesNoApiTagModuleModeAll(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .uses("p1.A")
+ .uses("p1.B")
+ .exports("p1")
+ .classes("package p1; public class A {}")
+ .classes("package p1; public class B {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--show-module-contents", "all",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", true,
+ "<h3>Services</h3>");
+
+ checkOutput("m-summary.html", true,
+ "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
+ "<caption><span>Uses</span><span class=\"tabEnd\"> </span></caption>\n" +
+ "<tr>\n" +
+ "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
+ "</tr>\n" +
+ "<tbody>\n" +
+ "<tr class=\"altColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"class in p1\">A</a></th>\n" +
+ "<td class=\"colLast\"> </td>\n" +
+ "</tr>\n" +
+ "<tr class=\"rowColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/B.html\" title=\"class in p1\">B</a></th>\n" +
+ "<td class=\"colLast\"> </td>\n" +
+ "</tr>\n" +
+ "</tbody>\n" +
+ "</table>\n");
+ }
+
+ @Test
+ public void checkUsesWithApiTagModuleModeDefault(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .comment("module m.\n@uses p1.A")
+ .uses("p1.A")
+ .uses("p1.B")
+ .exports("p1")
+ .classes("package p1; public class A {}")
+ .classes("package p1; public class B {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", true,
+ "<h3>Services</h3>");
+
+ checkOutput("m-summary.html", true,
+ "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
+ "<caption><span>Uses</span><span class=\"tabEnd\"> </span></caption>\n" +
+ "<tr>\n" +
+ "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
+ "</tr>\n" +
+ "<tbody>\n" +
+ "<tr class=\"altColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"class in p1\">A</a></th>\n" +
+ "<td class=\"colLast\"> </td>\n" +
+ "</tr>\n" +
+ "</tbody>\n" +
+ "</table>\n");
+ }
+
+ @Test
+ public void checkProvidesNoApiTagModuleModeDefault(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .comment("module m.\n@uses p1.A")
+ .provides("p1.A", "p1.B")
+ .exports("p1")
+ .classes("package p1; public interface A {}")
+ .classes("package p1; public class B implements A {}")
+ .provides("p2.A", "p2.B")
+ .exports("p2")
+ .classes("package p2; public interface A {}")
+ .classes("package p2; public class B implements A {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", false,
+ "<h3>Services</h3>");
+ }
+
+ @Test
+ public void checkProvidesNoApiTagModuleModeAll(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .comment("module m.\n@uses p1.A") // bogus uses tag
+ .provides("p1.A", "p1.B")
+ .exports("p1")
+ .classes("package p1; public interface A {}")
+ .classes("package p1; public class B implements A {}")
+ .provides("p2.A", "p2.B")
+ .exports("p2")
+ .classes("package p2; public interface A {}")
+ .classes("package p2; public class B implements A {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--show-module-contents", "all",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", true,
+ "<h3>Services</h3>");
+
+ checkOutput("m-summary.html", true,
+ "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
+ "<caption><span>Provides</span><span class=\"tabEnd\"> </span></caption>\n" +
+ "<tr>\n" +
+ "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
+ "</tr>\n" +
+ "<tbody>\n" +
+ "<tr class=\"altColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
+ "<td class=\"colLast\"> <br>(<span class=\"implementationLabel\">Implementation(s):</span> <a href=\"p1/B.html\" title=\"class in p1\">B</a>)</td>\n" +
+ "</tr>\n" +
+ "<tr class=\"rowColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p2/A.html\" title=\"interface in p2\">A</a></th>\n" +
+ "<td class=\"colLast\"> <br>(<span class=\"implementationLabel\">Implementation(s):</span> <a href=\"p2/B.html\" title=\"class in p2\">B</a>)</td>\n" +
+ "</tr>\n" +
+ "</tbody>\n");
+ }
+
+ @Test
+ public void checkProvidesWithApiTagModuleModeDefault(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .comment("module m.\n@provides p1.A abc")
+ .provides("p1.A", "p1.B")
+ .exports("p1")
+ .classes("package p1; public interface A {}")
+ .classes("package p1; public class B implements A {}")
+ .provides("p2.A", "p2.B")
+ .exports("p2")
+ .classes("package p2; public interface A {}")
+ .classes("package p2; public class B implements A {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", true,
+ "<h3>Services</h3>");
+
+ checkOutput("m-summary.html", true,
+ "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
+ "<caption><span>Provides</span><span class=\"tabEnd\"> </span></caption>\n" +
+ "<tr>\n" +
+ "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
+ "</tr>\n" +
+ "<tbody>\n" +
+ "<tr class=\"altColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
+ "<td class=\"colLast\">abc </td>\n" +
+ "</tr>\n" +
+ "</tbody>\n" +
+ "</table>\n");
+ }
+
+ @Test
+ public void checkUsesProvidesWithApiTagsModeDefault(Path base) throws Exception {
+ ModuleBuilder mb = new ModuleBuilder(tb, "m")
+ .comment("module m.\n@provides p1.A abc\n@uses p2.B def")
+ .provides("p1.A", "p1.B")
+ .exports("p1")
+ .classes("package p1; public interface A {}")
+ .classes("package p1; public class B implements A {}")
+ .provides("p2.A", "p2.B")
+ .uses("p2.B")
+ .exports("p2")
+ .classes("package p2; public interface A {}")
+ .classes("package p2; public class B implements A {}");
+ mb.write(base);
+
+ javadoc("-d", base.toString() + "/out",
+ "-quiet",
+ "--module-source-path", base.toString(),
+ "--module", "m");
+
+ checkExit(Exit.OK);
+
+ checkOutput("m-summary.html", true,
+ "<h3>Services</h3>");
+
+ checkOutput("m-summary.html", true,
+ "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
+ "<caption><span>Provides</span><span class=\"tabEnd\"> </span></caption>\n" +
+ "<tr>\n" +
+ "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
+ "</tr>\n" +
+ "<tbody>\n" +
+ "<tr class=\"altColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
+ "<td class=\"colLast\">abc </td>\n" +
+ "</tr>\n" +
+ "</tbody>\n" +
+ "</table>",
+ "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
+ "<caption><span>Uses</span><span class=\"tabEnd\"> </span></caption>\n" +
+ "<tr>\n" +
+ "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
+ "</tr>\n" +
+ "<tbody>\n" +
+ "<tr class=\"altColor\">\n" +
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"p2/B.html\" title=\"class in p2\">B</a></th>\n" +
+ "<td class=\"colLast\">def </td>\n" +
+ "</tr>\n" +
+ "</tbody>\n" +
+ "</table>\n");
+ }
+
+}
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
- * 8168766 8168688 8162674 8160196 8175799 8174974 8176778
+ * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -270,6 +270,32 @@
checkModuleModeAll(true);
}
+ /**
+ * Test generated module summary page of a module with no exported package.
+ */
+ @Test
+ void testModuleSummaryNoExportedPkgAll() {
+ javadoc("-d", "out-ModuleSummaryNoExportedPkgAll", "-use", "--show-module-contents=all",
+ "-sourcepath", testSrc + "/moduleNoExport",
+ "--module", "moduleNoExport",
+ "testpkgmdlNoExport");
+ checkExit(Exit.OK);
+ checkModuleSummaryNoExported(true);
+ }
+
+ /**
+ * Test generated module summary page of a module with no exported package.
+ */
+ @Test
+ void testModuleSummaryNoExportedPkgApi() {
+ javadoc("-d", "out-ModuleSummaryNoExportedPkgApi", "-use",
+ "-sourcepath", testSrc + "/moduleNoExport",
+ "--module", "moduleNoExport",
+ "testpkgmdlNoExport");
+ checkExit(Exit.OK);
+ checkModuleSummaryNoExported(false);
+ }
+
void checkDescription(boolean found) {
checkOutput("moduleA-summary.html", found,
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -277,14 +303,14 @@
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\">This is a test description for the moduleA module. Search "
- + "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
+ + "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
checkOutput("moduleB-summary.html", found,
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
+ "<a name=\"module.description\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\">This is a test description for the moduleB module. Search "
- + "word <a id=\"search_word\">search_word</a> with no description.</div>");
+ + "word <a id=\"search_word\" class=\"searchTagResult\">search_word</a> with no description.</div>");
checkOutput("overview-summary.html", found,
"</script>\n"
+ "<div class=\"contentContainer\">\n"
@@ -311,7 +337,7 @@
+ "<li class=\"blockList\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
- + "<!-- ============ MODULES SUMMARY =========== -->");
+ + "<!-- ============ PACKAGES SUMMARY =========== -->");
checkOutput("moduleB-summary.html", found,
"<div class=\"contentContainer\">\n"
+ "<ul class=\"blockList\">\n"
@@ -325,7 +351,7 @@
checkOutput("moduleA-summary.html", found,
"<section role=\"region\">\n"
+ "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
- + " This API element is subject to removal in a future version. </span>\n"
+ + " This API element is subject to removal in a future version.</span>\n"
+ "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
+ "</div>\n"
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -333,7 +359,7 @@
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\">This is a test description for the moduleA module. Search "
- + "phrase <a id=\"searchphrase\">search phrase</a>.</div>");
+ + "phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>.</div>");
checkOutput("moduleB-summary.html", found,
"<section role=\"region\">\n"
+ "<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -341,7 +367,7 @@
+ "<!-- -->\n"
+ "</a>\n"
+ "<div class=\"block\">This is a test description for the moduleB module. Search "
- + "word <a id=\"search_word\">search_word</a> with no description.</div>");
+ + "word <a id=\"search_word\" class=\"searchTagResult\">search_word</a> with no description.</div>");
checkOutput("overview-summary.html", found,
"</nav>\n"
+ "</header>\n"
@@ -372,7 +398,7 @@
+ "<li class=\"blockList\">\n"
+ "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
- + "<!-- ============ MODULES SUMMARY =========== -->");
+ + "<!-- ============ PACKAGES SUMMARY =========== -->");
checkOutput("moduleB-summary.html", found,
"<div class=\"contentContainer\">\n"
+ "<ul class=\"blockList\">\n"
@@ -591,11 +617,7 @@
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
+ "<td class=\"colLast\">With a test description for uses. </td>\n"
+ "</tr>",
- "<tr class=\"altColor\">\n"
- + "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkg2mdlB/TestInterface2InModuleB.html\" title=\"interface in testpkg2mdlB\">TestInterface2InModuleB</a></th>\n"
- + "<td class=\"colLast\"> </td>\n"
- + "</tr>",
- "<caption><span>Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<caption><span>Opens</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
@@ -618,7 +640,7 @@
+ "<h1 title=\"Module\" class=\"title\">Module moduleT</h1>\n"
+ "</div>",
"<div class=\"block\">This is a test description for the moduleT module. "
- + "Search phrase <a id=\"searchphrase\">search phrase</a>. "
+ + "Search phrase <a id=\"searchphrase\" class=\"searchTagResult\">search phrase</a>. "
+ "Make sure there are no exported packages.</div>",
"<tbody>\n"
+ "<tr class=\"altColor\">\n"
@@ -730,17 +752,12 @@
checkOutput("moduleA-summary.html", true,
"<li><a href=\"#module.description\">Description</a> | <a href=\"#modules.summary\">"
+ "Modules</a> | <a href=\"#packages.summary\">Packages</a> | Services</li>",
- "<td class=\"colFirst\">transitive</td>\n"
- + "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
- + "<td class=\"colLast\">\n"
- + "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
- + "</td>",
- "<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
- + "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\"> </span></caption>",
- "<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
- + "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<table class=\"packagesSummary\" summary=\"Indirect Exports table, listing modules, and packages\">\n"
+ + "<caption><span>Indirect Exports</span><span class=\"tabEnd\"> </span></caption>",
+ "<table class=\"packagesSummary\" summary=\"Indirect Opens table, listing modules, and packages\">\n"
+ + "<caption><span>Indirect Opens</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
- + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+ + "<th class=\"colFirst\" scope=\"col\">From</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+ "</tr>\n",
"<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
@@ -751,15 +768,15 @@
checkOutput("moduletags-summary.html", true,
"<li><a href=\"#module.description\">Description</a> | <a href=\"#modules.summary\">Modules"
+ "</a> | <a href=\"#packages.summary\">Packages</a> | Services</li>",
- "<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
- + "<caption><span>Additional Modules Required</span><span class=\"tabEnd\"> </span></caption>",
+ "<table class=\"requiresSummary\" summary=\"Indirect Requires table, listing modules, and an explanation\">\n"
+ + "<caption><span>Indirect Requires</span><span class=\"tabEnd\"> </span></caption>",
"<td class=\"colFirst\">transitive</td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">This is a test description for the moduleB module.</div>\n"
+ "</td>",
- "<table class=\"packagesSummary\" summary=\"Additional Exported Packages table, listing modules, and packages\">\n"
- + "<caption><span>Additional Exported Packages</span><span class=\"tabEnd\"> </span></caption>",
+ "<table class=\"packagesSummary\" summary=\"Indirect Exports table, listing modules, and packages\">\n"
+ + "<caption><span>Indirect Exports</span><span class=\"tabEnd\"> </span></caption>",
"<td class=\"colFirst\">transitive static</td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><a href=\"moduleA-summary.html\">moduleA</a></th>\n"
+ "<td class=\"colLast\">\n"
@@ -771,16 +788,16 @@
+ "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
- "<table class=\"requiresSummary\" summary=\"Additional Modules Required table, listing modules, and an explanation\">\n"
- + "<caption><span>Additional Modules Required</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<table class=\"requiresSummary\" summary=\"Indirect Requires table, listing modules, and an explanation\">\n"
+ + "<caption><span>Indirect Requires</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Modifier</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
- "<table class=\"packagesSummary\" summary=\"Additional Opened Packages table, listing modules, and packages\">\n"
- + "<caption><span>Additional Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<table class=\"packagesSummary\" summary=\"Indirect Opens table, listing modules, and packages\">\n"
+ + "<caption><span>Indirect Opens</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
- + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
+ + "<th class=\"colFirst\" scope=\"col\">From</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Packages</th>\n"
+ "</tr>\n",
"<th class=\"colFirst\" scope=\"row\"><a href=\"moduleB-summary.html\">moduleB</a></th>\n"
@@ -797,7 +814,7 @@
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></th>\n"
+ "<td class=\"colLast\"> </td>",
"<table class=\"packagesSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
- + "<caption><span>Opened Packages</span><span class=\"tabEnd\"> </span></caption>\n"
+ + "<caption><span>Opens</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n"
@@ -830,9 +847,9 @@
+ "<td class=\"colSecond\">All Modules</td>\n"
+ "<td class=\"colLast\"> </td>",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\"> </span></span>"
- + "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(1);\">Exported Packages</a></span>"
+ + "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(1);\">Exports</a></span>"
+ "<span class=\"tabEnd\"> </span></span><span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:showPkgs(4);\">"
- + "Concealed Packages</a></span><span class=\"tabEnd\"> </span></span></caption>",
+ + "Concealed</a></span><span class=\"tabEnd\"> </span></span></caption>",
"<th class=\"colFirst\" scope=\"row\"><a href=\"concealedpkgmdlA/package-summary.html\">concealedpkgmdlA</a></th>\n"
+ "<td class=\"colSecond\">None</td>\n"
+ "<td class=\"colLast\"> </td>");
@@ -854,10 +871,10 @@
+ "<td class=\"colLast\"> <br>(<span class=\"implementationLabel\">Implementation(s):</span> <a href=\"testpkgmdlB/TestClassInModuleB.html\" "
+ "title=\"class in testpkgmdlB\">TestClassInModuleB</a>)</td>",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Packages</span><span class=\"tabEnd\"> </span></span><span id=\"t1\" class=\"tableTab\"><span>"
- + "<a href=\"javascript:showPkgs(1);\">Exported Packages</a></span><span class=\"tabEnd\"> </span></span><span id=\"t2\" class=\"tableTab\"><span>"
- + "<a href=\"javascript:showPkgs(2);\">Opened Packages</a></span><span class=\"tabEnd\"> </span></span></caption>");
+ + "<a href=\"javascript:showPkgs(1);\">Exports</a></span><span class=\"tabEnd\"> </span></span><span id=\"t2\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:showPkgs(2);\">Opens</a></span><span class=\"tabEnd\"> </span></span></caption>");
checkOutput("moduleC-summary.html", found,
- "<caption><span>Exported Packages</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<caption><span>Exports</span><span class=\"tabEnd\"> </span></caption>\n"
+ "<tr>\n"
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colSecond\" scope=\"col\">Module</th>\n"
@@ -872,7 +889,7 @@
void checkModuleDeprecation(boolean found) {
checkOutput("moduleA-summary.html", found,
"<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated, for removal:"
- + " This API element is subject to removal in a future version. </span>\n"
+ + " This API element is subject to removal in a future version.</span>\n"
+ "<div class=\"block\"><span class=\"deprecationComment\">This module is deprecated.</span></div>\n"
+ "</div>");
checkOutput("deprecated-list.html", found,
@@ -910,4 +927,13 @@
checkOutput("index.html", found,
"<iframe src=\"module-overview-frame.html\" name=\"packageListFrame\" title=\"All Modules\"></iframe>");
}
+
+ void checkModuleSummaryNoExported(boolean found) {
+ checkOutput("moduleNoExport-summary.html", found,
+ "<!-- ============ PACKAGES SUMMARY =========== -->\n"
+ + "<a name=\"packages.summary\">\n"
+ + "<!-- -->\n"
+ + "</a>",
+ "<caption><span>Concealed</span><span class=\"tabEnd\"> </span></caption>");
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleNoExport/module-info.java Mon Apr 24 21:34:23 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This is a test description for the moduleNoExport module. Make sure there are no exported packages.
+ */
+module moduleNoExport {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduleNoExport/testpkgmdlNoExport/TestClassInModuleNoExport.java Mon Apr 24 21:34:23 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. 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 testpkgmdlNoExport;
+
+public class TestClassInModuleNoExport {
+ public void testMethodClassModuleNoExport() { }
+}
--- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794
+ * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218
* @summary Test the search feature of javadoc.
* @author bpatel
* @library ../lib
@@ -321,9 +321,9 @@
+ "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
checkOutput("index-all.html", true,
"<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag"
- + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>",
+ + " <a id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</a></span></div>",
"<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n"
- + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>");
+ + " method <a id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</a></span></div>");
}
void checkSplitIndex() {
--- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,8 @@
/*
* @test
- * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743
+ * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417
+ * 8175218
* @summary Run tests on doclet stylesheet.
* @author jamieh
* @library ../lib
@@ -140,8 +141,8 @@
+ ".usesSummary td.colFirst, .usesSummary th.colFirst,\n"
+ ".providesSummary td.colFirst, .providesSummary th.colFirst,\n"
+ ".memberSummary td.colFirst, .memberSummary th.colFirst,\n"
- + ".memberSummary td.colSecond, .memberSummary th.colSecond,\n"
- + ".typeSummary td.colFirst{\n"
+ + ".memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,\n"
+ + ".typeSummary td.colFirst {\n"
+ " vertical-align:top;\n"
+ "}",
".overviewSummary td, .memberSummary td, .typeSummary td,\n"
@@ -162,6 +163,16 @@
"@import url('resources/fonts/dejavu.css');",
".navPadding {\n"
+ " padding-top: 107px;\n"
+ + "}",
+ "a[name]:before, a[name]:target, a[id]:before, a[id]:target {\n"
+ + " content:\"\";\n"
+ + " display:inline-block;\n"
+ + " position:relative;\n"
+ + " padding-top:129px;\n"
+ + " margin-top:-129px;\n"
+ + "}\n"
+ + ".searchTagResult:before, .searchTagResult:target {\n"
+ + " color:red;\n"
+ "}");
// Test whether a link to the stylesheet file is inserted properly
--- a/langtools/test/jdk/javadoc/tool/CheckResourceKeys.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/javadoc/tool/CheckResourceKeys.java Mon Apr 24 21:34:23 2017 +0200
@@ -33,8 +33,6 @@
*/
import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import javax.tools.*;
import com.sun.tools.classfile.*;
@@ -265,7 +263,7 @@
* Get the set of keys from the javadoc resource bundles.
*/
Set<String> getResourceKeys() {
- Module jdk_javadoc = Layer.boot().findModule("jdk.javadoc").get();
+ Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get();
String[] names = {
"jdk.javadoc.internal.doclets.formats.html.resources.standard",
"jdk.javadoc.internal.doclets.toolkit.resources.doclets",
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8144095 8164825 8169818 8153402 8165405 8177079
+ * @bug 8144095 8164825 8169818 8153402 8165405 8177079 8178013
* @summary Test Command Completion
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
@@ -173,6 +173,8 @@
"/save ", "/set "),
a -> assertCompletion(a, "/help /set |", false,
"editor", "feedback", "format", "mode", "prompt", "start", "truncation"),
+ a -> assertCompletion(a, "/help set |", false,
+ "editor", "feedback", "format", "mode", "prompt", "start", "truncation"),
a -> assertCompletion(a, "/help /edit |", false),
a -> assertCompletion(a, "/help dr|", false,
"drop ")
--- a/langtools/test/jdk/jshell/DyingRemoteAgent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/DyingRemoteAgent.java Mon Apr 24 21:34:23 2017 +0200
@@ -22,6 +22,8 @@
*/
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import jdk.jshell.JShell;
import jdk.jshell.execution.JdiExecutionControlProvider;
import jdk.jshell.execution.RemoteExecutionControl;
@@ -45,6 +47,8 @@
pm.put(JdiExecutionControlProvider.PARAM_REMOTE_AGENT, DyingRemoteAgent.class.getName());
pm.put(JdiExecutionControlProvider.PARAM_HOST_NAME, host==null? "" : host);
pm.put(JdiExecutionControlProvider.PARAM_LAUNCH, ""+isLaunch);
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
return JShell.builder()
.executionEngine(ecp, pm)
.build();
--- a/langtools/test/jdk/jshell/HangingRemoteAgent.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/HangingRemoteAgent.java Mon Apr 24 21:34:23 2017 +0200
@@ -22,6 +22,8 @@
*/
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import jdk.jshell.JShell;
import jdk.jshell.execution.JdiExecutionControlProvider;
import jdk.jshell.execution.RemoteExecutionControl;
@@ -59,6 +61,8 @@
pm.put(JdiExecutionControlProvider.PARAM_HOST_NAME, host==null? "" : host);
pm.put(JdiExecutionControlProvider.PARAM_LAUNCH, ""+isLaunch);
pm.put(JdiExecutionControlProvider.PARAM_TIMEOUT, ""+TIMEOUT);
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
return JShell.builder()
.executionEngine(ecp, pm)
.build();
--- a/langtools/test/jdk/jshell/HistoryTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/HistoryTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -33,6 +33,8 @@
import java.lang.reflect.Field;
import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import jdk.internal.jline.extra.EditingHistory;
import org.testng.annotations.Test;
import jdk.internal.jshell.tool.JShellTool;
@@ -45,6 +47,8 @@
@Override
protected void testRawRun(Locale locale, String[] args) {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
repl = ((JShellToolBuilder) builder(locale))
.rawTool();
try {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/HistoryUITest.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,83 @@
+/*
+ * 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 8178077
+ * @summary Check the UI behavior of editing history.
+ * @modules
+ * jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.jshell/jdk.jshell:open
+ * @library /tools/lib
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
+ * @build Compiler UITesting
+ * @build HistoryUITest
+ * @run testng HistoryUITest
+ */
+
+import org.testng.annotations.Test;
+
+@Test
+public class HistoryUITest extends UITesting {
+
+ public void testPrevNextSnippet() throws Exception {
+ doRunTest((inputSink, out) -> {
+ inputSink.write("void test1() {\nSystem.err.println(1);\n}\n");
+ waitOutput(out, "\u0005");
+ inputSink.write("void test2() {\nSystem.err.println(2);\n}\n");
+ waitOutput(out, "\u0005");
+ inputSink.write(CTRL_UP);
+ waitOutput(out, "^void test2\\(\\) \\{");
+ inputSink.write(CTRL_UP);
+ waitOutput(out, "^" + clearOut("2() {") + "1\\(\\) \\{");
+ inputSink.write(CTRL_DOWN);
+ waitOutput(out, "^" + clearOut("1() {") + "2\\(\\) \\{");
+ inputSink.write(ENTER);
+ waitOutput(out, "^\n\u0006");
+ inputSink.write(UP);
+ waitOutput(out, "^}");
+ inputSink.write(UP);
+ waitOutput(out, "^" + clearOut("}") + "System.err.println\\(2\\);");
+ inputSink.write(UP);
+ waitOutput(out, "^" + clearOut("System.err.println(2);") + "void test2\\(\\) \\{");
+ inputSink.write(UP);
+ waitOutput(out, "^\u0007");
+ inputSink.write(DOWN);
+ waitOutput(out, "^" + clearOut("void test2() {") + "System.err.println\\(2\\);");
+ inputSink.write(DOWN);
+ waitOutput(out, "^" + clearOut("System.err.println(2);") + "}");
+ inputSink.write(DOWN);
+ waitOutput(out, "^" + clearOut("}"));
+ inputSink.write(DOWN);
+ waitOutput(out, "^\u0007");
+ });
+ }
+ //where:
+ private static final String CTRL_UP = "\033[1;5A";
+ private static final String CTRL_DOWN = "\033[1;5B";
+ private static final String UP = "\033[A";
+ private static final String DOWN = "\033[B";
+ private static final String ENTER = "\n";
+
+}
--- a/langtools/test/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -29,6 +29,8 @@
* @run testng JdiBadOptionLaunchExecutionControlTest
*/
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.testng.annotations.Test;
import jdk.jshell.JShell;
import static org.testng.Assert.assertTrue;
@@ -42,6 +44,8 @@
public void badOptionLaunchTest() {
try {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
JShell.builder()
.executionEngine("jdi:launch(true)")
.remoteVMOptions("-BadBadOption")
--- a/langtools/test/jdk/jshell/JdiBadOptionListenExecutionControlTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/JdiBadOptionListenExecutionControlTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -29,6 +29,8 @@
* @run testng JdiBadOptionListenExecutionControlTest
*/
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.testng.annotations.Test;
import jdk.jshell.JShell;
import static org.testng.Assert.assertTrue;
@@ -38,16 +40,18 @@
public class JdiBadOptionListenExecutionControlTest {
private static final String EXPECTED_ERROR =
- "Launching JShell execution engine threw: Failed remote listen:";
+ "Unrecognized option: -BadBadOption";
public void badOptionListenTest() {
try {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
JShell.builder()
.executionEngine("jdi")
.remoteVMOptions("-BadBadOption")
.build();
} catch (IllegalStateException ex) {
- assertTrue(ex.getMessage().startsWith(EXPECTED_ERROR), ex.getMessage());
+ assertTrue(ex.getMessage().contains(EXPECTED_ERROR), ex.getMessage());
return;
}
fail("Expected IllegalStateException");
--- a/langtools/test/jdk/jshell/JdiBogusHostListenExecutionControlTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/JdiBogusHostListenExecutionControlTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -29,6 +29,8 @@
* @run testng JdiBogusHostListenExecutionControlTest
*/
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.testng.annotations.Test;
import jdk.jshell.JShell;
import static org.testng.Assert.assertTrue;
@@ -42,6 +44,8 @@
public void badOptionListenTest() {
try {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
JShell.builder()
.executionEngine("jdi:hostname(BattyRumbleBuckets-Snurfle-99-Blip)")
.build();
--- a/langtools/test/jdk/jshell/KullaTesting.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/KullaTesting.java Mon Apr 24 21:34:23 2017 +0200
@@ -30,7 +30,6 @@
import java.lang.reflect.Method;
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
-import java.lang.reflect.Layer;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -211,11 +210,11 @@
public ClassLoader createAndRunFromModule(String moduleName, Path modPath) {
ModuleFinder finder = ModuleFinder.of(modPath);
- Layer parent = Layer.boot();
+ ModuleLayer parent = ModuleLayer.boot();
Configuration cf = parent.configuration()
.resolve(finder, ModuleFinder.of(), Set.of(moduleName));
ClassLoader scl = ClassLoader.getSystemClassLoader();
- Layer layer = parent.defineModulesWithOneLoader(cf, scl);
+ ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
ClassLoader loader = layer.findLoader(moduleName);
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(loader);
--- a/langtools/test/jdk/jshell/MergedTabShiftTabTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/MergedTabShiftTabTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -31,37 +31,29 @@
* jdk.jshell/jdk.jshell:open
* @library /tools/lib
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
- * @build Compiler
+ * @build Compiler UITesting
* @build MergedTabShiftTabTest
* @run testng MergedTabShiftTabTest
*/
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.io.Writer;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jdk.jshell.JShell;
-import jdk.jshell.tool.JavaShellToolBuilder;
import org.testng.annotations.Test;
@Test
-public class MergedTabShiftTabTest {
+public class MergedTabShiftTabTest extends UITesting {
public void testCommand() throws Exception {
doRunTest((inputSink, out) -> {
@@ -281,60 +273,6 @@
});
}
- private void doRunTest(Test test) throws Exception {
- PipeInputStream input = new PipeInputStream();
- StringBuilder out = new StringBuilder();
- PrintStream outS = new PrintStream(new OutputStream() {
- @Override public void write(int b) throws IOException {
- synchronized (out) {
- System.out.print((char) b);
- out.append((char) b);
- out.notifyAll();
- }
- }
- });
- Thread runner = new Thread(() -> {
- try {
- JavaShellToolBuilder.builder()
- .in(input, input)
- .out(outS)
- .err(outS)
- .promptCapture(true)
- .persistence(new HashMap<>())
- .locale(Locale.US)
- .run("--no-startup");
- } catch (Exception ex) {
- throw new IllegalStateException(ex);
- }
- });
-
- Writer inputSink = new OutputStreamWriter(input.createOutput()) {
- @Override
- public void write(String str) throws IOException {
- super.write(str);
- flush();
- }
- };
-
- runner.start();
-
- try {
- waitOutput(out, "\u0005");
- test.test(inputSink, out);
- } finally {
- inputSink.write("\003\003/exit");
-
- runner.join(1000);
- if (runner.isAlive()) {
- runner.stop();
- }
- }
- }
-
- interface Test {
- public void test(Writer inputSink, StringBuilder out) throws Exception;
- }
-
private Path prepareZip() {
String clazz1 =
"package jshelltest;\n" +
@@ -404,162 +342,4 @@
return MessageFormat.format(resources.getString(key), args);
}
- private static final long TIMEOUT;
-
- static {
- long factor;
-
- try {
- factor = (long) Double.parseDouble(System.getProperty("test.timeout.factor", "1"));
- } catch (NumberFormatException ex) {
- factor = 1;
- }
- TIMEOUT = 60_000 * factor;
- }
-
- private void waitOutput(StringBuilder out, String expected) {
- expected = expected.replaceAll("\n", System.getProperty("line.separator"));
- Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL);
- synchronized (out) {
- long s = System.currentTimeMillis();
-
- while (true) {
- Matcher m = expectedPattern.matcher(out);
- if (m.find()) {
- out.delete(0, m.end() + 1);
- return ;
- }
- long e = System.currentTimeMillis();
- if ((e - s) > TIMEOUT) {
- throw new IllegalStateException("Timeout waiting for: " + quote(expected) + ", actual output so far: " + quote(out.toString()));
- }
- try {
- out.wait(TIMEOUT);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- }
- }
- }
-
- private String quote(String original) {
- StringBuilder output = new StringBuilder();
-
- for (char c : original.toCharArray()) {
- if (c < 32) {
- output.append(String.format("\\u%04X", (int) c));
- } else {
- output.append(c);
- }
- }
-
- return output.toString();
- }
-
- private static class PipeInputStream extends InputStream {
-
- private static final int INITIAL_SIZE = 128;
- private int[] buffer = new int[INITIAL_SIZE];
- private int start;
- private int end;
- private boolean closed;
-
- @Override
- public synchronized int read() throws IOException {
- if (start == end && !closed) {
- inputNeeded();
- }
- while (start == end) {
- if (closed) {
- return -1;
- }
- try {
- wait();
- } catch (InterruptedException ex) {
- //ignore
- }
- }
- try {
- return buffer[start];
- } finally {
- start = (start + 1) % buffer.length;
- }
- }
-
- @Override
- public synchronized int read(byte[] b, int off, int len) throws IOException {
- if (b == null) {
- throw new NullPointerException();
- } else if (off < 0 || len < 0 || len > b.length - off) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return 0;
- }
-
- int c = read();
- if (c == -1) {
- return -1;
- }
- b[off] = (byte)c;
-
- int totalRead = 1;
- while (totalRead < len && start != end) {
- int r = read();
- if (r == (-1))
- break;
- b[off + totalRead++] = (byte) r;
- }
- return totalRead;
- }
-
- protected void inputNeeded() throws IOException {}
-
- private synchronized void write(int b) {
- if (closed) {
- throw new IllegalStateException("Already closed.");
- }
- int newEnd = (end + 1) % buffer.length;
- if (newEnd == start) {
- //overflow:
- int[] newBuffer = new int[buffer.length * 2];
- int rightPart = (end > start ? end : buffer.length) - start;
- int leftPart = end > start ? 0 : start - 1;
- System.arraycopy(buffer, start, newBuffer, 0, rightPart);
- System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart);
- buffer = newBuffer;
- start = 0;
- end = rightPart + leftPart;
- newEnd = end + 1;
- }
- buffer[end] = b;
- end = newEnd;
- notifyAll();
- }
-
- @Override
- public synchronized void close() {
- closed = true;
- notifyAll();
- }
-
- public OutputStream createOutput() {
- return new OutputStream() {
- @Override public void write(int b) throws IOException {
- PipeInputStream.this.write(b);
- }
- @Override
- public void write(byte[] b, int off, int len) throws IOException {
- for (int i = 0 ; i < len ; i++) {
- write(Byte.toUnsignedInt(b[off + i]));
- }
- }
- @Override
- public void close() throws IOException {
- PipeInputStream.this.close();
- }
- };
- }
-
- }
-
}
--- a/langtools/test/jdk/jshell/ReplToolTesting.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/ReplToolTesting.java Mon Apr 24 21:34:23 2017 +0200
@@ -34,6 +34,8 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import java.util.prefs.AbstractPreferences;
import java.util.prefs.BackingStoreException;
import java.util.regex.Matcher;
@@ -265,6 +267,8 @@
}
protected JavaShellToolBuilder builder(Locale locale) {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
return JavaShellToolBuilder
.builder()
.in(cmdin, userin)
--- a/langtools/test/jdk/jshell/StartOptionTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/StartOptionTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
*/
/*
- * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343
+ * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343 8178023
* @summary Testing start-up options.
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
@@ -43,6 +43,8 @@
import java.util.Locale;
import java.util.function.Consumer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -63,6 +65,8 @@
private InputStream cmdInStream;
private JavaShellToolBuilder builder() {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
return JavaShellToolBuilder
.builder()
.out(new PrintStream(cmdout), new PrintStream(console), new PrintStream(userout))
@@ -179,14 +183,11 @@
}
public void testStartupFailedOption() throws Exception {
- try {
- builder().run("-R-hoge-foo-bar");
- } catch (IllegalStateException ex) {
- String s = ex.getMessage();
- assertTrue(s.startsWith("Launching JShell execution engine threw: Failed remote"), s);
- return;
- }
- fail("Expected IllegalStateException");
+ start(
+ s -> assertEquals(s.trim(), "", "cmdout: "),
+ s -> assertEquals(s.trim(), "", "userout: "),
+ s -> assertTrue(s.contains("Unrecognized option: -hoge-foo-bar"), "cmderr: " + s),
+ "-R-hoge-foo-bar");
}
public void testStartupUnknown() throws Exception {
@@ -201,6 +202,14 @@
}
}
+ public void testUnknownModule() throws Exception {
+ start(
+ s -> assertEquals(s.trim(), "", "cmdout: "),
+ s -> assertEquals(s.trim(), "", "userout: "),
+ s -> assertTrue(s.contains("rror") && s.contains("unKnown"), "cmderr: " + s),
+ "--add-modules", "unKnown");
+ }
+
public void testFeedbackOptionConflict() throws Exception {
start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.",
"--feedback", "concise", "--feedback", "verbose");
--- a/langtools/test/jdk/jshell/ToolProviderTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/ToolProviderTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -87,15 +87,6 @@
}
@Override
- public void testStartupFailedOption() throws Exception {
- if (runShellServiceLoader("-R-hoge-foo-bar") == 0) {
- fail("Expected tool failure");
- } else {
- check(cmderr, s -> s.startsWith("Launching JShell execution engine threw: Failed remote"), "cmderr");
- }
- }
-
- @Override
public void testShowVersion() throws Exception {
start(
s -> {
--- a/langtools/test/jdk/jshell/ToolReloadTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
* @test
* @key intermittent
- * @bug 8081845 8147898 8143955 8165405
+ * @bug 8081845 8147898 8143955 8165405 8178023
* @summary Tests for /reload in JShell tool
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
@@ -40,6 +40,7 @@
import java.util.function.Function;
import org.testng.annotations.Test;
+import static org.testng.Assert.assertTrue;
@Test
@@ -199,6 +200,27 @@
);
}
+ public void testEnvBadModule() {
+ test(
+ (a) -> assertVariable(a, "int", "x", "5", "5"),
+ (a) -> assertMethod(a, "int m(int z) { return z * z; }",
+ "(int)int", "m"),
+ (a) -> assertCommandCheckOutput(a, "/env --add-module unKnown",
+ s -> {
+ assertTrue(s.startsWith(
+ "| Setting new options and restoring state.\n" +
+ "| Restart failed:"));
+ assertTrue(s.contains("unKnown"),
+ "\"unKnown\" missing from: " + s);
+ assertTrue(s.contains("previous settings"),
+ "\"previous settings\" missing from: " + s);
+ }),
+ (a) -> evaluateExpression(a, "int", "m(x)", "25"),
+ (a) -> assertCommandCheckOutput(a, "/vars", assertVariables()),
+ (a) -> assertCommandCheckOutput(a, "/methods", assertMethods())
+ );
+ }
+
public void testReloadExitRestore() {
test(false, new String[]{"--no-startup"},
(a) -> assertVariable(a, "int", "x", "5", "5"),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/jshell/UITesting.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,277 @@
+/*
+ * 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.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import jdk.jshell.tool.JavaShellToolBuilder;
+
+public class UITesting {
+
+ protected void doRunTest(Test test) throws Exception {
+ // turn on logging of launch failures
+ Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
+
+ PipeInputStream input = new PipeInputStream();
+ StringBuilder out = new StringBuilder();
+ PrintStream outS = new PrintStream(new OutputStream() {
+ @Override public void write(int b) throws IOException {
+ synchronized (out) {
+ System.out.print((char) b);
+ out.append((char) b);
+ out.notifyAll();
+ }
+ }
+ });
+ Thread runner = new Thread(() -> {
+ try {
+ JavaShellToolBuilder.builder()
+ .in(input, input)
+ .out(outS)
+ .err(outS)
+ .promptCapture(true)
+ .persistence(new HashMap<>())
+ .locale(Locale.US)
+ .run("--no-startup");
+ } catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ });
+
+ Writer inputSink = new OutputStreamWriter(input.createOutput()) {
+ @Override
+ public void write(String str) throws IOException {
+ super.write(str);
+ flush();
+ }
+ };
+
+ runner.start();
+
+ try {
+ waitOutput(out, "\u0005");
+ test.test(inputSink, out);
+ } finally {
+ inputSink.write("\003\003/exit");
+
+ runner.join(1000);
+ if (runner.isAlive()) {
+ runner.stop();
+ }
+ }
+ }
+
+ protected interface Test {
+ public void test(Writer inputSink, StringBuilder out) throws Exception;
+ }
+
+ private static final long TIMEOUT;
+
+ static {
+ long factor;
+
+ try {
+ factor = (long) Double.parseDouble(System.getProperty("test.timeout.factor", "1"));
+ } catch (NumberFormatException ex) {
+ factor = 1;
+ }
+ TIMEOUT = 60_000 * factor;
+ }
+
+ protected void waitOutput(StringBuilder out, String expected) {
+ expected = expected.replaceAll("\n", System.getProperty("line.separator"));
+ Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL);
+ synchronized (out) {
+ long s = System.currentTimeMillis();
+
+ while (true) {
+ Matcher m = expectedPattern.matcher(out);
+ if (m.find()) {
+ out.delete(0, m.end() + 1);
+ return ;
+ }
+ long e = System.currentTimeMillis();
+ if ((e - s) > TIMEOUT) {
+ throw new IllegalStateException("Timeout waiting for: " + quote(expected) + ", actual output so far: " + quote(out.toString()));
+ }
+ try {
+ out.wait(TIMEOUT);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private String quote(String original) {
+ StringBuilder output = new StringBuilder();
+
+ for (char c : original.toCharArray()) {
+ if (c < 32) {
+ output.append(String.format("\\u%04X", (int) c));
+ } else {
+ output.append(c);
+ }
+ }
+
+ return output.toString();
+ }
+
+ protected String clearOut(String what) {
+ return backspace(what.length()) + space(what.length()) + backspace(what.length());
+ }
+
+ protected String backspace(int n) {
+ return fill(n, '\010');
+ }
+
+ protected String space(int n) {
+ return fill(n, ' ');
+ }
+
+ private String fill(int n, char c) {
+ StringBuilder result = new StringBuilder(n);
+
+ while (n-- > 0)
+ result.append(c);
+
+ return result.toString();
+ }
+
+ private static class PipeInputStream extends InputStream {
+
+ private static final int INITIAL_SIZE = 128;
+ private int[] buffer = new int[INITIAL_SIZE];
+ private int start;
+ private int end;
+ private boolean closed;
+
+ @Override
+ public synchronized int read() throws IOException {
+ if (start == end && !closed) {
+ inputNeeded();
+ }
+ while (start == end) {
+ if (closed) {
+ return -1;
+ }
+ try {
+ wait();
+ } catch (InterruptedException ex) {
+ //ignore
+ }
+ }
+ try {
+ return buffer[start];
+ } finally {
+ start = (start + 1) % buffer.length;
+ }
+ }
+
+ @Override
+ public synchronized int read(byte[] b, int off, int len) throws IOException {
+ if (b == null) {
+ throw new NullPointerException();
+ } else if (off < 0 || len < 0 || len > b.length - off) {
+ throw new IndexOutOfBoundsException();
+ } else if (len == 0) {
+ return 0;
+ }
+
+ int c = read();
+ if (c == -1) {
+ return -1;
+ }
+ b[off] = (byte)c;
+
+ int totalRead = 1;
+ while (totalRead < len && start != end) {
+ int r = read();
+ if (r == (-1))
+ break;
+ b[off + totalRead++] = (byte) r;
+ }
+ return totalRead;
+ }
+
+ protected void inputNeeded() throws IOException {}
+
+ private synchronized void write(int b) {
+ if (closed) {
+ throw new IllegalStateException("Already closed.");
+ }
+ int newEnd = (end + 1) % buffer.length;
+ if (newEnd == start) {
+ //overflow:
+ int[] newBuffer = new int[buffer.length * 2];
+ int rightPart = (end > start ? end : buffer.length) - start;
+ int leftPart = end > start ? 0 : start - 1;
+ System.arraycopy(buffer, start, newBuffer, 0, rightPart);
+ System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart);
+ buffer = newBuffer;
+ start = 0;
+ end = rightPart + leftPart;
+ newEnd = end + 1;
+ }
+ buffer[end] = b;
+ end = newEnd;
+ notifyAll();
+ }
+
+ @Override
+ public synchronized void close() {
+ closed = true;
+ notifyAll();
+ }
+
+ public OutputStream createOutput() {
+ return new OutputStream() {
+ @Override public void write(int b) throws IOException {
+ PipeInputStream.this.write(b);
+ }
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ for (int i = 0 ; i < len ; i++) {
+ write(Byte.toUnsignedInt(b[off + i]));
+ }
+ }
+ @Override
+ public void close() throws IOException {
+ PipeInputStream.this.close();
+ }
+ };
+ }
+
+ }
+
+}
--- a/langtools/test/tools/javac/6410653/T6410653.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/6410653/T6410653.java Mon Apr 24 21:34:23 2017 +0200
@@ -31,7 +31,6 @@
*/
import java.lang.reflect.Field;
-import java.lang.reflect.Module;
import java.io.File;
import java.io.ByteArrayOutputStream;
import javax.tools.*;
--- a/langtools/test/tools/javac/T6406771.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/T6406771.java Mon Apr 24 21:34:23 2017 +0200
@@ -11,9 +11,9 @@
// Editing the imports and other leading text may affect the golden text in the tests field.
// Also beware of scripts that auto-expand tabs to spaces.
+
+
import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import javax.annotation.processing.*;
import javax.lang.model.*;
--- a/langtools/test/tools/javac/diags/CheckExamples.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/diags/CheckExamples.java Mon Apr 24 21:34:23 2017 +0200
@@ -39,8 +39,6 @@
*/
import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
@@ -111,7 +109,7 @@
}
}
- Module jdk_compiler = Layer.boot().findModule("jdk.compiler").get();
+ Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get();
ResourceBundle b =
ResourceBundle.getBundle("com.sun.tools.javac.resources.compiler", jdk_compiler);
Set<String> resourceKeys = new TreeSet<String>(b.keySet());
--- a/langtools/test/tools/javac/diags/CheckResourceKeys.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/diags/CheckResourceKeys.java Mon Apr 24 21:34:23 2017 +0200
@@ -31,8 +31,6 @@
*/
import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import javax.tools.*;
import com.sun.tools.classfile.*;
@@ -395,7 +393,7 @@
* Get the set of keys from the javac resource bundles.
*/
Set<String> getResourceKeys() {
- Module jdk_compiler = Layer.boot().findModule("jdk.compiler").get();
+ Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get();
Set<String> results = new TreeSet<String>();
for (String name : new String[]{"javac", "compiler"}) {
ResourceBundle b =
--- a/langtools/test/tools/javac/diags/Example.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/diags/Example.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,8 +24,18 @@
import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.*;
+import java.util.Map.Entry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import java.util.regex.*;
+import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+
import javax.annotation.processing.Processor;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticCollector;
@@ -210,9 +220,53 @@
File modulepathDir = new File(tempDir, "modulepath");
modulepathDir.mkdirs();
clean(modulepathDir);
- List<String> sOpts = Arrays.asList("-d", modulepathDir.getPath(),
- "--module-source-path", new File(file, "modulepath").getAbsolutePath());
- new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles);
+ boolean hasModuleInfo =
+ modulePathFiles.stream()
+ .anyMatch(f -> f.getName().equalsIgnoreCase("module-info.java"));
+ Path modulePath = new File(file, "modulepath").toPath().toAbsolutePath();
+ if (hasModuleInfo) {
+ //ordinary modules
+ List<String> sOpts =
+ Arrays.asList("-d", modulepathDir.getPath(),
+ "--module-source-path", modulePath.toString());
+ new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles);
+ } else {
+ //automatic modules:
+ Map<String, List<Path>> module2Files =
+ modulePathFiles.stream()
+ .map(f -> f.toPath())
+ .collect(Collectors.groupingBy(p -> modulePath.relativize(p)
+ .getName(0)
+ .toString()));
+ for (Entry<String, List<Path>> e : module2Files.entrySet()) {
+ File scratchDir = new File(tempDir, "scratch");
+ scratchDir.mkdirs();
+ clean(scratchDir);
+ List<String> sOpts =
+ Arrays.asList("-d", scratchDir.getPath());
+ new Jsr199Compiler(verbose).run(null,
+ null,
+ false,
+ sOpts,
+ e.getValue().stream()
+ .map(p -> p.toFile())
+ .collect(Collectors.toList()));
+ try (JarOutputStream jarOut =
+ new JarOutputStream(new FileOutputStream(new File(modulepathDir, e.getKey() + ".jar")))) {
+ Files.find(scratchDir.toPath(), Integer.MAX_VALUE, (p, attr) -> attr.isRegularFile())
+ .forEach(p -> {
+ try (InputStream in = Files.newInputStream(p)) {
+ jarOut.putNextEntry(new ZipEntry(scratchDir.toPath()
+ .relativize(p)
+ .toString()));
+ jarOut.write(in.readAllBytes());
+ } catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ });
+ }
+ }
+ }
opts.add("--module-path");
opts.add(modulepathDir.getAbsolutePath());
}
--- a/langtools/test/tools/javac/diags/examples/NoJavaLang.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/diags/examples/NoJavaLang.java Mon Apr 24 21:34:23 2017 +0200
@@ -22,7 +22,7 @@
*/
// key: compiler.misc.fatal.err.no.java.lang
-// options: -source 8 -target 8 -Xbootclasspath:
+// options: -source 8 -target 8 -Xbootclasspath: -classpath .
// run: backdoor
class NoJavaLang { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RequiresAutomatic/module-info.java Mon Apr 24 21:34:23 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.
+ */
+
+//options: -Xlint:requires-automatic
+//key: compiler.warn.requires.automatic
+module RequiresAutomatic {
+ requires a;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RequiresAutomatic/modulepath/a/A.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class A {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/module-info.java Mon Apr 24 21:34:23 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.
+ */
+
+//key: compiler.warn.requires.transitive.automatic
+module RequiresTransitiveAutomatic {
+ requires transitive a;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/modulepath/a/A.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class A {}
--- a/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -74,7 +74,7 @@
// test with bootclasspath, for as long as its around
void testBootClassPath() {
- String[] bcpOpts = { "-Xlint:-options", "-source", "8", "-bootclasspath", "." };
+ String[] bcpOpts = { "-Xlint:-options", "-source", "8", "-bootclasspath", ".", "-classpath", "." };
test(bcpOpts, compilerErrorMessage);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/T8177933.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8177933
+ * @summary Stackoverflow during compilation, starting jdk-9+163
+ *
+ * @library /tools/javac/lib
+ * @requires !(os.family == "solaris")
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.code
+ * jdk.compiler/com.sun.tools.javac.comp
+ * jdk.compiler/com.sun.tools.javac.main
+ * jdk.compiler/com.sun.tools.javac.tree
+ * jdk.compiler/com.sun.tools.javac.util
+ * @build combo.ComboTestHelper
+
+ * @run main/othervm -Xss512K T8177933
+ */
+
+import combo.ComboInstance;
+import combo.ComboParameter;
+import combo.ComboTask.Result;
+import combo.ComboTestHelper;
+
+import javax.lang.model.element.Element;
+
+public class T8177933 extends ComboInstance<T8177933> {
+
+ static final int MAX_DEPTH = 350;
+
+ static class CallExpr implements ComboParameter {
+ @Override
+ public String expand(String optParameter) {
+ Integer n = Integer.parseInt(optParameter);
+ if (n == MAX_DEPTH) {
+ return "m()";
+ } else {
+ return "m().#{CALL." + (n + 1) + "}";
+ }
+ }
+ }
+
+ static final String sourceTemplate =
+ "class Test {\n" +
+ " Test m() { return null; }\n" +
+ " void test() {\n" +
+ " #{CALL.0};\n" +
+ "} }\n";
+
+ public static void main(String[] args) {
+ new ComboTestHelper<T8177933>()
+ .withDimension("CALL", new CallExpr())
+ .run(T8177933::new);
+ }
+
+ @Override
+ protected void doWork() throws Throwable {
+ Result<Iterable<? extends Element>> result = newCompilationTask()
+ .withOption("-XDdev")
+ .withSourceFromTemplate(sourceTemplate)
+ .analyze();
+ if (!result.get().iterator().hasNext()) {
+ fail("Exception occurred when compiling combo. " + result.compilationInfo());
+ }
+ }
+}
--- a/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java Mon Apr 24 21:34:23 2017 +0200
@@ -21,8 +21,6 @@
* questions.
*/
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
@@ -102,7 +100,7 @@
protected void addExports(String moduleName, String... packageNames) {
for (String packageName : packageNames) {
try {
- Layer layer = Layer.boot();
+ ModuleLayer layer = ModuleLayer.boot();
Optional<Module> m = layer.findModule(moduleName);
if (!m.isPresent())
throw new Error("module not found: " + moduleName);
--- a/langtools/test/tools/javac/modules/AddLimitMods.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java Mon Apr 24 21:34:23 2017 +0200
@@ -418,13 +418,13 @@
" public static void main(String... args) throws Exception {\n");
for (Entry<String, String> e : MODULES_TO_CHECK_TO_SAMPLE_CLASS.entrySet()) {
- testClassNamed.append(" System.err.println(\"visible:" + e.getKey() + ":\" + java.lang.reflect.Layer.boot().findModule(\"" + e.getKey() + "\").isPresent());\n");
+ testClassNamed.append(" System.err.println(\"visible:" + e.getKey() + ":\" + ModuleLayer.boot().findModule(\"" + e.getKey() + "\").isPresent());\n");
}
testClassNamed.append(" Class<?> cp = Class.forName(Test.class.getClassLoader().getUnnamedModule(), \"cp.CP\");\n");
testClassNamed.append(" cp.getDeclaredMethod(\"runMe\").invoke(null);\n");
- testClassNamed.append(" Class<?> automatic = Class.forName(java.lang.reflect.Layer.boot().findModule(\"automatic\").get(), \"automatic.Automatic\");\n");
+ testClassNamed.append(" Class<?> automatic = Class.forName(ModuleLayer.boot().findModule(\"automatic\").get(), \"automatic.Automatic\");\n");
testClassNamed.append(" automatic.getDeclaredMethod(\"runMe\").invoke(null);\n");
testClassNamed.append(" }\n" +
--- a/langtools/test/tools/javac/modules/AutomaticModules.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/modules/AutomaticModules.java Mon Apr 24 21:34:23 2017 +0200
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8155026
+ * @bug 8155026 8178011
* @summary Test automatic modules
* @library /tools/lib
* @modules
@@ -300,9 +300,8 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- expected = Arrays.asList("Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read: m1x, apiB, automaticB)",
- "Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
- "2 errors");
+ expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
+ "1 error");
if (!expected.equals(log)) {
throw new Exception("expected output not found: " + log);
@@ -310,7 +309,7 @@
}
@Test
- public void testDropTrailingVersion(Path base) throws Exception {
+ public void testWithTrailingVersion(Path base) throws Exception {
Path legacySrc = base.resolve("legacy-src");
tb.writeJavaFiles(legacySrc,
"package api; public class Api {}");
@@ -348,7 +347,7 @@
Files.createDirectories(classes);
tb.writeJavaFiles(m,
- "module m { requires test; }",
+ "module m { requires test1; }",
"package impl; public class Impl { public void e(api.Api api) { } }");
new JavacTask(tb)
@@ -358,4 +357,261 @@
.run()
.writeAll();
}
+
+ @Test
+ public void testMultipleAutomatic(Path base) throws Exception {
+ Path modulePath = base.resolve("module-path");
+
+ Files.createDirectories(modulePath);
+
+ for (char c : new char[] {'A', 'B'}) {
+ Path automaticSrc = base.resolve("automaticSrc" + c);
+ tb.writeJavaFiles(automaticSrc, "package api" + c + "; public class Api {}");
+ Path automaticClasses = base.resolve("automaticClasses" + c);
+ tb.createDirectories(automaticClasses);
+
+ String automaticLog = new JavacTask(tb)
+ .outdir(automaticClasses)
+ .files(findJavaFiles(automaticSrc))
+ .run()
+ .writeAll()
+ .getOutput(Task.OutputKind.DIRECT);
+
+ if (!automaticLog.isEmpty())
+ throw new Exception("expected output not found: " + automaticLog);
+
+ Path automaticJar = modulePath.resolve("automatic" + c + "-1.0.jar");
+
+ new JarTask(tb, automaticJar)
+ .baseDir(automaticClasses)
+ .files("api" + c + "/Api.class")
+ .run();
+ }
+
+ Path src = base.resolve("src");
+
+ tb.writeJavaFiles(src.resolve("m1x"),
+ "package impl; public class Impl { apiA.Api a; apiB.Api b; }");
+
+ Path classes = base.resolve("classes");
+
+ Files.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("--module-path", modulePath.toString(),
+ "-XDrawDiagnostics")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList("Impl.java:1:35: compiler.err.package.not.visible: apiA, (compiler.misc.not.def.access.does.not.read.from.unnamed: apiA, automaticA)",
+ "Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read.from.unnamed: apiB, automaticB)",
+ "2 errors");
+
+ if (!expected.equals(log)) {
+ throw new Exception("expected output not found: " + log);
+ }
+
+ new JavacTask(tb)
+ .options("--module-path", modulePath.toString(),
+ "--add-modules", "automaticA",
+ "-XDrawDiagnostics")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run()
+ .writeAll();
+ }
+
+ @Test
+ public void testLintRequireAutomatic(Path base) throws Exception {
+ Path modulePath = base.resolve("module-path");
+
+ Files.createDirectories(modulePath);
+
+ for (char c : new char[] {'A', 'B'}) {
+ Path automaticSrc = base.resolve("automaticSrc" + c);
+ tb.writeJavaFiles(automaticSrc, "package api" + c + "; public class Api {}");
+ Path automaticClasses = base.resolve("automaticClasses" + c);
+ tb.createDirectories(automaticClasses);
+
+ String automaticLog = new JavacTask(tb)
+ .outdir(automaticClasses)
+ .files(findJavaFiles(automaticSrc))
+ .run()
+ .writeAll()
+ .getOutput(Task.OutputKind.DIRECT);
+
+ if (!automaticLog.isEmpty())
+ throw new Exception("expected output not found: " + automaticLog);
+
+ Path automaticJar = modulePath.resolve("automatic" + c + "-1.0.jar");
+
+ new JarTask(tb, automaticJar)
+ .baseDir(automaticClasses)
+ .files("api" + c + "/Api.class")
+ .run();
+ }
+
+ Path src = base.resolve("src");
+
+ tb.writeJavaFiles(src,
+ "module m1x {\n" +
+ " requires transitive automaticA;\n" +
+ " requires automaticB;\n" +
+ "}");
+
+ Path classes = base.resolve("classes");
+
+ Files.createDirectories(classes);
+
+ List<String> expected;
+ List<String> log;
+
+ log = new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList("module-info.java:2:25: compiler.warn.requires.transitive.automatic",
+ "- compiler.err.warnings.and.werror",
+ "1 error",
+ "1 warning");
+
+ if (!expected.equals(log)) {
+ throw new Exception("expected output not found: " + log);
+ }
+
+ log = new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-Xlint:requires-automatic",
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList("module-info.java:2:25: compiler.warn.requires.transitive.automatic",
+ "module-info.java:3:14: compiler.warn.requires.automatic",
+ "- compiler.err.warnings.and.werror",
+ "1 error",
+ "2 warnings");
+
+ if (!expected.equals(log)) {
+ throw new Exception("expected output not found: " + log);
+ }
+
+ log = new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-Xlint:-requires-transitive-automatic,requires-automatic",
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList("module-info.java:2:25: compiler.warn.requires.automatic",
+ "module-info.java:3:14: compiler.warn.requires.automatic",
+ "- compiler.err.warnings.and.werror",
+ "1 error",
+ "2 warnings");
+
+ if (!expected.equals(log)) {
+ throw new Exception("expected output not found: " + log);
+ }
+
+ new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-Xlint:-requires-transitive-automatic",
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.SUCCESS)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ tb.writeJavaFiles(src,
+ "@SuppressWarnings(\"requires-transitive-automatic\")\n" +
+ "module m1x {\n" +
+ " requires transitive automaticA;\n" +
+ " requires automaticB;\n" +
+ "}");
+
+ new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.SUCCESS)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ log = new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-Xlint:requires-automatic",
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList("module-info.java:3:25: compiler.warn.requires.automatic",
+ "module-info.java:4:14: compiler.warn.requires.automatic",
+ "- compiler.err.warnings.and.werror",
+ "1 error",
+ "2 warnings");
+
+ if (!expected.equals(log)) {
+ throw new Exception("expected output not found: " + log);
+ }
+
+ tb.writeJavaFiles(src,
+ "@SuppressWarnings(\"requires-automatic\")\n" +
+ "module m1x {\n" +
+ " requires transitive automaticA;\n" +
+ " requires automaticB;\n" +
+ "}");
+
+ log = new JavacTask(tb)
+ .options("--source-path", src.toString(),
+ "--module-path", modulePath.toString(),
+ "-Xlint:requires-automatic",
+ "-XDrawDiagnostics",
+ "-Werror")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList("module-info.java:3:25: compiler.warn.requires.transitive.automatic",
+ "- compiler.err.warnings.and.werror",
+ "1 error",
+ "1 warning");
+
+ if (!expected.equals(log)) {
+ throw new Exception("expected output not found: " + log);
+ }
+ }
+
}
--- a/langtools/test/tools/javac/modules/IncubatingTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/modules/IncubatingTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -122,14 +122,11 @@
"-XDrawDiagnostics")
.outdir(testClasses)
.files(findJavaFiles(testSrc))
- .run(Expect.FAIL)
+ .run(Expect.SUCCESS)
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- expected = Arrays.asList(
- "T.java:1:11: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.from.unnamed: api, jdk.i)",
- "1 error"
- );
+ expected = Arrays.asList("");
if (!expected.equals(log)) {
throw new AssertionError("Unexpected output: " + log);
--- a/langtools/test/tools/javac/modules/ModuleSourcePathTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/modules/ModuleSourcePathTest.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,11 +37,18 @@
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.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
import toolbox.JavacTask;
import toolbox.Task;
import toolbox.ToolBox;
@@ -442,6 +449,76 @@
}
}
+ @Test
+ public void setLocation(Path base) throws Exception {
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src.resolve("m1x"), "module m1x { }", "package a; class A { }");
+ Path modules = base.resolve("modules");
+ tb.createDirectories(modules);
+
+ JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+ try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
+ fm.setLocationFromPaths(StandardLocation.MODULE_SOURCE_PATH, List.of(src));
+ new JavacTask(tb)
+ .options("-XDrawDiagnostics")
+ .fileManager(fm)
+ .outdir(modules)
+ .files(findJavaFiles(src))
+ .run()
+ .writeAll();
+
+ checkFiles(modules.resolve("m1x/module-info.class"), modules.resolve("m1x/a/A.class"));
+ }
+ }
+
+ @Test
+ public void getLocation_valid(Path base) throws Exception {
+ Path src1 = base.resolve("src1");
+ tb.writeJavaFiles(src1.resolve("m1x"), "module m1x { }", "package a; class A { }");
+ Path src2 = base.resolve("src2");
+ tb.writeJavaFiles(src1.resolve("m2x"), "module m2x { }", "package b; class B { }");
+
+ JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+ try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
+ fm.setLocationFromPaths(StandardLocation.MODULE_SOURCE_PATH, List.of(src1, src2));
+ checkLocation(fm.getLocationAsPaths(StandardLocation.MODULE_SOURCE_PATH), List.of(src1, src2));
+ }
+ }
+
+ @Test
+ public void getLocation_ISA(Path base) throws Exception {
+ Path src1 = base.resolve("src1");
+ tb.writeJavaFiles(src1.resolve("m1x"), "module m1x { }", "package a; class A { }");
+ Path src2 = base.resolve("src2");
+ tb.writeJavaFiles(src2.resolve("m2x").resolve("extra"), "module m2x { }", "package b; class B { }");
+ Path modules = base.resolve("modules");
+ tb.createDirectories(modules);
+
+ String FS = File.separator;
+ String PS = File.pathSeparator;
+ JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+ try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
+ fm.handleOption("--module-source-path",
+ List.of(src1 + PS + src2 + FS + "*" + FS + "extra").iterator());
+
+ try {
+ Iterable<? extends Path> paths = fm.getLocationAsPaths(StandardLocation.MODULE_SOURCE_PATH);
+ out.println("result: " + asList(paths));
+ throw new Exception("expected IllegalStateException not thrown");
+ } catch (IllegalStateException e) {
+ out.println("Exception thrown, as expected: " + e);
+ }
+
+ // even if we can't do getLocation for the MODULE_SOURCE_PATH, we should be able
+ // to do getLocation for the modules, which will additionally confirm the option
+ // was effective as intended.
+ Location locn1 = fm.getLocationForModule(StandardLocation.MODULE_SOURCE_PATH, "m1x");
+ checkLocation(fm.getLocationAsPaths(locn1), List.of(src1.resolve("m1x")));
+ Location locn2 = fm.getLocationForModule(StandardLocation.MODULE_SOURCE_PATH, "m2x");
+ checkLocation(fm.getLocationAsPaths(locn2), List.of(src2.resolve("m2x").resolve("extra")));
+ }
+ }
+
private void generateModules(Path base, String... paths) throws IOException {
for (int i = 0; i < paths.length; i++) {
String moduleName = "m" + i + "x";
@@ -455,8 +532,25 @@
private void checkFiles(Path... files) throws Exception {
for (Path file : files) {
if (!Files.exists(file)) {
- throw new Exception("File not exists: " + file);
+ throw new Exception("File not found: " + file);
}
}
}
+
+ private void checkLocation(Iterable<? extends Path> locn, List<Path> ref) throws Exception {
+ List<Path> list = asList(locn);
+ if (!list.equals(ref)) {
+ out.println("expect: " + ref);
+ out.println(" found: " + list);
+ throw new Exception("location not as expected");
+ }
+ }
+
+ private <T> List<T> asList(Iterable<? extends T> iter) {
+ List<T> list = new ArrayList<>();
+ for (T item : iter) {
+ list.add(item);
+ }
+ return list;
+ }
}
--- a/langtools/test/tools/javac/modules/ModuleTestBase.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/modules/ModuleTestBase.java Mon Apr 24 21:34:23 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
@@ -33,7 +33,6 @@
*/
public class ModuleTestBase extends TestRunner {
protected ToolBox tb;
- private int errors;
ModuleTestBase() {
super(System.err);
--- a/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java Mon Apr 24 21:34:23 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8160181
+ * @bug 8160181 8176572
* @summary Add lint warning for digits in module names
* @library /tools/lib
* @modules
@@ -63,6 +63,22 @@
Path src_m3 = src.resolve("mango100");
tb.writeJavaFiles(src_m3, "@SuppressWarnings(\"module\") module mango100 { }");
+ // Check that there is no warning at use site.
+ Path src_m4 = src.resolve("mangouser");
+ tb.writeJavaFiles(src_m4, "module mangouser { requires mango19; }");
+
+ // Check that we warn about component names ending in digit also
+ Path src_m5 = src.resolve("mango1000.mangofruit.mangomodule");
+ tb.writeJavaFiles(src_m5, "module mango1000.mangofruit.mangomodule { }");
+
+ // Check that we warn about component names ending in digit also
+ Path src_m6 = src.resolve("mangofruit.mango1000.mangomodule");
+ tb.writeJavaFiles(src_m6, "module mangofruit.mango1000.mangomodule { }");
+
+ // Check that we warn about component names ending in digit also
+ Path src_m7 = src.resolve("mangomodule.mangofruit.mango1000");
+ tb.writeJavaFiles(src_m7, "module mangomodule.mangofruit.mango1000 { }");
+
Path classes = base.resolve("classes");
tb.createDirectories(classes);
@@ -78,9 +94,12 @@
.getOutput(Task.OutputKind.DIRECT);
if (!log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango19") ||
+ !log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango1000") ||
+ !log.contains("module-info.java:1:18: compiler.warn.poor.choice.for.module.name: mango1000") ||
+ !log.contains("module-info.java:1:30: compiler.warn.poor.choice.for.module.name: mango1000") ||
!log.contains("- compiler.err.warnings.and.werror") ||
!log.contains("1 error") ||
- !log.contains("1 warning"))
+ !log.contains("4 warning"))
throw new Exception("expected output not found: " + log);
}
}
--- a/langtools/test/tools/javac/treeannotests/TestProcessor.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/treeannotests/TestProcessor.java Mon Apr 24 21:34:23 2017 +0200
@@ -21,8 +21,6 @@
* questions.
*/
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.io.*;
import java.util.*;
import javax.annotation.processing.*;
--- a/langtools/test/tools/javac/warnings/VerifyLintDescriptions.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javac/warnings/VerifyLintDescriptions.java Mon Apr 24 21:34:23 2017 +0200
@@ -30,8 +30,6 @@
* jdk.compiler/com.sun.tools.javac.util
*/
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -42,7 +40,7 @@
public class VerifyLintDescriptions {
public static void main(String... args) {
- Layer boot = Layer.boot();
+ ModuleLayer boot = ModuleLayer.boot();
Module jdk_compiler = boot.findModule("jdk.compiler").get();
ResourceBundle b = ResourceBundle.getBundle("com.sun.tools.javac.resources.javac",
Locale.US,
--- a/langtools/test/tools/javadoc/CheckResourceKeys.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/javadoc/CheckResourceKeys.java Mon Apr 24 21:34:23 2017 +0200
@@ -32,8 +32,6 @@
*/
import java.io.*;
-import java.lang.reflect.Layer;
-import java.lang.reflect.Module;
import java.util.*;
import javax.tools.*;
import com.sun.tools.classfile.*;
@@ -229,7 +227,7 @@
* Get the set of keys from the javadoc resource bundles.
*/
Set<String> getResourceKeys() {
- Module jdk_javadoc = Layer.boot().findModule("jdk.javadoc").get();
+ Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get();
String[] names = {
"com.sun.tools.doclets.formats.html.resources.standard",
"com.sun.tools.doclets.internal.toolkit.resources.doclets",
--- a/langtools/test/tools/lib/toolbox/JavacTask.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/lib/toolbox/JavacTask.java Mon Apr 24 21:34:23 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
@@ -287,10 +287,13 @@
rc = runAPI(direct.pw);
break;
case CMDLINE:
+ if (fileManager != null) {
+ throw new IllegalStateException("file manager set in CMDLINE mode");
+ }
rc = runCommand(direct.pw);
break;
default:
- throw new IllegalStateException();
+ throw new IllegalStateException("unknown mode " + mode);
}
} catch (IOException e) {
toolBox.out.println("Exception occurred: " + e);
--- a/langtools/test/tools/lib/toolbox/ModuleBuilder.java Mon Apr 24 12:08:09 2017 -0400
+++ b/langtools/test/tools/lib/toolbox/ModuleBuilder.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -247,7 +247,9 @@
List<String> sources = new ArrayList<>();
StringBuilder sb = new StringBuilder();
if (!comment.isEmpty()) {
- sb.append("/**\n").append(comment.replace("\n", " *")).append(" */\n");
+ sb.append("/**\n * ")
+ .append(comment.replace("\n", "\n * "))
+ .append("\n */\n");
}
sb.append("module ").append(name).append(" {\n");
requires.forEach(r -> sb.append(" " + r + "\n"));
--- a/make/RunTests.gmk Mon Apr 24 12:08:09 2017 -0400
+++ b/make/RunTests.gmk Mon Apr 24 21:34:23 2017 +0200
@@ -160,6 +160,7 @@
ifeq ($(TEST), )
$(info No test selection given in TEST!)
$(info Please use e.g. 'run-test TEST=tier1' or 'run-test-tier1')
+ $(info See common/doc/testing.[md|html] for help)
$(error Cannot continue)
endif
@@ -182,6 +183,7 @@
ifneq ($(UNKNOWN_TEST), )
$(info Unknown test selection: '$(UNKNOWN_TEST)')
+ $(info See common/doc/testing.[md|html] for help)
$(error Cannot continue)
endif
--- a/make/UpdateBuildDocs.gmk Mon Apr 24 12:08:09 2017 -0400
+++ b/make/UpdateBuildDocs.gmk Mon Apr 24 21:34:23 2017 +0200
@@ -47,6 +47,7 @@
# Remaining parameters are named arguments. These include:
# SOURCE_FILE The markdown source file
# TARGET_DIR The directory where to store the generated html file
+# OPTIONS Additional options to pandoc
#
SetupMarkdownToHtml = $(NamedParamsMacroTemplate)
define SetupMarkdownToHtmlBody
@@ -65,12 +66,13 @@
$$(call LogInfo, Converting $$(notdir $1) to html)
$$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown)
$$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \
- $$(PANDOC) -f markdown -t html --standalone '$$<' -o '$$@')
- TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` ; \
- if [ "x$$TOO_LONG_LINES" != x ]; then \
+ $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
+ --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@')
+ TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
+ if [ "x$$$$TOO_LONG_LINES" != x ]; then \
$$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
$$(ECHO) "The following lines are longer than 80 characters:" ; \
- $$(GREP) -E -e '^.{80}.+$$$$' $$< ; \
+ $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
fi
$1 := $$($1_OUTPUT_FILE)
@@ -80,12 +82,17 @@
################################################################################
-BUILD_DOCS_DIR := $(TOPDIR)/common/doc
-BUILD_DOCS_MD_FILE := building.md
+DOCS_DIR := $(TOPDIR)/common/doc
$(eval $(call SetupMarkdownToHtml, building, \
- SOURCE_FILE := $(BUILD_DOCS_DIR)/$(BUILD_DOCS_MD_FILE), \
- TARGET_DIR := $(BUILD_DOCS_DIR), \
+ SOURCE_FILE := $(DOCS_DIR)/building.md, \
+ TARGET_DIR := $(DOCS_DIR), \
+))
+
+$(eval $(call SetupMarkdownToHtml, testing, \
+ SOURCE_FILE := $(DOCS_DIR)/testing.md, \
+ TARGET_DIR := $(DOCS_DIR), \
+ OPTIONS := --toc, \
))
################################################################################
--- a/make/common/SetupJavaCompilers.gmk Mon Apr 24 12:08:09 2017 -0400
+++ b/make/common/SetupJavaCompilers.gmk Mon Apr 24 21:34:23 2017 +0200
@@ -32,7 +32,7 @@
# If warnings needs to be non-fatal for testing purposes use a command like:
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:all,-removal -Werror
+JAVAC_WARNINGS := -Xlint:all -Werror
# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
# and the interim javac, to be run by the boot jdk.
--- a/nashorn/.hgtags Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/.hgtags Mon Apr 24 21:34:23 2017 +0200
@@ -399,3 +399,5 @@
2cd29b339692524de64d049b329873facaff9727 jdk-9+162
5e5e436543daea0c174d878d5e3ff8dd791e538a jdk-9+163
b473fab09baab51a06ffba02eb06c7f5ee8578f7 jdk-9+164
+e36e62d3ea53c316f295b37bcc19867fbf510235 jdk-9+165
+5b2e7b2101c0048ba9f1df722e56611f523fdfe8 jdk-9+166
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java Mon Apr 24 21:34:23 2017 +0200
@@ -92,7 +92,6 @@
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java Mon Apr 24 21:34:23 2017 +0200
@@ -84,7 +84,6 @@
package jdk.dynalink.beans;
import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java Mon Apr 24 21:34:23 2017 +0200
@@ -89,7 +89,6 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Field;
-import java.lang.reflect.Module;
import java.lang.reflect.Method;
/**
--- a/nashorn/src/jdk.dynalink/share/classes/module-info.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.dynalink/share/classes/module-info.java Mon Apr 24 21:34:23 2017 +0200
@@ -217,6 +217,7 @@
* from B will get a chance to link the call site in A when it encounters the
* object from B.
*
+ * @moduleGraph
* @since 9
*/
module jdk.dynalink {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Mon Apr 24 21:34:23 2017 +0200
@@ -51,9 +51,7 @@
import java.lang.module.ModuleReader;
import java.lang.module.ModuleReference;
import java.lang.reflect.Field;
-import java.lang.reflect.Layer;
import java.lang.reflect.Modifier;
-import java.lang.reflect.Module;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
@@ -378,7 +376,7 @@
static final boolean javaSqlFound, javaSqlRowsetFound;
static {
- final Layer boot = Layer.boot();
+ final ModuleLayer boot = ModuleLayer.boot();
javaSqlFound = boot.findModule("java.sql").isPresent();
javaSqlRowsetFound = boot.findModule("java.sql.rowset").isPresent();
}
@@ -1334,7 +1332,7 @@
* @return the new Module
*/
static Module createModuleTrusted(final ModuleDescriptor descriptor, final ClassLoader loader) {
- return createModuleTrusted(Layer.boot(), descriptor, loader);
+ return createModuleTrusted(ModuleLayer.boot(), descriptor, loader);
}
/**
@@ -1346,7 +1344,7 @@
* @param loader the class loader of the module
* @return the new Module
*/
- static Module createModuleTrusted(final Layer parent, final ModuleDescriptor descriptor, final ClassLoader loader) {
+ static Module createModuleTrusted(final ModuleLayer parent, final ModuleDescriptor descriptor, final ClassLoader loader) {
final String mn = descriptor.name();
final ModuleReference mref = new ModuleReference(descriptor, null) {
@@ -1374,8 +1372,8 @@
final Configuration cf = parent.configuration()
.resolve(finder, ModuleFinder.of(), Set.of(mn));
- final PrivilegedAction<Layer> pa = () -> parent.defineModules(cf, name -> loader);
- final Layer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT);
+ final PrivilegedAction<ModuleLayer> pa = () -> parent.defineModules(cf, name -> loader);
+ final ModuleLayer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT);
final Module m = layer.findModule(mn).get();
assert m.getLayer() == layer;
@@ -1796,7 +1794,7 @@
collect(Collectors.toSet());
}
- final Layer boot = Layer.boot();
+ final ModuleLayer boot = ModuleLayer.boot();
final Configuration conf = boot.configuration().
resolve(mf, ModuleFinder.of(), rootMods);
final String firstMod = rootMods.iterator().next();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java Mon Apr 24 21:34:23 2017 +0200
@@ -34,7 +34,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.lang.reflect.Module;
import java.security.AccessController;
import java.security.CodeSource;
import java.security.Permission;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,7 +27,6 @@
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Modifier;
-import java.lang.reflect.Module;
import java.security.CodeSource;
import java.util.Objects;
import java.util.Set;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java Mon Apr 24 21:34:23 2017 +0200
@@ -32,7 +32,6 @@
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Modifier;
-import java.lang.reflect.Module;
import java.security.ProtectionDomain;
import java.util.Set;
import jdk.nashorn.internal.codegen.ObjectClassGenerator;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java Mon Apr 24 21:34:23 2017 +0200
@@ -27,7 +27,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.lang.reflect.Module;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java Mon Apr 24 21:34:23 2017 +0200
@@ -25,7 +25,6 @@
package jdk.nashorn.internal.scripts;
-import java.lang.reflect.Module;
import jdk.nashorn.api.scripting.JSObject;
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java Mon Apr 24 21:34:23 2017 +0200
@@ -90,6 +90,7 @@
In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects:
{@code JSAdapter}, {@code JavaImporter}, {@code Packages}
+@moduleGraph
@since 9
*/
module jdk.scripting.nashorn {
--- a/nashorn/test/TEST.ROOT Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/test/TEST.ROOT Mon Apr 24 21:34:23 2017 +0200
@@ -8,7 +8,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b04
+requiredVersion=4.2 b07
# Use new module options
useNewOptions=true
--- a/nashorn/test/src/jdk/nashorn/test/models/Reflector.java Mon Apr 24 12:08:09 2017 -0400
+++ b/nashorn/test/src/jdk/nashorn/test/models/Reflector.java Mon Apr 24 21:34:23 2017 +0200
@@ -29,7 +29,6 @@
import java.lang.reflect.Executable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.lang.reflect.Module;
import jdk.nashorn.internal.runtime.Context;
/**
--- a/test/lib/jdk/test/lib/JDKToolLauncher.java Mon Apr 24 12:08:09 2017 -0400
+++ b/test/lib/jdk/test/lib/JDKToolLauncher.java Mon Apr 24 21:34:23 2017 +0200
@@ -24,9 +24,7 @@
package jdk.test.lib;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import jdk.test.lib.process.ProcessTools;
/**
* A utility for constructing command lines for starting JDK tool processes.
@@ -59,7 +57,6 @@
} else {
executable = JDKToolFinder.getTestJDKTool(tool);
}
- vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
}
/**
--- a/test/lib/jdk/test/lib/apps/LingeredApp.java Mon Apr 24 12:08:09 2017 -0400
+++ b/test/lib/jdk/test/lib/apps/LingeredApp.java Mon Apr 24 21:34:23 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -143,7 +143,7 @@
if (appProcess == null) {
throw new RuntimeException("Process is not alive");
}
- return appProcess.getPid();
+ return appProcess.pid();
}
/**
--- a/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java Mon Apr 24 12:08:09 2017 -0400
+++ b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java Mon Apr 24 21:34:23 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
@@ -28,6 +28,7 @@
import java.util.Collections;
import java.util.function.BooleanSupplier;
+import jdk.test.lib.management.InputArguments;
import jdk.test.lib.process.ExitCode;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
@@ -105,7 +106,7 @@
throws Throwable {
List<String> finalOptions = new ArrayList<>();
if (addTestVMOptions) {
- Collections.addAll(finalOptions, ProcessTools.getVmInputArgs());
+ Collections.addAll(finalOptions, InputArguments.getVmInputArgs());
Collections.addAll(finalOptions, Utils.getTestJavaOpts());
}
Collections.addAll(finalOptions, options);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/management/InputArguments.java Mon Apr 24 21:34:23 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * 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 jdk.test.lib.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.List;
+
+public class InputArguments {
+ /**
+ * Gets the array of strings containing input arguments passed to the VM
+ *
+ * @return arguments
+ */
+ public static String[] getVmInputArgs() {
+ RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+ List<String> args = runtime.getInputArguments();
+ return args.toArray(new String[args.size()]);
+ }
+}
--- a/test/lib/jdk/test/lib/process/ProcessTools.java Mon Apr 24 12:08:09 2017 -0400
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java Mon Apr 24 21:34:23 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
@@ -28,13 +28,10 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -45,7 +42,6 @@
import java.util.stream.Collectors;
import jdk.test.lib.JDKToolFinder;
-import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
public final class ProcessTools {
@@ -66,23 +62,23 @@
}
/**
- * Pumps stdout and stderr from running the process into a String.
- *
- * @param processHandler ProcessHandler to run.
- * @return Output from process.
- * @throws IOException If an I/O error occurs.
- */
+ * Pumps stdout and stderr from running the process into a String.
+ *
+ * @param processHandler ProcessHandler to run.
+ * @return Output from process.
+ * @throws IOException If an I/O error occurs.
+ */
public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException {
return getOutput(processBuilder.start());
}
/**
- * Pumps stdout and stderr the running process into a String.
- *
- * @param process Process to pump.
- * @return Output from process.
- * @throws IOException If an I/O error occurs.
- */
+ * Pumps stdout and stderr the running process into a String.
+ *
+ * @param process Process to pump.
+ * @return Output from process.
+ * @throws IOException If an I/O error occurs.
+ */
public static OutputBuffer getOutput(Process process) throws IOException {
ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
@@ -302,40 +298,16 @@
* @return Process id
*/
public static long getProcessId() throws Exception {
- return ProcessHandle.current().getPid();
- }
- /**
- * Gets the array of strings containing input arguments passed to the VM
- *
- * @return arguments
- */
- public static String[] getVmInputArgs() {
- RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
- List<String> args = runtime.getInputArguments();
- return args.toArray(new String[args.size()]);
+ return ProcessHandle.current().pid();
}
- /**
- * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
- *
- * @return String[] with platform specific arguments, empty if there are
- * none
- */
- public static String[] getPlatformSpecificVMArgs() {
-
- if (Platform.is64bit() && Platform.isSolaris()) {
- return new String[] { "-d64" };
- }
-
- return new String[] {};
- }
/**
* Create ProcessBuilder using the java launcher from the jdk to be tested and
* with any platform specific arguments prepended
*/
- public static ProcessBuilder createJavaProcessBuilder(String... command) throws Exception {
+ public static ProcessBuilder createJavaProcessBuilder(String... command) {
return createJavaProcessBuilder(false, command);
}
@@ -348,12 +320,11 @@
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
- public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
+ public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
String javapath = JDKToolFinder.getJDKTool("java");
ArrayList<String> args = new ArrayList<>();
args.add(javapath);
- Collections.addAll(args, getPlatformSpecificVMArgs());
args.add("-cp");
args.add(System.getProperty("java.class.path"));
@@ -386,26 +357,6 @@
/**
* Executes a test jvm process, waits for it to finish and returns the process output.
- * The default jvm options from the test's run command, jtreg, test.vm.opts and test.java.opts, are added.
- * The java from the test.jdk is used to execute the command.
- *
- * The command line will be like:
- * {test.jdk}/bin/java {test.fromRun.opts} {test.vm.opts} {test.java.opts} cmds
- *
- * @param cmds User specifed arguments.
- * @return The output from the process.
- */
- public static OutputAnalyzer executeTestJvmAllArgs(String... cmds) throws Throwable {
- List<String> argsList = new ArrayList<>();
- String[] testArgs = getVmInputArgs();
- Collections.addAll(argsList, testArgs);
- Collections.addAll(argsList, Utils.addTestJavaOpts(cmds));
- ProcessBuilder pb = createJavaProcessBuilder(argsList.toArray(new String[argsList.size()]));
- return executeProcess(pb);
- }
-
- /**
- * Executes a test jvm process, waits for it to finish and returns the process output.
* The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
* The java from the test.jdk is used to execute the command.
*
@@ -580,8 +531,8 @@
}
@Override
- public long getPid() {
- return p.getPid();
+ public long pid() {
+ return p.pid();
}
@Override