--- a/.hgtags-top-repo Wed May 31 17:42:17 2017 +0000
+++ b/.hgtags-top-repo Wed Jul 05 23:33:35 2017 +0200
@@ -420,6 +420,7 @@
03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6
b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169
4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170
-
aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7
df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8
+b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9
+4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171
--- a/common/autoconf/spec.gmk.in Wed May 31 17:42:17 2017 +0000
+++ b/common/autoconf/spec.gmk.in Wed Jul 05 23:33:35 2017 +0200
@@ -651,7 +651,7 @@
MV:=@MV@
NAWK:=@NAWK@
NICE:=@NICE@
-PANDOC:=@PANDOC@
+PANDOC:=@FIXPATH@ @PANDOC@
PATCH:=@PATCH@
PRINTF:=@PRINTF@
RM:=@RM@
--- a/common/doc/building.html Wed May 31 17:42:17 2017 +0000
+++ b/common/doc/building.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,21 +1,23 @@
-<!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">
+<!DOCTYPE html>
+<html>
<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" />
+ <meta charset="utf-8">
+ <meta name="generator" content="pandoc">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>OpenJDK Build README</title>
<style type="text/css">code{white-space: pre;}</style>
- <link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
+ <link rel="stylesheet" href="../../jdk/make/data/docs-resources/specs/resources/jdk-default.css">
+ <!--[if lt IE 9]>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
+ <![endif]-->
</head>
<body>
-<div id="header">
+<header>
<h1 class="title">OpenJDK Build README</h1>
-</div>
-<div class="figure">
-<img src="http://openjdk.java.net/images/openjdk.png" alt="OpenJDK" />
-<p class="caption">OpenJDK</p>
-</div>
+</header>
+<figure>
+<img src="http://openjdk.java.net/images/openjdk.png" alt="OpenJDK" /><figcaption>OpenJDK</figcaption>
+</figure>
<hr />
<h2 id="introduction">Introduction</h2>
<p>This README file contains build instructions for the <a href="http://openjdk.java.net">OpenJDK</a>. Building the source code for the OpenJDK requires a certain degree of technical expertise.</p>
@@ -149,50 +151,50 @@
<table>
<thead>
<tr class="header">
-<th align="left">Package</th>
-<th align="left">Version</th>
+<th style="text-align: left;">Package</th>
+<th style="text-align: left;">Version</th>
</tr>
</thead>
<tbody>
<tr class="odd">
-<td align="left">developer/solarisstudio-124/backend</td>
-<td align="left">12.4-1.0.6.0</td>
+<td style="text-align: left;">developer/solarisstudio-124/backend</td>
+<td style="text-align: left;">12.4-1.0.6.0</td>
</tr>
<tr class="even">
-<td align="left">developer/solarisstudio-124/c++</td>
-<td align="left">12.4-1.0.10.0</td>
+<td style="text-align: left;">developer/solarisstudio-124/c++</td>
+<td style="text-align: left;">12.4-1.0.10.0</td>
</tr>
<tr class="odd">
-<td align="left">developer/solarisstudio-124/cc</td>
-<td align="left">12.4-1.0.4.0</td>
+<td style="text-align: left;">developer/solarisstudio-124/cc</td>
+<td style="text-align: left;">12.4-1.0.4.0</td>
</tr>
<tr class="even">
-<td align="left">developer/solarisstudio-124/library/c++-libs</td>
-<td align="left">12.4-1.0.10.0</td>
+<td style="text-align: left;">developer/solarisstudio-124/library/c++-libs</td>
+<td style="text-align: left;">12.4-1.0.10.0</td>
</tr>
<tr class="odd">
-<td align="left">developer/solarisstudio-124/library/math-libs</td>
-<td align="left">12.4-1.0.0.1</td>
+<td style="text-align: left;">developer/solarisstudio-124/library/math-libs</td>
+<td style="text-align: left;">12.4-1.0.0.1</td>
</tr>
<tr class="even">
-<td align="left">developer/solarisstudio-124/library/studio-gccrt</td>
-<td align="left">12.4-1.0.0.1</td>
+<td style="text-align: left;">developer/solarisstudio-124/library/studio-gccrt</td>
+<td style="text-align: left;">12.4-1.0.0.1</td>
</tr>
<tr class="odd">
-<td align="left">developer/solarisstudio-124/studio-common</td>
-<td align="left">12.4-1.0.0.1</td>
+<td style="text-align: left;">developer/solarisstudio-124/studio-common</td>
+<td style="text-align: left;">12.4-1.0.0.1</td>
</tr>
<tr class="even">
-<td align="left">developer/solarisstudio-124/studio-ja</td>
-<td align="left">12.4-1.0.0.1</td>
+<td style="text-align: left;">developer/solarisstudio-124/studio-ja</td>
+<td style="text-align: left;">12.4-1.0.0.1</td>
</tr>
<tr class="odd">
-<td align="left">developer/solarisstudio-124/studio-legal</td>
-<td align="left">12.4-1.0.0.1</td>
+<td style="text-align: left;">developer/solarisstudio-124/studio-legal</td>
+<td style="text-align: left;">12.4-1.0.0.1</td>
</tr>
<tr class="even">
-<td align="left">developer/solarisstudio-124/studio-zhCN</td>
-<td align="left">12.4-1.0.0.1</td>
+<td style="text-align: left;">developer/solarisstudio-124/studio-zhCN</td>
+<td style="text-align: left;">12.4-1.0.0.1</td>
</tr>
</tbody>
</table>
@@ -211,66 +213,66 @@
<table>
<thead>
<tr class="header">
-<th align="left">Binary Name</th>
-<th align="left">Category</th>
-<th align="left">Package</th>
-<th align="left">Description</th>
+<th style="text-align: left;">Binary Name</th>
+<th style="text-align: left;">Category</th>
+<th style="text-align: left;">Package</th>
+<th style="text-align: left;">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
-<td align="left">ar.exe</td>
-<td align="left">Devel</td>
-<td align="left">binutils</td>
-<td align="left">The GNU assembler, linker and binary utilities</td>
+<td style="text-align: left;">ar.exe</td>
+<td style="text-align: left;">Devel</td>
+<td style="text-align: left;">binutils</td>
+<td style="text-align: left;">The GNU assembler, linker and binary utilities</td>
</tr>
<tr class="even">
-<td align="left">make.exe</td>
-<td align="left">Devel</td>
-<td align="left">make</td>
-<td align="left">The GNU version of the 'make' utility built for CYGWIN</td>
+<td style="text-align: left;">make.exe</td>
+<td style="text-align: left;">Devel</td>
+<td style="text-align: left;">make</td>
+<td style="text-align: left;">The GNU version of the 'make' utility built for CYGWIN</td>
</tr>
<tr class="odd">
-<td align="left">m4.exe</td>
-<td align="left">Interpreters</td>
-<td align="left">m4</td>
-<td align="left">GNU implementation of the traditional Unix macro processor</td>
+<td style="text-align: left;">m4.exe</td>
+<td style="text-align: left;">Interpreters</td>
+<td style="text-align: left;">m4</td>
+<td style="text-align: left;">GNU implementation of the traditional Unix macro processor</td>
</tr>
<tr class="even">
-<td align="left">cpio.exe</td>
-<td align="left">Utils</td>
-<td align="left">cpio</td>
-<td align="left">A program to manage archives of files</td>
+<td style="text-align: left;">cpio.exe</td>
+<td style="text-align: left;">Utils</td>
+<td style="text-align: left;">cpio</td>
+<td style="text-align: left;">A program to manage archives of files</td>
</tr>
<tr class="odd">
-<td align="left">gawk.exe</td>
-<td align="left">Utils</td>
-<td align="left">awk</td>
-<td align="left">Pattern-directed scanning and processing language</td>
+<td style="text-align: left;">gawk.exe</td>
+<td style="text-align: left;">Utils</td>
+<td style="text-align: left;">awk</td>
+<td style="text-align: left;">Pattern-directed scanning and processing language</td>
</tr>
<tr class="even">
-<td align="left">file.exe</td>
-<td align="left">Utils</td>
-<td align="left">file</td>
-<td align="left">Determines file type using 'magic' numbers</td>
+<td style="text-align: left;">file.exe</td>
+<td style="text-align: left;">Utils</td>
+<td style="text-align: left;">file</td>
+<td style="text-align: left;">Determines file type using 'magic' numbers</td>
</tr>
<tr class="odd">
-<td align="left">zip.exe</td>
-<td align="left">Archive</td>
-<td align="left">zip</td>
-<td align="left">Package and compress (archive) files</td>
+<td style="text-align: left;">zip.exe</td>
+<td style="text-align: left;">Archive</td>
+<td style="text-align: left;">zip</td>
+<td style="text-align: left;">Package and compress (archive) files</td>
</tr>
<tr class="even">
-<td align="left">unzip.exe</td>
-<td align="left">Archive</td>
-<td align="left">unzip</td>
-<td align="left">Extract compressed files in a ZIP archive</td>
+<td style="text-align: left;">unzip.exe</td>
+<td style="text-align: left;">Archive</td>
+<td style="text-align: left;">unzip</td>
+<td style="text-align: left;">Extract compressed files in a ZIP archive</td>
</tr>
<tr class="odd">
-<td align="left">free.exe</td>
-<td align="left">System</td>
-<td align="left">procps</td>
-<td align="left">Display amount of free and used memory in the system</td>
+<td style="text-align: left;">free.exe</td>
+<td style="text-align: left;">System</td>
+<td style="text-align: left;">procps</td>
+<td style="text-align: left;">Display amount of free and used memory in the system</td>
</tr>
</tbody>
</table>
@@ -561,14 +563,14 @@
This is probably an issue with SELinux (See <a href="http://en.wikipedia.org/wiki/SELinux">SELinux on Wikipedia</a>). Parts of the VM is built without the <code>-fPIC</code> for performance reasons.</p></li>
</ul>
<p>To completely disable SELinux:</p>
-<ol style="list-style-type: decimal">
+<ol type="1">
<li><code>$ su root</code></li>
<li><code># system-config-securitylevel</code></li>
<li><code>In the window that appears, select the SELinux tab</code></li>
<li><code>Disable SELinux</code></li>
</ol>
<p>Alternatively, instead of completely disabling it you could disable just this one check.</p>
-<ol style="list-style-type: decimal">
+<ol type="1">
<li>Select System->Administration->SELinux Management</li>
<li>In the SELinux Management Tool which appears, select "Boolean" from the menu on the left</li>
<li>Expand the "Memory Protection" group</li>
@@ -616,62 +618,62 @@
<table>
<thead>
<tr class="header">
-<th align="left">Base OS and Architecture</th>
-<th align="left">OS</th>
-<th align="left">C/C++ Compiler</th>
-<th align="left">Processors</th>
-<th align="left">RAM Minimum</th>
-<th align="left">DISK Needs</th>
+<th style="text-align: left;">Base OS and Architecture</th>
+<th style="text-align: left;">OS</th>
+<th style="text-align: left;">C/C++ Compiler</th>
+<th style="text-align: left;">Processors</th>
+<th style="text-align: left;">RAM Minimum</th>
+<th style="text-align: left;">DISK Needs</th>
</tr>
</thead>
<tbody>
<tr class="odd">
-<td align="left">Linux X86 (32-bit) and X64 (64-bit)</td>
-<td align="left">Oracle Enterprise Linux 6.4</td>
-<td align="left">gcc 4.9.2</td>
-<td align="left">2 or more</td>
-<td align="left">1 GB</td>
-<td align="left">6 GB</td>
+<td style="text-align: left;">Linux X86 (32-bit) and X64 (64-bit)</td>
+<td style="text-align: left;">Oracle Enterprise Linux 6.4</td>
+<td style="text-align: left;">gcc 4.9.2</td>
+<td style="text-align: left;">2 or more</td>
+<td style="text-align: left;">1 GB</td>
+<td style="text-align: left;">6 GB</td>
</tr>
<tr class="even">
-<td align="left">Solaris SPARCV9 (64-bit)</td>
-<td align="left">Solaris 11 Update 1</td>
-<td align="left">Studio 12 Update 4 + patches</td>
-<td align="left">4 or more</td>
-<td align="left">4 GB</td>
-<td align="left">8 GB</td>
+<td style="text-align: left;">Solaris SPARCV9 (64-bit)</td>
+<td style="text-align: left;">Solaris 11 Update 1</td>
+<td style="text-align: left;">Studio 12 Update 4 + patches</td>
+<td style="text-align: left;">4 or more</td>
+<td style="text-align: left;">4 GB</td>
+<td style="text-align: left;">8 GB</td>
</tr>
<tr class="odd">
-<td align="left">Solaris X64 (64-bit)</td>
-<td align="left">Solaris 11 Update 1</td>
-<td align="left">Studio 12 Update 4 + patches</td>
-<td align="left">4 or more</td>
-<td align="left">4 GB</td>
-<td align="left">8 GB</td>
+<td style="text-align: left;">Solaris X64 (64-bit)</td>
+<td style="text-align: left;">Solaris 11 Update 1</td>
+<td style="text-align: left;">Studio 12 Update 4 + patches</td>
+<td style="text-align: left;">4 or more</td>
+<td style="text-align: left;">4 GB</td>
+<td style="text-align: left;">8 GB</td>
</tr>
<tr class="even">
-<td align="left">Windows X86 (32-bit)</td>
-<td align="left">Windows Server 2012 R2 x64</td>
-<td align="left">Microsoft Visual Studio C++ 2013 Professional Edition</td>
-<td align="left">2 or more</td>
-<td align="left">2 GB</td>
-<td align="left">6 GB</td>
+<td style="text-align: left;">Windows X86 (32-bit)</td>
+<td style="text-align: left;">Windows Server 2012 R2 x64</td>
+<td style="text-align: left;">Microsoft Visual Studio C++ 2013 Professional Edition</td>
+<td style="text-align: left;">2 or more</td>
+<td style="text-align: left;">2 GB</td>
+<td style="text-align: left;">6 GB</td>
</tr>
<tr class="odd">
-<td align="left">Windows X64 (64-bit)</td>
-<td align="left">Windows Server 2012 R2 x64</td>
-<td align="left">Microsoft Visual Studio C++ 2013 Professional Edition</td>
-<td align="left">2 or more</td>
-<td align="left">2 GB</td>
-<td align="left">6 GB</td>
+<td style="text-align: left;">Windows X64 (64-bit)</td>
+<td style="text-align: left;">Windows Server 2012 R2 x64</td>
+<td style="text-align: left;">Microsoft Visual Studio C++ 2013 Professional Edition</td>
+<td style="text-align: left;">2 or more</td>
+<td style="text-align: left;">2 GB</td>
+<td style="text-align: left;">6 GB</td>
</tr>
<tr class="even">
-<td align="left">Mac OS X X64 (64-bit)</td>
-<td align="left">Mac OS X 10.9 "Mavericks"</td>
-<td align="left">Xcode 6.3 or newer</td>
-<td align="left">2 or more</td>
-<td align="left">4 GB</td>
-<td align="left">6 GB</td>
+<td style="text-align: left;">Mac OS X X64 (64-bit)</td>
+<td style="text-align: left;">Mac OS X 10.9 "Mavericks"</td>
+<td style="text-align: left;">Xcode 6.3 or newer</td>
+<td style="text-align: left;">2 or more</td>
+<td style="text-align: left;">4 GB</td>
+<td style="text-align: left;">6 GB</td>
</tr>
</tbody>
</table>
--- a/common/doc/testing.html Wed May 31 17:42:17 2017 +0000
+++ b/common/doc/testing.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,19 +1,22 @@
-<!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">
+<!DOCTYPE html>
+<html>
<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" />
+ <meta charset="utf-8">
+ <meta name="generator" content="pandoc">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Testing OpenJDK</title>
<style type="text/css">code{white-space: pre;}</style>
- <link rel="stylesheet" href=" ../../jdk/make/data/docs-resources/specs/resources/jdk-default.css" type="text/css" />
+ <link rel="stylesheet" href="../../jdk/make/data/docs-resources/specs/resources/jdk-default.css">
+ <!--[if lt IE 9]>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
+ <![endif]-->
<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
</head>
<body>
-<div id="header">
+<header>
<h1 class="title">Testing OpenJDK</h1>
-</div>
-<div id="TOC">
+</header>
+<nav 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>
@@ -26,16 +29,18 @@
<li><a href="#gtest-keywords">Gtest keywords</a></li>
</ul></li>
</ul>
-</div>
+</nav>
<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>The main target "run-test" uses the jdk-image as the tested product. There is also an alternate target "exploded-run-test" that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.</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>
+$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+$ make exploded-run-test TEST=hotspot_tier1</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>
--- a/common/doc/testing.md Wed May 31 17:42:17 2017 +0000
+++ b/common/doc/testing.md Wed Jul 05 23:33:35 2017 +0200
@@ -7,6 +7,11 @@
and more complex ad-hoc combination of tests is possible. The user interface is
forgiving, and clearly report errors it cannot resolve.
+The main target "run-test" uses the jdk-image as the tested product. There is
+also an alternate target "exploded-run-test" that uses the exploded image
+instead. Not all tests will run successfully on the exploded image, but using
+this target can greatly improve rebuild times for certain workflows.
+
Some example command-lines:
$ make run-test-tier1
@@ -15,6 +20,7 @@
$ 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"
+ $ make exploded-run-test TEST=hotspot_tier1
## Test selection
--- a/corba/.hgtags Wed May 31 17:42:17 2017 +0000
+++ b/corba/.hgtags Wed Jul 05 23:33:35 2017 +0200
@@ -422,3 +422,5 @@
8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170
aed5a4edc8275c1c50195503756ff92bfe0197f5 jdk-10+7
648b0a00824eb29e71936bc3258d309a25e3b8c0 jdk-10+8
+54c6621f7b34cc6ce6c0882d047f61fe0962c257 jdk-10+9
+c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171
--- a/hotspot/.hgtags Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/.hgtags Wed Jul 05 23:33:35 2017 +0200
@@ -582,3 +582,5 @@
38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170
9d4746eca95aec3e5a344bf2520745dcc1d17eed jdk-10+7
f5ded0cf954c770deeecb80f2ba1ba6a05cd979b jdk-10+8
+233647e3d3800e76d7612014b745b37a88098f63 jdk-10+9
+d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171
--- a/hotspot/.mx.jvmci/mx_jvmci.py Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/.mx.jvmci/mx_jvmci.py Wed Jul 05 23:33:35 2017 +0200
@@ -303,9 +303,9 @@
out.close('link')
out.open('link')
- out.element('name', data='generated')
+ out.element('name', data='gensrc')
out.element('type', data='2')
- generated = join(_get_hotspot_build_dir(jvmVariant, debugLevel), 'generated')
+ generated = join(_get_hotspot_build_dir(jvmVariant, debugLevel), 'gensrc')
out.element('locationURI', data=mx.get_eclipse_project_rel_locationURI(generated, eclProjectDir))
out.close('link')
@@ -620,18 +620,12 @@
def _get_hotspot_build_dir(jvmVariant=None, debugLevel=None):
"""
Gets the directory in which a particular HotSpot configuration is built
- (e.g., <JDK_REPO_ROOT>/build/macosx-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2)
+ (e.g., <JDK_REPO_ROOT>/build/macosx-x86_64-normal-server-release/hotspot/variant-<variant>)
"""
if jvmVariant is None:
jvmVariant = _vm.jvmVariant
- os = mx.get_os()
- if os == 'darwin':
- os = 'bsd'
- arch = mx.get_arch()
- buildname = {'client': 'compiler1', 'server': 'compiler2'}.get(jvmVariant, jvmVariant)
-
- name = '{}_{}_{}'.format(os, arch, buildname)
+ name = 'variant-{}'.format(jvmVariant)
return join(_get_jdk_build_dir(debugLevel=debugLevel), 'hotspot', name)
class JVMCI9JDKConfig(mx.JDKConfig):
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Wed Jul 05 23:33:35 2017 +0200
@@ -4134,28 +4134,33 @@
if ((dst_enc < 16) && (nds_enc < 16)) {
vandps(dst, nds, negate_field, vector_len);
} else if ((src_enc < 16) && (dst_enc < 16)) {
- movss(src, nds);
+ evmovdqul(src, nds, Assembler::AVX_512bit);
vandps(dst, src, negate_field, vector_len);
} else if (src_enc < 16) {
- movss(src, nds);
+ evmovdqul(src, nds, Assembler::AVX_512bit);
vandps(src, src, negate_field, vector_len);
- movss(dst, src);
+ evmovdqul(dst, src, Assembler::AVX_512bit);
} else if (dst_enc < 16) {
- movdqu(src, xmm0);
- movss(xmm0, nds);
+ evmovdqul(src, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, nds, Assembler::AVX_512bit);
vandps(dst, xmm0, negate_field, vector_len);
- movdqu(xmm0, src);
- } else if (nds_enc < 16) {
- movdqu(src, xmm0);
- vandps(xmm0, nds, negate_field, vector_len);
- movss(dst, xmm0);
- movdqu(xmm0, src);
- } else {
- movdqu(src, xmm0);
- movss(xmm0, nds);
- vandps(xmm0, xmm0, negate_field, vector_len);
- movss(dst, xmm0);
- movdqu(xmm0, src);
+ evmovdqul(xmm0, src, Assembler::AVX_512bit);
+ } else {
+ if (src_enc != dst_enc) {
+ evmovdqul(src, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, nds, Assembler::AVX_512bit);
+ vandps(xmm0, xmm0, negate_field, vector_len);
+ evmovdqul(dst, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, src, Assembler::AVX_512bit);
+ } else {
+ subptr(rsp, 64);
+ evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, nds, Assembler::AVX_512bit);
+ vandps(xmm0, xmm0, negate_field, vector_len);
+ evmovdqul(dst, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
+ addptr(rsp, 64);
+ }
}
}
@@ -4166,28 +4171,33 @@
if ((dst_enc < 16) && (nds_enc < 16)) {
vandpd(dst, nds, negate_field, vector_len);
} else if ((src_enc < 16) && (dst_enc < 16)) {
- movsd(src, nds);
+ evmovdqul(src, nds, Assembler::AVX_512bit);
vandpd(dst, src, negate_field, vector_len);
} else if (src_enc < 16) {
- movsd(src, nds);
+ evmovdqul(src, nds, Assembler::AVX_512bit);
vandpd(src, src, negate_field, vector_len);
- movsd(dst, src);
+ evmovdqul(dst, src, Assembler::AVX_512bit);
} else if (dst_enc < 16) {
- movdqu(src, xmm0);
- movsd(xmm0, nds);
+ evmovdqul(src, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, nds, Assembler::AVX_512bit);
vandpd(dst, xmm0, negate_field, vector_len);
- movdqu(xmm0, src);
- } else if (nds_enc < 16) {
- movdqu(src, xmm0);
- vandpd(xmm0, nds, negate_field, vector_len);
- movsd(dst, xmm0);
- movdqu(xmm0, src);
- } else {
- movdqu(src, xmm0);
- movsd(xmm0, nds);
- vandpd(xmm0, xmm0, negate_field, vector_len);
- movsd(dst, xmm0);
- movdqu(xmm0, src);
+ evmovdqul(xmm0, src, Assembler::AVX_512bit);
+ } else {
+ if (src_enc != dst_enc) {
+ evmovdqul(src, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, nds, Assembler::AVX_512bit);
+ vandpd(xmm0, xmm0, negate_field, vector_len);
+ evmovdqul(dst, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, src, Assembler::AVX_512bit);
+ } else {
+ subptr(rsp, 64);
+ evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, nds, Assembler::AVX_512bit);
+ vandpd(xmm0, xmm0, negate_field, vector_len);
+ evmovdqul(dst, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
+ addptr(rsp, 64);
+ }
}
}
@@ -4934,6 +4944,24 @@
}
}
+void MacroAssembler::pshufd(XMMRegister dst, Address src, int mode) {
+ if (VM_Version::supports_avx512vl()) {
+ Assembler::pshufd(dst, src, mode);
+ } else {
+ int dst_enc = dst->encoding();
+ if (dst_enc < 16) {
+ Assembler::pshufd(dst, src, mode);
+ } else {
+ subptr(rsp, 64);
+ evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
+ Assembler::pshufd(xmm0, src, mode);
+ evmovdqul(dst, xmm0, Assembler::AVX_512bit);
+ evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
+ addptr(rsp, 64);
+ }
+ }
+}
+
// This instruction exists within macros, ergo we cannot control its input
// when emitted through those patterns.
void MacroAssembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) {
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Wed Jul 05 23:33:35 2017 +0200
@@ -1232,6 +1232,9 @@
void punpcklbw(XMMRegister dst, XMMRegister src);
void punpcklbw(XMMRegister dst, Address src) { Assembler::punpcklbw(dst, src); }
+ void pshufd(XMMRegister dst, Address src, int mode);
+ void pshufd(XMMRegister dst, XMMRegister src, int mode) { Assembler::pshufd(dst, src, mode); }
+
void pshuflw(XMMRegister dst, XMMRegister src, int mode);
void pshuflw(XMMRegister dst, Address src, int mode) { Assembler::pshuflw(dst, src, mode); }
--- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Wed Jul 05 23:33:35 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
@@ -23,6 +23,12 @@
* questions.
*/
+/**
+ * Defines the implementation of the HotSpot Serviceability Agent.
+ *
+ * @moduleGraph
+ * @since 9
+ */
module jdk.hotspot.agent {
requires java.datatransfer;
requires java.desktop;
--- a/hotspot/src/share/vm/oops/constMethod.cpp Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/src/share/vm/oops/constMethod.cpp Wed Jul 05 23:33:35 2017 +0200
@@ -407,8 +407,12 @@
ResourceMark rm;
assert(is_constMethod(), "must be constMethod");
st->print_cr("%s", internal_name());
- st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method()));
- method()->print_value_on(st); st->cr();
+ Method* m = method();
+ st->print(" - method: " INTPTR_FORMAT " ", p2i((address)m));
+ if (m != NULL) {
+ m->print_value_on(st);
+ }
+ st->cr();
if (has_stackmap_table()) {
st->print(" - stackmap data: ");
stackmap_data()->print_value_on(st);
@@ -421,7 +425,12 @@
void ConstMethod::print_value_on(outputStream* st) const {
assert(is_constMethod(), "must be constMethod");
st->print(" const part of method " );
- method()->print_value_on(st);
+ Method* m = method();
+ if (m != NULL) {
+ m->print_value_on(st);
+ } else {
+ st->print("NULL");
+ }
}
#if INCLUDE_SERVICES
@@ -461,7 +470,7 @@
// Verification can occur during oop construction before the method or
// other fields have been initialized.
- guarantee(method()->is_method(), "should be method");
+ guarantee(method() != NULL && method()->is_method(), "should be method");
address m_end = (address)((intptr_t) this + size());
address compressed_table_start = code_end();
--- a/hotspot/src/share/vm/opto/matcher.cpp Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/src/share/vm/opto/matcher.cpp Wed Jul 05 23:33:35 2017 +0200
@@ -1000,7 +1000,7 @@
if (C->failing()) return NULL;
if (m == NULL) { Matcher::soft_match_failure(); return NULL; }
} else { // Nothing the matcher cares about
- if( n->is_Proj() && n->in(0)->is_Multi()) { // Projections?
+ if (n->is_Proj() && n->in(0) != NULL && n->in(0)->is_Multi()) { // Projections?
// Convert to machine-dependent projection
m = n->in(0)->as_Multi()->match( n->as_Proj(), this );
#ifdef ASSERT
@@ -1645,6 +1645,7 @@
// Build the object to represent this state & prepare for recursive calls
MachNode *mach = s->MachNodeGenerator(rule);
+ guarantee(mach != NULL, "Missing MachNode");
mach->_opnds[0] = s->MachOperGenerator(_reduceOp[rule]);
assert( mach->_opnds[0] != NULL, "Missing result operand" );
Node *leaf = s->_leaf;
--- a/hotspot/src/share/vm/opto/memnode.cpp Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/src/share/vm/opto/memnode.cpp Wed Jul 05 23:33:35 2017 +0200
@@ -1123,6 +1123,9 @@
// Use _idx of address base (could be Phi node) for boxed values.
intptr_t ignore = 0;
Node* base = AddPNode::Ideal_base_and_offset(in(Address), phase, ignore);
+ if (base == NULL) {
+ return this;
+ }
this_iid = base->_idx;
}
const Type* this_type = bottom_type();
@@ -3947,9 +3950,10 @@
// if it is the last unused 4 bytes of an instance, forget about it
intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
if (zeroes_done + BytesPerLong >= size_limit) {
- assert(allocation() != NULL, "");
- if (allocation()->Opcode() == Op_Allocate) {
- Node* klass_node = allocation()->in(AllocateNode::KlassNode);
+ AllocateNode* alloc = allocation();
+ assert(alloc != NULL, "must be present");
+ if (alloc != NULL && alloc->Opcode() == Op_Allocate) {
+ Node* klass_node = alloc->in(AllocateNode::KlassNode);
ciKlass* k = phase->type(klass_node)->is_klassptr()->klass();
if (zeroes_done == k->layout_helper())
zeroes_done = size_limit;
--- a/hotspot/test/ProblemList.txt Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/test/ProblemList.txt Wed Jul 05 23:33:35 2017 +0200
@@ -64,14 +64,14 @@
runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
# This test is disabled since it will stress NMT and timeout during normal testing
runtime/NMT/MallocStressTest.java 8166548 generic-all
-runtime/SharedArchiveFile/BootAppendTests.java 8150683 generic-all
+runtime/SharedArchiveFile/BootAppendTests.java 8179103 generic-all
runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
#############################################################################
# :hotspot_serviceability
-serviceability/jdwp/AllModulesCommandTest.java 8168478 generic-all
+serviceability/jdwp/AllModulesCommandTest.java 8170541 generic-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java 8173936 generic-all
--- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,7 +23,7 @@
package compiler.codecache.stress;
-import jdk.test.lib.wrappers.TimeLimitedRunner;
+import jdk.test.lib.TimeLimitedRunner;
import jdk.test.lib.Utils;
public class CodeCacheStressRunner {
--- a/hotspot/test/compiler/codecache/stress/Helper.java Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/test/compiler/codecache/stress/Helper.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,7 +25,7 @@
import jdk.test.lib.Asserts;
import jdk.test.lib.ByteCodeLoader;
-import jdk.test.lib.wrappers.InfiniteLoop;
+import jdk.test.lib.InfiniteLoop;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java Wed Jul 05 23:33:35 2017 +0200
@@ -29,7 +29,7 @@
import compiler.compilercontrol.share.pool.PoolHelper;
import compiler.compilercontrol.share.scenario.Executor;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.wrappers.TimeLimitedRunner;
+import jdk.test.lib.TimeLimitedRunner;
import jdk.test.lib.Utils;
import java.util.ArrayList;
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -44,7 +44,7 @@
package compiler.whitebox;
import jdk.test.lib.Asserts;
-import jdk.test.lib.wrappers.InfiniteLoop;
+import jdk.test.lib.InfiniteLoop;
import sun.hotspot.WhiteBox;
import sun.hotspot.code.BlobType;
--- a/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java Wed May 31 17:42:17 2017 +0000
+++ b/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -32,7 +32,6 @@
* @test
* @summary Tests the modules-related JDWP commands
* @library /test/lib
- * @ignore 8170541
* @modules jdk.jdwp.agent
* @modules java.base/jdk.internal.misc
* @compile AllModulesCommandTestDebuggee.java
--- a/jaxp/.hgtags Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/.hgtags Wed Jul 05 23:33:35 2017 +0200
@@ -422,3 +422,5 @@
6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170
09cae4c36242734f5450de739b8264523a030809 jdk-10+7
856998840907b67b7e1fc49259f785ac085a189b jdk-10+8
+3c75f07b2a49cb0a4f4eb5df8bbcbc64dda3153f jdk-10+9
+c27321c889cf4c8e465a61b84572c00ef7ee6004 jdk-9+171
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Wed Jul 05 23:33:35 2017 +0200
@@ -34,9 +34,9 @@
* The CatalogFeatures holds a collection of features and properties.
* <p>
*
- * <center><h2><a name="CatalogFeatures">Catalog Features</a></h2></center></p>
*
- * <table border="1">
+ * <table class="plain">
+ * <caption>Catalog Features</caption>
* <thead>
* <tr>
* <th rowspan="2">Feature</th>
@@ -44,7 +44,7 @@
* <th rowspan="2">Property Name</th>
* <th rowspan="2">System Property [1]</th>
* <th rowspan="2">jaxp.properties [1]</th>
- * <th colspan="2" align="center">Value [2]</th>
+ * <th colspan="2" style="text-align:center">Value [2]</th>
* <th rowspan="2">Action</th>
* </tr>
* <tr>
@@ -55,7 +55,7 @@
* <tbody>
*
* <tr>
- * <td><a name="FILES">FILES</a></td>
+ * <td><a id="FILES">FILES</a></td>
* <td>A semicolon-delimited list of URIs to locate the catalog files.
* The URIs must be absolute and have a URL protocol handler for the URI scheme.
* </td>
@@ -71,7 +71,7 @@
* </tr>
*
* <tr>
- * <td rowspan="2"><a name="PREFER">PREFER</a></td>
+ * <td rowspan="2"><a id="PREFER">PREFER</a></td>
* <td rowspan="2">Indicates the preference between the public and system
* identifiers. The default value is public [3].</td>
* <td rowspan="2">javax.xml.catalog.prefer</td>
@@ -89,7 +89,7 @@
* </tr>
*
* <tr>
- * <td rowspan="2"><a name="DEFER">DEFER</a></td>
+ * <td rowspan="2"><a id="DEFER">DEFER</a></td>
* <td rowspan="2">Indicates that the alternative catalogs including those
* specified in delegate entries or nextCatalog are not read until they are
* needed. The default value is true.</td>
@@ -107,7 +107,7 @@
* </tr>
*
* <tr>
- * <td rowspan="3"><a name="RESOLVE">RESOLVE</a></td>
+ * <td rowspan="3"><a id="RESOLVE">RESOLVE</a></td>
* <td rowspan="3">Determines the action if there is no matching entry found after
* all of the specified catalogs are exhausted. The default is strict.</td>
* <td rowspan="3">javax.xml.catalog.resolve [4]</td>
@@ -241,9 +241,10 @@
* supports a resolver. The following table lists all such processes.
*
* <p>
- * <center><h3><a name="CatalogFeatures">Processes with Catalog Support</a></h3></center></p>
+ * <h3><a id="ProcessesWithCatalogSupport">Processes with Catalog Support</a></h3>
*
- * <table border="1">
+ * <table class="striped">
+ * <caption>Processes with Catalog Support</caption>
* <thead>
* <tr>
* <th>Process</th>
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,8 +1,8 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!DOCTYPE HTML>
<html>
<head>
<!--
-Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
questions.
-->
</head>
-<body bgcolor="white">
+<body>
Provides the classes for implementing
<a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html">
@@ -35,7 +35,7 @@
<p>
Unless otherwise noted, passing a null argument to
a constructor or method in any class or interface in this package will
- cause a <tt>NullPointerException</tt> to be thrown.
+ cause a <code>NullPointerException</code> to be thrown.
</p>
@since 9
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, 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
@@ -774,15 +774,11 @@
/**
* Create an {@code XMLGregorianCalendar} from a {@link GregorianCalendar}.
*
- * <table border="2" rules="all" cellpadding="2">
+ * <table class="striped">
+ * <caption>Field by Field Conversion from
+ * {@link GregorianCalendar} to an {@link XMLGregorianCalendar}</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">
- * Field by Field Conversion from
- * {@link GregorianCalendar} to an {@link XMLGregorianCalendar}
- * </th>
- * </tr>
- * <tr>
* <th>{@code java.util.GregorianCalendar} field</th>
* <th>{@code javax.xml.datatype.XMLGregorianCalendar} field</th>
* </tr>
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,26 +120,22 @@
* maps to. Type is computed based on fields that are set,
* i.e. {@link #isSet(DatatypeConstants.Field field)} == {@code true}.
*
- * <table border="2" rules="all" cellpadding="2">
+ * <table class="striped">
+ * <caption>Required fields for XML Schema 1.0 Date/Time Datatypes.<br>
+ * <i>(timezone is optional for all date/time datatypes)</i></caption>
* <thead>
* <tr>
- * <th align="center" colspan="7">
- * Required fields for XML Schema 1.0 Date/Time Datatypes.<br>
- * <i>(timezone is optional for all date/time datatypes)</i>
- * </th>
+ * <th>Datatype</th>
+ * <th>year</th>
+ * <th>month</th>
+ * <th>day</th>
+ * <th>hour</th>
+ * <th>minute</th>
+ * <th>second</th>
* </tr>
* </thead>
* <tbody>
* <tr>
- * <td>Datatype</td>
- * <td>year</td>
- * <td>month</td>
- * <td>day</td>
- * <td>hour</td>
- * <td>minute</td>
- * <td>second</td>
- * </tr>
- * <tr>
* <td>{@link DatatypeConstants#DURATION}</td>
* <td>X</td>
* <td>X</td>
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java Wed Jul 05 23:33:35 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
@@ -53,25 +53,21 @@
* <a href="http://www.w3.org/TR/xmlschema-2/#isoformats">W3C XML Schema 1.0 Part 2, Appendix D,
* <i>ISO 8601 Date and Time Formats</i></a>.
*
- * <a name="datetimefieldmapping"></a>
- * <table border="2" rules="all" cellpadding="2">
+ * <a id="datetimefieldmapping"></a>
+ * <table class="striped">
+ * <caption>Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation</caption>
* <thead>
* <tr>
- * <th align="center" colspan="3">
- * Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
- * </th>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
* <th>XML Schema 1.0<br>
* datatype<br>
* field</th>
* <th>Related<br>XMLGregorianCalendar<br>Accessor(s)</th>
* <th>Value Range</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
- * <td><a name="datetimefield-year">year</a></td>
+ * <td><a id="datetimefield-year">year</a></td>
* <td> {@link #getYear()} + {@link #getEon()} or<br>
* {@link #getEonAndYear}
* </td>
@@ -89,12 +85,12 @@
* </td>
* </tr>
* <tr>
- * <td><a name="datetimefield-month">month</a></td>
+ * <td><a id="datetimefield-month">month</a></td>
* <td> {@link #getMonth()} </td>
* <td> 1 to 12 or {@link DatatypeConstants#FIELD_UNDEFINED} </td>
* </tr>
* <tr>
- * <td><a name="datetimefield-day">day</a></td>
+ * <td><a id="datetimefield-day">day</a></td>
* <td> {@link #getDay()} </td>
* <td> Independent of month, max range is 1 to 31 or {@link DatatypeConstants#FIELD_UNDEFINED}.<br>
* The normative value constraint stated relative to month
@@ -102,7 +98,7 @@
* </td>
* </tr>
* <tr>
- * <td><a name="datetimefield-hour">hour</a></td>
+ * <td><a id="datetimefield-hour">hour</a></td>
* <td>{@link #getHour()}</td>
* <td>
* 0 to 23 or {@link DatatypeConstants#FIELD_UNDEFINED}.
@@ -114,12 +110,12 @@
* </td>
* </tr>
* <tr>
- * <td><a name="datetimefield-minute">minute</a></td>
+ * <td><a id="datetimefield-minute">minute</a></td>
* <td> {@link #getMinute()} </td>
* <td> 0 to 59 or {@link DatatypeConstants#FIELD_UNDEFINED} </td>
* </tr>
* <tr>
- * <td><a name="datetimefield-second">second</a></td>
+ * <td><a id="datetimefield-second">second</a></td>
* <td>
* {@link #getSecond()} + {@link #getMillisecond()}/1000 or<br>
* {@link #getSecond()} + {@link #getFractionalSecond()}
@@ -135,7 +131,7 @@
* </td>
* </tr>
* <tr>
- * <td><a name="datetimefield-timezone">timezone</a></td>
+ * <td><a id="datetimefield-timezone">timezone</a></td>
* <td> {@link #getTimezone()} </td>
* <td> Number of minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.
* Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).
@@ -748,26 +744,22 @@
* Return the name of the XML Schema date/time type that this instance
* maps to. Type is computed based on fields that are set.
*
- * <table border="2" rules="all" cellpadding="2">
+ * <table class="striped">
+ * <caption>Required fields for XML Schema 1.0 Date/Time Datatypes.<br>
+ * <i>(timezone is optional for all date/time datatypes)</i></caption>
* <thead>
* <tr>
- * <th align="center" colspan="7">
- * Required fields for XML Schema 1.0 Date/Time Datatypes.<br>
- * <i>(timezone is optional for all date/time datatypes)</i>
- * </th>
+ * <th>Datatype</th>
+ * <th>year</th>
+ * <th>month</th>
+ * <th>day</th>
+ * <th>hour</th>
+ * <th>minute</th>
+ * <th>second</th>
* </tr>
* </thead>
* <tbody>
* <tr>
- * <td>Datatype</td>
- * <td>year</td>
- * <td>month</td>
- * <td>day</td>
- * <td>hour</td>
- * <td>minute</td>
- * <td>second</td>
- * </tr>
- * <tr>
* <td>{@link DatatypeConstants#DATETIME}</td>
* <td>X</td>
* <td>X</td>
@@ -911,21 +903,17 @@
* instance, see
* {@link #toGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar)}.
*
- * <table border="2" rules="all" cellpadding="2">
+ * <table class="striped">
+ * <caption>Field by Field Conversion from this class to
+ * {@code java.util.GregorianCalendar}</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">
- * Field by Field Conversion from this class to
- * {@code java.util.GregorianCalendar}
- * </th>
+ * <th>{@code java.util.GregorianCalendar} field</th>
+ * <th>{@code javax.xml.datatype.XMLGregorianCalendar} field</th>
* </tr>
* </thead>
* <tbody>
* <tr>
- * <td>{@code java.util.GregorianCalendar} field</td>
- * <td>{@code javax.xml.datatype.XMLGregorianCalendar} field</td>
- * </tr>
- * <tr>
* <td>{@code ERA}</td>
* <td>{@link #getEonAndYear()}{@code .signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.AD}</td>
* </tr>
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<!doctype html>
<!--
-Copyright (c) 2004, 2005, 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,8 +24,7 @@
questions.
-->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
<title>javax.xml.xpath</title>
@@ -50,9 +49,10 @@
<li><a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthDuration">XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a></li>
</ul>
- <hr />
+ <hr>
- <table border="1" cellpadding="2">
+ <table class="striped">
+ <caption> W3C XML Schema/Java Type Mappings</caption>
<thead>
<tr>
<th>W3C XML Schema Data Type</th>
@@ -101,10 +101,11 @@
</tbody>
</table>
- <hr />
+ <hr>
- <table border="1" cellpadding="2">
+ <table class="striped">
+ <caption>XQuery and XPath/Java Type Mappings</caption>
<thead>
<tr>
<th>XQuery 1.0 and XPath 2.0 Data Model</th>
@@ -124,7 +125,7 @@
</tbody>
</table>
- <hr />
+ <hr>
<p>
W3C XML Schema data types that have a "<em>natural</em>" mapping to Java types are defined by
@@ -151,7 +152,7 @@
<li>xs:unsignedShort</li>
</ul>
- <hr />
+ <hr>
<ul>
@@ -162,7 +163,7 @@
<li>Since 1.5</li>
</ul>
- <hr />
+ <hr>
</body>
--- a/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,17 +88,12 @@
* table describes the returned Namespace URI value for all
* possible prefix values:
*
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Return value for specified prefixes</caption>
* <thead>
* <tr>
- * <td align="center" colspan="2">
- * {@code getNamespaceURI(prefix)}
- * return value for specified prefixes
- * </td>
- * </tr>
- * <tr>
- * <td>prefix parameter</td>
- * <td>Namespace URI return value</td>
+ * <th>prefix parameter</th>
+ * <th>Namespace URI return value</th>
* </tr>
* </thead>
* <tbody>
@@ -158,15 +153,10 @@
* table describes the returned prefix value for all Namespace URI
* values:
*
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Return value for specified Namespace URIs</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">
- * {@code getPrefix(namespaceURI)} return value for
- * specified Namespace URIs
- * </th>
- * </tr>
- * <tr>
* <th>Namespace URI parameter</th>
* <th>prefix value returned</th>
* </tr>
@@ -230,14 +220,10 @@
* table describes the returned prefixes value for all Namespace
* URI values:
*
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Return value for specified Namespace URIs</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">{@code
- * getPrefixes(namespaceURI)} return value for
- * specified Namespace URIs</th>
- * </tr>
- * <tr>
* <th>Namespace URI parameter</th>
* <th>prefixes value returned</th>
* </tr>
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 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
@@ -64,21 +64,17 @@
* Add an event to the output stream
* Adding a START_ELEMENT will open a new namespace scope that
* will be closed when the corresponding END_ELEMENT is written.
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Required and optional fields for events added to the writer</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">
- * Required and optional fields for events added to the writer
- * </th>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
* <th>Event Type</th>
* <th>Required Fields</th>
* <th>Optional Fields</th>
* <th>Required Behavior</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td> START_ELEMENT </td>
* <td> QName name </td>
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, 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
@@ -36,22 +36,18 @@
* Each property varies in the level of support required by each implementation.
* The level of support required is described in the 'Required' column.
*
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Configuration Parameters</caption>
* <thead>
* <tr>
- * <th align="center" colspan="5">
- * Configuration parameters
- * </th>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
* <th>Property Name</th>
* <th>Behavior</th>
* <th>Return type</th>
* <th>Default Value</th>
* <th>Required</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr><td>javax.xml.stream.isValidating</td><td>Turns on/off implementation specific DTD validation</td><td>Boolean</td><td>False</td><td>No</td></tr>
* <tr><td>javax.xml.stream.isNamespaceAware</td><td>Turns on/off namespace processing for XML 1.0 support</td><td>Boolean</td><td>True</td><td>True (required) / False (optional)</td></tr>
* <tr><td>javax.xml.stream.isCoalescing</td><td>Requires the processor to coalesce adjacent character data</td><td>Boolean</td><td>False</td><td>Yes</td></tr>
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, 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
@@ -36,22 +36,18 @@
* Each property varies in the level of support required by each implementation.
* The level of support required is described in the 'Required' column.
*
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Configuration Parameters</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">
- * Configuration parameters
- * </th>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
* <th>Property Name</th>
* <th>Behavior</th>
* <th>Return type</th>
* <th>Default Value</th>
* <th>Required</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr><td>javax.xml.stream.isRepairingNamespaces</td><td>defaults prefixes
* on the output side</td><td>Boolean</td><td>False</td><td>Yes</td></tr>
* </tbody>
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 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
@@ -71,19 +71,15 @@
* If a method is called in an invalid state the method will throw a
* java.lang.IllegalStateException.
*
- * <table border="2" rules="all" cellpadding="4">
+ * <table class="striped">
+ * <caption>Valid methods for each state</caption>
* <thead>
* <tr>
- * <th align="center" colspan="2">
- * Valid methods for each state
- * </th>
- * </tr>
- * </thead>
- * <tbody>
- * <tr>
* <th>Event Type</th>
* <th>Valid Methods</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td> All States </td>
* <td> getProperty(), hasNext(), require(), close(),
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 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
@@ -38,12 +38,10 @@
* Each NAMESPACE
* and ATTRIBUTE must be individually written.
*
- * <table border="1" cellpadding="2" cellspacing="0">
+ * <table class="striped">
+ * <caption>XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour</caption>
* <thead>
- * <tr>
- * <th colspan="5">XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour</th>
- * </tr>
- * <tr>
+ * <tr style="border-bottom: 1px solid black">
* <th>Method</th> <!-- method -->
* <th colspan="2">{@code isRepairingNamespaces} == true</th>
* <th colspan="2">{@code isRepairingNamespaces} == false</th>
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<!doctype html>
<!--
-Copyright (c) 2000, 2005, 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,11 +24,7 @@
questions.
-->
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
<title>javax.xml.transform</title>
@@ -97,7 +93,7 @@
<h3>
-<a name="qname-delimiter">Qualified Name Representation</a>
+<a id="qname-delimiter">Qualified Name Representation</a>
</h3>
<p><a href="http://www.w3.org/TR/REC-xml-names">Namespaces</a>
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Wed Jul 05 23:33:35 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
@@ -58,7 +58,7 @@
* may not attempt to recursively invoke the {@code newSchema} method,
* even from the same thread.
*
- * <h2><a name="schemaLanguage"></a>Schema Language</h2>
+ * <h2><a id="schemaLanguage"></a>Schema Language</h2>
* <p>
* This spec uses a namespace URI to designate a schema language.
* The following table shows the values defined by this specification.
@@ -84,7 +84,8 @@
* validation implemented on this interface necessarily deviate from
* the XML DTD semantics as defined in the XML 1.0</em>.
*
- * <table border="1" cellpadding="2">
+ * <table class="striped">
+ * <caption>URIs for Supported Schema languages</caption>
* <thead>
* <tr>
* <th>value</th>
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, 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
@@ -60,7 +60,7 @@
* the list of available schema languages</a>.
*
* @throws NullPointerException
- * If the <tt>schemaLanguage</tt> parameter is null.
+ * If the <code>schemaLanguage</code> parameter is null.
*
* @return <code>null</code> if the callee fails to create one.
*/
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -131,12 +131,10 @@
* <p>This method places the following restrictions on the types of
* the {@link Source}/{@link Result} accepted.
*
- * <table border=1>
+ * <table class="plain">
+ * <caption>{@code Source} / {@code Result} Accepted</caption>
* <thead>
* <tr>
- * <th colspan="5">{@code Source} / {@code Result} Accepted</th>
- * </tr>
- * <tr>
* <th></th>
* <th>{@link javax.xml.transform.stream.StreamSource}</th>
* <th>{@link javax.xml.transform.sax.SAXSource}</th>
@@ -144,7 +142,7 @@
* <th>{@link javax.xml.transform.stax.StAXSource}</th>
* </tr>
* </thead>
- * <tbody align="center">
+ * <tbody style="text-align:center">
* <tr>
* <td>{@code null}</td>
* <td>OK</td>
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<!doctype html>
<!--
-Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,7 @@
questions.
-->
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
<title>javax.xml.validation</title>
@@ -86,7 +82,7 @@
process simple (see <a href="#example-1">example</a> below).</li>
</ul>
<p>
- <a name="example-1"><strong>Usage example</strong>.</a> The following example demonstrates validating
+ <a id="example-1"><strong>Usage example</strong>.</a> The following example demonstrates validating
an XML document with the Validation API (for readability, some exception handling is not shown):
</p>
<pre>
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java Wed Jul 05 23:33:35 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
@@ -31,14 +31,18 @@
/**
* {@code XPath} provides access to the XPath evaluation environment and expressions.
+ * The XPath evaluation is affected by the factors described in the following table.
*
- * <a name="XPath-evaluation"></a>
- * <table border="1" cellpadding="2">
+ * <a id="XPath-evaluation"></a>
+ * <table class="striped">
+ * <caption>Evaluation of XPath Expressions</caption>
* <thead>
* <tr>
- * <th colspan="2">Evaluation of XPath Expressions.</th>
+ * <th>Factor</th>
+ * <th>Behavior</th>
* </tr>
* </thead>
+ * <tbody>
* <tr>
* <td>context</td>
* <td>
@@ -84,6 +88,7 @@
* Conversion to the return type follows XPath conversion rules.
* </td>
* </tr>
+ * </tbody>
* </table>
*
* <p>An XPath object is not thread-safe and not reentrant.
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java Wed Jul 05 23:33:35 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
@@ -30,14 +30,18 @@
/**
* {@code XPathExpression} provides access to compiled XPath expressions.
+ * The XPath evaluation is affected by the factors described in the following table.
*
- * <a name="XPathExpression-evaluation"></a>
- * <table border="1" cellpadding="2">
+ * <a id="XPathExpression-evaluation"></a>
+ * <table class="striped">
+ * <caption>Evaluation of XPath Expressions</caption>
* <thead>
* <tr>
- * <th colspan="2">Evaluation of XPath Expressions.</th>
+ * <th>Factor</th>
+ * <th>Behavior</th>
* </tr>
* </thead>
+ * <tbody>
* <tr>
* <td>context</td>
* <td>
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -1,8 +1,8 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!doctype html>
<html>
<head>
<!--
-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
@@ -26,7 +26,7 @@
questions.
-->
</head>
-<body bgcolor="white">
+<body>
This package provides an <em>object-model neutral</em> API for the
evaluation of XPath expressions and access to the evaluation
@@ -36,7 +36,7 @@
The XPath API supports <a href="http://www.w3.org/TR/xpath">
XML Path Language (XPath) Version 1.0</a>
-<hr />
+<hr>
<ul>
<li><a href='#XPath.Overview'>1. XPath Overview</a></li>
@@ -52,7 +52,7 @@
<li><a href='#XPath.Use'>5. Using the XPath API</a></li>
</ul>
<p>
-<a name="XPath.Overview"></a>
+<a id="XPath.Overview"></a>
<h3>1. XPath Overview</h3>
<p>The XPath language provides a simple, concise syntax for selecting
@@ -69,7 +69,7 @@
replace many lines of DOM API code.
</p>
-<a name="XPath.Expressions"></a>
+<a id="XPath.Expressions"></a>
<h3>2. XPath Expressions</h3>
<p>An XPath <em>expression</em> is composed of a <em>location
@@ -139,11 +139,15 @@
nodes. The following table gives examples of location paths for each
of these node types:</p>
-<table border="1">
+<table class="striped">
+<caption>Examples of Location Path</caption>
+<thead>
<tr>
-<td>Location Path</td>
-<td>Description</td>
+<th>Location Path</th>
+<th>Description</th>
</tr>
+</thead>
+<tbody>
<tr>
<td>
<code>/foo/bar/<strong>@id</strong></code>
@@ -171,6 +175,7 @@
<code><bar></code> element.
</td>
</tr>
+</tbody>
</table>
<p>Predicates allow for refining the nodes selected by an XPath
@@ -194,7 +199,7 @@
</pre>
</blockquote>
-<a name="XPath.Datatypes"></a>
+<a id="XPath.Datatypes"></a>
<h3>3. XPath Data Types</h3>
<p>While XPath expressions select nodes in the XML document, the XPath
@@ -207,7 +212,7 @@
<li><code>String</code></li>
</ul>
-<a name="XPath.Datatypes.QName"></a>
+<a id="XPath.Datatypes.QName"></a>
<h3>3.1 QName types</h3>
The XPath API defines the following {@link javax.xml.namespace.QName} types to
represent return types of an XPath evaluation:
@@ -236,7 +241,7 @@
<p>The <code>Number</code> return type attempts to coalesce the text
of a node to a <code>double</code> data type.
-<a name="XPath.Datatypes.Class"></a>
+<a id="XPath.Datatypes.Class"></a>
<h3>3.2 Class types</h3>
In addition to the QName types, the XPath API supports the use of Class types
through the <code>XPathExpression.evaluteExpression(...)</code> or
@@ -254,14 +259,14 @@
<p>
Of the subtypes of Number, only Double, Integer and Long are supported.
-<a name="XPath.Datatypes.Enum"></a>
+<a id="XPath.Datatypes.Enum"></a>
<h3>3.3 Enum types</h3>
Enum types are defined in {@link javax.xml.xpath.XPathEvaluationResult.XPathResultType}
that provide mappings between the QName and Class types above. The result of
evaluating an expression using the <code>XPathExpression.evaluteExpression(...)</code>
or <code>XPath.evaluateExpression(...)</code> methods will be of one of these types.
-<a name="XPath.Context"></a>
+<a id="XPath.Context"></a>
<h3>4. XPath Context</h3>
<p>XPath location paths may be relative to a particular node in the
@@ -278,7 +283,7 @@
It is an XML document tree represented as a hierarchy of nodes, a
{@link org.w3c.dom.Node} for example, in the JDK implementation.
-<a name="XPath.Use"></a>
+<a id="XPath.Use"></a>
<h3>5. Using the XPath API</h3>
Consider the following XML document:
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java Wed Jul 05 23:33:35 2017 +0200
@@ -111,7 +111,9 @@
* <p>The following table gives some examples of the relations between the
* attribute value in the original document (parsed attribute), the value as
* exposed in the DOM, and the serialization of the value:
- * <table border='1' cellpadding='3'>
+ * <table class="striped">
+ * <caption>Examples of the Original, Normalized and Serialized Values </caption>
+ * <thead>
* <tr>
* <th>Examples</th>
* <th>Parsed
@@ -119,6 +121,8 @@
* <th>Initial <code>Attr.value</code></th>
* <th>Serialized attribute value</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>
* Character reference</td>
@@ -126,7 +130,7 @@
* <pre>"x&#178;=5"</pre>
* </td>
* <td valign='top' rowspan='1' colspan='1'>
- * <pre>"x\u00b2=5"</pre>
+ * <pre>"x²=5"</pre>
* </td>
* <td valign='top' rowspan='1' colspan='1'>
* <pre>"x&#178;=5"</pre>
@@ -180,6 +184,7 @@
* <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load Options</em></td>
* <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load/Save Options</em></td>
* </tr>
+ * </tbody>
* </table>
* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
*/
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java Wed Jul 05 23:33:35 2017 +0200
@@ -353,37 +353,42 @@
* instantiate.
* @return A new <code>Element</code> object with the following
* attributes:
- * <table border='1' cellpadding='3'>
+ * <table class="striped">
+ * <caption>Attributes of the {@code Element} object</caption>
+ * <thead>
* <tr>
* <th>Attribute</th>
* <th>Value</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Node.nodeName</code></td>
+ * <td>
* <code>qualifiedName</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Node.namespaceURI</code></td>
+ * <td>
* <code>namespaceURI</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
- * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
+ * <td><code>Node.prefix</code></td>
+ * <td>prefix, extracted
* from <code>qualifiedName</code>, or <code>null</code> if there is
* no prefix</td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
+ * <td><code>Node.localName</code></td>
+ * <td>local name, extracted from
* <code>qualifiedName</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Element.tagName</code></td>
+ * <td>
* <code>qualifiedName</code></td>
* </tr>
+ * </tbody>
* </table>
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
@@ -417,43 +422,48 @@
* @param qualifiedName The qualified name of the attribute to
* instantiate.
* @return A new <code>Attr</code> object with the following attributes:
- * <table border='1' cellpadding='3'>
+ * <table class="striped">
+ * <caption>Attributes of the {@code Attr} object </caption>
+ * <thead>
* <tr>
* <th>
* Attribute</th>
* <th>Value</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
+ * <td><code>Node.nodeName</code></td>
+ * <td>qualifiedName</td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* <code>Node.namespaceURI</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
+ * <td><code>namespaceURI</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* <code>Node.prefix</code></td>
- * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
+ * <td>prefix, extracted from
* <code>qualifiedName</code>, or <code>null</code> if there is no
* prefix</td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
+ * <td><code>Node.localName</code></td>
+ * <td>local name, extracted from
* <code>qualifiedName</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Attr.name</code></td>
+ * <td>
* <code>qualifiedName</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
- * <td valign='top' rowspan='1' colspan='1'>the empty
+ * <td><code>Node.nodeValue</code></td>
+ * <td>the empty
* string</td>
* </tr>
+ * </tbody>
* </table>
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java Wed Jul 05 23:33:35 2017 +0200
@@ -61,104 +61,109 @@
* <p>The values of <code>nodeName</code>,
* <code>nodeValue</code>, and <code>attributes</code> vary according to the
* node type as follows:
- * <table border='1' cellpadding='3'>
+ * <table class="striped">
+ * <caption style="display:none">Interface table</caption>
+ * <thead>
* <tr>
* <th>Interface</th>
* <th>nodeName</th>
* <th>nodeValue</th>
* <th>attributes</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* <code>Attr</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as <code>Attr.name</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as
+ * <td>same as <code>Attr.name</code></td>
+ * <td>same as
* <code>Attr.value</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>CDATASection</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>CDATASection</code></td>
+ * <td>
* <code>"#cdata-section"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as <code>CharacterData.data</code>, the
+ * <td>same as <code>CharacterData.data</code>, the
* content of the CDATA Section</td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Comment</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Comment</code></td>
+ * <td>
* <code>"#comment"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as <code>CharacterData.data</code>, the
+ * <td>same as <code>CharacterData.data</code>, the
* content of the comment</td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Document</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Document</code></td>
+ * <td>
* <code>"#document"</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* <code>DocumentFragment</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>"#document-fragment"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>"#document-fragment"</code></td>
+ * <td>
* <code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>DocumentType</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as
+ * <td><code>DocumentType</code></td>
+ * <td>same as
* <code>DocumentType.name</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* <code>Element</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as <code>Element.tagName</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>same as <code>Element.tagName</code></td>
+ * <td><code>null</code></td>
+ * <td>
* <code>NamedNodeMap</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Entity</code></td>
- * <td valign='top' rowspan='1' colspan='1'>entity name</td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Entity</code></td>
+ * <td>entity name</td>
+ * <td><code>null</code></td>
+ * <td>
* <code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>EntityReference</code></td>
- * <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>EntityReference</code></td>
+ * <td>name of entity referenced</td>
+ * <td>
* <code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Notation</code></td>
- * <td valign='top' rowspan='1' colspan='1'>notation name</td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Notation</code></td>
+ * <td>notation name</td>
+ * <td>
* <code>null</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>ProcessingInstruction</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same
+ * <td><code>ProcessingInstruction</code></td>
+ * <td>same
* as <code>ProcessingInstruction.target</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as
+ * <td>same as
* <code>ProcessingInstruction.data</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Text</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td><code>Text</code></td>
+ * <td>
* <code>"#text"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>same as <code>CharacterData.data</code>, the content
+ * <td>same as <code>CharacterData.data</code>, the content
* of the text node</td>
- * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
+ * <td><code>null</code></td>
* </tr>
+ * </tbody>
* </table>
* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
*/
@@ -687,30 +692,35 @@
* textual content.
* <br>The string returned is made of the text content of this node
* depending on its type, as defined below:
- * <table border='1' cellpadding='3'>
+ * <table class="striped">
+ * <caption style="display:none">Node/Content table</caption>
+ * <thead>
* <tr>
* <th>Node type</th>
* <th>Content</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE</td>
- * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
+ * <td>concatenation of the <code>textContent</code>
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.</td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+ * <td>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE</td>
- * <td valign='top' rowspan='1' colspan='1'><code>nodeValue</code></td>
+ * <td><code>nodeValue</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE,
+ * <td>DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
- * <td valign='top' rowspan='1' colspan='1'><em>null</em></td>
+ * <td><em>null</em></td>
* </tr>
+ * </tbody>
* </table>
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
@@ -737,30 +747,35 @@
* textual content.
* <br>The string returned is made of the text content of this node
* depending on its type, as defined below:
- * <table border='1' cellpadding='3'>
+ * <table class="striped">
+ * <caption style="display:none">Node/Content table</caption>
+ * <thead>
* <tr>
* <th>Node type</th>
* <th>Content</th>
* </tr>
+ * </thead>
+ * <tbody>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>
+ * <td>
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE</td>
- * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
+ * <td>concatenation of the <code>textContent</code>
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.</td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+ * <td>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE</td>
- * <td valign='top' rowspan='1' colspan='1'><code>nodeValue</code></td>
+ * <td><code>nodeValue</code></td>
* </tr>
* <tr>
- * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE,
+ * <td>DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
- * <td valign='top' rowspan='1' colspan='1'><em>null</em></td>
+ * <td><em>null</em></td>
* </tr>
+ * </tbody>
* </table>
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -2,7 +2,7 @@
<head>
<title>W3C IPR SOFTWARE NOTICE</title>
</head>
-<body bgcolor="white">
+<body>
<p>
Document Object Model Level 2 Traversal and Range is a
platform and language-neutral interfaces that allow programs
@@ -20,14 +20,14 @@
<h1>
W3C IPR SOFTWARE NOTICE
</h1>
- <h3>
+ <h2>
Copyright © 2000 <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved.
- </h3>
+ </h2>
<p>
The DOM bindings are published under the W3C Software Copyright Notice
and License. The software license requires "Notice of any changes or
@@ -42,14 +42,14 @@
and License could be found at <a
href='http://www.w3.org/Consortium/Legal/copyright-software-19980720'>http://www.w3.org/Consortium/Legal/copyright-software-19980720</a>
</p>
- <h3>
+ <h2>
Copyright © 1994-2000 <a href="http://www.w3.org/">World Wide Web
Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
National de Recherche en Informatique et en Automatique</a>, <a
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
Reserved. http://www.w3.org/Consortium/Legal/
- </h3>
+ </h2>
<p>
This W3C work (including software, documents, or other related items) is
being provided by the copyright holders under the following license. By
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/package.html Wed May 31 17:42:17 2017 +0000
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/package.html Wed Jul 05 23:33:35 2017 +0200
@@ -24,14 +24,18 @@
<em>setFeature</em>. Those standard identifiers are: </p>
-<table border="1" cellpadding="3" cellspacing="0" width="100%">
- <tr align="center" bgcolor="#ccccff">
+<table class="striped">
+ <caption>SAX2 Standard Features </caption>
+ <thead>
+ <tr>
<th>Feature ID</th>
<th>Access</th>
<th>Default</th>
<th>Description</th>
</tr>
-
+ </thead>
+
+ <tbody>
<tr>
<td>external-general-entities</td>
<td><em>read/write</em></td>
@@ -208,7 +212,7 @@
Returns "false" if the parser supports only XML 1.0.
</td>
</tr>
-
+ </tbody>
</table>
<p> Support for the default values of the
@@ -236,11 +240,15 @@
<code>dom-node</code>. Manage those properties using
<em>setProperty()</em>. Those identifiers are: </p>
-<table border="1" cellpadding="3" cellspacing="0" width="100%">
- <tr align="center" bgcolor="#ccccff">
+<table class="striped">
+<caption>SAX2 Standard Properties </caption>
+<thead>
+ <tr>
<th>Property ID</th>
<th>Description</th>
</tr>
+</thead>
+<tbody>
<tr>
<td>declaration-handler</td>
@@ -287,7 +295,7 @@
<td> Readable only during a parser callback, this exposes a <b>TBS</b>
chunk of characters responsible for the current event. </td>
</tr>
-
+</tbody>
</table>
<p> All of these standard properties are optional;
--- a/jaxws/.hgtags Wed May 31 17:42:17 2017 +0000
+++ b/jaxws/.hgtags Wed Jul 05 23:33:35 2017 +0200
@@ -425,3 +425,5 @@
e75d3abe579a7b39b762fc0a1a337c49eb072d82 jdk-9+170
b0efae7df1dfa14926058baebaf999e4268c955c jdk-10+7
e705867d9989d00e4357f66f18b302c95e13b5e7 jdk-10+8
+2fe03e35bed54238bcaeeb298b011df240e3711d jdk-10+9
+139e7c786ee4885efe53eb650b72c7b5a2d3b964 jdk-9+171
--- a/jdk/.hgtags Wed May 31 17:42:17 2017 +0000
+++ b/jdk/.hgtags Wed Jul 05 23:33:35 2017 +0200
@@ -422,3 +422,5 @@
ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170
cbd65760a005766610583949b3b5c9ace92e74b3 jdk-10+7
f0adc10ed8316e6cf316e3208c5ecf6835d22bc4 jdk-10+8
+b9409a7daa6c793dd631e52fe6ef79d08a3b337a jdk-10+9
+29bbedd4cce8e14742bdb22118c057b877c02f0f jdk-9+171
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/docs-resources/resources/jdk-default.css Wed Jul 05 23:33:35 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.
+ */
+
+body {
+ margin: 2em 2em;
+ font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica;
+ font-size: 10pt;
+ line-height: 1.4;
+}
+
+pre, code, tt {
+ font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Luxi Mono,
+ Courier New, monospace;
+}
+
+blockquote {
+ margin: 1.5ex 0em 1.5ex 2em;
+}
+
+p {
+ padding: 0pt;
+ margin: 1ex 0em;
+}
+
+p:first-child, pre:first-child { margin-top: 0pt; }
+
+h1 {
+ font-weight: bold;
+ padding: 0pt;
+ margin: 2ex .5ex 1ex 0pt;
+}
+
+h1:first-child, h2:first-child {
+ margin-top: 0ex;
+}
+
+h2 {
+ font-weight: bold;
+ padding: 0pt;
+ margin: 2ex 0pt 1ex 0pt;
+}
+
+h3 {
+ font-weight: bold;
+ padding: 0pt;
+ margin: 1.5ex 0pt 1ex 0pt;
+}
+
+h4 {
+ font-weight: bold;
+ padding: 0pt;
+ margin: 1.5ex 0pt 1ex 0pt;
+}
+
+a:link {
+ color: #437291;
+}
+
+a:visited {
+ color: #666666;
+}
+
+a[href]:hover {
+ color: #e76f00;
+}
+
+a img {
+ border-width: 0px;
+}
+
+img {
+ background: white;
+}
+
+table {
+ border-collapse: collapse;
+ margin-left: 15px;
+ margin-right: 15px;
+}
+
+th, td {
+ padding: 3px;
+ vertical-align: top;
+}
+
+table, th, td {
+ border: 1px solid black;
+}
+
+caption {
+ text-align: left;
+ font-style: italic;
+ text-indent: 15px;
+ margin-bottom:10px;
+}
+
+tr:nth-child(even), tr:nth-child(even) th[scope=row] {
+ background: #DDD;
+}
+
+tr:nth-child(odd), tr:nth-child(odd) th[scope=row] {
+ background: #FFF;
+}
+
+th {
+ background: #DDF;
+}
--- a/jdk/make/data/docs-resources/specs/resources/jdk-default.css Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-body {
- margin: 2em 2em;
- font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica;
- font-size: 10pt;
- line-height: 1.4;
-}
-
-pre, code, tt {
- font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Luxi Mono,
- Courier New, monospace;
-}
-
-blockquote {
- margin: 1.5ex 0em 1.5ex 2em;
-}
-
-p {
- padding: 0pt;
- margin: 1ex 0em;
-}
-
-p:first-child, pre:first-child { margin-top: 0pt; }
-
-h1 {
- font-weight: bold;
- padding: 0pt;
- margin: 2ex .5ex 1ex 0pt;
-}
-
-h1:first-child, h2:first-child {
- margin-top: 0ex;
-}
-
-h2 {
- font-weight: bold;
- padding: 0pt;
- margin: 2ex 0pt 1ex 0pt;
-}
-
-h3 {
- font-weight: bold;
- padding: 0pt;
- margin: 1.5ex 0pt 1ex 0pt;
-}
-
-h4 {
- font-weight: bold;
- padding: 0pt;
- margin: 1.5ex 0pt 1ex 0pt;
-}
-
-a:link {
- color: #437291;
-}
-
-a:visited {
- color: #666666;
-}
-
-a[href]:hover {
- color: #e76f00;
-}
-
-a img {
- border-width: 0px;
-}
-
-img {
- background: white;
-}
-
-table {
- border-collapse: collapse;
- margin-left: 15px;
- margin-right: 15px;
-}
-
-th, td {
- padding: 3px;
- vertical-align: top;
-}
-
-table, th, td {
- border: 1px solid black;
-}
-
-caption {
- text-align: left;
- font-style: italic;
- text-indent: 15px;
- margin-bottom:10px;
-}
-
-tr:nth-child(even) {
- background: #DDD;
-}
-
-tr:nth-child(odd) {
- background: #FFF;
-}
-
-th {
- background: #DDF;
-}
--- a/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java Wed Jul 05 23:33:35 2017 +0200
@@ -31,18 +31,23 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.stream.Collectors;
+import java.util.function.Predicate;
import java.util.stream.Stream;
+import static java.util.stream.Collectors.*;
/**
* Build tool to generate the docs bundle index page.
@@ -104,59 +109,33 @@
}
private static final String HEADER_TITLE = "@HEADER_TITLE@";
+
+
final Path outputfile;
final String title;
- final Map<String, String> moduleGroups;
-
+ final Map<String, Set<ModuleDescriptor>> moduleGroups = new HashMap<>();
GenDocsBundlePage(String title, Path outputfile) throws IOException
{
this.outputfile = outputfile;
this.title = title;
- this.moduleGroups = moduleGroups();
- }
- static Map<String, String> moduleGroups() throws IOException {
+ // read module groups
ModuleFinder finder = ModuleFinder.ofSystem();
- Map<String, String> groups = new HashMap<>();
try (InputStream in = GenDocsBundlePage.class.getResourceAsStream(MODULE_GROUPS_PROPS)) {
Properties props = new Properties();
props.load(in);
for (String key: props.stringPropertyNames()) {
- Set<String> mods = Stream.of(props.getProperty(key).split("\\s+"))
- .filter(mn -> finder.find(mn).isPresent())
- .map(String::trim)
- .collect(Collectors.toSet());
+ Set<ModuleDescriptor> mods =
+ Stream.of(props.getProperty(key).split("\\s+"))
+ .map(String::trim)
+ .flatMap(mn -> finder.find(mn).stream())
+ .map(ModuleReference::descriptor)
+ .collect(toSet());
- // divide into 3 columns: Java SE, JDK, JavaFX
- StringBuilder sb = new StringBuilder();
- sb.append(mods.stream()
- .filter(mn -> mn.startsWith("java."))
- .sorted()
- .map(GenDocsBundlePage::toHRef)
- .collect(Collectors.joining("\n")));
- sb.append("</td>\n<td>")
- .append(mods.stream()
- .filter(mn -> mn.startsWith("jdk."))
- .sorted()
- .map(GenDocsBundlePage::toHRef)
- .collect(Collectors.joining("\n")));
- sb.append("</td>\n<td>");
- if (mods.stream().anyMatch(mn -> mn.startsWith("javafx."))) {
- sb.append(mods.stream()
- .filter(mn -> mn.startsWith("javafx."))
- .sorted()
- .map(GenDocsBundlePage::toHRef)
- .collect(Collectors.joining("\n")));
- }
String name = "@" + key.toUpperCase(Locale.ENGLISH) + "@";
- groups.put(name, sb.toString());
- }
+ moduleGroups.put(name, mods);
+ };
}
- return groups;
- }
-
- static String toHRef(String mn) {
- return String.format("<a href=\"api/%s-summary.html\">%s</a><br>", mn, mn);
}
void run(BufferedReader reader) throws IOException {
@@ -174,13 +153,95 @@
if (line.contains(HEADER_TITLE)) {
line = line.replace(HEADER_TITLE, title);
}
- if (line.contains("@")) {
- for (Map.Entry<String,String> e: moduleGroups.entrySet()) {
- if (line.contains(e.getKey())) {
- line = line.replace(e.getKey(), e.getValue());
- }
+ int i = line.indexOf('@');
+ int j = line.indexOf('@', i+1);
+ if (i >= 0 && i < j) {
+ String name = line.substring(i, j+1);
+ if (moduleGroups.containsKey(name)) {
+ line = line.replace(name, formatModuleGroup(name));
}
}
return line;
}
+
+ String toHRef(ModuleDescriptor md) {
+ String mn = md.name();
+ String formattedName;
+ if (hasExportedAPIs(md)) {
+ // has exported APIs
+ formattedName = mn;
+ } else if (!md.provides().isEmpty()) {
+ // a provider
+ formattedName = "<i>" + mn + "</i>";
+ } else {
+ // a tool
+ formattedName = "<i>" + mn + "</i>";
+ }
+ return String.format("<a href=\"api/%s-summary.html\">%s</a>",
+ mn, formattedName);
+ }
+
+ String formatModuleGroup(String groupName) {
+ StringBuilder sb = new StringBuilder();
+ // organize in Java SE, JDK, JavaFX, JCP groups
+ Set<ModuleDescriptor> modules = moduleGroups.get(groupName);
+ Arrays.stream(ModuleGroup.values())
+ .forEach(g -> {
+ Set<ModuleDescriptor> mods = modules.stream()
+ .filter(md -> g.predicate.test(md.name()))
+ .collect(toSet());
+ if (!mods.isEmpty()) {
+ sb.append("<div class=" + g.cssClass + ">\n");
+ // modules with exported API
+ mods.stream()
+ .filter(this::hasExportedAPIs)
+ .sorted(Comparator.comparing(ModuleDescriptor::name))
+ .map(this::toHRef)
+ .forEach(m -> sb.append(m).append("\n"));
+
+ // tools and providers
+ mods.stream()
+ .filter(md -> !hasExportedAPIs(md))
+ .sorted(Comparator.comparing(ModuleDescriptor::name))
+ .map(this::toHRef)
+ .forEach(m -> sb.append(m).append("\n"));
+ sb.append("</div>");
+ }
+ });
+ return sb.toString();
+ }
+
+ private boolean hasExportedAPIs(ModuleDescriptor md) {
+ if (md.exports().stream().anyMatch(e -> !e.isQualified())) {
+ return true;
+ }
+ // this should check if any indirect exports
+ // checking requires transitive would be sufficient for JDK modules
+ if (md.requires().stream()
+ .map(ModuleDescriptor.Requires::modifiers)
+ .anyMatch(mods -> mods.contains(ModuleDescriptor.Requires.Modifier.TRANSITIVE))) {
+ return true;
+ }
+ return false;
+ }
+
+ private static final Set<String> NON_JAVA_SE_MODULES =
+ Set.of("java.jnlp", "java.smartcardio");
+
+ /**
+ * CSS class names are defined in docs-bundle-page.html
+ */
+ enum ModuleGroup {
+ JAVA_SE("javase", mn -> mn.startsWith("java.") && !NON_JAVA_SE_MODULES.contains(mn)),
+ JDK("jdk", mn -> mn.startsWith("jdk.")),
+ JAVAFX("javafx", mn -> mn.startsWith("javafx.")),
+ NON_JAVA_SE("jcp", NON_JAVA_SE_MODULES::contains);
+
+ final String cssClass;
+ final Predicate<String> predicate;
+ ModuleGroup(String cssClass, Predicate<String> predicate) {
+ this.cssClass = cssClass;
+ this.predicate = predicate;
+ }
+ }
}
--- a/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html Wed May 31 17:42:17 2017 +0000
+++ b/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html Wed Jul 05 23:33:35 2017 +0200
@@ -26,121 +26,146 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <meta http-equiv="content-type" content="text/html;" charset="utf-8">
- <style type="text/css">
-table {
- border-collapse: collapse;
-}
-table {
+<title>@HEADER_TITLE@</title>
+
+<meta http-equiv="content-type" content="text/html;" charset="utf-8">
+<link rel="stylesheet" href="resources/jdk-default.css" type="text/css" />
+<style type="text/css">
+
+table a { text-decoration: none }
+table { border: none }
+th, td { border: 2px solid white; }
+thead th { background-color: #DDD }
+tbody th { background-color: #EEE }
+
+table div.javase, ul.key span.javase { background-color: #C6E7F3 }
+table div.jdk, ul.key span.jdk { background-color: #ECE1C5 }
+table div.javafx, ul.key span.javafx { background-color: #ECEDCC }
+table div.jcp, ul.key span.jcp { background-color: #E9E9E9 }
+td div { padding: 3px 5px; color: blue }
+table tbody td div a { padding: 0 .5em; margin: 0: 1em; }
+table tbody td div a:link { color: black }
+table tbody td div a:visited { color: black }
+table tbody td div a[href]:hover { color: black; text-decoration: underline }
+td { padding: 0 }
+table tbody td div a { padding: 0 .5em; margin: 0: 1em }
+
+.key { font-size: smaller; }
+ul.key li { display:inline-block; padding: 0 1em }
+ul.key span {
border: 1px solid black;
-}
-th ,td {
- border: 0px solid black;
-}
-thead th {
- background-color: #DDD;
-}
-tbody > tr:nth-child(even) {
- background-color: #EEE
-}
-tbody > tr:nth-child(odd) {
- background-color: #FFF
+ font-family: DejaVu Sans Mono, monospace;
}
-th, td {
- font-family: sans-serif; /* could eventually be DejaVu */
- font-size: small;
- padding: 5px 10px;
- vertical-align:top;
-}
-td a {
- text-decoration: none;
+ul.key span:before { content: " " }
+ul.key span:after { content: " " }
+
+caption {
+ text-align: center;
}
-tr th {
- text-align:left;
+
+tr:nth-child(even), tr:nth-child(even) th[scope=row] {
+ background-color: #EEE;
}
-caption {
- font-size: smaller;
- font-weight: bold;
+tr:nth-child(odd), tr:nth-child(odd) th[scope=row] {
+ background-color: #EEE;
}
+
</style>
-<title>@HEADER_TITLE@</title>
</head>
-<body>
<h1>@HEADER_TITLE@</h1>
<ul>
<li><a href="api/index.html">JDK API Specification</a></li>
-<li>Java Language Specification</li>
-<li>Java Virtual Machine Specification</li>
+<li><a href="https://docs.oracle.com/javase/specs/">
+ Java Language and Virtual Machine Specifications</a></li>
+<li><a href="https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=tools_reference_overview">
+ Tools Reference</a></li>
</ul>
+
<table>
-<caption>Modules</caption>
+<caption style="display:none">JDK Modules</caption>
<thead>
<tr>
<th scope="col">Group</th>
- <th scope="col">Java SE</th>
- <th scope="col">JDK</th>
- <th scope="col">JavaFX</th>
+ <th scope="col">Modules</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Foundation</th>
- <td>@CORE_MODULES@</td>
+ <td>@JAVA_BASE@</td>
</tr>
<tr>
-<th scope="row">Security</th>
- <td>@SECURITY_MODULES@</td>
-</tr>
-<tr>
-<th scope="row">Instrumentation and<br>Management</th>
- <td>@INSTRUMENT_MGMT_MODULES@</td>
-</tr>
-<tr>
-<th scope="row">Integration</th>
+ <th scope="row">Integration</th>
<td>@INTEGRATION_MODULES@</td>
</tr>
<tr>
<th scope="row">User Interface</th>
- <td>@UI_TOOLKITS_MODULES@</td>
+ <td>@UI_MODULES@</td>
+</tr>
+<tr>
+ <th scope="row">Compilation</th>
+ <td>@COMPILER_MODULES@</td>
</tr>
<tr>
- <th scope="row">Compiler and Scripting</th>
- <td>@COMPILER_SCRIPTING_MODULES@</td>
+ <th scope="row">Scripting</th>
+ <td>@SCRIPTING_MODULES@</td>
+</tr>
+<tr>
+ <th scope="row">Security</th>
+ <td>@SECURITY_MODULES@</td>
+</tr>
+<tr>
+ <th scope="row">Management</th>
+ <td>@MANAGEMENT_MODULES@</td>
</tr>
<tr>
- <th scope="row">Debugging</th>
- <td>@DEBUG_MODULES@</td>
+ <th scope="row">Instrumentation</th>
+ <td>@INSTRUMENT_MODULES@</td>
+</tr>
+<tr>
+ <th scope="row">Serviceability</th>
+ <td>@SVC_MODULES@</td>
</tr>
<tr>
- <th scope="row">Tools and Tool APIs</th>
- <td>@TOOL_MODULES@</td>
+ <th scope="row">Packaging</th>
+ <td>@PACKAGING_MODULES@</td>
</tr>
<tr>
- <th scope="row">Incubating Features</th>
+ <th scope="row">Incubator</th>
<td>@INCUBATOR_MODULES@</td>
</tr>
<tr>
+ <th scope="row">Non-Java SE</th>
+ <td>@OTHER_MODULES@</td>
+</tr>
+<tr>
<th scope="row">Java EE</th>
<td>@JAVA_EE_MODULES@</td>
</tr>
<tr>
- <th scope="row"></th>
- <th scope="row">Outside Java SE</th>
- <th scope="row">JDK</th>
- <th scope="row">JavaFX</th>
-</tr>
-<tr>
- <th scope="row">Others</th>
- <td>@OTHER_MODULES@</td>
+ <th scope="row">Aggregator</th>
+ <td>@AGGREGATOR_MODULES@</td>
</tr>
</tbody>
</table>
+<p class="key">Key:
+<ul class="key">
+<li><span class="javase"> </span> Java SE
+<li><span class="jdk"> </span> JDK
+<li><span class="javafx"> </span> JavaFX
+<li><span class="jcp"> </span> Non-Java SE
+<li><i>italic</i> No Exported API (e.g. a tool or provider)</li>
+</ul>
+
<p>
-<hr/>
-<a href="legal/cpyr.html">Copyright</a>© 1993, 2017, Oracle and/or its affiliates. All rights reserved.</p>
+<hr>
+<a href="legal/cpyr.html">Copyright</a> © 1993, 2017, Oracle and/or its affiliates. All rights reserved.</p>
+
</body>
</html>
+
+
--- a/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties Wed May 31 17:42:17 2017 +0000
+++ b/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties Wed Jul 05 23:33:35 2017 +0200
@@ -1,13 +1,8 @@
# Module Grouping for the docs bundle page
#
-core_modules=\
-java.base \
-jdk.charsets \
-jdk.localedata \
-jdk.net \
-jdk.sctp \
-jdk.zipfs
+java_base=\
+java.base
java_ee_modules=\
java.activation \
@@ -17,6 +12,10 @@
java.xml.ws \
java.xml.ws.annotation
+aggregator_modules=\
+java.se \
+java.se.ee
+
security_modules=\
java.security.jgss \
java.security.sasl \
@@ -26,18 +25,22 @@
jdk.crypto.cryptoki \
jdk.crypto.ec \
jdk.crypto.mscapi \
-jdk.crypto.ucrypto
+jdk.crypto.ucrypto \
+jdk.policytool
-instrument_mgmt_modules=\
-java.instrument \
+instrument_modules=\
+java.instrument
+
+management_modules=\
java.management \
java.management.rmi \
-jdk.jfr \
jdk.management \
jdk.management.agent \
jdk.management.cmm \
jdk.management.jfr \
jdk.management.resource \
+jdk.snmp \
+jdk.jconsole
integration_modules=\
java.logging \
@@ -47,11 +50,18 @@
java.sql \
java.sql.rowset \
java.xml \
+jdk.charsets \
+jdk.localedata \
+jdk.net \
+jdk.sctp \
+jdk.jsobject \
jdk.httpserver \
jdk.naming.dns \
-jdk.naming.rmi
+jdk.naming.rmi \
+jdk.xml.dom \
+jdk.zipfs
-ui_toolkits_modules=\
+ui_modules=\
java.datatransfer \
java.desktop \
javafx.base \
@@ -63,39 +73,40 @@
javafx.web \
jdk.accessibility
-other_modules=\
-java.jnlp \
-java.smartcardio \
-jdk.jsobject \
-jdk.xml.dom
-
-debug_modules=\
-jdk.jdi \
-jdk.jdwp.agent
-
-tool_modules=\
+svc_modules=\
+jdk.jfr \
jdk.attach \
-jdk.editpad \
+jdk.jcmd \
+jdk.jdi \
+jdk.jdwp.agent \
+jdk.jstatd \
+jdk.hotspot.agent
+
+packaging_modules=\
jdk.jartool \
+jdk.jlink \
+jdk.pack \
+jdk.packager.services
+
+compiler_modules=\
+java.compiler \
+jdk.compiler \
jdk.javadoc \
-jdk.jcmd \
-jdk.jconsole \
jdk.jdeps \
-jdk.jlink \
+jdk.editpad \
jdk.jshell \
-jdk.jstatd \
-jdk.pack \
-jdk.policytool \
-jdk.packager.services \
jdk.rmic
-compiler_scripting_modules=\
-java.compiler \
+scripting_modules=\
java.scripting \
-jdk.compiler \
jdk.dynalink \
jdk.scripting.nashorn \
jdk.scripting.nashorn.shell
+other_modules=\
+java.jnlp \
+java.smartcardio
+
incubator_modules=\
jdk.incubator.httpclient
+
--- a/jdk/make/src/classes/build/tools/taglet/ExtLink.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/make/src/classes/build/tools/taglet/ExtLink.java Wed Jul 05 23:33:35 2017 +0200
@@ -56,7 +56,7 @@
static final String TAG_NAME = "extLink";
- static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=";
+ static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=";
static final Pattern TAG_PATTERN = Pattern.compile("(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)");
--- a/jdk/src/java.base/aix/native/libnet/aix_close.c Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/aix/native/libnet/aix_close.c Wed Jul 05 23:33:35 2017 +0200
@@ -421,10 +421,8 @@
}
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
- struct sockaddr *from, int *fromlen) {
- socklen_t socklen = *fromlen;
- BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, &socklen) );
- *fromlen = socklen;
+ struct sockaddr *from, socklen_t *fromlen) {
+ BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) );
}
int NET_Send(int s, void *msg, int len, unsigned int flags) {
@@ -440,10 +438,8 @@
BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) );
}
-int NET_Accept(int s, struct sockaddr *addr, int *addrlen) {
- socklen_t socklen = *addrlen;
- BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen) );
- *addrlen = socklen;
+int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) {
+ BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) );
}
int NET_Connect(int s, struct sockaddr *addr, int addrlen) {
--- a/jdk/src/java.base/share/classes/java/io/File.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/io/File.java Wed Jul 05 23:33:35 2017 +0200
@@ -923,6 +923,12 @@
* java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
* Files.readAttributes} method may be used.
*
+ * @apiNote
+ * While the unit of time of the return value is milliseconds,
+ * the granularity of the value depends on the underlying
+ * file system and may be larger. For example, some
+ * file systems use time stamps in units of seconds.
+ *
* @return A <code>long</code> value representing the time the file was
* last modified, measured in milliseconds since the epoch
* (00:00:00 GMT, January 1, 1970), or <code>0L</code> if the
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Wed Jul 05 23:33:35 2017 +0200
@@ -137,6 +137,7 @@
* <li>{@code AES/CBC/PKCS5Padding} (128)</li>
* <li>{@code AES/ECB/NoPadding} (128)</li>
* <li>{@code AES/ECB/PKCS5Padding} (128)</li>
+ * <li>{@code AES/GCM/NoPadding} (128)</li>
* <li>{@code DES/CBC/NoPadding} (56)</li>
* <li>{@code DES/CBC/PKCS5Padding} (56)</li>
* <li>{@code DES/ECB/NoPadding} (56)</li>
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Wed Jul 05 23:33:35 2017 +0200
@@ -363,10 +363,6 @@
static void initHelpMessage(String progname) {
outBuf = outBuf.append(getLocalizedMessage("java.launcher.opt.header",
(progname == null) ? "java" : progname ));
- outBuf = outBuf.append(getLocalizedMessage("java.launcher.opt.datamodel",
- 32));
- outBuf = outBuf.append(getLocalizedMessage("java.launcher.opt.datamodel",
- 64));
}
/**
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Wed Jul 05 23:33:35 2017 +0200
@@ -34,7 +34,6 @@
\ <module>/<mainclass> are passed as the arguments to main class.\n\n\
\ where options include:\n\n
-java.launcher.opt.datamodel =\ -d{0}\t Deprecated, will be removed in a future release\n
java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n
java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n
--- a/jdk/src/java.base/share/native/libjli/args.c Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/share/native/libjli/args.c Wed Jul 05 23:33:35 2017 +0200
@@ -456,6 +456,11 @@
env++;
}
+ // Trailing space
+ if (*env == '\0') {
+ break;
+ }
+
arg = p;
while (*env != '\0' && !isspace(*env)) {
if (*env == '"' || *env == '\'') {
--- a/jdk/src/java.base/share/native/libjli/emessages.h Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/share/native/libjli/emessages.h Wed Jul 05 23:33:35 2017 +0200
@@ -36,7 +36,7 @@
#define JNI_ERROR "Error: A JNI error has occurred, please check your installation and try again"
#define JNI_ERROR1 "Error: can't find JNI interfaces in: %s"
-#define ARG_INFO_ENVVAR "NOTE: Picked up the following options via %s:\n %s"
+#define ARG_INFO_ENVVAR "NOTE: Picked up %s: %s"
#define ARG_WARN "Warning: %s option is no longer supported."
#define ARG_ERROR1 "Error: %s requires class path specification"
--- a/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c Wed Jul 05 23:33:35 2017 +0200
@@ -229,12 +229,15 @@
WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) {
struct stat64 sb;
if (stat64(path, &sb) == 0) {
-#ifndef MACOSX
+#if defined(_AIX)
+ rv = (jlong)sb.st_mtime * 1000;
+ rv += (jlong)sb.st_mtime_n / 1000000;
+#elif defined(MACOSX)
+ rv = (jlong)sb.st_mtimespec.tv_sec * 1000;
+ rv += (jlong)sb.st_mtimespec.tv_nsec / 1000000;
+#else
rv = (jlong)sb.st_mtim.tv_sec * 1000;
rv += (jlong)sb.st_mtim.tv_nsec / 1000000;
-#else
- rv = (jlong)sb.st_mtimespec.tv_sec * 1000;
- rv += (jlong)sb.st_mtimespec.tv_nsec / 1000000;
#endif
}
} END_PLATFORM_STRING(env, path);
@@ -419,14 +422,16 @@
struct timeval tv[2];
/* Preserve access time */
-#ifndef MACOSX
+#if defined(_AIX)
+ tv[0].tv_sec = sb.st_atime;
+ tv[0].tv_usec = sb.st_atime_n / 1000;
+#elif defined(MACOSX)
+ tv[0].tv_sec = sb.st_atimespec.tv_sec;
+ tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000;
+#else
tv[0].tv_sec = sb.st_atim.tv_sec;
tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
-#else
- tv[0].tv_sec = sb.st_atimespec.tv_sec;
- tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000;
#endif
-
/* Change last-modified time */
tv[1].tv_sec = time / 1000;
tv[1].tv_usec = (time % 1000) * 1000;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java Wed Jul 05 23:33:35 2017 +0200
@@ -160,7 +160,7 @@
creds = new Credentials(
rep.ticket,
req.reqBody.cname,
- rep.ticket.sname,
+ enc_part.sname,
enc_part.key,
enc_part.flags,
enc_part.authtime,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java Wed Jul 05 23:33:35 2017 +0200
@@ -88,7 +88,7 @@
this.creds = new Credentials(rep.ticket,
rep.cname,
- rep.ticket.sname,
+ enc_part.sname,
enc_part.key,
enc_part.flags,
enc_part.authtime,
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Wed Jul 05 23:33:35 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
@@ -190,11 +190,6 @@
}
@Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- throw new UnsupportedOperationException("Not supported.");
- }
-
- @Override
CompletableFuture<Void> whenReceivingResponse() {
throw new UnsupportedOperationException("Not supported.");
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Wed Jul 05 23:33:35 2017 +0200
@@ -33,7 +33,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLPermission;
-import java.nio.ByteBuffer;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -76,9 +75,6 @@
boolean upgrading; // to HTTP/2
final PushGroup<?,T> pushGroup;
- // buffer for receiving response headers
- private volatile ByteBuffer rxBuffer;
-
Exchange(HttpRequestImpl request, MultiExchange<?,T> multi) {
this.request = request;
this.upgrading = false;
@@ -121,17 +117,6 @@
return client;
}
- ByteBuffer getBuffer() {
- if(rxBuffer == null) {
- synchronized (this) {
- if(rxBuffer == null) {
- rxBuffer = Utils.getExchangeBuffer();
- }
- }
- }
- return rxBuffer;
- }
-
public Response response() throws IOException, InterruptedException {
return responseImpl(null);
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Wed Jul 05 23:33:35 2017 +0200
@@ -55,7 +55,7 @@
final HttpConnection connection;
final HttpClientImpl client;
final Executor executor;
- final ByteBuffer buffer; // used for receiving
+ volatile ByteBuffer buffer; // used for receiving
@Override
public String toString() {
@@ -74,7 +74,7 @@
this.client = exchange.client();
this.executor = exchange.executor();
this.operations = new LinkedList<>();
- this.buffer = exchange.getBuffer();
+ this.buffer = Utils.EMPTY_BYTEBUFFER;
if (connection != null) {
this.connection = connection;
} else {
@@ -157,7 +157,9 @@
try {
response = new Http1Response<>(connection, this);
response.readHeaders();
- return response.response();
+ Response r = response.response();
+ buffer = response.getBuffer();
+ return r;
} catch (Throwable t) {
connection.close();
throw t;
@@ -213,7 +215,9 @@
return MinimalFuture.supply( () -> {
response = new Http1Response<>(connection, Http1Exchange.this);
response.readHeaders();
- return response.response();
+ Response r = response.response();
+ buffer = response.getBuffer();
+ return r;
}, executor);
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java Wed Jul 05 23:33:35 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 @@
private final HttpConnection connection;
private ResponseHeaders headers;
private int responseCode;
- private final ByteBuffer buffer; // same buffer used for reading status line and headers
+ private ByteBuffer buffer;
private final Http1Exchange<T> exchange;
private final boolean redirecting; // redirecting
private boolean return2Cache; // return connection to cache when finished
@@ -96,6 +96,10 @@
return finished;
}
+ ByteBuffer getBuffer() {
+ return buffer;
+ }
+
int fixupContentLen(int clen) {
if (request.method().equalsIgnoreCase("HEAD")) {
return 0;
@@ -194,12 +198,15 @@
static final char CR = '\r';
static final char LF = '\n';
- private int getBuffer() throws IOException {
+ private int obtainBuffer() throws IOException {
int n = buffer.remaining();
if (n == 0) {
- buffer.clear();
- return connection.read(buffer);
+ buffer = connection.read();
+ if (buffer == null) {
+ return -1;
+ }
+ n = buffer.remaining();
}
return n;
}
@@ -207,18 +214,17 @@
String readStatusLine() throws IOException {
boolean cr = false;
StringBuilder statusLine = new StringBuilder(128);
- ByteBuffer b = buffer;
- while (getBuffer() != -1) {
- byte[] buf = b.array();
- int offset = b.position();
- int len = b.limit() - offset;
+ while ((obtainBuffer()) != -1) {
+ byte[] buf = buffer.array();
+ int offset = buffer.position();
+ int len = buffer.limit() - offset;
for (int i = 0; i < len; i++) {
char c = (char) buf[i+offset];
if (cr) {
if (c == LF) {
- b.position(i + 1 + offset);
+ buffer.position(i + 1 + offset);
return statusLine.toString();
} else {
throw new IOException("invalid status line");
@@ -231,7 +237,7 @@
}
}
// unlikely, but possible, that multiple reads required
- b.position(b.limit());
+ buffer.position(buffer.limit());
}
return null;
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java Wed Jul 05 23:33:35 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
@@ -323,12 +323,9 @@
}
}
- final int read(ByteBuffer buffer) throws IOException {
- return readImpl(buffer);
- }
-
final ByteBuffer read() throws IOException {
- return readImpl();
+ ByteBuffer b = readImpl();
+ return b;
}
/*
@@ -337,9 +334,6 @@
*/
protected abstract ByteBuffer readImpl() throws IOException;
- /** Reads as much as possible into given buffer and returns amount read. */
- protected abstract int readImpl(ByteBuffer buffer) throws IOException;
-
@Override
public String toString() {
return "HttpConnection: " + channel().toString();
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Wed Jul 05 23:33:35 2017 +0200
@@ -311,8 +311,7 @@
}
}
- @Override
- protected int readImpl(ByteBuffer buf) throws IOException {
+ private int readImpl(ByteBuffer buf) throws IOException {
int mark = buf.position();
int n;
// FIXME: this hack works in conjunction with the corresponding change
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java Wed Jul 05 23:33:35 2017 +0200
@@ -157,11 +157,6 @@
}
@Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- return delegate.readImpl(buffer);
- }
-
- @Override
boolean isSecure() {
return false;
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java Wed Jul 05 23:33:35 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
@@ -148,11 +148,7 @@
// make sure we have at least 1 byte to look at
private void getHunk() throws IOException {
if (chunkbuf == null || !chunkbuf.hasRemaining()) {
- if (chunkbuf == null) {
- chunkbuf = Utils.getBuffer();
- }
- chunkbuf.clear();
- connection.read(chunkbuf);
+ chunkbuf = connection.read();
}
}
@@ -256,7 +252,6 @@
private void pushBodyFixed(ByteBuffer b) throws IOException {
int remaining = contentLength;
- //lastBufferUsed = b;
while (b.hasRemaining() && remaining > 0) {
ByteBuffer buffer = Utils.getBuffer();
int amount = Math.min(b.remaining(), remaining);
@@ -265,22 +260,14 @@
buffer.flip();
dataConsumer.accept(Optional.of(buffer));
}
- //client.returnBuffer(b);
while (remaining > 0) {
- ByteBuffer buffer = Utils.getBuffer();
- int xx = connection.read(buffer);
- if (xx == -1)
+ ByteBuffer buffer = connection.read();
+ if (buffer == null)
throw new IOException("connection closed");
int bytesread = buffer.remaining();
// assume for now that pipelining not implemented
if (bytesread > remaining) {
- System.err.println("xx = " + xx);
- System.err.println("bytesread = " + bytesread);
- System.err.println("remaining = " + remaining);
- for (int i=0; i<remaining; i++) {
- System.err.printf("%x ", buffer.get());
- }
throw new IOException("too many bytes read");
}
remaining -= bytesread;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseHeaders.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseHeaders.java Wed Jul 05 23:33:35 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
@@ -72,7 +72,7 @@
static final class InputStreamWrapper extends InputStream {
final HttpConnection connection;
- final ByteBuffer buffer;
+ ByteBuffer buffer;
int lastRead = -1; // last byte read from the buffer
int consumed = 0; // number of bytes consumed.
InputStreamWrapper(HttpConnection connection, ByteBuffer buffer) {
@@ -83,9 +83,8 @@
@Override
public int read() throws IOException {
if (!buffer.hasRemaining()) {
- buffer.clear();
- int n = connection.read(buffer);
- if (n == -1) {
+ buffer = connection.read();
+ if (buffer == null) {
return lastRead = -1;
}
}
@@ -97,6 +96,16 @@
}
}
+ private static void display(Map<String, List<String>> map) {
+ map.forEach((k,v) -> {
+ System.out.print (k + ": ");
+ for (String val : v) {
+ System.out.print(val + ", ");
+ }
+ System.out.println("");
+ });
+ }
+
private Map<String, List<String>> parse(InputStreamWrapper input)
throws IOException
{
@@ -114,7 +123,6 @@
// finds is CR. This only happens if there are no headers, and
// only one byte will be consumed from the buffer. In this case
// the next byte MUST be LF
- //System.err.println("Last character read is: " + (byte)lastRead);
if (input.read() != LF) {
throw new IOException("Unexpected byte sequence when no headers: "
+ ((int)CR) + " " + input.lastRead
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Wed Jul 05 23:33:35 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,10 +162,11 @@
@Override
protected ByteBuffer readImpl() throws IOException {
- ByteBuffer dst = ByteBuffer.allocate(8192);
- int n = readImpl(dst);
+ WrapperResult r = sslDelegate.recvData(ByteBuffer.allocate(8192));
+ // TODO: check for closure
+ int n = r.result.bytesProduced();
if (n > 0) {
- return dst;
+ return r.buf;
} else if (n == 0) {
return Utils.EMPTY_BYTEBUFFER;
} else {
@@ -174,19 +175,6 @@
}
@Override
- protected int readImpl(ByteBuffer buf) throws IOException {
- // TODO: need to ensure that buf is big enough for application data
- WrapperResult r = sslDelegate.recvData(buf);
- // TODO: check for closure
- String s = "Receive) ";
- //debugPrint(s, r.buf);
- if (r.result.bytesProduced() > 0) {
- assert buf == r.buf;
- }
- return r.result.bytesProduced();
- }
-
- @Override
boolean connected() {
return delegate.connected();
}
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Wed Jul 05 23:33:35 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
@@ -104,9 +104,7 @@
}
SSLEngineResult result;
- /* if passed in buffer was not big enough then the a reallocated buffer
- * is returned here */
- ByteBuffer buf;
+ ByteBuffer buf; // buffer containing result data
}
int app_buf_size;
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Wed Jul 05 23:33:35 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
@@ -164,19 +164,10 @@
@Override
protected ByteBuffer readImpl() throws IOException {
- return sslDelegate.recvData(Utils.EMPTY_BYTEBUFFER).buf; // fix this, make the read normal
- }
+ ByteBuffer buf = Utils.getBuffer();
- @Override
- protected int readImpl(ByteBuffer buf) throws IOException {
WrapperResult r = sslDelegate.recvData(buf);
- // TODO: check for closure
- String s = "Receive) ";
- //debugPrint(s, r.buf);
- if (r.result.bytesProduced() > 0) {
- assert buf == r.buf;
- }
- return r.result.bytesProduced();
+ return r.buf;
}
@Override
--- a/jdk/test/ProblemList.txt Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/ProblemList.txt Wed Jul 05 23:33:35 2017 +0200
@@ -258,8 +258,6 @@
tools/jimage/JImageListTest.java 8170120 generic-all
tools/jimage/JImageVerifyTest.java 8170120 generic-all
-tools/jar/multiRelease/RuntimeTest.java 8173905 generic-all
-
tools/schemagen/MultiReleaseJarTest.java 8174692 generic-all
tools/wsgen/MultiReleaseJarTest.java 8174692 generic-all
--- a/jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java Wed Jul 05 23:33:35 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
@@ -25,7 +25,7 @@
* @test
* @bug 7130985
* @summary Four helper classes missing in Sun JDK
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @build jdk.testlibrary.*
* @modules java.corba
* @run main CorbaExceptionsCompileTest
@@ -35,12 +35,12 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.rmi.RemoteException;
+
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.TypeCodePackage.Bounds;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import jdk.testlibrary.JDKToolLauncher;
public class CorbaExceptionsCompileTest implements CorbaExceptionsTest {
--- a/jdk/test/com/sun/crypto/provider/CICO/PBEFunc/CipherNCFuncTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/com/sun/crypto/provider/CICO/PBEFunc/CipherNCFuncTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, 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
@@ -20,20 +20,22 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
* @test
* @bug 8048604
- * @library ../ /lib/testlibrary
+ * @library ../ /test/lib
* @summary This test verifies the assertion "There should be no transformation
- * on the plaintext/ciphertext in encryption/decryption mechanism" for
- * feature "NullCipher".
+ * on the plaintext/ciphertext in encryption/decryption mechanism" for
+ * feature "NullCipher".
*/
+
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NullCipher;
import javax.crypto.ShortBufferException;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class CipherNCFuncTest {
public static void main(String[] args) throws ShortBufferException,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/File/createTempFile/SecurityTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 4138064
+ * @build SecurityTest
+ * @run main/othervm/policy=java.policy SecurityTest
+ */
+
+import java.io.File;
+
+public class SecurityTest {
+
+ public static void main(String[] args) throws Exception {
+ try {
+ File f = File.createTempFile("foo", null);
+ } catch (java.security.AccessControlException x) {
+ throw x;
+ } catch (SecurityException x) {
+ if (x.getMessage().equals("Unable to create temporary file")) {
+ return;
+ }
+ throw x;
+ }
+ throw new Exception("SecurityException not thrown");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/File/createTempFile/java.policy Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,2 @@
+grant {
+};
--- a/jdk/test/java/io/InputStream/ReadAllBytes.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/io/InputStream/ReadAllBytes.java Wed Jul 05 23:33:35 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
@@ -27,13 +27,12 @@
import java.io.InputStream;
import java.util.Arrays;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/*
* @test
* @bug 8080835
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main ReadAllBytes
* @summary Basic test for InputStream.readAllBytes
* @key randomness
--- a/jdk/test/java/io/InputStream/ReadNBytes.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/io/InputStream/ReadNBytes.java Wed Jul 05 23:33:35 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
@@ -27,13 +27,12 @@
import java.io.InputStream;
import java.util.Arrays;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/*
* @test
* @bug 8080835
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main ReadNBytes
* @summary Basic test for InputStream.readNBytes
* @key randomness
--- a/jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# @bug 4088176
-# @summary Test reading an evolved class serialization into the original class
-
-rm *.class tmp.ser
-javac WriteAddedField.java
-java ${TESTVMOPTS} WriteAddedField
-rm *.class
-javac ReadAddedField.java
-java ${TESTVMOPTS} ReadAddedField
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,107 @@
+/*
+ * 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 4087295 4785472
+ * @library /test/lib
+ * @build jdk.test.lib.compiler.CompilerUtils
+ * @build jdk.test.lib.process.ProcessTools
+ * @build RenamePackageTest
+ * @run main RenamePackageTest
+ * @summary Enable resolveClass() to accommodate package renaming.
+ * This fix enables one to implement a resolveClass method that maps a
+ * Serialiazable class within a serialization stream to the same class
+ * in a different package within the JVM runtime. See run shell script
+ * for instructions on how to run this test.
+ */
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.process.ProcessTools;
+
+public class RenamePackageTest {
+ public static void main(String args[]) throws Exception {
+ setup();
+
+ runTestSerialDriver();
+ runInstallSerialDriver();
+
+ runInstallSerialDriver();
+ runTestSerialDriver();
+ }
+
+ private static final Path SHARE = Paths.get(System.getProperty("test.classes"), "share");
+ private static final Path OCLASSES = Paths.get(System.getProperty("test.classes"), "oclasses");
+ private static final Path NCLASSES = Paths.get(System.getProperty("test.classes"), "nclasses");
+
+ private static void setup() throws Exception {
+
+ boolean b = CompilerUtils.compile(Paths.get(System.getProperty("test.src"), "extension"),
+ SHARE);
+ assertTrue(b);
+ b = CompilerUtils.compile(Paths.get(System.getProperty("test.src"), "test"),
+ OCLASSES,
+ "-classpath",
+ SHARE.toString());
+ assertTrue(b);
+ b = CompilerUtils.compile(Paths.get(System.getProperty("test.src"), "install"),
+ NCLASSES,
+ "-classpath",
+ SHARE.toString());
+ assertTrue(b);
+ }
+
+ private static void runTestSerialDriver() throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+ "-classpath",
+ SHARE.toString()
+ + File.pathSeparator
+ + OCLASSES.toString(),
+ "test.SerialDriver", "-s");
+ Process p = ProcessTools.startProcess("test SerialDriver", pb);
+ p.waitFor();
+ assertTrue(p.exitValue() == 0);
+ }
+
+ private static void runInstallSerialDriver() throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+ "-classpath",
+ SHARE.toString()
+ + File.pathSeparator
+ + NCLASSES.toString(),
+ "install.SerialDriver", "-d");
+ Process p = ProcessTools.startProcess("install SerialDriver", pb);
+ p.waitFor();
+ assertTrue(p.exitValue() == 0);
+ }
+
+ private static void assertTrue(boolean b) {
+ if (!b) {
+ throw new RuntimeException("expected true, get false");
+ }
+ }
+}
--- a/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-#
-# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4087295 4785472
-# @summary Enable resolveClass() to accommodate package renaming.
-# This fix enables one to implement a resolveClass method that maps a
-# Serialiazable class within a serialization stream to the same class
-# in a different package within the JVM runtime. See run shell script
-# for instructions on how to run this test.
-
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-
-OS=`uname -s`
-# Need to determine the classpath separator and filepath separator based on the
-# operating system.
-case "$OS" in
-SunOS | Linux | Darwin | AIX )
- PS=":" ;;
-Windows* | CYGWIN* )
- PS=";" ;;
-* )
- echo "Unrecognized system!"
- exit 1 ;;
-esac
-
-JAVA=${TESTJAVA}/bin/java
-JAVAC=${COMPILEJAVA}/bin/javac
-MKDIR=mkdir
-RDEL="rm -r"
-
-if [ -d ${TESTCLASSES}/oclasses ]
-then
- ${RDEL} ${TESTCLASSES}/oclasses
-fi
-if [ -d ${TESTCLASSES}/nclasses ]
-then
- ${RDEL} ${TESTCLASSES}/nclasses
-fi
-if [ -d ${TESTCLASSES}/share ]
-then
- ${RDEL} ${TESTCLASSES}/share
-fi
-if [ -f ${TESTCLASSES}/stream.ser ]
-then
- ${RDEL} ${TESTCLASSES}/stream.ser
-fi
-
-mkdir ${TESTCLASSES}/oclasses
-mkdir ${TESTCLASSES}/share
-mkdir ${TESTCLASSES}/nclasses
-
-# Build sources
-set -e
-${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/share \
- ${TESTSRC}/extension/ExtendedObjectInputStream.java
-CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;
-${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/oclasses \
- ${TESTSRC}/test/SerialDriver.java
-CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;
-${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/nclasses \
- ${TESTSRC}/install/SerialDriver.java
-
-# Run Case 1. Map test.SerialDriver within stream to install.SerialDriver.
-CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
-${JAVA} ${TESTVMOPTS} test.SerialDriver -s
-CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
-${JAVA} ${TESTVMOPTS} install.SerialDriver -d
-rm stream.ser
-
-# Run Case 2. Map install.SerialDriver within stream to test.SerialDriver.
-CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
-${JAVA} ${TESTVMOPTS} install.SerialDriver -s
-CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
-${JAVA} ${TESTVMOPTS} test.SerialDriver -d
--- a/jdk/test/java/io/Serializable/failureAtomicity/FailureAtomicity.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/io/Serializable/failureAtomicity/FailureAtomicity.java Wed Jul 05 23:33:35 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,8 +26,7 @@
* @bug 8071474
* @summary Better failure atomicity for default read object.
* @modules jdk.compiler
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library /test/lib
* @compile FailureAtomicity.java SerialRef.java
* @run main failureAtomicity.FailureAtomicity
*/
@@ -59,7 +58,7 @@
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
@SuppressWarnings("unchecked")
public class FailureAtomicity {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/maskSyntheticModifier/MaskSyntheticModifierTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4897937
+ * @run main MaskSyntheticModifierTest
+ * @summary Verify that the presence of the JVM_ACC_SYNTHETIC bit in the
+ * modifiers of fields and methods does not affect default
+ * serialVersionUID calculation.
+ */
+
+import java.io.ObjectStreamClass;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+public class MaskSyntheticModifierTest {
+ public static void main(String[] args) throws Exception {
+ setup();
+
+ long suid = ObjectStreamClass.lookup(Foo.class).getSerialVersionUID();
+ if (suid != 8027844768744011556L) {
+ throw new Error("incorrect serialVersionUID: " + suid);
+ }
+ }
+
+ private static void setup() throws Exception {
+ Files.copy(Paths.get(System.getProperty("test.src"), "Foo.class"),
+ Paths.get("Foo.class"), StandardCopyOption.REPLACE_EXISTING);
+ }
+}
--- a/jdk/test/java/io/Serializable/maskSyntheticModifier/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @bug 4897937
- * @summary Verify that the presence of the JVM_ACC_SYNTHETIC bit in the
- * modifiers of fields and methods does not affect default
- * serialVersionUID calculation.
- */
-
-import java.io.ObjectStreamClass;
-
-public class Test {
- public static void main(String[] args) {
- long suid = ObjectStreamClass.lookup(Foo.class).getSerialVersionUID();
- if (suid != 8027844768744011556L) {
- throw new Error("incorrect serialVersionUID: " + suid);
- }
- }
-}
--- a/jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4897937
-# @summary Verify that the presence of the JVM_ACC_SYNTHETIC bit in the
-# modifiers of fields and methods does not affect default
-# serialVersionUID calculation.
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
-exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC="."
-fi
-
-set -ex
-cp ${TESTSRC}/Foo.class .
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/Test.java
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test
-rm -f *.class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/packageAccess/PackageAccessTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,116 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4765255
+ * @library /lib/testlibrary
+ * @build JarUtils A B C D PackageAccessTest
+ * @run main PackageAccessTest
+ * @summary Verify proper functioning of package equality checks used to
+ * determine accessibility of superclass constructor and inherited
+ * writeReplace/readResolve methods.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.InvalidClassException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class PackageAccessTest {
+
+ static Class bcl;
+ static Class dcl;
+
+ public static void main(String[] args) throws Exception {
+ setup();
+
+ try (URLClassLoader ldr =
+ new URLClassLoader(new URL[]{ new URL("file:foo.jar") },
+ PackageAccessTest.class.getClassLoader())) {
+ bcl = Class.forName("B", true, ldr);
+ dcl = Class.forName("D", true, ldr);
+
+ Object b = bcl.newInstance();
+ try {
+ swizzle(b);
+ throw new Error("expected InvalidClassException for class B");
+ } catch (InvalidClassException e) {
+ System.out.println("caught " + e);
+ e.printStackTrace();
+ }
+ if (A.packagePrivateConstructorInvoked) {
+ throw new Error("package private constructor of A invoked");
+ }
+
+ Object d = dcl.newInstance();
+ swizzle(d);
+ }
+ }
+
+ static void swizzle(Object obj) throws Exception {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(obj);
+ oout.close();
+ ByteArrayInputStream bin =
+ new ByteArrayInputStream(bout.toByteArray());
+ new TestObjectInputStream(bin).readObject();
+ }
+
+ static void setup() throws Exception {
+ Path classes = Paths.get(System.getProperty("test.classes", ""));
+ JarUtils.createJarFile(Paths.get("foo.jar"), classes,
+ classes.resolve("B.class"), classes.resolve("D.class"));
+ Files.delete(classes.resolve("B.class"));
+ Files.delete(classes.resolve("D.class"));
+ }
+}
+
+class TestObjectInputStream extends ObjectInputStream {
+ TestObjectInputStream(InputStream in) throws IOException {
+ super(in);
+ }
+
+ protected Class resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException
+ {
+ String n = desc.getName();
+ if (n.equals("B")) {
+ return PackageAccessTest.bcl;
+ } else if (n.equals("D")) {
+ return PackageAccessTest.dcl;
+ } else {
+ return super.resolveClass(desc);
+ }
+ }
+}
--- a/jdk/test/java/io/Serializable/packageAccess/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @bug 4765255
- * @summary Verify proper functioning of package equality checks used to
- * determine accessibility of superclass constructor and inherited
- * writeReplace/readResolve methods.
- */
-
-import java.io.*;
-import java.net.*;
-
-public class Test {
-
- static Class bcl;
- static Class dcl;
-
- public static void main(String[] args) throws Exception {
- ClassLoader ldr =
- new URLClassLoader(new URL[]{ new URL("file:foo.jar") },
- Test.class.getClassLoader());
- bcl = Class.forName("B", true, ldr);
- dcl = Class.forName("D", true, ldr);
-
- Object b = bcl.newInstance();
- try {
- swizzle(b);
- throw new Error("expected InvalidClassException for class B");
- } catch (InvalidClassException e) {
- System.out.println("caught " + e);
- e.printStackTrace();
- }
- if (A.packagePrivateConstructorInvoked) {
- throw new Error("package private constructor of A invoked");
- }
-
- Object d = dcl.newInstance();
- swizzle(d);
- }
-
- static void swizzle(Object obj) throws Exception {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oout = new ObjectOutputStream(bout);
- oout.writeObject(obj);
- oout.close();
- ByteArrayInputStream bin =
- new ByteArrayInputStream(bout.toByteArray());
- new TestObjectInputStream(bin).readObject();
- }
-}
-
-class TestObjectInputStream extends ObjectInputStream {
- TestObjectInputStream(InputStream in) throws IOException {
- super(in);
- }
-
- protected Class resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException
- {
- String n = desc.getName();
- if (n.equals("B")) {
- return Test.bcl;
- } else if (n.equals("D")) {
- return Test.dcl;
- } else {
- return super.resolveClass(desc);
- }
- }
-}
--- a/jdk/test/java/io/Serializable/packageAccess/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4765255
-# @summary Verify proper functioning of package equality checks used to
-# determine accessibility of superclass constructor and inherited
-# writeReplace/readResolve methods.
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
-exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC="."
-fi
-
-set -ex
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}/A.java ${TESTSRC}/B.java ${TESTSRC}/C.java ${TESTSRC}/D.java \
- ${TESTSRC}/Test.java
-${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf foo.jar B.class D.class
-rm -f B.class D.class
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test
-rm -f *.class *.jar
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/resolveClass/consTest/ConsTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4413434
+ * @library /lib/testlibrary
+ * @build JarUtils SetupJar Boot
+ * @run driver SetupJar
+ * @run main/othervm -Xbootclasspath/a:boot.jar ConsTest
+ * @summary Verify that generated java.lang.reflect implementation classes do
+ * not interfere with serialization's class resolution mechanism.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+
+public class ConsTest implements Serializable {
+ public static void main(String[] args) throws Exception {
+ Constructor cons = Boot.class.getConstructor(
+ new Class[] { ObjectInputStream.class });
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(new ConsTest());
+ oout.close();
+
+ for (int i = 0; i < 100; i++) {
+ ObjectInputStream oin = new ObjectInputStream(
+ new ByteArrayInputStream(bout.toByteArray()));
+ cons.newInstance(new Object[]{ oin });
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/resolveClass/consTest/SetupJar.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class SetupJar {
+
+ public static void main(String args[]) throws Exception {
+ Path classes = Paths.get(System.getProperty("test.classes", ""));
+ JarUtils.createJarFile(Paths.get("boot.jar"), classes,
+ classes.resolve("Boot.class"));
+ }
+}
--- a/jdk/test/java/io/Serializable/resolveClass/consTest/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @bug 4413434
- * @summary Verify that generated java.lang.reflect implementation classes do
- * not interfere with serialization's class resolution mechanism.
- */
-
-import java.io.*;
-import java.lang.reflect.*;
-
-public class Test implements Serializable {
- public static void main(String[] args) throws Exception {
- Constructor cons = Boot.class.getConstructor(
- new Class[] { ObjectInputStream.class });
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oout = new ObjectOutputStream(bout);
- oout.writeObject(new Test());
- oout.close();
-
- for (int i = 0; i < 100; i++) {
- ObjectInputStream oin = new ObjectInputStream(
- new ByteArrayInputStream(bout.toByteArray()));
- cons.newInstance(new Object[]{ oin });
- }
- }
-}
--- a/jdk/test/java/io/Serializable/resolveClass/consTest/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4413434
-# @summary Verify that generated java.lang.reflect implementation classes do
-# not interfere with serialization's class resolution mechanism.
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
-exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC="."
-fi
-
-set -ex
-
-rm -f *.class *.jar
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/Boot.java
-${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf boot.jar *.class
-rm -f *.class
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -classpath boot.jar -d . \
- ${TESTSRC}/Test.java
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Xbootclasspath/a:boot.jar Test
-rm -f *.class *.jar
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/DeserializeButtonTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4413434
+ * @library /lib/testlibrary
+ * @build JarUtils Foo
+ * @run main DeserializeButtonTest
+ * @summary Verify that class loaded outside of application class loader is
+ * correctly resolved during deserialization when read in by custom
+ * readObject() method of a bootstrap class (in this case,
+ * java.util.Vector).
+ */
+
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class DeserializeButtonTest {
+ public static void main(String[] args) throws Exception {
+ setup();
+
+ try (URLClassLoader ldr =
+ new URLClassLoader(new URL[]{ new URL("file:cb.jar") })) {
+ Runnable r = (Runnable) Class.forName("Foo", true, ldr).newInstance();
+ r.run();
+ }
+ }
+
+ private static void setup() throws Exception {
+ Path classes = Paths.get(System.getProperty("test.classes", ""));
+ JarUtils.createJarFile(Paths.get("cb.jar"),
+ classes,
+ classes.resolve("Foo.class"),
+ classes.resolve("Foo$TestElement.class"));
+ }
+}
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @bug 4413434
- * @summary Verify that class loaded outside of application class loader is
- * correctly resolved during deserialization when read in by custom
- * readObject() method of a bootstrap class (in this case,
- * java.util.Vector).
- */
-
-import java.io.*;
-import java.net.*;
-
-public class Test {
- public static void main(String[] args) throws Exception {
- ClassLoader ldr =
- new URLClassLoader(new URL[]{ new URL("file:cb.jar") });
- Runnable r = (Runnable) Class.forName("Foo", true, ldr).newInstance();
- r.run();
- }
-}
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4413434
-# @summary Verify that class loaded outside of application class loader is
-# correctly resolved during deserialization when read in by custom
-# readObject() method of a bootstrap class (in this case,
-# java.util.Vector).
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
-exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC="."
-fi
-
-set -ex
-
-rm -f *.class *.jar
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/Foo.java
-${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf cb.jar *.class
-rm -f *.class
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/Test.java
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test
-rm -f *.class *.jar
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/serialver/classpath/ClasspathTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4035147 4785472
+ * @library /test/lib
+ * @build jdk.test.lib.JDKToolLauncher
+ * @build jdk.test.lib.process.ProcessTools
+ * @build ClasspathTest
+ * @run main serialver.ClasspathTest
+ * @summary Test the use of the -classpath switch in the serialver application.
+ */
+
+package serialver;
+
+import java.io.File;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.process.ProcessTools;
+
+public class ClasspathTest implements java.io.Serializable {
+ int a;
+ int b;
+
+ public static void main(String args[]) throws Exception {
+ JDKToolLauncher serialver =
+ JDKToolLauncher.create("serialver")
+ .addToolArg("-classpath")
+ .addToolArg(System.getProperty("test.class.path"))
+ .addToolArg("serialver.ClasspathTest");
+ Process p = ProcessTools.startProcess("serialver",
+ new ProcessBuilder(serialver.getCommand()));
+ p.waitFor();
+ if (p.exitValue() != 0) {
+ throw new RuntimeException("error occurs in serialver");
+ }
+ }
+}
--- a/jdk/test/java/io/Serializable/serialver/classpath/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *
- * @bug 4035147
- * @sumary Simple java class for test purposes
- */
-
-package serialver;
-
-public class Test implements java.io.Serializable{
- int a;
- int b;
-}
--- a/jdk/test/java/io/Serializable/serialver/classpath/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#
-# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4035147 4785472
-# @summary Test the use of the -classpath switch in the serialver application.
-# @author Naveen Sanjeeva
-#
-# @build Test
-# @run shell run.sh
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PS=":" ;;
- Windows* | CYGWIN* )
- PS=";" ;;
- * )
- echo "Unrecognized system!"
- exit 1 ;;
-esac
-
-# the test code
-
-echo "Using the classpath .${PS}${TESTCLASSES}"
-${TESTJAVA}/bin/serialver -classpath ".${PS}${TESTCLASSES}" serialver.Test
-
-exit $?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/serialver/nested/NestedTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4312217 4785473
+ * @library /test/lib
+ * @build jdk.test.lib.JDKToolLauncher
+ * @build jdk.test.lib.process.ProcessTools
+ * @build NestedTest
+ * @run main serialver.NestedTest
+ * @summary To test the use of nested class specification using the '.'
+ * notation instead of the '$' notation.
+ */
+
+package serialver;
+
+import java.io.Serializable;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.process.ProcessTools;
+
+public class NestedTest implements Serializable {
+ public static class Test1 implements Serializable {
+ public static class Test2 implements Serializable{
+ private static final long serialVersionUID = 100L;
+ }
+ }
+
+ public static void main(String args[]) throws Exception {
+ JDKToolLauncher serialver =
+ JDKToolLauncher.create("serialver")
+ .addToolArg("-classpath")
+ .addToolArg(System.getProperty("test.class.path"))
+ .addToolArg("serialver.NestedTest.Test1.Test2");
+ Process p = ProcessTools.startProcess("serialver",
+ new ProcessBuilder(serialver.getCommand()));
+ p.waitFor();
+ if (p.exitValue() != 0) {
+ throw new RuntimeException("error occurs in serialver.");
+ }
+ }
+}
--- a/jdk/test/java/io/Serializable/serialver/nested/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- *
- * @bug 4312217
- * @summary To test the use of nested class specification using the '.'
- * notation instead of the '$' notation.
- */
-package serialver;
-
-import java.io.*;
-
-public class Test implements Serializable {
- public static class Test1 implements Serializable {
- public static class Test2 implements Serializable{
- private static final long serialVersionUID = 100L;
- }
- }
-}
--- a/jdk/test/java/io/Serializable/serialver/nested/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#
-# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4312217 4785473
-# @summary Test the use of the -classpath switch in the serialver application.
-# @author Naveen Sanjeeva
-#
-# @build Test
-# @run shell run.sh
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PS=":" ;;
- Windows* | CYGWIN* )
- PS=";" ;;
- * )
- echo "Unrecognized system!"
- exit 1 ;;
-esac
-
-# the test code
-
-echo "Using the classpath .${PS}${TESTCLASSES}"
-${TESTJAVA}/bin/serialver -classpath ".${PS}${TESTCLASSES}" 'serialver.Test.Test1.Test2'
-
-exit $?
--- a/jdk/test/java/io/Serializable/subclass/Allow.policy Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/io/Serializable/subclass/Allow.policy Wed Jul 05 23:33:35 2017 +0200
@@ -2,7 +2,6 @@
// "standard" properies that can be read by anyone
permission java.io.FilePermission "-","read,write,execute";
permission java.io.SerializablePermission "enableSubstitution";
- permission java.io.SerializablePermission "enableSubclassImplementation";
// Needed to get access to private writeObjectMethod and
// to be able to call it.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/subclass/SubclassTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4100915
+ * @summary Verify that [write/read]ObjectOverride methods get called.
+ * Test verifies that ALL methods to write an object can
+ * be overridden. However, the testing for reading an object
+ * is incomplete. Only test that readObjectOverride is called.
+ * An entire protocol would need to be implemented and written
+ * out before being able to test the input side of the API.
+ *
+ * Also, would be appropriate that this program verify
+ * that if SerializablePermission "enableSubclassImplementation"
+ * is not in the security policy and security is enabled, that
+ * a security exception is thrown when constructing the
+ * ObjectOutputStream subclass.
+ *
+ *
+ * @compile AbstractObjectInputStream.java AbstractObjectOutputStream.java
+ * @compile XObjectInputStream.java XObjectOutputStream.java
+ * @compile SubclassTest.java
+ * @run main SubclassTest
+ * @run main/othervm/policy=Allow.policy SubclassTest -expectSecurityException
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import java.io.Serializable;
+
+/**
+ * Test if customized readObject and writeObject are called.
+ */
+class B implements Serializable {
+ public int publicIntField;
+ public static int numWriteObjectCalled = 0;
+ B(int v) {
+ publicIntField = v;
+ }
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ numWriteObjectCalled++;
+ os.defaultWriteObject();
+ }
+
+ private void readObject(ObjectInputStream is)
+ throws IOException, ClassNotFoundException
+ {
+ is.defaultReadObject();
+ }
+
+};
+
+/**
+ * Test PutFields interface.
+ */
+
+class C implements Serializable {
+ public int xx1;
+ public int xx2;
+ static final ObjectStreamField[] serialPersistentFields = {
+ new ObjectStreamField("x1", Integer.TYPE),
+ new ObjectStreamField("x2", Integer.TYPE),
+ new ObjectStreamField("x3", Integer.TYPE),
+ new ObjectStreamField("x4", Integer.TYPE)
+ };
+ C() {
+ xx1 = 300;
+ xx2 = 400;
+ }
+
+ private void writeObject(ObjectOutputStream os) throws IOException {
+ ObjectOutputStream.PutField putFields = os.putFields();
+ putFields.put("x1", xx1);
+ putFields.put("x2", xx2);
+ putFields.put("x3", xx1 * 2);
+ putFields.put("x4", xx2 * 2);
+ os.writeFields();
+ }
+
+};
+
+
+class A implements Serializable {
+ public int publicIntField;
+ public long publicLongField;
+ public B publicBField;
+ public B[] publicBArray = { new B(4), new B(6)};
+ public C publicCField;
+
+ public A() {
+ publicIntField = 3;
+ publicLongField = 10L;
+ publicBField = new B(5);
+ publicCField = new C();
+ }
+};
+
+public class SubclassTest {
+ public static void main(String argv[])
+ throws IOException, ClassNotFoundException
+ {
+ boolean expectSecurityException = false;
+
+ if (argv.length > 0 &&
+ argv[0].compareTo("-expectSecurityException") == 0)
+ expectSecurityException = true;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(20);
+ XObjectOutputStream os = null;
+ try {
+ os = new XObjectOutputStream(baos);
+ if (expectSecurityException)
+ throw new Error("Assertion failure. " +
+ "Expected a security exception on previous line.");
+ } catch (SecurityException e) {
+ if (expectSecurityException) {
+ System.err.println("Caught expected security exception.");
+ return;
+ }
+ throw e;
+ }
+ os.writeObject(new A());
+ os.close();
+ if (B.numWriteObjectCalled != 3)
+ throw new Error("Expected B.writeObject() to be called 3 times;" +
+ " observed only " + B.numWriteObjectCalled + " times");
+
+ XObjectInputStream is =
+ new XObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
+ try {
+ A a = (A)is.readObject();
+ throw new Error("Expected readObjectOverride() to be called and throw IOException(not implemented)");
+ } catch (IOException e) {
+ }
+ is.close();
+ }
+};
--- a/jdk/test/java/io/Serializable/subclass/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +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 4100915
- * @summary Verify that [write/read]ObjectOverride methods get called.
- * Test verifies that ALL methods to write an object can
- * be overridden. Howver, the testing for reading an object
- * is incomplete. Only test that readObjectOverride is called.
- * An entire protocol would need to be implemented and written
- * out before being able to test the input side of the API.
- *
- * Also, would be appropriate that this program verify
- * that if SerializablePermission "enableSubclassImplamentation"
- * is not in the security policy and security is enabled, that
- * a security excepiton is thrown when constructing the
- * ObjectOutputStream subclass.
- *
- *
- * @compile AbstractObjectInputStream.java AbstractObjectOutputStream.java XObjectInputStream.java XObjectOutputStream.java Test.java
- * @run main Test
- */
-
-import java.io.*;
-
-/**
- * Test if customized readObject and writeObject are called.
- */
-class B implements Serializable {
- public int publicIntField;
- public static int numWriteObjectCalled = 0;
- B(int v) {
- publicIntField = v;
- }
- private void writeObject(ObjectOutputStream os) throws IOException {
- numWriteObjectCalled++;
- os.defaultWriteObject();
- }
-
- private void readObject(ObjectInputStream is)
- throws IOException, ClassNotFoundException
- {
- is.defaultReadObject();
- }
-
-};
-
-/**
- * Test PutFields interface.
- */
-
-class C implements Serializable {
- public int xx1;
- public int xx2;
- static final ObjectStreamField[] serialPersistentFields = {
- new ObjectStreamField("x1", Integer.TYPE),
- new ObjectStreamField("x2", Integer.TYPE),
- new ObjectStreamField("x3", Integer.TYPE),
- new ObjectStreamField("x4", Integer.TYPE)
- };
- C() {
- xx1 = 300;
- xx2 = 400;
- }
-
- private void writeObject(ObjectOutputStream os) throws IOException {
- ObjectOutputStream.PutField putFields = os.putFields();
- putFields.put("x1", xx1);
- putFields.put("x2", xx2);
- putFields.put("x3", xx1 * 2);
- putFields.put("x4", xx2 * 2);
- os.writeFields();
- }
-
-};
-
-
-class A implements Serializable {
- public int publicIntField;
- public long publicLongField;
- public B publicBField;
- public B[] publicBArray = { new B(4), new B(6)};
- public C publicCField;
-
- public A() {
- publicIntField = 3;
- publicLongField = 10L;
- publicBField = new B(5);
- publicCField = new C();
- }
-};
-
-public class Test {
- public static void main(String argv[])
- throws IOException, ClassNotFoundException
- {
- boolean expectSecurityException = false;
-
- if (argv.length > 0 &&
- argv[0].compareTo("-expectSecurityException") == 0)
- expectSecurityException = true;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream(20);
- XObjectOutputStream os = null;
- try {
- os = new XObjectOutputStream(baos);
- if (expectSecurityException)
- throw new Error("Assertion failure. " +
- "Expected a security exception on previous line.");
- } catch (SecurityException e) {
- if (expectSecurityException)
- return;
- else
- throw e;
- }
- os.writeObject(new A());
- os.close();
- if (B.numWriteObjectCalled != 3)
- throw new Error("Expected B.writeObject() to be called 3 times;" +
- " observed only " + B.numWriteObjectCalled + " times");
-
- XObjectInputStream is =
- new XObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
- try {
- A a = (A)is.readObject();
- throw new Error("Expected readObjectOverride() to be called and throw IOException(not implemented)");
- } catch (IOException e) {
- }
- is.close();
- }
-};
--- a/jdk/test/java/io/Serializable/subclass/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# @bug 4100915
-mkdir classes
-javac -d classes *.java
-java ${TESTVMOPTS} -classpath classes -Djava.policy=Allow.policy Test
-# ENABLE next line when new method for invoking a main with a SecureClassLoader is known
-#java -classpath classes -Djava.policy=NotAllow.policy Test -expectSecurityException
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/superclassDataLoss/SuperclassDataLossTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,121 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4325590
+ * @library /lib/testlibrary
+ * @build JarUtils A B
+ * @run main SuperclassDataLossTest
+ * @summary Verify that superclass data is not lost when incoming superclass
+ * descriptor is matched with local class that is not a superclass of
+ * the deserialized instance's class.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+class MixedSuperclassStream extends ObjectInputStream {
+ private boolean ldr12A;
+ private URLClassLoader ldr1;
+ private URLClassLoader ldr2;
+
+ MixedSuperclassStream(InputStream in, URLClassLoader ldr1,
+ URLClassLoader ldr2, boolean ldr1First) throws IOException {
+ super(in);
+ this.ldr1 = ldr1;
+ this.ldr2 = ldr2;
+ this.ldr12A = ldr12A;
+ }
+
+ protected Class resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException
+ {
+ // resolve A's classdesc to class != B's superclass
+ String name = desc.getName();
+ if (ldr12A) {
+ if (name.equals("A")) {
+ return Class.forName(name, true, ldr1);
+ } else if (name.equals("B")) {
+ return Class.forName(name, true, ldr2);
+ }
+ } else {
+ if (name.equals("B")) {
+ return Class.forName(name, true, ldr1);
+ } else if (name.equals("A")) {
+ return Class.forName(name, true, ldr2);
+ }
+ }
+ return super.resolveClass(desc);
+ }
+}
+
+public class SuperclassDataLossTest {
+
+ public static void main(String[] args) throws Exception {
+ try (URLClassLoader ldr1 = new URLClassLoader(new URL[] { new URL("file:cb1.jar") });
+ URLClassLoader ldr2 = new URLClassLoader(new URL[] { new URL("file:cb2.jar") })) {
+ setup();
+
+ Runnable a = (Runnable) Class.forName("B", true, ldr1).newInstance();
+ a.run();
+
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(a);
+ oout.close();
+
+ test(bout, ldr1, ldr2, true);
+ test(bout, ldr1, ldr2, false);
+ }
+ }
+
+ private static void test(ByteArrayOutputStream bout, URLClassLoader ldr1,
+ URLClassLoader ldr2, boolean ldr12A) throws Exception {
+ ByteArrayInputStream bin =
+ new ByteArrayInputStream(bout.toByteArray());
+ ObjectInputStream oin = new MixedSuperclassStream(bin, ldr1, ldr2, ldr12A);
+ Runnable a = (Runnable) oin.readObject();
+ a.run();
+ }
+
+ private static void setup() throws Exception {
+ Path classes = Paths.get(System.getProperty("test.classes", ""));
+ JarUtils.createJarFile(Paths.get("cb1.jar"), classes,
+ classes.resolve("A.class"), classes.resolve("B.class"));
+ Files.copy(Paths.get("cb1.jar"), Paths.get("cb2.jar"),
+ StandardCopyOption.REPLACE_EXISTING);
+ }
+}
--- a/jdk/test/java/io/Serializable/superclassDataLoss/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @bug 4325590
- * @summary Verify that superclass data is not lost when incoming superclass
- * descriptor is matched with local class that is not a superclass of
- * the deserialized instance's class.
- */
-
-import java.io.*;
-import java.net.*;
-
-class MixedSuperclassStream extends ObjectInputStream {
- MixedSuperclassStream(InputStream in) throws IOException { super(in); }
-
- protected Class resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException
- {
- // resolve A's classdesc to class != B's superclass
- String name = desc.getName();
- if (name.equals("A")) {
- return Class.forName(name, true, Test.ldr1);
- } else if (name.equals("B")) {
- return Class.forName(name, true, Test.ldr2);
- } else {
- return super.resolveClass(desc);
- }
- }
-}
-
-public class Test {
-
- static URLClassLoader ldr1, ldr2;
- static {
- try {
- ldr1 = new URLClassLoader(new URL[] { new URL("file:cb1.jar") });
- ldr2 = new URLClassLoader(new URL[] { new URL("file:cb2.jar") });
- } catch (MalformedURLException ex) {
- throw new Error();
- }
- }
-
- public static void main(String[] args) throws Exception {
- Runnable a = (Runnable) Class.forName("B", true, ldr1).newInstance();
- a.run();
-
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oout = new ObjectOutputStream(bout);
- oout.writeObject(a);
- oout.close();
-
- ByteArrayInputStream bin =
- new ByteArrayInputStream(bout.toByteArray());
- ObjectInputStream oin = new MixedSuperclassStream(bin);
- a = (Runnable) oin.readObject();
- a.run();
- }
-}
--- a/jdk/test/java/io/Serializable/superclassDataLoss/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4325590
-# @summary Verify that superclass data is not lost when incoming superclass
-# descriptor is matched with local class that is not a superclass of
-# the deserialized instance's class.
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
-exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC="."
-fi
-
-set -ex
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}/A.java ${TESTSRC}/B.java
-${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf cb1.jar A.class B.class
-cp cb1.jar cb2.jar
-rm -f A.class B.class
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}/Test.java
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test
-rm -f *.class *.jar
--- a/jdk/test/java/io/Serializable/unnamedPackageSwitch/Test.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @bug 4348213
- * @summary Verify that deserialization allows an incoming class descriptor
- * representing a class in the unnamed package to be resolved to a
- * local class with the same name in a named package, and vice-versa.
- */
-
-import java.io.*;
-
-class A implements Serializable {
- private static final long serialVersionUID = 0L;
-}
-
-class TestObjectInputStream extends ObjectInputStream {
- TestObjectInputStream(InputStream in) throws IOException { super(in); }
- protected Class resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException
- {
- String name = desc.getName();
- if (name.equals("A")) {
- return pkg.A.class;
- } else if (name.equals("pkg.A")) {
- return A.class;
- } else {
- return super.resolveClass(desc);
- }
- }
-}
-
-public class Test {
- public static void main(String[] args) throws Exception {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oout = new ObjectOutputStream(bout);
- oout.writeObject(new A());
- oout.writeObject(new pkg.A());
- oout.close();
-
- ObjectInputStream oin = new TestObjectInputStream(
- new ByteArrayInputStream(bout.toByteArray()));
- oin.readObject();
- oin.readObject();
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/unnamedPackageSwitch/UnnamedPackageSwitchTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,76 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4348213
+ * @build UnnamedPackageSwitchTest pkg.A
+ * @run main UnnamedPackageSwitchTest
+ * @summary Verify that deserialization allows an incoming class descriptor
+ * representing a class in the unnamed package to be resolved to a
+ * local class with the same name in a named package, and vice-versa.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+
+class A implements Serializable {
+ private static final long serialVersionUID = 0L;
+}
+
+class TestObjectInputStream extends ObjectInputStream {
+ TestObjectInputStream(InputStream in) throws IOException { super(in); }
+ protected Class resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException
+ {
+ String name = desc.getName();
+ if (name.equals("A")) {
+ return pkg.A.class;
+ } else if (name.equals("pkg.A")) {
+ return A.class;
+ } else {
+ return super.resolveClass(desc);
+ }
+ }
+}
+
+public class UnnamedPackageSwitchTest {
+ public static void main(String[] args) throws Exception {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ ObjectOutputStream oout = new ObjectOutputStream(bout);
+ oout.writeObject(new A());
+ oout.writeObject(new pkg.A());
+ oout.close();
+
+ ObjectInputStream oin = new TestObjectInputStream(
+ new ByteArrayInputStream(bout.toByteArray()));
+ oin.readObject();
+ oin.readObject();
+ }
+}
--- a/jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4348213
-# @summary Verify that deserialization allows an incoming class descriptor
-# representing a class in the unnamed package to be resolved to a
-# local class with the same name in a named package, and vice-versa.
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
-exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ] ; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC="."
-fi
-
-set -ex
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}/A.java ${TESTSRC}/Test.java
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test
--- a/jdk/test/java/lang/Class/forName/modules/TestDriver.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Class/forName/modules/TestDriver.java Wed Jul 05 23:33:35 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
@@ -29,7 +29,7 @@
import java.util.Arrays;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import static jdk.testlibrary.ProcessTools.*;
import org.testng.annotations.BeforeClass;
@@ -40,9 +40,9 @@
* @test
* @bug 8087335
* @summary Tests for Class.forName(Module,String)
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler
- * @build TestDriver CompilerUtils jdk.testlibrary.ProcessTools jdk.testlibrary.FileUtils TestMain TestLayer
+ * @build TestDriver CompilerUtils jdk.testlibrary.ProcessTools TestMain TestLayer
* @run testng TestDriver
*/
--- a/jdk/test/java/lang/ClassLoader/Assert.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/ClassLoader/Assert.java Wed Jul 05 23:33:35 2017 +0200
@@ -28,7 +28,7 @@
* @run main/othervm Assert
* @summary Test the assertion facility
* @author Mike McCloskey
- * @key randomness intermittent
+ * @key randomness
*/
import package1.*;
--- a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main ParseHexFloatingPoint
* @bug 4826774 8078672
* @summary Numerical tests for hexadecimal inputs to parse{Double, Float} (use -Dseed=X to set PRNG seed)
@@ -32,7 +31,7 @@
* @key randomness
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class ParseHexFloatingPoint {
private ParseHexFloatingPoint(){}
--- a/jdk/test/java/lang/Integer/BitTwiddle.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Integer/BitTwiddle.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main BitTwiddle
* @bug 4495754 8078672
* @summary Basic test for int bit twiddling (use -Dseed=X to set PRNG seed)
@@ -33,7 +32,7 @@
*/
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import static java.lang.Integer.*;
public class BitTwiddle {
--- a/jdk/test/java/lang/Long/BitTwiddle.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Long/BitTwiddle.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main BitTwiddle
* @bug 4495754 8078672
* @summary Basic test for long bit twiddling (use -Dseed=X to set PRNG seed)
@@ -33,7 +32,7 @@
*/
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import static java.lang.Long.*;
public class BitTwiddle {
--- a/jdk/test/java/lang/Math/CubeRootTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Math/CubeRootTests.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run main CubeRootTests
* @bug 4347132 4939441 8078672
* @summary Tests for {Math, StrictMath}.cbrt (use -Dseed=X to set PRNG seed)
@@ -32,7 +31,7 @@
* @key randomness
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class CubeRootTests {
private CubeRootTests(){}
--- a/jdk/test/java/lang/Math/HypotTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Math/HypotTests.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run main HypotTests
* @bug 4851638 4939441 8078672
* @summary Tests for {Math, StrictMath}.hypot (use -Dseed=X to set PRNG seed)
@@ -32,7 +31,7 @@
* @key randomness
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class HypotTests {
private HypotTests(){}
--- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run main IeeeRecommendedTests
* @bug 4860891 4826732 4780454 4939441 4826652 8078672
* @summary Tests for IEEE 754[R] recommended functions and similar methods (use -Dseed=X to set PRNG seed)
@@ -32,7 +31,7 @@
* @key randomness
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class IeeeRecommendedTests {
private IeeeRecommendedTests(){}
--- a/jdk/test/java/lang/Math/Log1pTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Math/Log1pTests.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run main Log1pTests
* @bug 4851638 4939441 8078672
* @summary Tests for {Math, StrictMath}.log1p (use -Dseed=X to set PRNG seed)
@@ -32,7 +31,7 @@
* @key randomness
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class Log1pTests {
private Log1pTests(){}
--- a/jdk/test/java/lang/Math/MultiplicationTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/Math/MultiplicationTests.java Wed Jul 05 23:33:35 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,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main MultiplicationTests
* @bug 5100935
* @summary Tests for multiplication methods (use -Dseed=X to set PRNG seed)
@@ -32,7 +31,7 @@
*/
import java.math.BigInteger;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class MultiplicationTests {
private MultiplicationTests(){}
--- a/jdk/test/java/lang/StackWalker/StackWalkTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/StackWalker/StackWalkTest.java Wed Jul 05 23:33:35 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
@@ -31,14 +31,13 @@
import java.util.Set;
import java.util.TreeSet;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* @test
* @bug 8140450
* @summary Stack Walk Test (use -Dseed=X to set PRNG seed)
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @compile StackRecorderUtil.java
* @run main/othervm StackWalkTest
* @run main/othervm/java.security.policy=stackwalktest.policy StackWalkTest
--- a/jdk/test/java/lang/StrictMath/CubeRootTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/StrictMath/CubeRootTests.java Wed Jul 05 23:33:35 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
@@ -25,8 +25,7 @@
* @test
* @bug 4347132 8136799
* @key randomness
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @build Tests
* @build FdlibmTranslit
* @build CubeRootTests
@@ -35,7 +34,7 @@
* @author Joseph D. Darcy
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/CubeRootTests.java test properties that should
--- a/jdk/test/java/lang/StrictMath/ExpTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/StrictMath/ExpTests.java Wed Jul 05 23:33:35 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,8 +25,7 @@
* @test
* @bug 8139688
* @key randomness
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @build Tests
* @build FdlibmTranslit
* @build ExpTests
@@ -34,7 +33,7 @@
* @summary Tests specifically for StrictMath.exp
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* The role of this test is to verify that the FDLIBM exp algorithm is
--- a/jdk/test/java/lang/StrictMath/HypotTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/StrictMath/HypotTests.java Wed Jul 05 23:33:35 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
@@ -26,8 +26,7 @@
* @bug 4851638
* @key randomness
* @summary Tests for StrictMath.hypot
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @build Tests
* @build FdlibmTranslit
* @build HypotTests
@@ -35,7 +34,7 @@
* @author Joseph D. Darcy
*/
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/HypotTests.java test properties that should
--- a/jdk/test/java/lang/String/LiteralReplace.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/String/LiteralReplace.java Wed Jul 05 23:33:35 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,8 +23,7 @@
/* @test
* @bug 8058779 8054307
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run testng LiteralReplace
* @summary Basic tests of String.replace(CharSequence, CharSequence)
* @key randomness
@@ -37,7 +36,7 @@
import java.util.regex.Pattern;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
--- a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java Wed Jul 05 23:33:35 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
@@ -21,7 +21,9 @@
* questions.
*/
-import com.oracle.testlibrary.jsr292.Helper;
+import sun.invoke.util.Wrapper;
+import test.java.lang.invoke.lib.Helper;
+
import java.io.File;
import java.io.Serializable;
import java.lang.invoke.MethodHandle;
@@ -31,13 +33,12 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
-import sun.invoke.util.Wrapper;
/*
* @test
* @bug 8060483 8066746
* @key randomness
- * @library /lib/testlibrary /lib/testlibrary/jsr292
+ * @library /lib/testlibrary /java/lang/invoke/common
* @modules java.base/sun.invoke.util
* @summary unit tests for MethodHandles.explicitCastArguments()
* @run main ExplicitCastArgumentsTest
@@ -249,21 +250,27 @@
for (Class parent : parents) {
for (int j = 0; j < children.length; j++) {
// Child type to parent type non-null conversion, shoud succeed
- testConversion(mode, children[j], parent, childInst[j], childInst[j], false, null);
+ testConversion(mode, children[j], parent, childInst[j],
+ childInst[j], false, null);
// Child type to parent type null conversion, shoud succeed
- testConversion(mode, children[j], parent, null, null, false, null);
+ testConversion(mode, children[j], parent, null,
+ null, false, null);
// Parent type to child type non-null conversion with parent
// type instance, should fail
- testConversion(mode, parent, children[j], testSuperObj, null, true, ClassCastException.class);
+ testConversion(mode, parent, children[j], testSuperObj,
+ null, true, ClassCastException.class);
// Parent type to child type non-null conversion with child
// type instance, should succeed
- testConversion(mode, parent, children[j], childInst[j], childInst[j], false, null);
+ testConversion(mode, parent, children[j], childInst[j],
+ childInst[j], false, null);
// Parent type to child type null conversion, should succeed
- testConversion(mode, parent, children[j], null, null, false, null);
+ testConversion(mode, parent, children[j], null,
+ null, false, null);
}
// Parent type to child type non-null conversion with sibling
// type instance, should fail
- testConversion(mode, parent, testSubClass1, testObj02, null, true, ClassCastException.class);
+ testConversion(mode, parent, testSubClass1, testObj02,
+ null, true, ClassCastException.class);
}
// Sibling type non-null conversion, should fail
testConversion(mode, testSubClass1,
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Wed Jul 05 23:33:35 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
@@ -28,11 +28,15 @@
* @ignore 8078602
* @summary Test verifies that lambda forms are garbage collected
* @author kshefov
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @build TestMethods
* @build LambdaFormTestCase
* @build LFGarbageCollectedTest
- * @run main/othervm -Xmx64m -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+HeapDumpOnOutOfMemoryError -DHEAP_DUMP=false LFGarbageCollectedTest
+ * @run main/othervm -Xmx64m
+ * -XX:SoftRefLRUPolicyMSPerMB=0
+ * -XX:+HeapDumpOnOutOfMemoryError
+ * -DHEAP_DUMP=false
+ * LFGarbageCollectedTest
*/
import java.lang.invoke.MethodHandle;
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -27,7 +27,7 @@
* @key randomness
* @summary Test verifies that lambda forms are cached when run with multiple threads
* @author kshefov
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @modules java.base/java.lang.invoke:open
* java.base/java.lang.ref:open
* java.management
@@ -38,16 +38,16 @@
* @run main/othervm LFMultiThreadCachingTest
*/
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
+
import java.lang.invoke.MethodHandle;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
/**
* Multiple threaded lambda forms caching test class.
@@ -57,13 +57,16 @@
private static final TestMethods.Kind[] KINDS;
static {
- EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
+ EnumSet<TestMethods.Kind> set
+ = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
KINDS = set.toArray(new TestMethods.Kind[set.size()]);
if (KINDS.length < 2) {
- throw new Error("TESTBUG: KINDS.length[" + KINDS.length + "] should be at least 2");
+ throw new Error("TESTBUG: KINDS.length[" + KINDS.length
+ + "] should be at least 2");
}
}
- private static final int CORES = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
+ private static final int CORES
+ = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
/**
* Constructor a for multiple threaded lambda forms caching test case.
@@ -144,6 +147,7 @@
* @param args Accepts no arguments.
*/
public static void main(String[] args) {
- LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
+ LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new,
+ EnumSet.allOf(TestMethods.class));
}
}
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -27,7 +27,7 @@
* @key randomness
* @summary Test verifies that lambda forms are cached when run with single thread
* @author kshefov
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @modules java.base/java.lang.ref:open
* java.base/java.lang.invoke:open
* java.management
@@ -77,6 +77,7 @@
* @param args Accepts no arguments.
*/
public static void main(String[] args) {
- LambdaFormTestCase.runTests(LFSingleThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
+ LambdaFormTestCase.runTests(LFSingleThreadCachingTest::new,
+ EnumSet.allOf(TestMethods.class));
}
}
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Wed Jul 05 23:33:35 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
@@ -21,8 +21,11 @@
* questions.
*/
-import com.oracle.testlibrary.jsr292.Helper;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
+import jdk.testlibrary.TimeLimitedRunner;
+import jdk.testlibrary.Utils;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
+import test.java.lang.invoke.lib.Helper;
+
import java.lang.invoke.MethodHandle;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
@@ -32,8 +35,6 @@
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
-import jdk.testlibrary.Utils;
-import jdk.testlibrary.TimeLimitedRunner;
/**
* Lambda forms caching test case class. Contains all necessary test routines to
@@ -44,7 +45,8 @@
*/
public abstract class LambdaFormTestCase {
- private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
+ private static final long TIMEOUT = Helper.IS_THOROUGH ?
+ 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
/**
* Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
@@ -92,7 +94,8 @@
long failCounter;
boolean passed;
- TestRun(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
+ TestRun(Function<TestMethods, LambdaFormTestCase> ctor,
+ Collection<TestMethods> testMethods) {
this.ctor = ctor;
this.testMethods = testMethods;
long testCaseNum = testMethods.size();
@@ -175,10 +178,12 @@
* object.
* @param testMethods list of test methods
*/
- public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
+ public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor,
+ Collection<TestMethods> testMethods) {
LambdaFormTestCase.TestRun run
= new LambdaFormTestCase.TestRun(ctor, testMethods);
- TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration);
+ TimeLimitedRunner runner
+ = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration);
try {
runner.call();
} catch (Exception ex) {
--- a/jdk/test/java/lang/invoke/LFCaching/TestMethods.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/LFCaching/TestMethods.java Wed Jul 05 23:33:35 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
@@ -21,7 +21,8 @@
* questions.
*/
-import com.oracle.testlibrary.jsr292.Helper;
+import test.java.lang.invoke.lib.Helper;
+
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -41,462 +42,472 @@
public enum TestMethods {
FOLD_ARGUMENTS("foldArguments") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- Class<?> combinerReturnType;
- if (realArity == 0) {
- combinerReturnType = void.class;
- } else {
- combinerReturnType = Helper.RNG.nextBoolean() ? void.class : mtTarget.parameterType(0);
- }
- data.put("combinerReturnType", combinerReturnType);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ Class<?> combinerReturnType;
+ if (realArity == 0) {
+ combinerReturnType = void.class;
+ } else {
+ combinerReturnType = Helper.RNG.nextBoolean() ?
+ void.class : mtTarget.parameterType(0);
+ }
+ data.put("combinerReturnType", combinerReturnType);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class<?> combinerReturnType = (Class) data.get("combinerReturnType");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- Class<?> rType = mtTarget.returnType();
- int combListStart = (combinerReturnType == void.class) ? 0 : 1;
- if (modifierMHArgNum < combListStart) {
- modifierMHArgNum = combListStart;
- }
- MethodHandle combiner = TestMethods.methodHandleGenerator(combinerReturnType,
- mtTarget.parameterList().subList(combListStart,
- modifierMHArgNum), kind);
- return MethodHandles.foldArguments(target, combiner);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class<?> combinerReturnType = (Class) data.get("combinerReturnType");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ Class<?> rType = mtTarget.returnType();
+ int combListStart = (combinerReturnType == void.class) ? 0 : 1;
+ if (modifierMHArgNum < combListStart) {
+ modifierMHArgNum = combListStart;
+ }
+ MethodHandle combiner = TestMethods.methodHandleGenerator(combinerReturnType,
+ mtTarget.parameterList().subList(combListStart,
+ modifierMHArgNum), kind);
+ return MethodHandles.foldArguments(target, combiner);
+ }
+ },
DROP_ARGUMENTS("dropArguments") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int dropArgsPos = Helper.RNG.nextInt(realArity + 1);
- data.put("dropArgsPos", dropArgsPos);
- MethodType mtDropArgs = TestMethods.randomMethodTypeGenerator(
- Helper.RNG.nextInt(super.maxArity - realArity));
- data.put("mtDropArgs", mtDropArgs);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int dropArgsPos = Helper.RNG.nextInt(realArity + 1);
+ data.put("dropArgsPos", dropArgsPos);
+ MethodType mtDropArgs = TestMethods.randomMethodTypeGenerator(
+ Helper.RNG.nextInt(super.maxArity - realArity));
+ data.put("mtDropArgs", mtDropArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtDropArgs = (MethodType) data.get("mtDropArgs");
- int dropArgsPos = (int) data.get("dropArgsPos");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- int mtTgtSlotsCount = TestMethods.argSlotsCount(mtTarget);
- int mtDASlotsCount = TestMethods.argSlotsCount(mtDropArgs);
- List<Class<?>> fakeParList;
- if (mtTgtSlotsCount + mtDASlotsCount > super.maxArity - 1) {
- fakeParList = TestMethods.reduceArgListToSlotsCount(mtDropArgs.parameterList(),
- super.maxArity - mtTgtSlotsCount - 1);
- } else {
- fakeParList = mtDropArgs.parameterList();
- }
- return MethodHandles.dropArguments(target, dropArgsPos, fakeParList);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtDropArgs = (MethodType) data.get("mtDropArgs");
+ int dropArgsPos = (int) data.get("dropArgsPos");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ int mtTgtSlotsCount = TestMethods.argSlotsCount(mtTarget);
+ int mtDASlotsCount = TestMethods.argSlotsCount(mtDropArgs);
+ List<Class<?>> fakeParList;
+ if (mtTgtSlotsCount + mtDASlotsCount > super.maxArity - 1) {
+ fakeParList = TestMethods.reduceArgListToSlotsCount(mtDropArgs.parameterList(),
+ super.maxArity - mtTgtSlotsCount - 1);
+ } else {
+ fakeParList = mtDropArgs.parameterList();
+ }
+ return MethodHandles.dropArguments(target, dropArgsPos, fakeParList);
+ }
+ },
EXPLICIT_CAST_ARGUMENTS("explicitCastArguments", Helper.MAX_ARITY / 2) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- MethodType mtExcplCastArgs = TestMethods.randomMethodTypeGenerator(realArity);
- if (mtTarget.returnType() == void.class) {
- mtExcplCastArgs = MethodType.methodType(void.class,
- mtExcplCastArgs.parameterArray());
- }
- if (mtExcplCastArgs.returnType() == void.class) {
- mtExcplCastArgs = MethodType.methodType(mtTarget.returnType(),
- mtExcplCastArgs.parameterArray());
- }
- data.put("mtExcplCastArgs", mtExcplCastArgs);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ MethodType mtExcplCastArgs = TestMethods.randomMethodTypeGenerator(realArity);
+ if (mtTarget.returnType() == void.class) {
+ mtExcplCastArgs = MethodType.methodType(void.class,
+ mtExcplCastArgs.parameterArray());
+ }
+ if (mtExcplCastArgs.returnType() == void.class) {
+ mtExcplCastArgs = MethodType.methodType(mtTarget.returnType(),
+ mtExcplCastArgs.parameterArray());
+ }
+ data.put("mtExcplCastArgs", mtExcplCastArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtExcplCastArgs = (MethodType) data.get("mtExcplCastArgs");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- return MethodHandles.explicitCastArguments(target, mtExcplCastArgs);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtExcplCastArgs = (MethodType) data.get("mtExcplCastArgs");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ return MethodHandles.explicitCastArguments(target, mtExcplCastArgs);
+ }
+ },
FILTER_ARGUMENTS("filterArguments", Helper.MAX_ARITY / 2) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
- data.put("filterArgsPos", filterArgsPos);
- int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
- data.put("filtersArgsArrayLength", filtersArgsArrayLength);
- MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
- data.put("mtFilter", mtFilter);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
+ data.put("filterArgsPos", filterArgsPos);
+ int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
+ data.put("filtersArgsArrayLength", filtersArgsArrayLength);
+ MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
+ data.put("mtFilter", mtFilter);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtFilter = (MethodType) data.get("mtFilter");
- int filterArgsPos = (int) data.get("filterArgsPos");
- int filtersArgsArrayLength = (int) data.get("filtersArgsArrayLength");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- MethodHandle[] filters = new MethodHandle[filtersArgsArrayLength];
- for (int i = 0; i < filtersArgsArrayLength; i++) {
- filters[i] = TestMethods.filterGenerator(mtFilter.parameterType(i),
- mtTarget.parameterType(filterArgsPos + i), kind);
- }
- return MethodHandles.filterArguments(target, filterArgsPos, filters);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtFilter = (MethodType) data.get("mtFilter");
+ int filterArgsPos = (int) data.get("filterArgsPos");
+ int filtersArgsArrayLength = (int) data.get("filtersArgsArrayLength");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ MethodHandle[] filters = new MethodHandle[filtersArgsArrayLength];
+ for (int i = 0; i < filtersArgsArrayLength; i++) {
+ filters[i] = TestMethods.filterGenerator(mtFilter.parameterType(i),
+ mtTarget.parameterType(filterArgsPos + i), kind);
+ }
+ return MethodHandles.filterArguments(target, filterArgsPos, filters);
+ }
+ },
FILTER_RETURN_VALUE("filterReturnValue") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
- int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
- MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
- data.put("mtFilter", mtFilter);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
+ int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
+ MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
+ data.put("mtFilter", mtFilter);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtFilter = (MethodType) data.get("mtFilter");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- MethodHandle filter = TestMethods.filterGenerator(mtTarget.returnType(),
- mtFilter.returnType(), kind);
- return MethodHandles.filterReturnValue(target, filter);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtFilter = (MethodType) data.get("mtFilter");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ MethodHandle filter = TestMethods.filterGenerator(mtTarget.returnType(),
+ mtFilter.returnType(), kind);
+ return MethodHandles.filterReturnValue(target, filter);
+ }
+ },
INSERT_ARGUMENTS("insertArguments", Helper.MAX_ARITY - 3) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int insertArgsPos = Helper.RNG.nextInt(realArity + 1);
- data.put("insertArgsPos", insertArgsPos);
- int insertArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - insertArgsPos);
- MethodType mtInsertArgs = MethodType.methodType(void.class, mtTarget.parameterList()
- .subList(insertArgsPos, insertArgsPos + insertArgsArrayLength));
- data.put("mtInsertArgs", mtInsertArgs);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int insertArgsPos = Helper.RNG.nextInt(realArity + 1);
+ data.put("insertArgsPos", insertArgsPos);
+ int insertArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - insertArgsPos);
+ MethodType mtInsertArgs = MethodType.methodType(void.class, mtTarget.parameterList()
+ .subList(insertArgsPos, insertArgsPos + insertArgsArrayLength));
+ data.put("mtInsertArgs", mtInsertArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtInsertArgs = (MethodType) data.get("mtInsertArgs");
- int insertArgsPos = (int) data.get("insertArgsPos");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- Object[] insertList = Helper.randomArgs(mtInsertArgs.parameterList());
- return MethodHandles.insertArguments(target, insertArgsPos, insertList);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtInsertArgs = (MethodType) data.get("mtInsertArgs");
+ int insertArgsPos = (int) data.get("insertArgsPos");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ Object[] insertList = Helper.randomArgs(mtInsertArgs.parameterList());
+ return MethodHandles.insertArguments(target, insertArgsPos, insertList);
+ }
+ },
PERMUTE_ARGUMENTS("permuteArguments", Helper.MAX_ARITY / 2) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int[] permuteArgsReorderArray = new int[realArity];
- int mtPermuteArgsNum = Helper.RNG.nextInt(Helper.MAX_ARITY);
- mtPermuteArgsNum = mtPermuteArgsNum == 0 ? 1 : mtPermuteArgsNum;
- MethodType mtPermuteArgs = TestMethods.randomMethodTypeGenerator(mtPermuteArgsNum);
- mtTarget = mtTarget.changeReturnType(mtPermuteArgs.returnType());
- for (int i = 0; i < realArity; i++) {
- int mtPermuteArgsParNum = Helper.RNG.nextInt(mtPermuteArgs.parameterCount());
- permuteArgsReorderArray[i] = mtPermuteArgsParNum;
- mtTarget = mtTarget.changeParameterType(
- i, mtPermuteArgs.parameterType(mtPermuteArgsParNum));
- }
- data.put("mtTarget", mtTarget);
- data.put("permuteArgsReorderArray", permuteArgsReorderArray);
- data.put("mtPermuteArgs", mtPermuteArgs);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int[] permuteArgsReorderArray = new int[realArity];
+ int mtPermuteArgsNum = Helper.RNG.nextInt(Helper.MAX_ARITY);
+ mtPermuteArgsNum = mtPermuteArgsNum == 0 ? 1 : mtPermuteArgsNum;
+ MethodType mtPermuteArgs = TestMethods.randomMethodTypeGenerator(mtPermuteArgsNum);
+ mtTarget = mtTarget.changeReturnType(mtPermuteArgs.returnType());
+ for (int i = 0; i < realArity; i++) {
+ int mtPermuteArgsParNum = Helper.RNG.nextInt(mtPermuteArgs.parameterCount());
+ permuteArgsReorderArray[i] = mtPermuteArgsParNum;
+ mtTarget = mtTarget.changeParameterType(
+ i, mtPermuteArgs.parameterType(mtPermuteArgsParNum));
+ }
+ data.put("mtTarget", mtTarget);
+ data.put("permuteArgsReorderArray", permuteArgsReorderArray);
+ data.put("mtPermuteArgs", mtPermuteArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtPermuteArgs = (MethodType) data.get("mtPermuteArgs");
- int[] permuteArgsReorderArray = (int[]) data.get("permuteArgsReorderArray");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- return MethodHandles.permuteArguments(target, mtPermuteArgs, permuteArgsReorderArray);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtPermuteArgs = (MethodType) data.get("mtPermuteArgs");
+ int[] permuteArgsReorderArray = (int[]) data.get("permuteArgsReorderArray");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ return MethodHandles.permuteArguments(target, mtPermuteArgs, permuteArgsReorderArray);
+ }
+ },
THROW_EXCEPTION("throwException") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class<?> rType = mtTarget.returnType();
- return MethodHandles.throwException(rType, Exception.class
- );
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class<?> rType = mtTarget.returnType();
+ return MethodHandles.throwException(rType, Exception.class
+ );
+ }
+ },
GUARD_WITH_TEST("guardWithTest") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- TestMethods.Kind targetKind;
- TestMethods.Kind fallbackKind;
- if (kind.equals(TestMethods.Kind.ONE)) {
- targetKind = TestMethods.Kind.ONE;
- fallbackKind = TestMethods.Kind.TWO;
- } else {
- targetKind = TestMethods.Kind.TWO;
- fallbackKind = TestMethods.Kind.ONE;
- }
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), targetKind);
- MethodHandle fallback = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), fallbackKind);
- MethodHandle test = TestMethods.methodHandleGenerator(boolean.class,
- mtTarget.parameterList().subList(0, modifierMHArgNum), kind);
- return MethodHandles.guardWithTest(test, target, fallback);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ TestMethods.Kind targetKind;
+ TestMethods.Kind fallbackKind;
+ if (kind.equals(TestMethods.Kind.ONE)) {
+ targetKind = TestMethods.Kind.ONE;
+ fallbackKind = TestMethods.Kind.TWO;
+ } else {
+ targetKind = TestMethods.Kind.TWO;
+ fallbackKind = TestMethods.Kind.ONE;
+ }
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), targetKind);
+ MethodHandle fallback = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), fallbackKind);
+ MethodHandle test = TestMethods.methodHandleGenerator(boolean.class,
+ mtTarget.parameterList().subList(0, modifierMHArgNum), kind);
+ return MethodHandles.guardWithTest(test, target, fallback);
+ }
+ },
CATCH_EXCEPTION("catchException") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- MethodHandle target;
- if (kind.equals(TestMethods.Kind.ONE)) {
- target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), TestMethods.Kind.ONE);
- } else {
- target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), TestMethods.Kind.EXCEPT);
- }
- List<Class<?>> handlerParamList = new ArrayList<>(mtTarget.parameterCount() + 1);
- handlerParamList.add(Exception.class);
- handlerParamList.addAll(mtTarget.parameterList().subList(0, modifierMHArgNum));
- MethodHandle handler = TestMethods.methodHandleGenerator(
- mtTarget.returnType(), handlerParamList, TestMethods.Kind.TWO);
- return MethodHandles.catchException(target, Exception.class, handler);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ MethodHandle target;
+ if (kind.equals(TestMethods.Kind.ONE)) {
+ target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), TestMethods.Kind.ONE);
+ } else {
+ target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), TestMethods.Kind.EXCEPT);
+ }
+ List<Class<?>> handlerParamList = new ArrayList<>(mtTarget.parameterCount() + 1);
+ handlerParamList.add(Exception.class);
+ handlerParamList.addAll(mtTarget.parameterList().subList(0, modifierMHArgNum));
+ MethodHandle handler = TestMethods.methodHandleGenerator(
+ mtTarget.returnType(), handlerParamList, TestMethods.Kind.TWO);
+ return MethodHandles.catchException(target, Exception.class, handler);
+ }
+ },
INVOKER("invoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- return MethodHandles.invoker(mtTarget);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ return MethodHandles.invoker(mtTarget);
+ }
+ },
EXACT_INVOKER("exactInvoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- return MethodHandles.exactInvoker(mtTarget);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ return MethodHandles.exactInvoker(mtTarget);
+ }
+ },
SPREAD_INVOKER("spreadInvoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- return MethodHandles.spreadInvoker(mtTarget, modifierMHArgNum);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ return MethodHandles.spreadInvoker(mtTarget, modifierMHArgNum);
+ }
+ },
ARRAY_ELEMENT_GETTER("arrayElementGetter") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class<?> rType = mtTarget.returnType();
- if (rType == void.class) {
- rType = Object.class;
- }
- return MethodHandles.arrayElementGetter(Array.newInstance(rType, 2).getClass());
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class<?> rType = mtTarget.returnType();
+ if (rType == void.class) {
+ rType = Object.class;
+ }
+ return MethodHandles.arrayElementGetter(Array.newInstance(rType, 2).getClass());
+ }
+ },
ARRAY_ELEMENT_SETTER("arrayElementSetter") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class<?> rType = mtTarget.returnType();
- if (rType == void.class) {
- rType = Object.class;
- }
- return MethodHandles.arrayElementSetter(Array.newInstance(rType, 2).getClass());
- }
- },
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class<?> rType = mtTarget.returnType();
+ if (rType == void.class) {
+ rType = Object.class;
+ }
+ return MethodHandles.arrayElementSetter(Array.newInstance(rType, 2).getClass());
+ }
+ },
CONSTANT("constant") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class<?> rType = mtTarget.returnType();
- if (rType == void.class) {
- rType = Object.class;
- }
- if (rType.equals(boolean.class)) {
- // There should be the same return values because for default values there are special "zero" forms
- return MethodHandles.constant(rType, true);
- } else {
- return MethodHandles.constant(rType, kind.getValue(rType));
- }
- }
- },
- IDENTITY("identity") {
- @Override
- public Map<String, Object> getTestCaseData() {
- Map<String, Object> data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class<?> rType = mtTarget.returnType();
+ if (rType == void.class) {
+ rType = Object.class;
+ }
+ if (rType.equals(boolean.class)) {
+ // There should be the same return values because for default values there are special "zero" forms
+ return MethodHandles.constant(rType, true);
+ } else {
+ return MethodHandles.constant(rType, kind.getValue(rType));
+ }
+ }
+ },
+IDENTITY("identity") {
+ @Override
+ public Map<String, Object> getTestCaseData() {
+ Map<String, Object> data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class<?> rType = mtTarget.returnType();
- if (rType == void.class) {
- rType = Object.class;
- }
- return MethodHandles.identity(rType);
- }
- };
+ @Override
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class<?> rType = mtTarget.returnType();
+ if (rType == void.class) {
+ rType = Object.class;
+ }
+ return MethodHandles.identity(rType);
+ }
+ };
/**
* Test method's name.
@@ -514,8 +525,10 @@
this(name, Helper.MAX_ARITY);
}
- protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- throw new UnsupportedOperationException("TESTBUG: getMH method is not implemented for test method " + this);
+ protected MethodHandle getMH(Map<String, Object> data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ throw new UnsupportedOperationException(
+ "TESTBUG: getMH method is not implemented for test method " + this);
}
/**
@@ -575,13 +588,15 @@
return Helper.castToWrapper(value, cl);
}
- private MethodHandle getBasicMH(Class<?> rType) throws NoSuchMethodException, IllegalAccessException {
+ private MethodHandle getBasicMH(Class<?> rType)
+ throws NoSuchMethodException, IllegalAccessException {
MethodHandle result = null;
switch (this) {
case ONE:
case TWO:
if (rType.equals(void.class)) {
- result = MethodHandles.lookup().findVirtual(Kind.class, "returnVoid", MethodType.methodType(void.class));
+ result = MethodHandles.lookup().findVirtual(Kind.class,
+ "returnVoid", MethodType.methodType(void.class));
result = MethodHandles.insertArguments(result, 0, this);
} else {
result = MethodHandles.constant(rType, getValue(rType));
--- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Wed Jul 05 23:33:35 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
@@ -20,25 +20,30 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
package test.java.lang.invoke.MethodHandles;
-import com.oracle.testlibrary.jsr292.Helper;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
import jdk.testlibrary.Asserts;
import jdk.testlibrary.TimeLimitedRunner;
import jdk.testlibrary.Utils;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
+import test.java.lang.invoke.lib.Helper;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Array;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
/* @test
- * @library /lib/testlibrary/jsr292 /lib/testlibrary/
+ * @library /lib/testlibrary /java/lang/invoke/common
* @compile CatchExceptionTest.java
* @run main/othervm -esa test.java.lang.invoke.MethodHandles.CatchExceptionTest
* @key intermittent randomness
@@ -68,8 +73,8 @@
private int dropped;
private MethodHandle thrower;
- public CatchExceptionTest(TestCase testCase, final boolean isVararg, final int argsCount,
- final int catchDrops) {
+ public CatchExceptionTest(TestCase testCase, final boolean isVararg,
+ final int argsCount, final int catchDrops) {
this.testCase = testCase;
this.dropped = catchDrops;
MethodHandle thrower = testCase.thrower;
@@ -353,8 +358,8 @@
new ClassCastException("testing"),
new java.io.IOException("testing"),
new LinkageError("testing")};
- List<Supplier<TestCase>> list = new ArrayList<>(constructors.length *
- throwables.length * ThrowMode.values().length);
+ List<Supplier<TestCase>> list = new ArrayList<>(constructors.length
+ * throwables.length * ThrowMode.values().length);
//noinspection unchecked
for (PartialConstructor f : constructors) {
for (ThrowMode mode : ThrowMode.values()) {
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java Wed Jul 05 23:33:35 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
@@ -23,23 +23,46 @@
/* @test
* @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /lib/testlibrary/jsr292
+ * @library /lib/testlibrary /java/lang/invoke/common
* @compile MethodHandlesTest.java remote/RemoteExample.java
- * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -esa test.java.lang.invoke.MethodHandlesTest
+ * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
+ * -XX:-VerifyDependencies
+ * -esa
+ * test.java.lang.invoke.MethodHandlesTest
*/
package test.java.lang.invoke;
+import org.junit.*;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
import test.java.lang.invoke.remote.RemoteExample;
-import java.lang.invoke.*;
-import static java.lang.invoke.MethodType.methodType;
+
+import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandleProxies;
+import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
-import java.lang.reflect.*;
-import java.util.*;
-import org.junit.*;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.MutableCallSite;
+import java.lang.invoke.WrongMethodTypeException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static java.lang.invoke.MethodType.methodType;
import static org.junit.Assert.*;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
-
/**
*
--- a/jdk/test/java/lang/invoke/PermuteArgsTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/PermuteArgsTest.java Wed Jul 05 23:33:35 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
@@ -23,9 +23,10 @@
/* @test
* @summary unit tests for method handles which permute their arguments
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
*/
+
/* Examples of manual runs:
* java -DPermuteArgsTest.{DRY_RUN=true,MAX_ARITY=253} test.java.lang.invoke.PermuteArgsTest
* java -DPermuteArgsTest.{VERBOSE=true,MAX_ARITY=5} test.java.lang.invoke.PermuteArgsTest
@@ -34,17 +35,23 @@
package test.java.lang.invoke;
-import org.testng.*;
-import org.testng.annotations.*;
-
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
+import org.testng.annotations.Test;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
-import java.util.*;
-import java.lang.reflect.*;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.WrongMethodTypeException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
-import java.lang.invoke.*;
-import static java.lang.invoke.MethodHandles.*;
-import static java.lang.invoke.MethodType.*;
+import static java.lang.invoke.MethodHandles.Lookup;
+import static java.lang.invoke.MethodHandles.lookup;
+import static java.lang.invoke.MethodHandles.permuteArguments;
+import static java.lang.invoke.MethodType.methodType;
public class PermuteArgsTest {
private static final Class<?> CLASS = PermuteArgsTest.class;
@@ -205,7 +212,8 @@
throw new IllegalArgumentException("cannot convert to type "+mt1+" from "+mh, ex);
}
}
- static MethodHandle findTestMH(String name, int[] perm) throws ReflectiveOperationException {
+ static MethodHandle findTestMH(String name, int[] perm)
+ throws ReflectiveOperationException {
int arity = perm.length;
Lookup lookup = lookup();
for (Method m : lookup.lookupClass().getDeclaredMethods()) {
@@ -259,7 +267,8 @@
}
}
- static void testPermutations(MethodHandle mh, int[] perm, int start, int end, Set<String> done) throws Throwable {
+ static void testPermutations(MethodHandle mh, int[] perm, int start, int end,
+ Set<String> done) throws Throwable {
if (end - start <= 1) return;
for (int j = 0; j <= 1; j++) {
testRotations(mh, perm, start, end, done);
@@ -283,7 +292,8 @@
}
}
- static void testRotations(MethodHandle mh, int[] perm, int start, int end, Set<String> done) throws Throwable {
+ static void testRotations(MethodHandle mh, int[] perm, int start, int end,
+ Set<String> done) throws Throwable {
Object[] args = junkArgs(mh.type().parameterArray());
for (int i = start; i < end; i++) {
if (done.add(Arrays.toString(perm)))
@@ -292,9 +302,11 @@
}
}
- static void testOnePermutation(MethodHandle mh, int[] perm, Object[] args) throws Throwable {
+ static void testOnePermutation(MethodHandle mh, int[] perm, Object[] args)
+ throws Throwable {
MethodType mt = mh.type();
- MethodType pmt = methodType(mt.returnType(), unpermuteArgs(perm, mt.parameterArray(), Class[].class));
+ MethodType pmt = methodType(mt.returnType(),
+ unpermuteArgs(perm, mt.parameterArray(), Class[].class));
if (VERBOSE)
System.out.println(Arrays.toString(perm));
testCases += 1;
--- a/jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Wed Jul 05 23:33:35 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
@@ -24,14 +24,18 @@
/*
* @test
* @bug 8019184
- * @library /lib/testlibrary /lib/testlibrary/jsr292
+ * @library /lib/testlibrary /java/lang/invoke/common
* @summary MethodHandles.catchException() fails when methods have 8 args + varargs
* @run main TestCatchExceptionWithVarargs
*/
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
-import java.util.*;
-import java.lang.invoke.*;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.LinkedList;
+import java.util.List;
public class TestCatchExceptionWithVarargs {
@@ -48,14 +52,16 @@
public static Object target(Object... a) throws Exception {
if (a[0] != firstArg) {
- throw new AssertionError("first argument different than expected: " + a[0] + " != " + firstArg);
+ throw new AssertionError("first argument different than expected: "
+ + a[0] + " != " + firstArg);
}
throw new MyException();
}
public static Object handler(Object... a) {
if (a[0] != firstArg) {
- throw new AssertionError("first argument different than expected: " + a[0] + " != " + firstArg);
+ throw new AssertionError("first argument different than expected: "
+ + a[0] + " != " + firstArg);
}
return a[0];
}
@@ -83,20 +89,27 @@
for (int i = 1; i < MAX_MH_ARITY - 1; i++) {
ptypes.add(0, Object.class);
- MethodHandle targetWithArgs = target.asType(MethodType.methodType(Object.class, ptypes));
- MethodHandle handlerWithArgs = handler.asType(MethodType.methodType(Object.class, ptypes));
- handlerWithArgs = MethodHandles.dropArguments(handlerWithArgs, 0, MyException.class);
+ MethodHandle targetWithArgs = target.asType(
+ MethodType.methodType(Object.class, ptypes));
+ MethodHandle handlerWithArgs = handler.asType(
+ MethodType.methodType(Object.class, ptypes));
+ handlerWithArgs = MethodHandles.dropArguments(
+ handlerWithArgs, 0, MyException.class);
- MethodHandle gwc1 = MethodHandles.catchException(targetWithArgs, MyException.class, handlerWithArgs);
+ MethodHandle gwc1 = MethodHandles.catchException(
+ targetWithArgs, MyException.class, handlerWithArgs);
// The next line throws an IllegalArgumentException if there is a bug.
- MethodHandle gwc2 = MethodHandles.catchException(gwc1, MyException.class, handlerWithArgs);
+ MethodHandle gwc2 = MethodHandles.catchException(
+ gwc1, MyException.class, handlerWithArgs);
// This is only to verify that the method handles can actually be invoked and do the right thing.
firstArg = new Object();
- Object o = gwc2.asSpreader(Object[].class, ptypes.size() - 1).invoke(firstArg, new Object[i]);
+ Object o = gwc2.asSpreader(Object[].class, ptypes.size() - 1)
+ .invoke(firstArg, new Object[i]);
if (o != firstArg) {
- throw new AssertionError("return value different than expected: " + o + " != " + firstArg);
+ throw new AssertionError("return value different than expected: "
+ + o + " != " + firstArg);
}
}
}
--- a/jdk/test/java/lang/invoke/VarargsArrayTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/lang/invoke/VarargsArrayTest.java Wed Jul 05 23:33:35 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
@@ -21,20 +21,20 @@
* questions.
*/
+import sun.invoke.util.Wrapper;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandleHelper;
import java.lang.invoke.MethodType;
-import sun.invoke.util.Wrapper;
import java.util.Arrays;
import java.util.Collections;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
/* @test
* @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int),
* MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int)
* @modules java.base/sun.invoke.util
- * @library /lib/testlibrary /lib/testlibrary/jsr292
+ * @library /lib/testlibrary /java/lang/invoke/common
* @compile/module=java.base java/lang/invoke/MethodHandleHelper.java
* @run main/bootclasspath VarargsArrayTest
* @run main/bootclasspath/othervm -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250
@@ -46,9 +46,12 @@
*/
public class VarargsArrayTest {
private static final Class<?> CLASS = VarargsArrayTest.class;
- private static final int MAX_ARITY = Integer.getInteger(CLASS.getSimpleName()+".MAX_ARITY", 40);
- private static final int START_ARITY = Integer.getInteger(CLASS.getSimpleName()+".START_ARITY", 0);
- private static final boolean EXHAUSTIVE = Boolean.getBoolean(CLASS.getSimpleName()+".EXHAUSTIVE");
+ private static final int MAX_ARITY = Integer.getInteger(
+ CLASS.getSimpleName()+".MAX_ARITY", 40);
+ private static final int START_ARITY = Integer.getInteger(
+ CLASS.getSimpleName()+".START_ARITY", 0);
+ private static final boolean EXHAUSTIVE = Boolean.getBoolean(
+ CLASS.getSimpleName()+".EXHAUSTIVE");
public static void main(String[] args) throws Throwable {
CodeCacheOverflowProcessor.runMHTest(VarargsArrayTest::test);
@@ -211,7 +214,8 @@
}
return;
}
- throw new AssertionError(Arrays.deepToString(arr1) + " != " + Arrays.deepToString(arr2));
+ throw new AssertionError(Arrays.deepToString(arr1)
+ + " != " + Arrays.deepToString(arr2));
}
public static void assertEquals(Object o1, Object o2) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,79 @@
+/*
+ * 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 test.java.lang.invoke.lib;
+
+import jdk.testlibrary.Utils;
+
+/**
+ * Helper class used to catch and process VirtualMachineError with message "Out
+ * of space in CodeCache". Some JSR292 tests run out of code cache size, so code
+ * cache overflows and VME is thrown. This VME is considered as non-critical in
+ * some JSR292 tests, so it should be processed to prevent test failure.
+ */
+public class CodeCacheOverflowProcessor {
+
+ /**
+ * Checks if an instance of Throwable is caused by VirtualMachineError with
+ * message "Out of space in CodeCache". May be used as filter in method
+ * {@code jdk.testlibrary.Utils.filterException}.
+ *
+ * @param t - Throwable to check.
+ * @return true if Throwable is caused by VME, false otherwise.
+ */
+ public static Boolean isThrowableCausedByVME(Throwable t) {
+ Throwable causeOfT = t;
+ do {
+ if (causeOfT instanceof VirtualMachineError
+ && causeOfT.getMessage().matches(".*[Oo]ut of space"
+ + " in CodeCache.*")) {
+ return true;
+ }
+ causeOfT = causeOfT != null ? causeOfT.getCause() : null;
+ } while (causeOfT != null && causeOfT != t);
+ return false;
+ }
+
+ /**
+ * Checks if the given test throws an exception caused by
+ * VirtualMachineError with message "Out of space in CodeCache", and, if VME
+ * takes place, processes it so that no exception is thrown, and prints its
+ * stack trace. If test throws exception not caused by VME, this method just
+ * re-throws this exception.
+ *
+ * @param test - test to check for and process VirtualMachineError.
+ * @return - an exception caused by VME or null
+ * if test has thrown no exception.
+ * @throws Throwable - if test has thrown an exception
+ * that is not caused by VME.
+ */
+ public static Throwable runMHTest(Utils.ThrowingRunnable test) throws Throwable {
+ Throwable t = Utils.filterException(test::run,
+ CodeCacheOverflowProcessor::isThrowableCausedByVME);
+ if (t != null) {
+ System.err.printf("%nNon-critical exception caught becuse of"
+ + " code cache size is not enough to run all test cases.%n%n");
+ }
+ return t;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/common/test/java/lang/invoke/lib/Helper.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,351 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.java.lang.invoke.lib;
+
+import jdk.testlibrary.Asserts;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+public class Helper {
+ /** Flag for verbose output, true if {@code -Dverbose} specified */
+ public static final boolean IS_VERBOSE
+ = System.getProperty("verbose") != null;
+ /**
+ * Flag for thorough testing -- all test will be executed,
+ * true if {@code -Dthorough} specified. */
+ public static final boolean IS_THOROUGH
+ = System.getProperty("thorough") != null;
+ /** Random number generator w/ initial seed equal to {@code -Dseed} */
+ public static final Random RNG;
+
+ static {
+ String str = System.getProperty("seed");
+ long seed = str != null ? Long.parseLong(str) : new Random().nextLong();
+ RNG = new Random(seed);
+ System.out.printf("-Dseed=%d%n", seed);
+ }
+
+ public static final long TEST_LIMIT;
+ static {
+ String str = System.getProperty("testLimit");
+ TEST_LIMIT = str != null ? Long.parseUnsignedLong(str) : 2000L;
+ System.out.printf("-DtestLimit=%d%n", TEST_LIMIT);
+ }
+
+ public static final int MAX_ARITY = 254;
+ public static final String MISSING_ARG = "missingArg";
+ public static final String MISSING_ARG_2 = "missingArg#2";
+
+ private static final int
+ // first int value
+ ONE_MILLION = (1000 * 1000),
+ // scale factor to reach upper 32 bits
+ TEN_BILLION = (10 * 1000 * 1000 * 1000),
+ // <<1 makes space for sign bit;
+ INITIAL_ARG_VAL = ONE_MILLION << 1;
+
+ public static final MethodHandle AS_LIST;
+
+ static {
+ try {
+ AS_LIST = MethodHandles.lookup().findStatic(
+ Arrays.class, "asList",
+ MethodType.methodType(List.class, Object[].class));
+ } catch (NoSuchMethodException | IllegalAccessException ex) {
+ throw new Error(ex);
+ }
+ }
+
+ public static boolean isDoubleCost(Class<?> aClass) {
+ return aClass == double.class || aClass == long.class;
+ }
+
+ private static List<List<Object>> calledLog = new ArrayList<>();
+ private static long nextArgVal;
+
+ public static void assertCalled(String name, Object... args) {
+ assertCalled(0, name, args);
+ }
+
+ public static void assertCalled(int lag, String name, Object... args) {
+ Object expected = logEntry(name, args);
+ Object actual = getCalled(lag);
+ Asserts.assertEQ(expected, actual, "method call w/ lag = " + lag);
+ }
+
+ public static Object called(String name, Object... args) {
+ List<Object> entry = logEntry(name, args);
+ calledLog.add(entry);
+ return entry;
+ }
+
+ private static List<Object> logEntry(String name, Object... args) {
+ return Arrays.asList(name, Arrays.asList(args));
+ }
+
+ public static void clear() {
+ calledLog.clear();
+ }
+
+ public static List<Object> getCalled(int lag) {
+ int size = calledLog.size();
+ return size <= lag ? null : calledLog.get(size - lag - 1);
+ }
+
+ public static List<Class<?>> randomClasses(Class<?>[] classes, int size) {
+ List<Class<?>> result = new ArrayList<>(size);
+ for (int i = 0; i < size; ++i) {
+ result.add(classes[RNG.nextInt(classes.length)]);
+ }
+ return result;
+ }
+
+ public static List<Class<?>> getParams(List<Class<?>> classes,
+ boolean isVararg, int argsCount) {
+ boolean unmodifiable = true;
+ List<Class<?>> result = classes.subList(0,
+ Math.min(argsCount, (MAX_ARITY / 2) - 1));
+ int extra = 0;
+ if (argsCount >= MAX_ARITY / 2) {
+ result = new ArrayList<>(result);
+ unmodifiable = false;
+ extra = (int) result.stream().filter(Helper::isDoubleCost).count();
+ int i = result.size();
+ while (result.size() + extra < argsCount) {
+ Class<?> aClass = classes.get(i);
+ if (Helper.isDoubleCost(aClass)) {
+ ++extra;
+ if (result.size() + extra >= argsCount) {
+ break;
+ }
+ }
+ result.add(aClass);
+ }
+ }
+ if (isVararg && result.size() > 0) {
+ if (unmodifiable) {
+ result = new ArrayList<>(result);
+ }
+ int last = result.size() - 1;
+ Class<?> aClass = result.get(last);
+ aClass = Array.newInstance(aClass, 2).getClass();
+ result.set(last, aClass);
+ }
+ return result;
+ }
+
+ public static MethodHandle addTrailingArgs(MethodHandle target, int nargs,
+ List<Class<?>> classes) {
+ int targetLen = target.type().parameterCount();
+ int extra = (nargs - targetLen);
+ if (extra <= 0) {
+ return target;
+ }
+ List<Class<?>> fakeArgs = new ArrayList<>(extra);
+ for (int i = 0; i < extra; ++i) {
+ fakeArgs.add(classes.get(i % classes.size()));
+ }
+ return MethodHandles.dropArguments(target, targetLen, fakeArgs);
+ }
+
+ public static MethodHandle varargsList(int arity) {
+ return AS_LIST.asCollector(Object[].class, arity);
+ }
+
+ private static long nextArg(boolean moreBits) {
+ long val = nextArgVal++;
+ long sign = -(val & 1); // alternate signs
+ val >>= 1;
+ if (moreBits)
+ // Guarantee some bits in the high word.
+ // In any case keep the decimal representation simple-looking,
+ // with lots of zeroes, so as not to make the printed decimal
+ // strings unnecessarily noisy.
+ {
+ val += (val % ONE_MILLION) * TEN_BILLION;
+ }
+ return val ^ sign;
+ }
+
+ private static int nextArg() {
+ // Produce a 32-bit result something like ONE_MILLION+(smallint).
+ // Example: 1_000_042.
+ return (int) nextArg(false);
+ }
+
+ private static long nextArg(Class<?> kind) {
+ if (kind == long.class || kind == Long.class ||
+ kind == double.class || kind == Double.class)
+ // produce a 64-bit result something like
+ // ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
+ // Example: 10_000_420_001_000_042.
+ {
+ return nextArg(true);
+ }
+ return (long) nextArg();
+ }
+
+ private static Object randomArg(Class<?> param) {
+ Object wrap = castToWrapperOrNull(nextArg(param), param);
+ if (wrap != null) {
+ return wrap;
+ }
+
+ if (param.isInterface()) {
+ for (Class<?> c : param.getClasses()) {
+ if (param.isAssignableFrom(c) && !c.isInterface()) {
+ param = c;
+ break;
+ }
+ }
+ }
+ if (param.isArray()) {
+ Class<?> ctype = param.getComponentType();
+ Object arg = Array.newInstance(ctype, 2);
+ Array.set(arg, 0, randomArg(ctype));
+ return arg;
+ }
+ if (param.isInterface() && param.isAssignableFrom(List.class)) {
+ return Arrays.asList("#" + nextArg());
+ }
+ if (param.isInterface() || param.isAssignableFrom(String.class)) {
+ return "#" + nextArg();
+ }
+
+ try {
+ return param.newInstance();
+ } catch (InstantiationException | IllegalAccessException ex) {
+ }
+ return null; // random class not Object, String, Integer, etc.
+ }
+
+ public static Object[] randomArgs(Class<?>... params) {
+ Object[] args = new Object[params.length];
+ for (int i = 0; i < args.length; i++) {
+ args[i] = randomArg(params[i]);
+ }
+ return args;
+ }
+
+ public static Object[] randomArgs(int nargs, Class<?> param) {
+ Object[] args = new Object[nargs];
+ for (int i = 0; i < args.length; i++) {
+ args[i] = randomArg(param);
+ }
+ return args;
+ }
+
+ public static Object[] randomArgs(int nargs, Class<?>... params) {
+ Object[] args = new Object[nargs];
+ for (int i = 0; i < args.length; i++) {
+ Class<?> param = params[i % params.length];
+ args[i] = randomArg(param);
+ }
+ return args;
+ }
+
+ public static Object[] randomArgs(List<Class<?>> params) {
+ return randomArgs(params.toArray(new Class<?>[params.size()]));
+ }
+
+ public static Object castToWrapper(Object value, Class<?> dst) {
+ Object wrap = null;
+ if (value instanceof Number) {
+ wrap = castToWrapperOrNull(((Number) value).longValue(), dst);
+ }
+ if (value instanceof Character) {
+ wrap = castToWrapperOrNull((char) (Character) value, dst);
+ }
+ if (wrap != null) {
+ return wrap;
+ }
+ return dst.cast(value);
+ }
+
+ @SuppressWarnings("cast")
+ // primitive cast to (long) is part of the pattern
+ private static Object castToWrapperOrNull(long value, Class<?> dst) {
+ if (dst == int.class || dst == Integer.class) {
+ return (int) (value);
+ }
+ if (dst == long.class || dst == Long.class) {
+ return (long) (value);
+ }
+ if (dst == char.class || dst == Character.class) {
+ return (char) (value);
+ }
+ if (dst == short.class || dst == Short.class) {
+ return (short) (value);
+ }
+ if (dst == float.class || dst == Float.class) {
+ return (float) (value);
+ }
+ if (dst == double.class || dst == Double.class) {
+ return (double) (value);
+ }
+ if (dst == byte.class || dst == Byte.class) {
+ return (byte) (value);
+ }
+ if (dst == boolean.class || dst == Boolean.class) {
+ return ((value % 29) & 1) == 0;
+ }
+ return null;
+ }
+
+ /**
+ * Routine used to obtain a randomly generated method type.
+ *
+ * @param arity Arity of returned method type.
+ * @return MethodType generated randomly.
+ */
+ public static MethodType randomMethodTypeGenerator(int arity) {
+ final Class<?>[] CLASSES = {
+ Object.class,
+ int.class,
+ boolean.class,
+ byte.class,
+ short.class,
+ char.class,
+ long.class,
+ float.class,
+ double.class
+ };
+ if (arity > MAX_ARITY) {
+ throw new IllegalArgumentException(
+ String.format("Arity should not exceed %d!", MAX_ARITY));
+ }
+ List<Class<?>> list = randomClasses(CLASSES, arity);
+ list = getParams(list, false, arity);
+ int i = RNG.nextInt(CLASSES.length + 1);
+ Class<?> rtype = i == CLASSES.length ? void.class : CLASSES[i];
+ return MethodType.methodType(rtype, list);
+ }
+}
--- a/jdk/test/java/math/BigDecimal/StringConstructor.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/math/BigDecimal/StringConstructor.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main StringConstructor
* @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460 8078672
* @summary Tests the BigDecimal string constructor (use -Dseed=X to set PRNG seed).
@@ -33,7 +32,7 @@
import java.math.*;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class StringConstructor {
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main BigIntegerTest
* @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460 8078672 8032027
* @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed)
@@ -47,7 +46,7 @@
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* This is a simple test class created to ensure that the results
--- a/jdk/test/java/math/BigInteger/ModPow65537.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/math/BigInteger/ModPow65537.java Wed Jul 05 23:33:35 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
@@ -23,8 +23,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main ModPow65537
* @bug 4891312 8074460 8078672
* @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed)
@@ -37,7 +36,7 @@
import java.security.*;
import java.security.spec.*;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class ModPow65537 {
--- a/jdk/test/java/math/BigInteger/PrimeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/math/BigInteger/PrimeTest.java Wed Jul 05 23:33:35 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
@@ -25,8 +25,7 @@
/*
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main PrimeTest
* @bug 8026236 8074460 8078672
* @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed)
@@ -40,7 +39,7 @@
import java.util.Set;
import java.util.SplittableRandom;
import java.util.TreeSet;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import static java.util.stream.Collectors.toCollection;
import static java.util.stream.Collectors.toList;
--- a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java Wed Jul 05 23:33:35 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
@@ -24,8 +24,7 @@
/*
* @test
* @ignore This test has huge memory requirements
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests
* @bug 6910473 8021204 8021203 9005933 8074460 8078672
* @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed)
@@ -40,7 +39,7 @@
import java.util.Arrays;
import java.math.BigInteger;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class SymmetricRangeTests {
--- a/jdk/test/java/net/Socket/OldSocketImpl.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 6449565
-# @run shell/timeout=140 OldSocketImpl.sh
-# @summary Pre-1.4 SocketImpl no longer supported
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- PS=";"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# no need to compile the test. It is already compiled
-# with 1.3 and in OldStyleImpl.jar
-
-# run
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTSRC}${FS}OldSocketImpl.jar OldSocketImpl
-result=$?
-if [ "$result" -ne "0" ]; then
- exit 1
-fi
-
-# no failures, exit.
-exit 0
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Socket/OldSocketImplTestDriver.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.process.ProcessTools;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * @test
+ * @bug 6449565
+ * @library /test/lib
+ * @build jdk.test.lib.process.ProcessTools
+ * @run main OldSocketImplTestDriver
+ * @summary Test driver for OdlSocketImpl
+ */
+public class OldSocketImplTestDriver {
+ public static void main(String[] args) throws Throwable {
+ Path jar = Paths.get(System.getProperty("test.src"),
+ "OldSocketImpl.jar");
+ ProcessTools.executeTestJava("-cp", jar.toString(), "OldSocketImpl")
+ .outputTo(System.out)
+ .errorTo(System.out)
+ .shouldHaveExitValue(0);
+ }
+}
--- a/jdk/test/java/net/URL/B5086147.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URL/B5086147.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,13 @@
/**
* @test
* @bug 5086147
- * @run shell B5086147.sh
+ * @requires (os.family == "windows")
+ * @run main B5086147
* @summary File,URI,URL conversions are strange for UNC path
*/
-import java.net.*;
-import java.io.*;
+import java.io.File;
+import java.net.URI;
public class B5086147 {
public static final void main( String[] aaParamters ) throws Exception{
--- a/jdk/test/java/net/URL/B5086147.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- exit 0
- ;;
- CYGWIN* )
- PS=";"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}B5086147.java
-
-failures=0
-
-echo ''
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} B5086147
-if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-
-if [ "$failures" != "0" ]; then
- echo $failures tests failed
- exit 1;
-fi
--- a/jdk/test/java/net/URLClassLoader/B5077773.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-import java.net.*;
-
-public class B5077773 {
-
- public static void main(String[] args) throws Exception {
- URLClassLoader loader = new URLClassLoader (new URL[] {new URL("file:foo.jar")});
- /* This test will fail if the file below is removed from rt.jar */
- InputStream is = loader.getResourceAsStream ("javax/swing/text/rtf/charsets/mac.txt");
- if (is == null) {
- System.out.println ("could not find mac.txt");
- return;
- }
- int c=0;
- while ((is.read()) != -1) {
- c++;
- }
- if (c == 26) /* size of bad file */ {
- throw new RuntimeException ("Wrong mac.txt file was loaded");
- }
- }
-}
--- a/jdk/test/java/net/URLClassLoader/B5077773.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @author Michael McMahon
-# @bug 5077773
-# @summary Change in behaviour w.r.t jdk1.4.2 when loading resourcebundles
-#
-# ${TESTJAVA} is pointing to the jre
-#
-# set platform-dependent variables
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Linux )
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- PS=";"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-cp ${TESTSRC}${FS}foo.jar .
-
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
- ${TESTSRC}${FS}B5077773.java
-
-WD=`pwd`
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} B5077773
-
--- a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, 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
@@ -26,24 +26,33 @@
* @bug 4167874
* @modules java.logging
* jdk.httpserver
+ * jdk.compiler
* @library ../../../../com/sun/net/httpserver
- * @library /lib/testlibrary
- * @build FileServerHandler jdk.testlibrary.FileUtils
- * @run shell build.sh
+ * /lib/testlibrary
+ * /test/lib
+ * @build FileServerHandler JarUtils CompilerUtils
* @run main/othervm CloseTest
* @summary URL-downloaded jar files can consume all available file descriptors
*/
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
import java.net.InetSocketAddress;
import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpServer;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
public class CloseTest extends Common {
-
+ private static final String WORK_DIR = System.getProperty("user.dir")
+ + "/";
//
// needs two jar files test1.jar and test2.jar with following structure
//
@@ -54,39 +63,31 @@
//
// and a directory hierarchy with the same structure/contents
- public static void main (String args[]) throws Exception {
+ public static void main(String args[]) throws Exception {
+ setup();
- String workdir = System.getProperty("test.classes");
- if (workdir == null) {
- workdir = args[0];
- }
- if (!workdir.endsWith("/")) {
- workdir = workdir+"/";
- }
+ startHttpServer(WORK_DIR + "serverRoot/");
- startHttpServer (workdir+"serverRoot/");
-
- String testjar = workdir + "test.jar";
- copyFile (workdir+"test1.jar", testjar);
- test (testjar, 1);
+ String testjar = WORK_DIR + "test.jar";
+ copyFile(WORK_DIR + "test1.jar", testjar);
+ test(testjar, 1);
// repeat test with different implementation
// of test.jar (whose TestClass.getValue() returns 2
-
- copyFile (workdir+"test2.jar", testjar);
- test (testjar, 2);
+ copyFile(WORK_DIR + "test2.jar", testjar);
+ test(testjar, 2);
// repeat test using a directory of files
- String testdir=workdir+"testdir/";
- rm_minus_rf (new File(testdir));
- copyDir (workdir+"test1/", testdir);
- test (testdir, 1);
+ String testdir = WORK_DIR + "testdir/";
+ rm_minus_rf(new File(testdir));
+ copyDir(WORK_DIR + "test1/", testdir);
+ test(testdir, 1);
- testdir=workdir+"testdir/";
- rm_minus_rf (new File(testdir));
- copyDir (workdir+"test2/", testdir);
- test (testdir, 2);
- getHttpServer().stop (3);
+ testdir = WORK_DIR + "testdir/";
+ rm_minus_rf(new File(testdir));
+ copyDir(WORK_DIR + "test2/", testdir);
+ test(testdir, 2);
+ getHttpServer().stop(3);
}
// create a loader on jarfile (or directory), plus a http loader
@@ -98,47 +99,48 @@
// check existing classes can be loaded
// check boot classes can be loaded
- static void test (String name, int expectedValue) throws Exception {
- URL url = new URL ("file", null, name);
+ static void test(String name, int expectedValue) throws Exception {
+
+ URL url = new URL("file", null, name);
URL url2 = getServerURL();
- System.out.println ("Doing tests with URL: " + url + " and " + url2);
+ System.out.println("Doing tests with URL: " + url + " and " + url2);
URL[] urls = new URL[2];
- urls[0] = url;
- urls[1] = url2;
- URLClassLoader loader = new URLClassLoader (urls);
- Class testclass = loadClass ("com.foo.TestClass", loader, true);
- Class class2 = loadClass ("Test", loader, true); // from http
+ urls[0] = url;
+ urls[1] = url2;
+ URLClassLoader loader = new URLClassLoader(urls);
+ Class testclass = loadClass("com.foo.TestClass", loader, true);
+ Class class2 = loadClass("Test", loader, true); // from http
class2.newInstance();
Object test = testclass.newInstance();
Method method = testclass.getDeclaredMethods()[0]; // int getValue();
- int res = (Integer) method.invoke (test);
+ int res = (Integer) method.invoke(test);
if (res != expectedValue) {
- throw new RuntimeException ("wrong value from getValue() ["+res+
- "/"+expectedValue+"]");
+ throw new RuntimeException("wrong value from getValue() [" + res +
+ "/" + expectedValue + "]");
}
// should find /resource1
- URL u1 = loader.findResource ("com/foo/Resource1");
+ URL u1 = loader.findResource("com/foo/Resource1");
if (u1 == null) {
- throw new RuntimeException ("can't find com/foo/Resource1 in test1.jar");
+ throw new RuntimeException("can't find com/foo/Resource1 in test1.jar");
}
- loader.close ();
+ loader.close();
// should NOT find /resource2 even though it is in jar
- URL u2 = loader.findResource ("com/foo/Resource2");
+ URL u2 = loader.findResource("com/foo/Resource2");
if (u2 != null) {
- throw new RuntimeException ("com/foo/Resource2 unexpected in test1.jar");
+ throw new RuntimeException("com/foo/Resource2 unexpected in test1.jar");
}
// load tests
- loadClass ("com.foo.TestClass1", loader, false);
- loadClass ("com.foo.TestClass", loader, true);
- loadClass ("java.util.ArrayList", loader, true);
+ loadClass("com.foo.TestClass1", loader, false);
+ loadClass("com.foo.TestClass", loader, true);
+ loadClass("java.util.ArrayList", loader, true);
// now check we can delete the path
- rm_minus_rf (new File(name));
- System.out.println (" ... OK");
+ rm_minus_rf(new File(name));
+ System.out.println(" ... OK");
}
static HttpServer httpServer;
@@ -147,17 +149,54 @@
return httpServer;
}
- static URL getServerURL () throws Exception {
+ static URL getServerURL() throws Exception {
int port = httpServer.getAddress().getPort();
- String s = "http://127.0.0.1:"+port+"/";
+ String s = "http://127.0.0.1:" + port + "/";
return new URL(s);
}
- static void startHttpServer (String docroot) throws Exception {
- httpServer = HttpServer.create (new InetSocketAddress(0), 10);
- HttpContext ctx = httpServer.createContext (
+ static void startHttpServer(String docroot) throws Exception {
+ httpServer = HttpServer.create(new InetSocketAddress(0), 10);
+ HttpContext ctx = httpServer.createContext(
"/", new FileServerHandler(docroot)
);
httpServer.start();
}
+
+ /**
+ * Prepare jars files for the tests
+ */
+ private static void setup () throws IOException {
+ String[] tests = new String[]{"test1", "test2"};
+ Path workDir = Paths.get(WORK_DIR);
+ Path testSrc = Paths.get(System.getProperty("test.src"));
+ for (String test : tests) {
+ Path testSrcDir = testSrc.resolve(test);
+ Path testTargetDir = workDir.resolve(test);
+ // Compile sources for corresponding test
+ CompilerUtils.compile(testSrcDir, testTargetDir);
+ // Copy all resources
+ Path packages = Paths.get("com", "foo");
+ Path copySrcDir = testSrcDir.resolve(packages);
+ Path copyTargetDir = testTargetDir.resolve(packages);
+ Files.createDirectories(copyTargetDir);
+ Path res1 = Paths.get("Resource1");
+ Path res2 = Paths.get("Resource2");
+ Files.copy(copySrcDir.resolve(res1), copyTargetDir.resolve(res1),
+ REPLACE_EXISTING);
+ Files.copy(copySrcDir.resolve(res2), copyTargetDir.resolve(res2),
+ REPLACE_EXISTING);
+ // Create jar
+ JarUtils.createJarFile(workDir.resolve(test + ".jar"), testTargetDir);
+ }
+
+ // Copy and compile server test class
+ Path serverRoot = Paths.get("serverRoot");
+ Path targetDir = workDir.resolve(serverRoot);
+ Path file = Paths.get("Test.java");
+ Files.createDirectories(targetDir);
+ Files.copy(testSrc.resolve(serverRoot).resolve(file),
+ targetDir.resolve(file), REPLACE_EXISTING);
+ CompilerUtils.compile(targetDir, targetDir);
+ }
}
--- a/jdk/test/java/net/URLClassLoader/closetest/Common.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URLClassLoader/closetest/Common.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
import java.io.*;
import java.net.*;
import java.nio.file.Files;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import static java.nio.file.StandardCopyOption.*;
public class Common {
--- a/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URLClassLoader/closetest/GetResourceAsStream.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,16 +24,25 @@
/**
* @test
* @bug 6899919
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
- * @run shell build2.sh
+ * @library /lib/testlibrary /test/lib
+ * @modules jdk.compiler
+ * @build JarUtils CompilerUtils
* @run main/othervm GetResourceAsStream
*/
-import java.io.*;
-import java.net.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.StandardOpenOption;
public class GetResourceAsStream extends Common {
+ private static final String WORK_DIR = System.getProperty("user.dir");
/*
* We simply test various scenarios with class/resource files
@@ -42,35 +51,30 @@
* on Windows. It will still run correctly on other platforms
*/
public static void main (String args[]) throws Exception {
-
- String workdir = System.getProperty("test.classes");
- if (workdir == null) {
- workdir = args[0];
- }
+ setup();
/* the jar we copy for each test */
- File srcfile = new File (workdir, "foo.jar");
+ File srcfile = new File(WORK_DIR, "foo.jar");
/* the jar we use for the test */
- File testfile = new File (workdir, "test.jar");
+ File testfile = new File(WORK_DIR, "test.jar");
- copyFile (srcfile, testfile);
- test (testfile, false, false);
+ copyFile(srcfile, testfile);
+ test(testfile, false, false);
- copyFile (srcfile, testfile);
- test (testfile, true, false);
+ copyFile(srcfile, testfile);
+ test(testfile, true, false);
- copyFile (srcfile, testfile);
- test (testfile, true, true);
+ copyFile(srcfile, testfile);
+ test(testfile, true, true);
// repeat test using a directory of files
- File testdir= new File (workdir, "testdir");
- File srcdir= new File (workdir, "test3");
+ File testdir = new File(WORK_DIR, "testdir");
+ File srcdir = new File(WORK_DIR, "test3");
- copyDir (srcdir, testdir);
- test (testdir, true, false);
-
+ copyDir(srcdir, testdir);
+ test(testdir, true, false);
}
// create a loader on jarfile (or directory)
@@ -82,7 +86,7 @@
static void test (File file, boolean loadclass, boolean readall)
throws Exception
{
- URL[] urls = new URL[] {file.toURL()};
+ URL[] urls = new URL[] {file.toURI().toURL()};
System.out.println ("Doing tests with URL: " + urls[0]);
URLClassLoader loader = new URLClassLoader (urls);
if (loadclass) {
@@ -97,7 +101,7 @@
loader.close ();
- // shouuld not find bye.txt now
+ // should not find bye.txt now
InputStream s1 = loader.getResourceAsStream("bye.txt");
if (s1 != null) {
throw new RuntimeException ("closed loader returned resource");
@@ -107,4 +111,26 @@
rm_minus_rf (file);
System.out.println (" ... OK");
}
+
+ /**
+ * Prepare jars files for the tests
+ */
+ private static void setup () throws IOException {
+ Path classes = Paths.get(WORK_DIR);
+ Path testSrc = Paths.get(System.getProperty("test.src"),
+ "test1", "com", "foo", "TestClass.java");
+ Path targetDir = classes.resolve("test3");
+ Path testTarget = targetDir.resolve("TestClass.java");
+ Files.createDirectories(targetDir);
+ Files.copy(testSrc, testTarget, StandardCopyOption.REPLACE_EXISTING);
+ // Compile sources for corresponding test
+ CompilerUtils.compile(targetDir, targetDir);
+ // Prepare txt files
+ Files.write(targetDir.resolve("hello.txt"), "Hello world".getBytes(),
+ StandardOpenOption.CREATE);
+ Files.write(targetDir.resolve("bye.txt"), "Bye world".getBytes(),
+ StandardOpenOption.CREATE);
+ // Create jar
+ JarUtils.createJarFile(classes.resolve("foo.jar"), targetDir);
+ }
}
--- a/jdk/test/java/net/URLClassLoader/closetest/build.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-#
-# This script builds the test files for the test
-# but not the actual test sources themselves.
-#
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-
-if [ "${COMPILEJAVA}" = "" ]; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-echo "COMPILEJAVA=${COMPILEJAVA}"
-
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-
-JAVAC="${COMPILEJAVA}/bin/javac"
-JAR="${COMPILEJAVA}/bin/jar"
-
-rm -rf ${TESTCLASSES}/test1
-rm -rf ${TESTCLASSES}/test2
-rm -rf ${TESTCLASSES}/serverRoot
-mkdir -p ${TESTCLASSES}/test1/com/foo
-mkdir -p ${TESTCLASSES}/test2/com/foo
-mkdir -p ${TESTCLASSES}/serverRoot
-
-cd ${TESTSRC}/test1/com/foo
-cp * ${TESTCLASSES}/test1/com/foo
-cd ${TESTCLASSES}/test1
-${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} com/foo/*.java
-${JAR} ${TESTTOOLVMOPTS} cvf ../test1.jar com/foo/*.class com/foo/Resource*
-
-cd ${TESTSRC}/test2/com/foo
-cp * ${TESTCLASSES}/test2/com/foo
-cd ${TESTCLASSES}/test2
-${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} com/foo/*.java
-${JAR} ${TESTTOOLVMOPTS} cvf ../test2.jar com/foo/*.class com/foo/Resource*
-
-cp ${TESTSRC}/serverRoot/Test.java ${TESTCLASSES}/serverRoot
-cd ${TESTCLASSES}/serverRoot
-${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} Test.java
--- a/jdk/test/java/net/URLClassLoader/closetest/build2.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-
-JAVAC="${TESTJAVA}/bin/javac"
-JAR="${TESTJAVA}/bin/jar"
-
-rm -rf ${TESTCLASSES}/test3
-mkdir -p ${TESTCLASSES}/test3
-
-echo "Hello world" > ${TESTCLASSES}/test3/hello.txt
-echo "Bye world" > ${TESTCLASSES}/test3/bye.txt
-cp ${TESTSRC}/test1/com/foo/TestClass.java ${TESTCLASSES}/test3
-cd ${TESTCLASSES}/test3
-${JAVAC} -d . TestClass.java
-
-${JAR} cvf foo.jar hello.txt bye.txt com/foo/TestClass.class
-rm -f ../foo.jar
-mv foo.jar ..
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/getresourceasstream/TestDriver.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * 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 5103449
+ * @summary REGRESSION: getResourceAsStream is broken in JDK1.5.0-rc
+ * @library /test/lib
+ * @build jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.process.ProcessTools
+ * Test
+ * @run main/othervm TestDriver
+ */
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.process.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+public class TestDriver {
+ private static final String ARCHIVE_NAME = "test.jar";
+ private static final String TEST_NAME = "Test";
+ private static final String POLICY_FILE = "policy";
+ public static void main(String[] args)
+ throws Throwable {
+
+ Path userDir = Paths.get(System.getProperty("user.dir"));
+ String java = JDKToolFinder.getTestJDKTool("java");
+ String basename = userDir.getFileName().toString();
+ setup(userDir);
+ ProcessBuilder[] tests = new ProcessBuilder[]{
+ new ProcessBuilder(
+ java, TEST_NAME, "./" + ARCHIVE_NAME
+ ),
+ new ProcessBuilder(
+ java, "-cp", ".",
+ "-Djava.security.policy=file:./policy",
+ "-Djava.security.manager",
+ TEST_NAME, "./" + ARCHIVE_NAME
+ ),
+ new ProcessBuilder(
+ java, "-cp", ".",
+ "-Djava.security.policy=file:./policy",
+ "-Djava.security.manager",
+ TEST_NAME, "./" + ARCHIVE_NAME
+ ),
+ new ProcessBuilder(
+ java, "-cp", "..",
+ "-Djava.security.policy=file:../policy",
+ "-Djava.security.manager",
+ TEST_NAME, "../" + ARCHIVE_NAME
+ ).directory(userDir.resolve("tmp").toFile()),
+ new ProcessBuilder(
+ java, "-cp", basename,
+ "-Djava.security.policy=file:" + basename + "/policy",
+ "-Djava.security.manager",
+ TEST_NAME, basename + "/" + ARCHIVE_NAME
+ ).directory(userDir.resolve("..").toFile())};
+ for (ProcessBuilder test : tests) {
+ runTest(test);
+ }
+ }
+
+ private static void setup(Path userDir) throws IOException {
+ Path src = Paths.get(System.getProperty("test.src"));
+ Path testJar = src.resolve(ARCHIVE_NAME);
+ Path policy = src.resolve(POLICY_FILE);
+ Path testClass = Paths.get(System.getProperty("test.classes"),
+ TEST_NAME + ".class");
+ Files.copy(testJar, userDir.resolve(ARCHIVE_NAME), REPLACE_EXISTING);
+ Files.copy(policy, userDir.resolve(POLICY_FILE), REPLACE_EXISTING);
+ Files.copy(testClass, userDir.resolve(TEST_NAME + ".class"),
+ REPLACE_EXISTING);
+ Files.createDirectories(userDir.resolve("tmp"));
+ }
+
+ private static void runTest(ProcessBuilder pb) throws Exception {
+ System.out.println("Testing with command: [" + pb.command() + "]");
+ ProcessTools.executeProcess(pb)
+ .outputTo(System.out)
+ .errorTo(System.err)
+ .shouldHaveExitValue(0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/getresourceasstream/policy Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+grant {
+ permission java.lang.RuntimePermission "createClassLoader";
+};
--- a/jdk/test/java/net/URLClassLoader/getresourceasstream/test.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-set -x
-# @test
-# @bug 5103449
-# @run shell test.sh
-# @summary REGRESSION: getResourceAsStream is broken in JDK1.5.0-rc
-#
-
-
-cat << POLICY > policy
-grant {
- permission java.lang.RuntimePermission "createClassLoader";
-};
-POLICY
-
-checkExit () {
- if [ $? != 0 ]; then
- exit $1;
- fi
-}
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/Test.java
-cp ${TESTSRC}/test.jar .
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} Test ./test.jar
-checkExit 1
-
-# try with security manager
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:./policy \
- -Djava.security.manager Test ./test.jar
-checkExit 2
-
-mkdir tmp
-cd tmp
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:../policy \
- -cp .. -Djava.security.manager Test ../test.jar
-checkExit 3
-
-cd ..
-THISDIR=$(basename $(pwd))
-cd ..
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.policy=file:$THISDIR/policy \
- -cp $THISDIR -Djava.security.manager Test $THISDIR/test.jar
-checkExit 4
-
-exit 0
--- a/jdk/test/java/net/URLClassLoader/sealing/CheckSealed.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URLClassLoader/sealing/CheckSealed.java Wed Jul 05 23:33:35 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
@@ -21,13 +21,6 @@
* questions.
*/
-/*
- * @test
- * @bug 4244970
- * @summary Test to see if sealing violation is detected correctly
- * @run shell checksealed.sh
- *
- */
public class CheckSealed {
public static void main(String[] argv) throws Exception {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLClassLoader/sealing/CheckSealedTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,89 @@
+/*
+ * 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 4244970
+ * @summary Test to see if sealing violation is detected correctly
+ * @library /test/lib
+ * @build jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.process.OutputAnalyzer
+ * @run main CheckSealedTest
+ */
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.process.ProcessTools;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+public class CheckSealedTest {
+ private static final String ARCHIVE_NAME = "b.jar";
+ private static final String TEST_NAME = "CheckSealed";
+ public static void main(String[] args)
+ throws Throwable {
+
+ String baseDir = System.getProperty("user.dir") + File.separator;
+ String javac = JDKToolFinder.getTestJDKTool("javac");
+ String java = JDKToolFinder.getTestJDKTool("java");
+
+ setup(baseDir);
+ String srcDir = System.getProperty("test.src");
+ String cp = srcDir + File.separator + "a" + File.pathSeparator
+ + srcDir + File.separator + "b.jar" + File.pathSeparator
+ + ".";
+ List<String[]> allCMDs = List.of(
+ // Compile command
+ new String[]{
+ javac, "-cp", cp, "-d", ".",
+ srcDir + File.separator + TEST_NAME + ".java"
+ },
+ // Run test the first time
+ new String[]{
+ java, "-cp", cp, TEST_NAME, "1"
+ },
+ // Run test the second time
+ new String[]{
+ java, "-cp", cp, TEST_NAME, "2"
+ }
+ );
+
+ for (String[] cmd : allCMDs) {
+ ProcessTools.executeCommand(cmd)
+ .outputTo(System.out)
+ .errorTo(System.out)
+ .shouldHaveExitValue(0);
+ }
+ }
+
+ private static void setup(String baseDir) throws IOException {
+ Path testJar = Paths.get(System.getProperty("test.src"), ARCHIVE_NAME);
+ Files.copy(testJar, Paths.get(baseDir, ARCHIVE_NAME), REPLACE_EXISTING);
+ }
+}
--- a/jdk/test/java/net/URLClassLoader/sealing/checksealed.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Linux )
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- PS=";"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-
-if [ x"$TESTJAVA" = x ]; then TESTJAVA=$1; fi
-if [ x"$COMPILEJAVA" = x ]; then COMPILEJAVA=$1; fi
-if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
-
-CLASSPATH=".${PS}${TESTSRC}${FS}a${PS}${TESTSRC}${FS}b.jar"
-
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -classpath "${CLASSPATH}" -d . \
- ${TESTSRC}${FS}CheckSealed.java
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp "${CLASSPATH}" CheckSealed 1
-if [ $? != 0 ]; then exit 1; fi
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp "${CLASSPATH}" CheckSealed 2
-if [ $? != 0 ]; then exit 1; fi
--- a/jdk/test/java/net/URLConnection/6212146/Test.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URLConnection/6212146/Test.java Wed Jul 05 23:33:35 2017 +0200
@@ -21,49 +21,43 @@
* questions.
*/
-import java.net.*;
-import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.file.Paths;
public class Test {
public static void main(String[] args)
throws Exception {
- String BASE_DIR = args[0];
- String ARCHIVE_NAME = args[1];
- String lProperty = System.getProperty( "do.iterations", "5000" );
- int lRepetitions = new Integer( lProperty ).intValue();
- System.out.println ( "Start creating copys of the archive, " + lRepetitions + " times" );
- for( int i = 0; i < lRepetitions; i++ ) {
- // Copy the given jar file and add a prefix
- copyFile( BASE_DIR, ARCHIVE_NAME, i);
+ String baseDir = args[0];
+ String archiveName = args[1];
+ String lProperty = System.getProperty("do.iterations", "5000");
+ int lRepetitions = Integer.valueOf(lProperty);
+ System.out.println("Start creating copys of the archive, "
+ + lRepetitions + " times");
+ for (int i = 0; i < lRepetitions; i++) {
+ // Copy the given jar file and add a prefix
+ copyFile(baseDir, archiveName, i);
+ }
+ System.out.println("Start opening the archives archive, "
+ + lRepetitions + " times");
+ System.out.println("First URL is jar:" + Paths.get(baseDir,
+ 0 + archiveName).toUri() + "!/foo/Test.class");
+ for (int i = 0; i < lRepetitions; i++) {
+ // Create URL
+ String lURLPath = "jar:" + Paths.get(baseDir, i
+ + archiveName).toUri() + "!/foo/Test.class";
+ URL lURL = new URL(lURLPath);
+ // Open URL Connection
+ try {
+ URLConnection lConnection = lURL.openConnection();
+ lConnection.getInputStream();
+ } catch (java.io.FileNotFoundException fnfe) {
+ // Ignore this one because we expect this one
+ } catch (java.util.zip.ZipException ze) {
+ throw new RuntimeException("Test failed: " + ze.getMessage());
+ }
}
- System.out.println ( "Start opening the archives archive, " + lRepetitions + " times" );
- System.out.println ( "First URL is jar:file://" + BASE_DIR + "1" + ARCHIVE_NAME + "!/foo/Test.class");
- for( int i = 0; i < lRepetitions; i++ ) {
- // Create ULR
- String lURLPath = "jar:file://" + BASE_DIR + i + ARCHIVE_NAME + "!/foo/Test.class";
- URL lURL = new URL( lURLPath );
- // Open URL Connection
- try {
- URLConnection lConnection = lURL.openConnection();
- lConnection.getInputStream();
- } catch( java.io.FileNotFoundException fnfe ) {
- // Ignore this one because we expect this one
- } catch( java.util.zip.ZipException ze ) {
- throw new RuntimeException ("Test failed: " + ze.getMessage());
- }
- }
- //System.out.println ( "Done testing, waiting 20 seconds for checking" );
- //System.out.println ( "Cleaning up");
- //for( int i = 0; i < lRepetitions; i++ ) {
- // Copy the given jar file and add a prefix
- //deleteFile( BASE_DIR, i, ARCHIVE_NAME);
- ////}
- }
-
- private static void deleteFile (String BASE_DIR, int pIndex, String pArchiveName) {
- java.io.File file = new java.io.File (BASE_DIR, pIndex + pArchiveName );
- file.delete ();
}
private static void copyFile( String pBaseDir, String pArchiveName, int pIndex) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/URLConnection/6212146/TestDriver.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * 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 6212146
+ * @summary URLConnection.connect() fails on JAR Entry it creates
+ * file handler leak
+ * @library /test/lib
+ * @build jdk.test.lib.JDKToolFinder
+ * jdk.test.lib.process.ProcessTools
+ * Test
+ * @run main/othervm TestDriver
+ */
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.process.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+public class TestDriver {
+ private static final String BASE_DIR = System.getProperty("user.dir")
+ + "/jars/";
+ private static final String ARCHIVE_NAME = "test.jar";
+ private static final String CMD_ULIMIT = "ulimit -n 300;";
+
+ public static void main(String[] args)
+ throws Throwable {
+ setup(BASE_DIR);
+ String testCMD = CMD_ULIMIT + JDKToolFinder.getTestJDKTool("java")
+ + " Test " + BASE_DIR + " " + ARCHIVE_NAME;
+ boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+ if (isWindows) {
+ testCMD = testCMD.replace("\\", "/");
+ }
+ ProcessTools.executeCommand("sh", "-c", testCMD)
+ .outputTo(System.out)
+ .errorTo(System.err)
+ .shouldHaveExitValue(0);
+ }
+
+ private static void setup(String baseDir) throws IOException {
+ Path testJar = Paths.get(System.getProperty("test.src"), ARCHIVE_NAME);
+ Path targetDir = Paths.get(baseDir);
+ Files.createDirectories(targetDir);
+ Files.copy(testJar, targetDir.resolve(ARCHIVE_NAME), REPLACE_EXISTING);
+ }
+}
--- a/jdk/test/java/net/URLConnection/6212146/test.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# @test
-# @run shell/timeout=380 test.sh
-# @bug 6212146
-# @summary URLConnection.connect() fails on JAR Entry it creates file handler leak
-#
-# set platform-dependent variables
-
-OS=`uname -s`
-case "$OS" in
- SunOS | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Linux )
- PS=":"
- FS="/"
- ;;
- CYGWIN* )
- PS=";"
- FS="/"
- ;;
- Windows* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-if [ -d jars ]; then
- rm -rf jars
-fi
-
-mkdir jars
-
-cp ${TESTSRC}${FS}test.jar jars
-
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}Test.java
-
-WD=`pwd`
-ulimit -H -n 300
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} Test ${WD}/jars/ test.jar
-result=$?
-rm -rf jars
-exit $?
--- a/jdk/test/java/net/URLConnection/UNCTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/URLConnection/UNCTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,16 @@
* questions.
*/
-import java.net.*;
+/**
+ * @test
+ * @bug 4401485
+ * @requires (os.family == "windows")
+ * @summary Check that URL.openConnection() doesn't open connection to UNC
+ * @run main UNCTest file://jdk/LOCAL-JAVA/jdk1.4/win/README.txt
+ */
+
+import java.net.URL;
+import java.net.URLConnection;
public class UNCTest {
public static void main(String args[]) throws Exception {
--- a/jdk/test/java/net/URLConnection/UNCTest.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please 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 4401485
-# @run shell UNCTest.sh
-# @summary Check that URL.openConnection() doesn't open connection
-# to UNC.
-
-UNC="file://jdk/LOCAL-JAVA/jdk1.4/win/README.txt"
-
-OS=`uname -s`
-case "$OS" in
- Windows_95 | Windows_98 | Windows_NT )
- ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}\\UNCTest.java
- ${TESTJAVA}/bin/java ${TESTVMOPTS} UNCTest ${UNC}
- exit
- ;;
-
- * )
- echo "This test is not intended for this OS - passing test"
- exit 0
- ;;
-esac
--- a/jdk/test/java/net/httpclient/RequestBodyTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/httpclient/RequestBodyTest.java Wed Jul 05 23:33:35 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,7 +26,7 @@
* @modules jdk.incubator.httpclient
* java.logging
* jdk.httpserver
- * @library /lib/testlibrary/
+ * @library /lib/testlibrary/ /test/lib
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
* @build LightWeightHttpServer
@@ -52,7 +52,7 @@
import java.util.concurrent.Executors;
import java.util.function.Supplier;
import javax.net.ssl.SSLContext;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import static java.nio.charset.StandardCharsets.*;
import static java.nio.file.StandardOpenOption.*;
import static jdk.incubator.http.HttpRequest.BodyProcessor.*;
--- a/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ResponseHeadersTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ResponseHeadersTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -214,10 +214,6 @@
protected ByteBuffer readImpl() throws IOException {
throw new AssertionError("Bad test assumption: should not have reached here!");
}
- @Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- throw new AssertionError("Bad test assumption: should not have reached here!");
- }
}
public static HttpHeaders createResponseHeaders(ByteBuffer buffer)
--- a/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java Wed Jul 05 23:33:35 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
@@ -45,7 +45,7 @@
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import jdk.testlibrary.JDKToolFinder;
import static java.lang.String.format;
import static java.util.Arrays.asList;
@@ -55,8 +55,8 @@
* @bug 8064924
* @modules jdk.compiler
* @summary Basic test for URLStreamHandlerProvider
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
+ * @library /lib/testlibrary /test/lib
+ * @build jdk.testlibrary.JDKToolFinder
* @compile Basic.java Child.java
* @run main Basic
*/
--- a/jdk/test/java/nio/Buffer/LimitDirectMemory.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/Buffer/LimitDirectMemory.java Wed Jul 05 23:33:35 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
@@ -21,6 +21,35 @@
* questions.
*/
+/*
+ * @test
+ * @bug 4627316 6743526
+ * @summary Test option to limit direct memory allocation
+ * @requires (os.arch == "x86_64") | (os.arch == "amd64") | (os.arch == "sparcv9")
+ * @library /test/lib
+ *
+ * @summary Test: memory is properly limited using multiple buffers
+ * @run main/othervm -XX:MaxDirectMemorySize=10 LimitDirectMemory true 10 1
+ * @run main/othervm -XX:MaxDirectMemorySize=1k LimitDirectMemory true 1k 100
+ * @run main/othervm -XX:MaxDirectMemorySize=10m LimitDirectMemory true 10m 10m
+ *
+ * @summary Test: We can increase the amount of available memory
+ * @run main/othervm -XX:MaxDirectMemorySize=65M LimitDirectMemory false 64M 65M
+ *
+ * @summary Test: Exactly the default amount of memory is available
+ * @run main/othervm LimitDirectMemory false 10 1
+ * @run main/othervm -Xmx64m LimitDirectMemory false 0 DEFAULT
+ * @run main/othervm -Xmx64m LimitDirectMemory true 0 DEFAULT+1
+ *
+ * @summary Test: We should be able to eliminate direct memory allocation entirely
+ * @run main/othervm -XX:MaxDirectMemorySize=0 LimitDirectMemory true 0 1
+ *
+ * @summary Test: Setting the system property should not work so we should be able
+ * to allocate the default amount
+ * @run main/othervm -Dsun.nio.MaxDirectMemorySize=1K -Xmx64m
+ * LimitDirectMemory false DEFAULT-1 DEFAULT/2
+ */
+
import java.nio.ByteBuffer;
import java.util.Properties;
@@ -28,8 +57,13 @@
private static final int K = 1024;
public static void main(String [] args) throws Exception {
- if (args.length < 2)
- throw new RuntimeException();
+ if (args.length < 2) {
+ throw new IllegalArgumentException("Usage: "
+ + "java LimitDirectMemory"
+ + " <OOME_expected(true|false)>"
+ + " <fill_direct_memory>"
+ + " <size_per_buffer>");
+ }
boolean throwp = parseThrow(args[0]);
int size = parseSize(args[1]);
int incr = (args.length > 2 ? parseSize(args[2]) : size);
--- a/jdk/test/java/nio/Buffer/LimitDirectMemory.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4627316 6743526
-# @summary Test option to limit direct memory allocation
-#
-# @requires (os.arch == "x86_64") | (os.arch == "amd64") | (os.arch == "sparcv9")
-# @build LimitDirectMemory
-# @run shell LimitDirectMemory.sh
-
-TMP1=tmp_$$
-
-runTest() {
- echo "Testing: $*"
- ${TESTJAVA}/bin/java ${TESTVMOPTS} $*
- if [ $? -eq 0 ]
- then echo "--- passed as expected"
- else
- echo "--- failed"
- exit 1
- fi
-}
-
-
-launchFail() {
- echo "Testing: -XX:MaxDirectMemorySize=$* -cp ${TESTCLASSES} \
- LimitDirectMemory true DEFAULT DEFAULT+1M"
- ${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:MaxDirectMemorySize=$* -cp ${TESTCLASSES} \
- LimitDirectMemory true DEFAULT DEFAULT+1M > ${TMP1} 2>&1
- cat ${TMP1}
- cat ${TMP1} | grep -s "Unrecognized VM option: \'MaxDirectMemorySize="
- if [ $? -ne 0 ]
- then echo "--- failed as expected"
- else
- echo "--- failed"
- exit 1
- fi
-}
-
-# $java LimitDirectMemory throwp fill_direct_memory size_per_buffer
-
-# Memory is properly limited using multiple buffers.
-runTest -XX:MaxDirectMemorySize=10 -cp ${TESTCLASSES} LimitDirectMemory true 10 1
-runTest -XX:MaxDirectMemorySize=1k -cp ${TESTCLASSES} LimitDirectMemory true 1k 100
-runTest -XX:MaxDirectMemorySize=10m -cp ${TESTCLASSES} LimitDirectMemory true 10m 10m
-
-# We can increase the amount of available memory.
-runTest -XX:MaxDirectMemorySize=65M -cp ${TESTCLASSES} \
- LimitDirectMemory false 64M 65M
-
-# Exactly the default amount of memory is available.
-runTest -cp ${TESTCLASSES} LimitDirectMemory false 10 1
-runTest -Xmx64m -cp ${TESTCLASSES} LimitDirectMemory false 0 DEFAULT
-runTest -Xmx64m -cp ${TESTCLASSES} LimitDirectMemory true 0 DEFAULT+1
-
-# We should be able to eliminate direct memory allocation entirely.
-runTest -XX:MaxDirectMemorySize=0 -cp ${TESTCLASSES} LimitDirectMemory true 0 1
-
-# Setting the system property should not work so we should be able to allocate
-# the default amount.
-runTest -Dsun.nio.MaxDirectMemorySize=1K -Xmx64m -cp ${TESTCLASSES} \
- LimitDirectMemory false DEFAULT-1 DEFAULT/2
-
-# Various bad values fail to launch the VM.
-launchFail foo
-launchFail 10kmt
-launchFail -1
-
-# Clean-up
-rm ${TMP1}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/Buffer/LimitDirectMemoryNegativeTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4627316 6743526
+ * @summary Test option to limit direct memory allocation,
+ * various bad values fail to launch the VM
+ * @requires (os.arch == "x86_64") | (os.arch == "amd64") | (os.arch == "sparcv9")
+ * @library /test/lib
+ *
+ * @run main LimitDirectMemoryNegativeTest foo
+ * @run main LimitDirectMemoryNegativeTest 10kmt
+ * @run main LimitDirectMemoryNegativeTest -1
+ */
+
+import jdk.test.lib.process.ProcessTools;
+
+public class LimitDirectMemoryNegativeTest {
+
+ private static final String ERR = "Improperly specified VM option 'MaxDirectMemorySize=";
+
+ public static void main(String[] args) throws Exception {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("missing size argument");
+ }
+
+ int exitCode = ProcessTools.executeTestJava(
+ "-XX:MaxDirectMemorySize=" + args[0],
+ LimitDirectMemoryNegativeTest.class.getName())
+ .shouldContain(ERR + args[0])
+ .getExitValue();
+ if (exitCode != 1) {
+ throw new RuntimeException("Unexpected exit code: " + exitCode);
+ }
+ }
+}
--- a/jdk/test/java/nio/ByteOrder/NativeOrder.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/ByteOrder/NativeOrder.java Wed Jul 05 23:33:35 2017 +0200
@@ -32,12 +32,19 @@
public static void main(String[] args) throws Exception {
ByteOrder bo = ByteOrder.nativeOrder();
- System.err.println(bo);
+ System.err.println("ByteOrder.nativeOrder:" + bo);
String arch = System.getProperty("os.arch");
+ System.err.println("os.arch:" + arch);
if (((arch.equals("i386") && (bo != ByteOrder.LITTLE_ENDIAN))) ||
+ ((arch.equals("amd64") && (bo != ByteOrder.LITTLE_ENDIAN))) ||
+ ((arch.equals("x86_64") && (bo != ByteOrder.LITTLE_ENDIAN))) ||
+ ((arch.equals("ppc64") && (bo != ByteOrder.BIG_ENDIAN))) ||
+ ((arch.equals("ppc64le") && (bo != ByteOrder.LITTLE_ENDIAN))) ||
+ ((arch.equals("s390x") && (bo != ByteOrder.BIG_ENDIAN))) ||
((arch.equals("sparc") && (bo != ByteOrder.BIG_ENDIAN)))) {
throw new Exception("Wrong byte order");
}
+ System.err.println("test is OK");
}
}
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,21 @@
* questions.
*/
-import java.nio.channels.AsynchronousChannelGroup;
-import java.util.concurrent.*;
+/*
+ * @test
+ * @bug 4607272
+ * @summary tests tasks can be submitted to a channel group's thread pool.
+ * @library /lib/testlibrary bootlib
+ * @build JarUtils PrivilegedThreadFactory Attack
+ * @run driver SetupJar
+ * @run main/othervm -Xbootclasspath/a:privileged.jar AsExecutor
+ */
-/**
- * Test that arbitrary tasks can be submitted to a channel group's thread pool.
- */
+import java.nio.channels.AsynchronousChannelGroup;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
public class AsExecutor {
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Attack.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.net.*;
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * A task that attempts to attack the current host.
- */
-
-public class Attack implements Runnable {
- private final CountDownLatch latch = new CountDownLatch(1);
- private volatile boolean failedDueToSecurityException;
-
- public void Attack() {
- // check class is on boot class path
- if (Attack.class.getClassLoader() != null)
- throw new RuntimeException("Attack class not on boot class path");
- }
-
- @Override
- public void run() {
- try {
- new Socket("127.0.0.1", 9999).close();
- throw new RuntimeException("Connected (not expected)");
- } catch (IOException e) {
- throw new RuntimeException("IOException (not expected)");
- } catch (SecurityException e) {
- failedDueToSecurityException = true;
- } finally {
- latch.countDown();
- }
- }
-
- public void waitUntilDone() throws InterruptedException {
- latch.await();
- }
-
- public boolean failedDueToSecurityException() {
- return failedDueToSecurityException;
- }
-}
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/PrivilegedThreadFactory.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.concurrent.ThreadFactory;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * The "privileged" ThreadFactory used by the AsExecutor test.
- */
-
-public class PrivilegedThreadFactory implements ThreadFactory {
- public void PrivilegedThreadPoolFactory() {
- // check class is on boot class path
- if (PrivilegedThreadFactory.class.getClassLoader() != null)
- throw new RuntimeException("PrivilegedThreadFactory class not on boot class path");
- }
-
- @Override
- public Thread newThread(final Runnable r) {
- return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
- @Override
- public Thread run() {
- Thread t = new Thread(r);
- t.setDaemon(true);
- return t;
- }
- });
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/SetupJar.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class SetupJar {
+
+ public static void main(String args[]) throws Exception {
+ Path classes = Paths.get(System.getProperty("test.classes", ""));
+ JarUtils.createJarFile(Paths.get("privileged.jar"),
+ classes.resolve("bootlib"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/bootlib/Attack.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.net.Socket;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * A task that attempts to attack the current host.
+ */
+
+public class Attack implements Runnable {
+ private final CountDownLatch latch = new CountDownLatch(1);
+ private volatile boolean failedDueToSecurityException;
+
+ public void Attack() {
+ // check class is on boot class path
+ if (Attack.class.getClassLoader() != null)
+ throw new RuntimeException("Attack class not on boot class path");
+ }
+
+ @Override
+ public void run() {
+ try {
+ new Socket("127.0.0.1", 9999).close();
+ throw new RuntimeException("Connected (not expected)");
+ } catch (IOException e) {
+ throw new RuntimeException("IOException (not expected)");
+ } catch (SecurityException e) {
+ failedDueToSecurityException = true;
+ } finally {
+ latch.countDown();
+ }
+ }
+
+ public void waitUntilDone() throws InterruptedException {
+ latch.await();
+ }
+
+ public boolean failedDueToSecurityException() {
+ return failedDueToSecurityException;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/bootlib/PrivilegedThreadFactory.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.concurrent.ThreadFactory;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * The "privileged" ThreadFactory used by the AsExecutor test.
+ */
+
+public class PrivilegedThreadFactory implements ThreadFactory {
+ public void PrivilegedThreadPoolFactory() {
+ // check class is on boot class path
+ if (PrivilegedThreadFactory.class.getClassLoader() != null)
+ throw new RuntimeException("PrivilegedThreadFactory class not on boot class path");
+ }
+
+ @Override
+ public Thread newThread(final Runnable r) {
+ return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
+ @Override
+ public Thread run() {
+ Thread t = new Thread(r);
+ t.setDaemon(true);
+ return t;
+ }
+ });
+ }
+}
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/run_any_task.sh Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4607272
-# @summary Unit test for AsynchronousChannelGrou#execute
-# @build AsExecutor PrivilegedThreadFactory Attack
-# @run shell run_any_task.sh
-
-# if TESTJAVA isn't set then we assume an interactive run.
-
-if [ -z "$TESTJAVA" ]; then
- TESTSRC=.
- TESTCLASSES=.
- JAVA=java
- JAR=jar
-else
- JAVA="${TESTJAVA}/bin/java"
- JAR="${TESTJAVA}/bin/jar"
-fi
-
-echo "Creating JAR file ..."
-$JAR -cf "${TESTCLASSES}/Privileged.jar" \
- -C "${TESTCLASSES}" PrivilegedThreadFactory.class \
- -C "${TESTCLASSES}" PrivilegedThreadFactory\$1.class \
- -C "${TESTCLASSES}" Attack.class
-
-echo "Running test ..."
-$JAVA ${TESTVMOPTS} \
- -Xbootclasspath/a:"${TESTCLASSES}/Privileged.jar" \
- -classpath "${TESTCLASSES}" \
- AsExecutor
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java Wed Jul 05 23:33:35 2017 +0200
@@ -24,8 +24,7 @@
/* @test
* @bug 4607272 6842687 6878369 6944810 7023403
* @summary Unit test for AsynchronousSocketChannel(use -Dseed=X to set PRNG seed)
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main Basic -skipSlowConnectTest
* @key randomness intermittent
*/
@@ -40,7 +39,7 @@
import java.util.Set;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class Basic {
private static final Random RAND = RandomFactory.getRandom();
--- a/jdk/test/java/nio/channels/FileChannel/Transfer.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/channels/FileChannel/Transfer.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,8 +25,7 @@
* @bug 4434723 4482726 4559072 4795550 5081340 5103988 6984545
* @summary Test FileChannel.transferFrom and transferTo (use -Dseed=X to set PRNG seed)
* @library ..
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run testng/timeout=300 Transfer
* @key randomness
*/
@@ -51,7 +50,7 @@
import java.util.Random;
import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import org.testng.annotations.Test;
--- a/jdk/test/java/nio/channels/Selector/SelectAndClose.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/channels/Selector/SelectAndClose.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,7 +23,6 @@
/* @test
* @bug 5004077
- * @key intermittent
* @summary Check blocking of select and close
*/
--- a/jdk/test/java/nio/channels/Selector/WakeupAfterClose.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/channels/Selector/WakeupAfterClose.java Wed Jul 05 23:33:35 2017 +0200
@@ -24,7 +24,6 @@
/* @test
* @bug 6524172
* @summary Invoking wakeup on closed Selector can throw NPE if close resets interrupt status
- * @key intermittent
*/
import java.io.IOException;
--- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,8 +23,7 @@
/* @test
* @summary Test socketchannel vector IO (use -Dseed=X to set PRNG seed)
- * @library .. /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library .. /test/lib
* @run main VectorIO
* @key randomness
*/
@@ -34,7 +33,7 @@
import java.nio.*;
import java.nio.channels.*;
import java.util.*;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class VectorIO {
--- a/jdk/test/java/nio/file/FileStore/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/file/FileStore/Basic.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,9 +25,7 @@
* @bug 4313887 6873621 6979526 7006126 7020517
* @summary Unit test for java.nio.file.FileStore
* @key intermittent
- * @library ..
- * @library .. /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library .. /test/lib
* @run main Basic
*/
@@ -35,8 +33,8 @@
import java.nio.file.attribute.*;
import java.io.File;
import java.io.IOException;
-import java.util.*;
-import jdk.testlibrary.FileUtils;
+
+import jdk.test.lib.util.FileUtils;
public class Basic {
--- a/jdk/test/java/nio/file/FileSystem/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/file/FileSystem/Basic.java Wed Jul 05 23:33:35 2017 +0200
@@ -24,8 +24,7 @@
/* @test
* @bug 4313887 6838333 8132497
* @summary Unit test for java.nio.file.FileSystem
- * @library .. /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library .. /test/lib
* @run main/othervm Basic
*/
@@ -41,7 +40,7 @@
import java.nio.file.Paths;
import java.nio.file.ProviderNotFoundException;
import java.util.HashMap;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
/**
* Simple sanity checks for java.nio.file.FileSystem
--- a/jdk/test/java/nio/file/Files/CopyAndMove.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/file/Files/CopyAndMove.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, 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
@@ -24,8 +24,8 @@
/* @test
* @bug 4313887 6838333 6917021 7006126 6950237 8006645
* @summary Unit test for java.nio.file.Files copy and move methods (use -Dseed=X to set PRNG seed)
- * @library .. /lib/testlibrary/
- * @build jdk.testlibrary.* CopyAndMove PassThroughFileSystem
+ * @library .. /test/lib
+ * @build CopyAndMove PassThroughFileSystem
* @run main/othervm CopyAndMove
* @key randomness
*/
@@ -39,7 +39,7 @@
import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class CopyAndMove {
static final Random rand = RandomFactory.getRandom();
--- a/jdk/test/java/nio/file/Files/StreamLinesTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/file/Files/StreamLinesTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,9 +23,8 @@
/* @test
* @bug 8072773
- * @library /lib/testlibrary/ /lib/testlibrary/bootlib
+ * @library /test/lib /lib/testlibrary/bootlib
* @build java.base/java.util.stream.OpTestCase
- * @build jdk.testlibrary.RandomFactory
* @run testng/othervm StreamLinesTest
* @summary Tests streams returned from Files.lines, primarily focused on
* testing the file-channel-based stream stream with supported
@@ -54,7 +53,7 @@
import java.util.stream.OpTestCase;
import java.util.stream.Stream;
import java.util.stream.TestData;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class StreamLinesTest extends OpTestCase {
--- a/jdk/test/java/nio/file/WatchService/LotsOfEvents.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/nio/file/WatchService/LotsOfEvents.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,8 +25,7 @@
* @bug 6907760 6929532
* @summary Tests WatchService behavior when lots of events are pending (use -Dseed=X to set PRNG seed)
* @library ..
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main/timeout=180 LotsOfEvents
* @key randomness
*/
@@ -37,7 +36,7 @@
import static java.nio.file.StandardWatchEventKinds.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class LotsOfEvents {
--- a/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java Wed Jul 05 23:33:35 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
@@ -23,76 +23,90 @@
* questions.
*/
-import java.io.File;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.util.JarUtils;
+
import java.io.FileWriter;
import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.nio.file.Path;
+import java.nio.file.Paths;
/*
* @test
* @bug 8048362
- * @compile ../../../lib/testlibrary/JavaToolUtils.java
- * DoPrivAccomplice.java DoPrivTest.java
* @summary Tests the doPrivileged with accomplice Generate two jars
* (DoPrivTest.jar and DoPrivAccomplice.jar) and grant permission to
- * DoPrivAccmplice.jar for reading user.home property from a PrivilagedAction.
- * Run DoPrivTest.jar and try to access user.home property using
+ * DoPrivAccmplice.jar for reading user.name property from a PrivilagedAction.
+ * Run DoPrivTest.jar and try to access user.name property using
* DoPrivAccmplice.jar.
- * @modules jdk.compiler
+ *
+ * @library /test/lib
+ *
* @run main/othervm DoPrivAccompliceTest
*/
public class DoPrivAccompliceTest {
+ private static final String ACTION_SOURCE = DoPrivAccomplice.class.getName();
+ private static final String TEST_SOURCE = DoPrivTest.class.getName();
- private static final String PWD = System.getProperty("test.classes", "./");
- private static final String ACTION_SOURCE = "DoPrivAccomplice";
- private static final String TEST_SOURCE = "DoPrivTest";
-
- public static void createPolicyFile(URI codebaseURL) throws IOException {
- String codebase = codebaseURL.toString();
+ private static void createPolicyFile(Path jarFile, Path policy) {
+ String codebase = jarFile.toFile().toURI().toString();
String quotes = "\"";
StringBuilder policyFile = new StringBuilder();
- policyFile.append("grant codeBase ").append(quotes).
- append(codebase).append(quotes).append("{\n").
- append("permission java.util.PropertyPermission ").
- append(quotes).append("user.name").append(quotes).
- append(",").append(quotes).append("read").append(quotes).
- append(";\n};");
- try (FileWriter writer = new FileWriter(new File(PWD, "java.policy"))) {
+ policyFile.append("grant codeBase ")
+ .append(quotes).append(codebase).append(quotes)
+ .append("{\n")
+ .append("permission java.util.PropertyPermission ")
+ .append(quotes).append("user.name").append(quotes)
+ .append(",")
+ .append(quotes).append("read").append(quotes)
+ .append(";\n};");
+ try (FileWriter writer = new FileWriter(policy.toFile())) {
writer.write(policyFile.toString());
- writer.close();
} catch (IOException e) {
- System.err.println("Error while creating policy file");
- throw e;
+ throw new Error("Error while creating policy file " + policy, e);
}
}
public static void main(String[] args) throws Exception {
- final File class1 = new File(PWD, ACTION_SOURCE + ".class");
- final File class2 = new File(PWD, TEST_SOURCE + ".class");
- final File jarFile1 = new File(PWD, ACTION_SOURCE + ".jar");
- final File jarFile2 = new File(PWD, TEST_SOURCE + ".jar");
- System.out.println("Compilation successfull");
- JavaToolUtils.createJar(jarFile1, Arrays.asList(new File[]{class1}));
+ // copy class files to pwd
+ ClassFileInstaller.main(ACTION_SOURCE, TEST_SOURCE);
+ Path pwd = Paths.get(".");
+ Path jarFile1 = pwd.resolve(ACTION_SOURCE + ".jar").toAbsolutePath();
+ Path jarFile2 = pwd.resolve(TEST_SOURCE + ".jar").toAbsolutePath();
+ Path policy = pwd.resolve("java.policy").toAbsolutePath();
+
+ JarUtils.createJar(jarFile1.toString(), ACTION_SOURCE + ".class");
System.out.println("Created jar file " + jarFile1);
- JavaToolUtils.createJar(jarFile2, Arrays.asList(new File[]{class2}));
+ JarUtils.createJar(jarFile2.toString(), TEST_SOURCE + ".class");
System.out.println("Created jar file " + jarFile2);
- createPolicyFile(jarFile1.toURI());
+
- List<String> commands = new ArrayList<>();
- final String pathSepartor = System.getProperty("path.separator");
- commands.add("-Djava.security.manager");
- commands.add("-Djava.security.policy=" + PWD + "/java.policy");
- commands.add("-classpath");
- commands.add(PWD + "/" + TEST_SOURCE + ".jar" + pathSepartor
- + PWD + "/" + ACTION_SOURCE + ".jar");
- commands.add(TEST_SOURCE);
- if (JavaToolUtils.runJava(commands) == 0) {
- System.out.println("Test PASSES");
- }
+ String pathSepartor = System.getProperty("path.separator");
+ String[] commands = {
+ "-Djava.security.manager",
+ "-Djava.security.policy=" + policy,
+ "-classpath", jarFile1 + pathSepartor + jarFile2,
+ TEST_SOURCE
+ };
+
+ String userName = System.getProperty("user.name");
+
+ createPolicyFile(jarFile1, policy);
+ System.out.println("Created policy for " + jarFile1);
+ ProcessTools.executeTestJava(commands)
+ .shouldHaveExitValue(0)
+ .shouldContain(userName)
+ .stderrShouldBeEmpty();
+
+ createPolicyFile(jarFile2, policy);
+ System.out.println("Created policy for " + jarFile2);
+ ProcessTools.executeTestJava(commands)
+ .shouldNotHaveExitValue(0)
+ .shouldNotContain(userName)
+ .stderrShouldContain("java.security.AccessControlException");
+
+ System.out.println("Test PASSES");
}
-
}
--- a/jdk/test/java/security/KeyStore/PKCS12/EntryProtectionTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/KeyStore/PKCS12/EntryProtectionTest.java Wed Jul 05 23:33:35 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
@@ -30,7 +30,7 @@
import java.util.List;
import java.util.Random;
import javax.crypto.spec.PBEParameterSpec;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import static java.lang.System.out;
import java.util.Arrays;
@@ -40,7 +40,7 @@
* @summary Test for feature 'support stronger entry protection'. An entry is
* stored to keystore with different PasswordProtection objects which are
* specified by different PBE algorithms (use -Dseed=X to set PRNG seed)
- * @library /lib/testlibrary ../
+ * @library /test/lib /lib/testlibrary ../
* @key randomness
*/
public class EntryProtectionTest {
--- a/jdk/test/java/security/MessageDigest/TestDigestIOStream.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/MessageDigest/TestDigestIOStream.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,6 +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
@@ -32,7 +31,7 @@
import java.security.Security;
import java.util.Arrays;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import static java.lang.System.out;
/**
@@ -41,7 +40,7 @@
* @summary MessageDigest tests with DigestIOStream
* @author Kevin Liu
* @key randomness
- * @library /lib/testlibrary
+ * @library /test/lib
* @run main/timeout=180 TestDigestIOStream
*/
--- a/jdk/test/java/security/MessageDigest/TestSameLength.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/MessageDigest/TestSameLength.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,6 +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,7 +26,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* @test
@@ -36,7 +35,7 @@
* algorithm/dataLen/(update,digest methods).
* @author Kevin Liu
* @key randomness
- * @library /lib/testlibrary
+ * @library /test/lib
*/
public class TestSameLength {
--- a/jdk/test/java/security/MessageDigest/TestSameValue.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/MessageDigest/TestSameValue.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,6 +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
@@ -28,7 +27,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* @test
@@ -37,7 +36,7 @@
* with various update/digest methods.
* @author Kevin Liu
* @key randomness
- * @library /lib/testlibrary
+ * @library /test/lib
*/
public class TestSameValue {
--- a/jdk/test/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java Wed Jul 05 23:33:35 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
@@ -27,13 +27,13 @@
import java.nio.file.Paths;
import java.security.AccessController;
import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8050402
* @summary Check policy is extensible with user defined permissions
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @compile TVJar/TVPermission.java
* @run main ExtensiblePolicyWithJarTest
*/
--- a/jdk/test/java/security/Signature/Offsets.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/security/Signature/Offsets.java Wed Jul 05 23:33:35 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
@@ -30,7 +30,7 @@
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/*
* @test
@@ -41,7 +41,7 @@
* get random set of clear text data to sign. After the signature
* generation, the test tries to verify signature with the above API
* and passing in different signature offset (0, 33, 66, 99).
- * @library /lib/testlibrary
+ * @library /test/lib
* @run main Offsets SUN NONEwithDSA
* @run main Offsets SUN SHA1withDSA
* @run main Offsets SUN SHA224withDSA
--- a/jdk/test/java/util/Base64/TestBase64.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/Base64/TestBase64.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
* @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
* 8014217 8025003 8026330 8028397 8129544 8165243
* @summary tests java.util.Base64
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main TestBase64
* @key randomness
*/
@@ -43,7 +42,7 @@
import java.util.List;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class TestBase64 {
--- a/jdk/test/java/util/List/SubList.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/List/SubList.java Wed Jul 05 23:33:35 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
@@ -24,8 +24,7 @@
/*
* @test
* @bug 8079136
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run testng SubList
* @summary Basic functionality of sublists
* @key randomness
@@ -46,7 +45,7 @@
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class SubList extends org.testng.Assert {
--- a/jdk/test/java/util/WeakHashMap/GCDuringIteration.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/WeakHashMap/GCDuringIteration.java Wed Jul 05 23:33:35 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
@@ -24,8 +24,7 @@
/*
* @test
* @bug 6499848
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run main GCDuringIteration
* @summary Check that iterators work properly in the presence of
* concurrent finalization and removal of elements.
@@ -43,7 +42,7 @@
import java.util.WeakHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.function.BooleanSupplier;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class GCDuringIteration {
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java Wed Jul 05 23:33:35 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
@@ -25,8 +25,7 @@
* @test
* @bug 6450200
* @summary Test proper handling of pool state changes
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.RandomFactory
+ * @library /test/lib
* @run main/othervm ConfigChanges
* @key randomness
* @author Martin Buchholz
@@ -45,7 +44,7 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.function.Supplier;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class ConfigChanges {
static final ThreadGroup tg = new ThreadGroup("pool");
--- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Wed Jul 05 23:33:35 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,9 +26,8 @@
* @bug 8132734 8144062 8165723
* @summary Test the extended API and the aliasing additions in JarFile that
* support multi-release jar files
- * @library /lib/testlibrary/java/util/jar /lib/testlibrary/
+ * @library /lib/testlibrary/java/util/jar /test/lib
* @build Compiler JarBuilder CreateMultiReleaseTestJars
- * @build jdk.testlibrary.RandomFactory
* @run testng MultiReleaseJarAPI
*/
@@ -45,7 +44,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
--- a/jdk/test/java/util/logging/FileHandlerMaxLocksTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/logging/FileHandlerMaxLocksTest.java Wed Jul 05 23:33:35 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,7 @@
* "java.util.logging.FileHandler.maxLocks" which will be present in
* "logging.properties" file with default value of 100. This property can be
* overriden by specifying this property in the custom config file.
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library /test/lib
* @author rpatil
* @run main/othervm FileHandlerMaxLocksTest
*/
@@ -40,7 +39,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.logging.FileHandler;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class FileHandlerMaxLocksTest {
--- a/jdk/test/java/util/regex/RegExTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/regex/RegExTest.java Wed Jul 05 23:33:35 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
@@ -37,8 +37,7 @@
* 6328855 6192895 6345469 6988218 6693451 7006761 8140212 8143282 8158482
* 8176029
*
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main RegExTest
* @key randomness
*/
@@ -52,7 +51,7 @@
import java.util.*;
import java.nio.CharBuffer;
import java.util.function.Predicate;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* This is a test class created to check the operation of
--- a/jdk/test/java/util/zip/InflaterInputStream/TestAvailable.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/zip/InflaterInputStream/TestAvailable.java Wed Jul 05 23:33:35 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
@@ -22,8 +22,7 @@
*/
/* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main TestAvailable
* @bug 7031075 8161426
* @summary Make sure that available() method behaves as expected.
@@ -33,7 +32,7 @@
import java.io.*;
import java.util.Random;
import java.util.zip.*;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class TestAvailable {
--- a/jdk/test/java/util/zip/ZipFile/MultiThreadedReadTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/zip/ZipFile/MultiThreadedReadTest.java Wed Jul 05 23:33:35 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
@@ -24,8 +24,7 @@
/* @test
* @bug 8038491
* @summary Crash in ZipFile.read() when ZipFileInputStream is shared between threads
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library /test/lib
* @run main MultiThreadedReadTest
* @key randomness
*/
@@ -38,7 +37,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class MultiThreadedReadTest extends Thread {
--- a/jdk/test/java/util/zip/ZipFile/ReadLongZipFileName.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/zip/ZipFile/ReadLongZipFileName.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2013, 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
@@ -24,15 +24,14 @@
/**
* @test
* @bug 6374379
- * @library ../../../../lib/testlibrary
+ * @library /test/lib
* @summary Verify that we can read zip file names > 255 chars long
*/
import java.io.*;
import java.util.jar.*;
-import java.util.zip.*;
import java.util.Stack;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class ReadLongZipFileName {
private static String entryName = "testFile.txt";;
--- a/jdk/test/java/util/zip/ZipFile/ZipEntryFreeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/java/util/zip/ZipFile/ZipEntryFreeTest.java Wed Jul 05 23:33:35 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,8 +24,7 @@
/* @test
* @bug 6907252
* @summary ZipFileInputStream Not Thread-Safe
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main ZipEntryFreeTest
*/
@@ -35,7 +34,7 @@
import java.util.Timer;
import java.util.TimerTask;
import java.util.zip.*;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class ZipEntryFreeTest extends Thread {
--- a/jdk/test/javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java Wed Jul 05 23:33:35 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,8 +23,7 @@
/**
* @test
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
*
* @bug 8145776
* @author a.stepanov
@@ -47,7 +46,7 @@
import javax.imageio.*;
import javax.imageio.stream.*;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class MultiPageTest {
--- a/jdk/test/javax/net/ssl/DTLS/DTLSIncorrectAppDataTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/DTLS/DTLSIncorrectAppDataTest.java Wed Jul 05 23:33:35 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,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS incorrect app data packages unwrapping.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.krb5:+open
@@ -49,7 +49,7 @@
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* Testing DTLS incorrect app data packages unwrapping. Incorrect application
--- a/jdk/test/javax/net/ssl/DTLS/DTLSRehandshakeWithCipherChangeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/DTLS/DTLSRehandshakeWithCipherChangeTest.java Wed Jul 05 23:33:35 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,7 +27,7 @@
* @summary Testing DTLS engines re-handshaking with cipher change. New cipher
* is taken randomly from the supporetd ciphers list.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
--- a/jdk/test/javax/net/ssl/DTLS/DTLSSequenceNumberTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/DTLS/DTLSSequenceNumberTest.java Wed Jul 05 23:33:35 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,7 +27,7 @@
* @summary Testing DTLS records sequence number property support in application
* data exchange.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.krb5:+open
@@ -51,7 +51,7 @@
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* Testing DTLS records sequence number property support in application data
--- a/jdk/test/javax/net/ssl/DTLSv10/DTLSv10IncorrectAppDataTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/DTLSv10/DTLSv10IncorrectAppDataTest.java Wed Jul 05 23:33:35 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,7 +26,7 @@
* @bug 8043758
* @summary Testing DTLS incorrect app data packages unwrapping.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon /javax/net/ssl/DTLS
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon /javax/net/ssl/DTLS
* @modules java.security.jgss
* jdk.security.auth
* java.security.jgss/sun.security.krb5:+open
--- a/jdk/test/javax/net/ssl/DTLSv10/DTLSv10RehandshakeWithCipherChangeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/DTLSv10/DTLSv10RehandshakeWithCipherChangeTest.java Wed Jul 05 23:33:35 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,7 +27,7 @@
* @summary Testing DTLS engines re-handshaking with cipher change. New cipher
* is taken randomly from the supporetd ciphers list.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
--- a/jdk/test/javax/net/ssl/TLS/TLSRehandshakeWithCipherChangeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/TLS/TLSRehandshakeWithCipherChangeTest.java Wed Jul 05 23:33:35 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,7 +27,7 @@
* @summary Testing TLS engines re-handshaking with cipher change. New cipher
* is taken randomly from the supporetd ciphers list.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
--- a/jdk/test/javax/net/ssl/TLSCommon/RehandshakeWithCipherChangeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/TLSCommon/RehandshakeWithCipherChangeTest.java Wed Jul 05 23:33:35 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
@@ -26,7 +26,7 @@
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
/**
* Testing SSLEngines re-handshaking with cipher change. New cipher is taken
--- a/jdk/test/javax/net/ssl/TLSv1/TLSRehandshakeWithCipherChangeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/TLSv1/TLSRehandshakeWithCipherChangeTest.java Wed Jul 05 23:33:35 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,7 +27,7 @@
* @summary Testing TLS engines re-handshaking with cipher change. New cipher
* is taken randomly from the supporetd ciphers list.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
--- a/jdk/test/javax/net/ssl/TLSv11/TLSRehandshakeWithCipherChangeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/net/ssl/TLSv11/TLSRehandshakeWithCipherChangeTest.java Wed Jul 05 23:33:35 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,7 +27,7 @@
* @summary Testing TLS engines re-handshaking with cipher change. New cipher
* is taken randomly from the supporetd ciphers list.
* @key randomness
- * @library /sun/security/krb5/auto /lib/testlibrary /javax/net/ssl/TLSCommon
+ * @library /sun/security/krb5/auto /test/lib /javax/net/ssl/TLSCommon
* @modules java.security.jgss
* java.security.jgss/sun.security.krb5:+open
* java.security.jgss/sun.security.krb5.internal:+open
--- a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java Wed Jul 05 23:33:35 2017 +0200
@@ -36,6 +36,7 @@
* @bug 4946913
* @summary DirectClip doesn't kill the thread correctly, sometimes
* @run main/othervm ClipCloseLoss
+ * @key intermittent
*/
public class ClipCloseLoss {
static int frameCount = 441000; // lets say 10 seconds
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,7 @@
* @key randomness
*
* @modules java.desktop/sun.awt
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
*
* @run main/timeout=300 bug7123767
*/
@@ -55,7 +54,7 @@
import java.util.Collections;
import java.util.Random;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class bug7123767 extends JFrame {
--- a/jdk/test/jdk/internal/util/jar/TestVersionedStream.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/jdk/internal/util/jar/TestVersionedStream.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,9 +25,8 @@
* @test
* @bug 8163798
* @summary basic tests for multi-release jar versioned streams
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.jartool/sun.tools.jar java.base/jdk.internal.util.jar
- * @build jdk.testlibrary.FileUtils
* @run testng TestVersionedStream
*/
@@ -57,7 +56,7 @@
import java.util.stream.Stream;
import java.util.zip.ZipFile;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class TestVersionedStream {
private final Path userdir;
--- a/jdk/test/jdk/modules/incubator/ImageModules.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/jdk/modules/incubator/ImageModules.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,7 +25,7 @@
* @test
* @bug 8170859
* @summary Basic test for incubator modules in jmods and images
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @key intermittent
* @modules jdk.compiler jdk.jartool jdk.jlink
* @build CompilerUtils
@@ -39,14 +39,13 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.spi.ToolProvider;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
--- a/jdk/test/jdk/security/jarsigner/Spec.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/jdk/security/jarsigner/Spec.java Wed Jul 05 23:33:35 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,7 +25,7 @@
* @test
* @bug 8056174
* @summary Make sure JarSigner impl conforms to spec
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/sun.security.tools.keytool
* java.base/sun.security.provider.certpath
* jdk.jartool
@@ -35,7 +35,7 @@
import com.sun.jarsigner.ContentSigner;
import com.sun.jarsigner.ContentSignerParameters;
import jdk.security.jarsigner.JarSigner;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
import sun.security.provider.certpath.X509CertPath;
import java.io.File;
--- a/jdk/test/lib/testlibrary/JavaToolUtils.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. 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.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.file.Files;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/**
- * Utils class for compiling , creating jar file and executing a java command
- *
- * @author Raghu Nair
- */
-
-public class JavaToolUtils {
-
- public static final long DEFAULT_WAIT_TIME = 10000;
-
- private JavaToolUtils() {
- }
-
- /**
- * Takes a list of files and compile these files into the working directory.
- *
- * @param files
- * @throws IOException
- */
- public static void compileFiles(List<File> files) throws IOException {
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- try (StandardJavaFileManager fileManager = compiler.
- getStandardFileManager(null, null, null)) {
- Iterable<? extends JavaFileObject> compilationUnit
- = fileManager.getJavaFileObjectsFromFiles(files);
- compiler.getTask(null, fileManager, null, null, null,
- compilationUnit).call();
- }
- }
-
- /**
- * Create a jar file using the list of files provided.
- *
- * @param jar
- * @param files
- * @throws IOException
- */
- public static void createJar(File jar, List<File> files)
- throws IOException {
- Manifest manifest = new Manifest();
- manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,
- "1.0");
- try (JarOutputStream target = new JarOutputStream(
- new FileOutputStream(jar), manifest)) {
- for (File file : files) {
- add(file, target);
- }
- }
- }
-
- private static void add(File source, JarOutputStream target)
- throws IOException {
- Objects.requireNonNull(source, "source cannot be null");
- Objects.requireNonNull(target, "target cannot be null");
- // not tested against directories and from different path.
- String name = source.getName();
- if (source.isDirectory()) {
- if (!name.isEmpty()) {
- if (!name.endsWith("/")) {
- name += "/";
- }
- JarEntry entry = new JarEntry(name);
- entry.setTime(source.lastModified());
- target.putNextEntry(entry);
- target.closeEntry();
- }
- for (File nestedFile : source.listFiles()) {
- add(nestedFile, target);
- }
- return;
- }
- System.out.println("Adding entry " + name);
- JarEntry entry = new JarEntry(name);
- entry.setTime(source.lastModified());
- target.putNextEntry(entry);
- Files.copy(source.toPath(), target);
- target.closeEntry();
- }
-
- /**
- * Runs java command with provided arguments. Caller should not pass java
- * command in the argument list.
- *
- * @param commands
- * @param waitTime time to wait for the command to exit in milli seconds
- * @return
- * @throws Exception
- */
- public static int runJava(List<String> commands,long waitTime)
- throws Exception {
- String java = System.getProperty("java.home") + "/bin/java";
- commands.add(0, java);
- String command = commands.toString().replace(",", " ");
- System.out.println("Executing the following command \n" + command);
- ProcessBuilder processBuilder = new ProcessBuilder(commands);
- final Process process = processBuilder.start();
- BufferedReader errorStream = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- BufferedReader outStream = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- String errorLine;
- StringBuilder errors = new StringBuilder();
- String outLines;
- while ((errorLine = errorStream.readLine()) != null) {
- errors.append(errorLine).append("\n");
- }
- while ((outLines = outStream.readLine()) != null) {
- System.out.println(outLines);
- }
- errorLine = errors.toString();
- System.err.println(errorLine);
- process.waitFor(waitTime, TimeUnit.MILLISECONDS);
- int exitStatus = process.exitValue();
- if (exitStatus != 0 && errorLine != null && errorLine.isEmpty()) {
- throw new RuntimeException(errorLine);
- }
- return exitStatus;
- }
-
- /**
- * Runs java command with provided arguments. Caller should not pass java
- * command in the argument list.
- *
- * @param commands
- * @return
- * @throws Exception
- */
- public static int runJava(List<String> commands) throws Exception {
- return runJava(commands, DEFAULT_WAIT_TIME);
- }
-
- /**
- * Run any command
- * @param commands
- * @return
- * @throws Exception
- */
- public static int runCommand(List<String> commands) throws Exception {
- String command = commands.toString().replace(",", " ");
- System.out.println("Executing the following command \n" + command);
- ProcessBuilder processBuilder = new ProcessBuilder(commands);
- final Process process = processBuilder.start();
- BufferedReader errorStream = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- BufferedReader outStream = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- String errorLine;
- StringBuilder errors = new StringBuilder();
- String outLines;
- while ((errorLine = errorStream.readLine()) != null) {
- errors.append(errorLine).append("\n");
- }
- while ((outLines = outStream.readLine()) != null) {
- System.out.println(outLines);
- }
- errorLine = errors.toString();
- System.err.println(errorLine);
- int exitStatus = process.exitValue();
- if (exitStatus != 0 && errorLine != null && errorLine.isEmpty()) {
- throw new RuntimeException(errorLine);
- }
- return exitStatus;
- }
-
-
-}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/FileUtils.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.io.IOException;
-import java.nio.file.DirectoryNotEmptyException;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * Common library for various test file utility functions.
- */
-public final class FileUtils {
-
- private static final boolean isWindows =
- System.getProperty("os.name").startsWith("Windows");
- private static final int RETRY_DELETE_MILLIS = isWindows ? 500 : 0;
- private static final int MAX_RETRY_DELETE_TIMES = isWindows ? 15 : 0;
-
- /**
- * Deletes a file, retrying if necessary.
- *
- * @param path the file to delete
- *
- * @throws NoSuchFileException
- * if the file does not exist (optional specific exception)
- * @throws DirectoryNotEmptyException
- * if the file is a directory and could not otherwise be deleted
- * because the directory is not empty (optional specific exception)
- * @throws IOException
- * if an I/O error occurs
- */
- public static void deleteFileWithRetry(Path path)
- throws IOException
- {
- try {
- deleteFileWithRetry0(path);
- } catch (InterruptedException x) {
- throw new IOException("Interrupted while deleting.", x);
- }
- }
-
- /**
- * Deletes a file, retrying if necessary.
- * No exception thrown if file doesn't exist.
- *
- * @param path the file to delete
- *
- * @throws NoSuchFileException
- * if the file does not exist (optional specific exception)
- * @throws DirectoryNotEmptyException
- * if the file is a directory and could not otherwise be deleted
- * because the directory is not empty (optional specific exception)
- * @throws IOException
- * if an I/O error occurs
- */
- public static void deleteFileIfExistsWithRetry(Path path)
- throws IOException
- {
- try {
- if(Files.exists(path))
- deleteFileWithRetry0(path);
- } catch (InterruptedException x) {
- throw new IOException("Interrupted while deleting.", x);
- }
- }
-
- private static void deleteFileWithRetry0(Path path)
- throws IOException, InterruptedException
- {
- int times = 0;
- IOException ioe = null;
- while (true) {
- try {
- Files.delete(path);
- while (Files.exists(path)) {
- times++;
- if (times > MAX_RETRY_DELETE_TIMES)
- throw new IOException("File still exists after " + times + " waits.");
- Thread.sleep(RETRY_DELETE_MILLIS);
- }
- break;
- } catch (NoSuchFileException | DirectoryNotEmptyException x) {
- throw x;
- } catch (IOException x) {
- // Backoff/retry in case another process is accessing the file
- times++;
- if (ioe == null)
- ioe = x;
- else
- ioe.addSuppressed(x);
-
- if (times > MAX_RETRY_DELETE_TIMES)
- throw ioe;
- Thread.sleep(RETRY_DELETE_MILLIS);
- }
- }
- }
-
- /**
- * Deletes a directory and its subdirectories, retrying if necessary.
- *
- * @param dir the directory to delete
- *
- * @throws IOException
- * If an I/O error occurs. Any such exceptions are caught
- * internally. If only one is caught, then it is re-thrown.
- * If more than one exception is caught, then the second and
- * following exceptions are added as suppressed exceptions of the
- * first one caught, which is then re-thrown.
- */
- public static void deleteFileTreeWithRetry(Path dir)
- throws IOException
- {
- IOException ioe = null;
- final List<IOException> excs = deleteFileTreeUnchecked(dir);
- if (!excs.isEmpty()) {
- ioe = excs.remove(0);
- for (IOException x : excs)
- ioe.addSuppressed(x);
- }
- if (ioe != null)
- throw ioe;
- }
-
- public static List<IOException> deleteFileTreeUnchecked(Path dir) {
- final List<IOException> excs = new ArrayList<>();
- try {
- java.nio.file.Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
- try {
- deleteFileWithRetry0(file);
- } catch (IOException x) {
- excs.add(x);
- } catch (InterruptedException x) {
- excs.add(new IOException("Interrupted while deleting.", x));
- return FileVisitResult.TERMINATE;
- }
- return FileVisitResult.CONTINUE;
- }
- @Override
- public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
- try {
- deleteFileWithRetry0(dir);
- } catch (IOException x) {
- excs.add(x);
- } catch (InterruptedException x) {
- excs.add(new IOException("Interrupted while deleting.", x));
- return FileVisitResult.TERMINATE;
- }
- return FileVisitResult.CONTINUE;
- }
- @Override
- public FileVisitResult visitFileFailed(Path file, IOException exc) {
- excs.add(exc);
- return FileVisitResult.CONTINUE;
- }
- });
- } catch (IOException x) {
- excs.add(x);
- }
- return excs;
- }
-
- /**
- * Checks whether all file systems are accessible. This is performed
- * by checking free disk space on all mounted file systems via a
- * separate, spawned process. File systems are considered to be
- * accessible if this process completes successfully before a given
- * fixed duration has elapsed.
- *
- * @implNote On Unix this executes the {@code df} command in a separate
- * process and on Windows always returns {@code true}.
- */
- public static boolean areFileSystemsAccessible() throws IOException {
- boolean areFileSystemsAccessible = true;
- if (!isWindows) {
- // try to check whether 'df' hangs
- System.out.println("\n--- df output ---");
- System.out.flush();
- Process proc = new ProcessBuilder("df").inheritIO().start();
- try {
- proc.waitFor(90, TimeUnit.SECONDS);
- } catch (InterruptedException ignored) {
- }
- try {
- int exitValue = proc.exitValue();
- if (exitValue != 0) {
- System.err.printf("df process exited with %d != 0%n",
- exitValue);
- areFileSystemsAccessible = false;
- }
- } catch (IllegalThreadStateException ignored) {
- System.err.println("df command apparently hung");
- areFileSystemsAccessible = false;
- }
- }
- return areFileSystemsAccessible;
- }
-}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/JarUtils.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-/**
- * Common library for various test jar file utility functions.
- */
-public final class JarUtils {
-
- /**
- * Create jar file with specified files. If a specified file does not exist,
- * a new jar entry will be created with the file name itself as the content.
- */
- public static void createJar(String dest, String... files)
- throws IOException {
- try (JarOutputStream jos = new JarOutputStream(
- new FileOutputStream(dest), new Manifest())) {
- for (String file : files) {
- System.out.println(String.format("Adding %s to %s",
- file, dest));
-
- // add an archive entry, and write a file
- jos.putNextEntry(new JarEntry(file));
- try (FileInputStream fis = new FileInputStream(file)) {
- fis.transferTo(jos);
- } catch (FileNotFoundException e) {
- jos.write(file.getBytes());
- }
- }
- }
- System.out.println();
- }
-
- /**
- * Add or remove specified files to existing jar file. If a specified file
- * to be updated or added does not exist, the jar entry will be created
- * with the file name itself as the content.
- *
- * @param src the original jar file name
- * @param dest the new jar file name
- * @param files the files to update. The list is broken into 2 groups
- * by a "-" string. The files before in the 1st group will
- * be either updated or added. The files in the 2nd group
- * will be removed. If no "-" exists, all files belong to
- * the 1st group.
- */
- public static void updateJar(String src, String dest, String... files)
- throws IOException {
- try (JarOutputStream jos = new JarOutputStream(
- new FileOutputStream(dest))) {
-
- // copy each old entry into destination unless the entry name
- // is in the updated list
- List<String> updatedFiles = new ArrayList<>();
- try (JarFile srcJarFile = new JarFile(src)) {
- Enumeration<JarEntry> entries = srcJarFile.entries();
- while (entries.hasMoreElements()) {
- JarEntry entry = entries.nextElement();
- String name = entry.getName();
- boolean found = false;
- boolean update = true;
- for (String file : files) {
- if (file.equals("-")) {
- update = false;
- } else if (name.equals(file)) {
- updatedFiles.add(file);
- found = true;
- break;
- }
- }
-
- if (found) {
- if (update) {
- System.out.println(String.format("Updating %s with %s",
- dest, name));
- jos.putNextEntry(new JarEntry(name));
- try (FileInputStream fis = new FileInputStream(name)) {
- fis.transferTo(jos);
- } catch (FileNotFoundException e) {
- jos.write(name.getBytes());
- }
- } else {
- System.out.println(String.format("Removing %s from %s",
- name, dest));
- }
- } else {
- System.out.println(String.format("Copying %s to %s",
- name, dest));
- jos.putNextEntry(entry);
- srcJarFile.getInputStream(entry).transferTo(jos);
- }
- }
- }
-
- // append new files
- for (String file : files) {
- if (file.equals("-")) {
- break;
- }
- if (!updatedFiles.contains(file)) {
- System.out.println(String.format("Adding %s with %s",
- dest, file));
- jos.putNextEntry(new JarEntry(file));
- try (FileInputStream fis = new FileInputStream(file)) {
- fis.transferTo(jos);
- } catch (FileNotFoundException e) {
- jos.write(file.getBytes());
- }
- }
- }
- }
- System.out.println();
- }
-
-}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/RandomFactory.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/RandomFactory.java Wed Jul 05 23:33:35 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
@@ -30,7 +30,12 @@
* Factory class which generates and prints to STDOUT a long-valued seed
* for use in initializing a PRNG. An instance of {@code Random} or
* {@code SplittableRandom} may likewise be obtained.
+ *
+ * @deprecated This class is deprecated. Use the one from
+ * {@code <root>/test/lib/jdk/test/lib}
+ *
*/
+@Deprecated
public class RandomFactory {
/**
* Attempt to obtain the seed from the value of the "seed" property.
--- a/jdk/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/CodeCacheOverflowProcessor.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.testlibrary.jsr292;
-
-import jdk.testlibrary.Utils;
-
-/**
- * Helper class used to catch and process VirtualMachineError with message "Out
- * of space in CodeCache". Some JSR292 tests run out of code cache size, so code
- * cache overflows and VME is thrown. This VME is considered as non-critical in
- * some JSR292 tests, so it should be processed to prevent test failure.
- */
-public class CodeCacheOverflowProcessor {
-
- /**
- * Checks if an instance of Throwable is caused by VirtualMachineError with
- * message "Out of space in CodeCache". May be used as filter in method
- * {@code jdk.testlibrary.Utils.filterException}.
- *
- * @param t - Throwable to check.
- * @return true if Throwable is caused by VME, false otherwise.
- */
- public static Boolean isThrowableCausedByVME(Throwable t) {
- Throwable causeOfT = t;
- do {
- if (causeOfT instanceof VirtualMachineError
- && causeOfT.getMessage().matches(".*[Oo]ut of space"
- + " in CodeCache.*")) {
- return true;
- }
- causeOfT = causeOfT != null ? causeOfT.getCause() : null;
- } while (causeOfT != null && causeOfT != t);
- return false;
- }
-
- /**
- * Checks if the given test throws an exception caused by
- * VirtualMachineError with message "Out of space in CodeCache", and, if VME
- * takes place, processes it so that no exception is thrown, and prints its
- * stack trace. If test throws exception not caused by VME, this method just
- * re-throws this exception.
- *
- * @param test - test to check for and process VirtualMachineError.
- * @return - an exception caused by VME or null
- * if test has thrown no exception.
- * @throws Throwable - if test has thrown an exception
- * that is not caused by VME.
- */
- public static Throwable runMHTest(Utils.ThrowingRunnable test) throws Throwable {
- Throwable t = Utils.filterException(test::run,
- CodeCacheOverflowProcessor::isThrowableCausedByVME);
- if (t != null) {
- System.err.printf("%nNon-critical exception caught becuse of"
- + " code cache size is not enough to run all test cases.%n%n");
- }
- return t;
- }
-}
--- a/jdk/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/Helper.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.testlibrary.jsr292;
-
-import jdk.testlibrary.Asserts;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import java.lang.reflect.Array;
-import java.util.*;
-
-public class Helper {
- /** Flag for verbose output, true if {@code -Dverbose} specified */
- public static final boolean IS_VERBOSE
- = System.getProperty("verbose") != null;
- /**
- * Flag for thorough testing -- all test will be executed,
- * true if {@code -Dthorough} specified. */
- public static final boolean IS_THOROUGH
- = System.getProperty("thorough") != null;
- /** Random number generator w/ initial seed equal to {@code -Dseed} */
- public static final Random RNG;
-
- static {
- String str = System.getProperty("seed");
- long seed = str != null ? Long.parseLong(str) : new Random().nextLong();
- RNG = new Random(seed);
- System.out.printf("-Dseed=%d%n", seed);
- }
-
- public static final long TEST_LIMIT;
- static {
- String str = System.getProperty("testLimit");
- TEST_LIMIT = str != null ? Long.parseUnsignedLong(str) : 2000L;
- System.out.printf("-DtestLimit=%d%n", TEST_LIMIT);
- }
-
- public static final int MAX_ARITY = 254;
- public static final String MISSING_ARG = "missingArg";
- public static final String MISSING_ARG_2 = "missingArg#2";
-
- private static final int
- // first int value
- ONE_MILLION = (1000 * 1000),
- // scale factor to reach upper 32 bits
- TEN_BILLION = (10 * 1000 * 1000 * 1000),
- // <<1 makes space for sign bit;
- INITIAL_ARG_VAL = ONE_MILLION << 1;
-
- public static final MethodHandle AS_LIST;
-
- static {
- try {
- AS_LIST = MethodHandles.lookup().findStatic(
- Arrays.class, "asList",
- MethodType.methodType(List.class, Object[].class));
- } catch (NoSuchMethodException | IllegalAccessException ex) {
- throw new Error(ex);
- }
- }
-
- public static boolean isDoubleCost(Class<?> aClass) {
- return aClass == double.class || aClass == long.class;
- }
-
- private static List<List<Object>> calledLog = new ArrayList<>();
- private static long nextArgVal;
-
- public static void assertCalled(String name, Object... args) {
- assertCalled(0, name, args);
- }
-
- public static void assertCalled(int lag, String name, Object... args) {
- Object expected = logEntry(name, args);
- Object actual = getCalled(lag);
- Asserts.assertEQ(expected, actual, "method call w/ lag = " + lag);
- }
-
- public static Object called(String name, Object... args) {
- List<Object> entry = logEntry(name, args);
- calledLog.add(entry);
- return entry;
- }
-
- private static List<Object> logEntry(String name, Object... args) {
- return Arrays.asList(name, Arrays.asList(args));
- }
-
- public static void clear() {
- calledLog.clear();
- }
-
- public static List<Object> getCalled(int lag) {
- int size = calledLog.size();
- return size <= lag ? null : calledLog.get(size - lag - 1);
- }
-
- public static List<Class<?>> randomClasses(Class<?>[] classes, int size) {
- List<Class<?>> result = new ArrayList<>(size);
- for (int i = 0; i < size; ++i) {
- result.add(classes[RNG.nextInt(classes.length)]);
- }
- return result;
- }
-
- public static List<Class<?>> getParams(List<Class<?>> classes,
- boolean isVararg, int argsCount) {
- boolean unmodifiable = true;
- List<Class<?>> result = classes.subList(0,
- Math.min(argsCount, (MAX_ARITY / 2) - 1));
- int extra = 0;
- if (argsCount >= MAX_ARITY / 2) {
- result = new ArrayList<>(result);
- unmodifiable = false;
- extra = (int) result.stream().filter(Helper::isDoubleCost).count();
- int i = result.size();
- while (result.size() + extra < argsCount) {
- Class<?> aClass = classes.get(i);
- if (Helper.isDoubleCost(aClass)) {
- ++extra;
- if (result.size() + extra >= argsCount) {
- break;
- }
- }
- result.add(aClass);
- }
- }
- if (isVararg && result.size() > 0) {
- if (unmodifiable) {
- result = new ArrayList<>(result);
- }
- int last = result.size() - 1;
- Class<?> aClass = result.get(last);
- aClass = Array.newInstance(aClass, 2).getClass();
- result.set(last, aClass);
- }
- return result;
- }
-
- public static MethodHandle addTrailingArgs(MethodHandle target, int nargs,
- List<Class<?>> classes) {
- int targetLen = target.type().parameterCount();
- int extra = (nargs - targetLen);
- if (extra <= 0) {
- return target;
- }
- List<Class<?>> fakeArgs = new ArrayList<>(extra);
- for (int i = 0; i < extra; ++i) {
- fakeArgs.add(classes.get(i % classes.size()));
- }
- return MethodHandles.dropArguments(target, targetLen, fakeArgs);
- }
-
- public static MethodHandle varargsList(int arity) {
- return AS_LIST.asCollector(Object[].class, arity);
- }
-
- private static long nextArg(boolean moreBits) {
- long val = nextArgVal++;
- long sign = -(val & 1); // alternate signs
- val >>= 1;
- if (moreBits)
- // Guarantee some bits in the high word.
- // In any case keep the decimal representation simple-looking,
- // with lots of zeroes, so as not to make the printed decimal
- // strings unnecessarily noisy.
- {
- val += (val % ONE_MILLION) * TEN_BILLION;
- }
- return val ^ sign;
- }
-
- private static int nextArg() {
- // Produce a 32-bit result something like ONE_MILLION+(smallint).
- // Example: 1_000_042.
- return (int) nextArg(false);
- }
-
- private static long nextArg(Class<?> kind) {
- if (kind == long.class || kind == Long.class ||
- kind == double.class || kind == Double.class)
- // produce a 64-bit result something like
- // ((TEN_BILLION+1) * (ONE_MILLION+(smallint)))
- // Example: 10_000_420_001_000_042.
- {
- return nextArg(true);
- }
- return (long) nextArg();
- }
-
- private static Object randomArg(Class<?> param) {
- Object wrap = castToWrapperOrNull(nextArg(param), param);
- if (wrap != null) {
- return wrap;
- }
-
- if (param.isInterface()) {
- for (Class<?> c : param.getClasses()) {
- if (param.isAssignableFrom(c) && !c.isInterface()) {
- param = c;
- break;
- }
- }
- }
- if (param.isArray()) {
- Class<?> ctype = param.getComponentType();
- Object arg = Array.newInstance(ctype, 2);
- Array.set(arg, 0, randomArg(ctype));
- return arg;
- }
- if (param.isInterface() && param.isAssignableFrom(List.class)) {
- return Arrays.asList("#" + nextArg());
- }
- if (param.isInterface() || param.isAssignableFrom(String.class)) {
- return "#" + nextArg();
- }
-
- try {
- return param.newInstance();
- } catch (InstantiationException | IllegalAccessException ex) {
- }
- return null; // random class not Object, String, Integer, etc.
- }
-
- public static Object[] randomArgs(Class<?>... params) {
- Object[] args = new Object[params.length];
- for (int i = 0; i < args.length; i++) {
- args[i] = randomArg(params[i]);
- }
- return args;
- }
-
- public static Object[] randomArgs(int nargs, Class<?> param) {
- Object[] args = new Object[nargs];
- for (int i = 0; i < args.length; i++) {
- args[i] = randomArg(param);
- }
- return args;
- }
-
- public static Object[] randomArgs(int nargs, Class<?>... params) {
- Object[] args = new Object[nargs];
- for (int i = 0; i < args.length; i++) {
- Class<?> param = params[i % params.length];
- args[i] = randomArg(param);
- }
- return args;
- }
-
- public static Object[] randomArgs(List<Class<?>> params) {
- return randomArgs(params.toArray(new Class<?>[params.size()]));
- }
-
- public static Object castToWrapper(Object value, Class<?> dst) {
- Object wrap = null;
- if (value instanceof Number) {
- wrap = castToWrapperOrNull(((Number) value).longValue(), dst);
- }
- if (value instanceof Character) {
- wrap = castToWrapperOrNull((char) (Character) value, dst);
- }
- if (wrap != null) {
- return wrap;
- }
- return dst.cast(value);
- }
-
- @SuppressWarnings("cast")
- // primitive cast to (long) is part of the pattern
- private static Object castToWrapperOrNull(long value, Class<?> dst) {
- if (dst == int.class || dst == Integer.class) {
- return (int) (value);
- }
- if (dst == long.class || dst == Long.class) {
- return (long) (value);
- }
- if (dst == char.class || dst == Character.class) {
- return (char) (value);
- }
- if (dst == short.class || dst == Short.class) {
- return (short) (value);
- }
- if (dst == float.class || dst == Float.class) {
- return (float) (value);
- }
- if (dst == double.class || dst == Double.class) {
- return (double) (value);
- }
- if (dst == byte.class || dst == Byte.class) {
- return (byte) (value);
- }
- if (dst == boolean.class || dst == Boolean.class) {
- return ((value % 29) & 1) == 0;
- }
- return null;
- }
-
- /**
- * Routine used to obtain a randomly generated method type.
- *
- * @param arity Arity of returned method type.
- * @return MethodType generated randomly.
- */
- public static MethodType randomMethodTypeGenerator(int arity) {
- final Class<?>[] CLASSES = {
- Object.class,
- int.class,
- boolean.class,
- byte.class,
- short.class,
- char.class,
- long.class,
- float.class,
- double.class
- };
- if (arity > MAX_ARITY) {
- throw new IllegalArgumentException(
- String.format("Arity should not exceed %d!", MAX_ARITY));
- }
- List<Class<?>> list = randomClasses(CLASSES, arity);
- list = getParams(list, false, arity);
- int i = RNG.nextInt(CLASSES.length + 1);
- Class<?> rtype = i == CLASSES.length ? void.class : CLASSES[i];
- return MethodType.methodType(rtype, list);
- }
-}
--- a/jdk/test/sun/nio/cs/FindDecoderBugs.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/nio/cs/FindDecoderBugs.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
* @test
* @bug 6380723
* @summary Decode many byte sequences in many ways (use -Dseed=X to set PRNG seed)
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main/timeout=1800 FindDecoderBugs
* @author Martin Buchholz
* @key randomness
@@ -36,7 +35,7 @@
import java.util.regex.*;
import java.nio.*;
import java.nio.charset.*;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class FindDecoderBugs {
--- a/jdk/test/sun/nio/cs/FindEncoderBugs.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/nio/cs/FindEncoderBugs.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
* @test
* @bug 6233345 6381699 6381702 6381705 6381706
* @summary Encode many char sequences in many ways
- * @library /lib/testlibrary/
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main/timeout=1200 FindEncoderBugs
* @author Martin Buchholz
* @key randomness
@@ -36,7 +35,7 @@
import java.util.regex.*;
import java.nio.*;
import java.nio.charset.*;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class FindEncoderBugs {
--- a/jdk/test/sun/security/ec/SignatureOffsets.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/ec/SignatureOffsets.java Wed Jul 05 23:33:35 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
@@ -34,7 +34,7 @@
* get random set of clear text data to sign. After the signature
* generation, the test tries to verify signature with the above API
* and passing in different signature offset (0, 33, 66, 99).
- * @library /lib/testlibrary
+ * @library /test/lib
* @compile ../../../java/security/Signature/Offsets.java
* @run main SignatureOffsets SunEC NONEwithECDSA
* @run main SignatureOffsets SunEC SHA1withECDSA
--- a/jdk/test/sun/security/krb5/auto/KDC.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/krb5/auto/KDC.java Wed Jul 05 23:33:35 2017 +0200
@@ -828,7 +828,9 @@
throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO
}
Ticket t = new Ticket(
- service,
+ System.getProperty("test.kdc.diff.sname") != null ?
+ new PrincipalName("xx" + service.toString()) :
+ service,
new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET)
);
EncTGSRepPart enc_part = new EncTGSRepPart(
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/TicketSName.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * 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 8178794
+ * @summary krb5 client should ignore sname in incoming tickets
+ * @compile -XDignore.symbol.file TicketSName.java
+ * @run main/othervm -Dtest.kdc.diff.sname TicketSName
+ */
+
+import sun.security.jgss.GSSUtil;
+import javax.security.auth.kerberos.KerberosTicket;
+
+public class TicketSName {
+
+ public static void main(String[] args) throws Exception {
+
+ new OneKDC(null).writeJAASConf();
+
+ Context c, s;
+ c = Context.fromJAAS("client");
+ s = Context.fromJAAS("server");
+
+ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+ Context.handshake(c, s);
+
+ String expected = OneKDC.SERVER + "@" + OneKDC.REALM;
+ if (!c.s().getPrivateCredentials(KerberosTicket.class)
+ .stream()
+ .anyMatch(t -> t.getServer().toString().equals(expected))) {
+ c.status();
+ throw new Exception("no " + expected);
+ }
+ }
+}
--- a/jdk/test/sun/security/mscapi/SignatureOffsets.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/mscapi/SignatureOffsets.java Wed Jul 05 23:33:35 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
@@ -34,7 +34,7 @@
* get random set of clear text data to sign. After the signature
* generation, the test tries to verify signature with the above API
* and passing in different signature offset (0, 33, 66, 99).
- * @library /lib/testlibrary
+ * @library /test/lib
* @compile ../../../java/security/Signature/Offsets.java
* @requires os.family == "windows"
* @run main SignatureOffsets SunMSCAPI NONEwithRSA
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java Wed Jul 05 23:33:35 2017 +0200
@@ -27,8 +27,7 @@
* @summary Verify that the RSA KeyPairGenerator works (use -Dseed=X to set PRNG seed)
* @author Andreas Sterbenz
* @library ..
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @modules jdk.crypto.cryptoki
* @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
* @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
@@ -46,7 +45,7 @@
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.RSAKeyGenParameterSpec;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
public class TestKeyPairGenerator extends PKCS11Test {
--- a/jdk/test/sun/security/rsa/SignatureOffsets.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/rsa/SignatureOffsets.java Wed Jul 05 23:33:35 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
@@ -34,7 +34,7 @@
* get random set of clear text data to sign. After the signature
* generation, the test tries to verify signature with the above API
* and passing in different signature offset (0, 33, 66, 99).
- * @library /lib/testlibrary
+ * @library /test/lib
* @compile ../../../java/security/Signature/Offsets.java
* @run main SignatureOffsets SunRsaSign MD2withRSA
* @run main SignatureOffsets SunRsaSign MD5withRSA
--- a/jdk/test/sun/security/ssl/rsa/SignatureOffsets.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/ssl/rsa/SignatureOffsets.java Wed Jul 05 23:33:35 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
@@ -34,7 +34,7 @@
* get random set of clear text data to sign. After the signature
* generation, the test tries to verify signature with the above API
* and passing in different signature offset (0, 33, 66, 99).
- * @library /lib/testlibrary
+ * @library /test/lib
* @compile ../../../../java/security/Signature/Offsets.java
* @run main SignatureOffsets SunJSSE MD2withRSA
* @run main SignatureOffsets SunJSSE MD5withRSA
--- a/jdk/test/sun/security/tools/jarsigner/AltProvider.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/AltProvider.java Wed Jul 05 23:33:35 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,7 @@
import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
import java.nio.file.*;
--- a/jdk/test/sun/security/tools/jarsigner/Options.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/Options.java Wed Jul 05 23:33:35 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
@@ -26,7 +26,7 @@
* @bug 8056174
* @summary Make sure the jarsigner tool still works after it's modified to
* be based on JarSigner API
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/sun.security.tools.keytool
* jdk.jartool/sun.security.tools.jarsigner
* java.base/sun.security.pkcs
@@ -35,7 +35,7 @@
import com.sun.jarsigner.ContentSigner;
import com.sun.jarsigner.ContentSignerParameters;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
import sun.security.pkcs.PKCS7;
import java.io.ByteArrayInputStream;
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Wed Jul 05 23:33:35 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
@@ -45,7 +45,7 @@
import jdk.test.lib.SecurityTools;
import jdk.testlibrary.*;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
import sun.security.pkcs.ContentInfo;
import sun.security.pkcs.PKCS7;
import sun.security.pkcs.PKCS9Attribute;
@@ -557,7 +557,7 @@
}
static void prepare() throws Exception {
- jdk.testlibrary.JarUtils.createJar("old.jar", "A");
+ JarUtils.createJar("old.jar", "A");
Files.deleteIfExists(Paths.get("tsks"));
keytool("-alias ca -genkeypair -ext bc -dname CN=CA");
keytool("-alias old -genkeypair -dname CN=old");
--- a/jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -22,7 +22,7 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
--- a/jdk/test/sun/security/tools/jarsigner/Warning.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/Warning.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
*/
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.ProcessTools;
@@ -34,7 +34,7 @@
* @test
* @bug 8024302 8026037 8130132
* @summary warnings, errors and -strict
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
*/
public class Warning {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for aliasNotInStore warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main AliasNotInStoreTest
*/
public class AliasNotInStoreTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for badExtendedKeyUsage warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main BadExtendedKeyUsageTest
*/
public class BadExtendedKeyUsageTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for badKeyUsage warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @ignore until 8026393 is fixed
* @run main BadKeyUsageTest
*/
--- a/jdk/test/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java Wed Jul 05 23:33:35 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
@@ -22,7 +22,7 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -32,7 +32,7 @@
* @test
* @bug 8024302 8026037
* @summary Test for badNetscapeCertType warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main BadNetscapeCertTypeTest
*/
public class BadNetscapeCertTypeTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java Wed Jul 05 23:33:35 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
@@ -24,13 +24,13 @@
import java.io.File;
import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for chainNotValidated warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main ChainNotValidatedTest
*/
public class ChainNotValidatedTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for hasExpiredCert warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main HasExpiredCertTest
*/
public class HasExpiredCertTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for hasExpiringCert warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main HasExpiringCertTest
*/
public class HasExpiringCertTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for hasUnsignedEntry warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main HasUnsignedEntryTest
*/
public class HasUnsignedEntryTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Checks if jarsigner prints appropriate warnings
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main MultipleWarningsTest
*/
public class MultipleWarningsTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/NoTimestampTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/NoTimestampTest.java Wed Jul 05 23:33:35 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
@@ -23,13 +23,13 @@
import java.util.Date;
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Checks warnings if -tsa and -tsacert options are not specified
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main NoTimestampTest
*/
public class NoTimestampTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for notSignedByAlias warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main NotSignedByAliasTest
*/
public class NotSignedByAliasTest extends Test {
--- a/jdk/test/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java Wed Jul 05 23:33:35 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
@@ -22,13 +22,13 @@
*/
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for notYetValidCert warning
- * @library /lib/testlibrary ../
+ * @library /lib/testlibrary /test/lib ../
* @run main NotYetValidCertTest
*/
public class NotYetValidCertTest extends Test {
--- a/jdk/test/sun/security/tools/keytool/ReadJar.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/sun/security/tools/keytool/ReadJar.java Wed Jul 05 23:33:35 2017 +0200
@@ -26,14 +26,13 @@
* @bug 6890872 8168882
* @summary keytool -printcert to recognize signed jar files
* @library /test/lib
- * @library /lib/testlibrary
*/
import java.nio.file.Files;
import java.nio.file.Paths;
import jdk.test.lib.SecurityTools;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.JarUtils;
+import jdk.test.lib.util.JarUtils;
public class ReadJar {
--- a/jdk/test/tools/jar/InputFilesTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/InputFilesTest.java Wed Jul 05 23:33:35 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,9 +28,8 @@
* options with/without a --release option. Some input files are
* duplicates that sometimes cause exceptions and other times do not,
* demonstrating identical behavior to JDK 8 jar tool.
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.jartool
- * @build jdk.testlibrary.FileUtils
* @run testng InputFilesTest
*/
@@ -51,7 +50,7 @@
import java.util.stream.Stream;
import java.util.zip.ZipException;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class InputFilesTest {
private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
--- a/jdk/test/tools/jar/ReleaseBeforeFiles.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/ReleaseBeforeFiles.java Wed Jul 05 23:33:35 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
@@ -27,9 +27,8 @@
* @summary test that both old style command line options and new gnu style
* command line options work with the --release option whether or
* not the --release option is preceded by a file name.
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.jartool/sun.tools.jar
- * @build jdk.testlibrary.FileUtils
* @run testng ReleaseBeforeFiles
*/
@@ -46,7 +45,7 @@
import java.util.Arrays;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class ReleaseBeforeFiles {
private Runnable onCompletion;
--- a/jdk/test/tools/jar/compat/CLICompatibility.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/compat/CLICompatibility.java Wed Jul 05 23:33:35 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
@@ -35,7 +35,7 @@
import java.util.jar.JarOutputStream;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import jdk.testlibrary.JDKToolFinder;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -49,8 +49,8 @@
/*
* @test
* @bug 8170952
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
+ * @library /lib/testlibrary /test/lib
+ * @build jdk.testlibrary.JDKToolFinder
* @run testng CLICompatibility
* @summary Basic test for compatibility of CLI options
*/
--- a/jdk/test/tools/jar/mmrjar/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/mmrjar/Basic.java Wed Jul 05 23:33:35 2017 +0200
@@ -29,8 +29,7 @@
* @modules java.base/jdk.internal.module
* jdk.compiler
* jdk.jartool
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library /test/lib
* @run testng Basic
*/
@@ -57,7 +56,7 @@
import java.util.zip.ZipFile;
import jdk.internal.module.ModuleInfoExtender;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class Basic {
private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
--- a/jdk/test/tools/jar/modularJar/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/modularJar/Basic.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,7 +25,6 @@
import java.lang.module.ModuleDescriptor;
import java.lang.reflect.Method;
import java.nio.file.*;
-import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.function.Consumer;
import java.util.jar.JarEntry;
@@ -36,7 +35,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import jdk.testlibrary.JDKToolFinder;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
@@ -48,10 +47,10 @@
/*
* @test
* @bug 8167328 8171830 8165640 8174248 8176772
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler
* jdk.jartool
- * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
+ * @build jdk.testlibrary.JDKToolFinder
* @compile Basic.java
* @run testng Basic
* @summary Tests for plain Modular jars & Multi-Release Modular jars
--- a/jdk/test/tools/jar/multiRelease/ApiValidatorTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/multiRelease/ApiValidatorTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -24,18 +24,16 @@
/*
* @test
* @summary Tests for API validator.
- * @library /test/lib /lib/testlibrary
+ * @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.compiler
* jdk.jartool
- * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Utils jdk.test.lib.process.*
- * @build jdk.testlibrary.FileUtils
* @build MRTestBase
* @run testng/timeout=1200 ApiValidatorTest
*/
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -421,4 +419,5 @@
javac(classes, sourceFiles);
}
-}
\ No newline at end of file
+}
+
--- a/jdk/test/tools/jar/multiRelease/Basic.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/multiRelease/Basic.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,19 +23,17 @@
/*
* @test
- * @library /test/lib /lib/testlibrary
+ * @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.compiler
* jdk.jartool
- * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Utils jdk.test.lib.process.*
- * @build jdk.testlibrary.FileUtils
* @build MRTestBase
* @run testng Basic
*/
import static org.testng.Assert.*;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import org.testng.annotations.*;
import java.io.File;
--- a/jdk/test/tools/jar/multiRelease/RuntimeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jar/multiRelease/RuntimeTest.java Wed Jul 05 23:33:35 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,12 +25,7 @@
* @test
* @summary Test Multi-Release jar usage in runtime
* @library /test/lib
- * @library /lib/testlibrary
* @modules jdk.compiler
- * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
- * jdk.test.lib.process.OutputAnalyzer
- * jdk.test.lib.process.ProcessTools
- * CompilerUtils RuntimeTest
* @run testng RuntimeTest
*/
@@ -41,6 +36,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.UncheckedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
@@ -51,7 +47,10 @@
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.testng.annotations.BeforeClass;
@@ -60,37 +59,53 @@
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.compiler.CompilerUtils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
public class RuntimeTest {
public static final int SUCCESS = 0;
- private final String src = System.getProperty("test.src", ".");
- private final String usr = System.getProperty("user.dir", ".");
+ private static final String src = System.getProperty("test.src", ".");
+ private static final String usr = System.getProperty("user.dir", ".");
+
+ private static final Path srcFileRoot = Paths.get(src, "data", "runtimetest");
+ private static final Path genFileRoot = Paths.get(usr, "data", "runtimetest");
+
+ private static final int OLD_RELEASE = 8;
+ private static final int CURRENT_RELEASE = Runtime.version().major();
+ private static final int FUTURE_RELEASE = CURRENT_RELEASE + 1;
+ private static final String MRJAR_BOTH_RELEASES = "MV_BOTH.jar";
+ private static final String MRJAR_CURRENT_RELEASE = "MV_ONLY_" + CURRENT_RELEASE + ".jar";
+ private static final String NON_MRJAR_OLD_RELEASE = "NON_MV.jar";
+
+ private static final int[] versions = { OLD_RELEASE, CURRENT_RELEASE, FUTURE_RELEASE };
@DataProvider(name = "jarFiles")
Object[][] jarFiles() {
- return new Object[][] { { "MV_BOTH.jar", 9, 9, 9 },
- { "MV_ONLY_9.jar", 9, 9, 9 },
- { "NON_MV.jar", 8, 8, 8 } };
+ return new Object[][]{
+ { MRJAR_BOTH_RELEASES, CURRENT_RELEASE, CURRENT_RELEASE, CURRENT_RELEASE },
+ { MRJAR_CURRENT_RELEASE, CURRENT_RELEASE, CURRENT_RELEASE, CURRENT_RELEASE },
+ { NON_MRJAR_OLD_RELEASE, OLD_RELEASE, OLD_RELEASE, OLD_RELEASE }
+ };
}
@BeforeClass
protected void setUpTest() throws Throwable {
+ createJarSourceFiles();
compile();
Path classes = Paths.get("classes");
- jar("cfm", "MV_BOTH.jar", "manifest.txt",
- "-C", classes.resolve("base").toString(), ".",
- "--release", "9", "-C", classes.resolve("v9").toString(), ".",
- "--release", "10", "-C", classes.resolve("v10").toString(), ".")
+ jar("cfm", MRJAR_BOTH_RELEASES, "manifest.txt",
+ "-C", classes.resolve("v" + OLD_RELEASE).toString(), ".",
+ "--release", "" + CURRENT_RELEASE, "-C", classes.resolve("v" + CURRENT_RELEASE).toString(), ".",
+ "--release", "" + FUTURE_RELEASE, "-C", classes.resolve("v" + FUTURE_RELEASE).toString(), ".")
.shouldHaveExitValue(0);
- jar("cfm", "MV_ONLY_9.jar", "manifest.txt",
- "-C", classes.resolve("base").toString(), ".",
- "--release", "9", "-C", classes.resolve("v9").toString(), ".")
+ jar("cfm", MRJAR_CURRENT_RELEASE, "manifest.txt",
+ "-C", classes.resolve("v" + OLD_RELEASE).toString(), ".",
+ "--release", "" + CURRENT_RELEASE, "-C", classes.resolve("v" + CURRENT_RELEASE).toString(), ".")
.shouldHaveExitValue(0);
- jar("cfm", "NON_MV.jar", "manifest.txt",
- "-C", classes.resolve("base").toString(), ".")
+ jar("cfm", NON_MRJAR_OLD_RELEASE, "manifest.txt",
+ "-C", classes.resolve("v" + OLD_RELEASE).toString(), ".")
.shouldHaveExitValue(0);
}
@@ -203,12 +218,37 @@
return ProcessTools.executeCommand(launcher.getCommand());
}
+ private static String platformPath(String p) {
+ return p.replace("/", File.separator);
+ }
+
+ private static void createJarSourceFiles() throws IOException {
+ for (int ver : versions) {
+ Files.find(srcFileRoot, 3, (file, attrs) -> (file.toString().endsWith(".template")))
+ .map(srcFileRoot::relativize)
+ .map(Path::toString)
+ .map(p -> p.replace(".template", ""))
+ .forEach(f -> {
+ try {
+ Path template = srcFileRoot.resolve(f + ".template");
+ Path out = genFileRoot.resolve(platformPath("v" + ver + "/" + f));
+ Files.createDirectories(out.getParent());
+ List<String> lines = Files.lines(template)
+ .map(s -> s.replaceAll("\\$version", String.valueOf(ver)))
+ .collect(Collectors.toList());
+ Files.write(out, lines);
+ } catch (IOException x) {
+ throw new UncheckedIOException(x);
+ }
+ });
+ }
+ }
+
private void compile() throws Throwable {
- String[] vers = { "base", "v9", "v10" };
- for (String ver : vers) {
- Path classes = Paths.get(usr, "classes", ver);
+ for (int ver : versions) {
+ Path classes = Paths.get(usr, "classes", "v" + ver);
Files.createDirectories(classes);
- Path source = Paths.get(src, "data", "runtimetest", ver);
+ Path source = genFileRoot.resolve("v" + ver);
assertTrue(CompilerUtils.compile(source, classes));
Files.copy(source.resolve("versionResource"),
classes.resolve("versionResource"),
@@ -217,10 +257,10 @@
Path classes = Paths.get(usr, "classes", "test");
Files.createDirectory(classes);
- Path source = Paths.get(src, "data", "runtimetest", "test");
+ Path source = srcFileRoot.resolve("test");
assertTrue(
- CompilerUtils.compile(source, classes, "-cp", "classes/base/"));
- Files.copy(Paths.get(src, "data", "runtimetest", "manifest.txt"),
+ CompilerUtils.compile(source, classes, "-cp", "classes/v" + OLD_RELEASE));
+ Files.copy(srcFileRoot.resolve("manifest.txt"),
Paths.get(usr, "manifest.txt"),
StandardCopyOption.REPLACE_EXISTING);
}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Helper.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-public class Helper {
-
- private static final int HELPER_VERSION = 8;
-
- public static int getHelperVersion() {
- return HELPER_VERSION;
- }
-}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Main.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 testpackage;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class Main {
-
- private static final int MAIN_VERSION = 8;
-
- public static void main(String[] args) {
- System.out.println("Main version: " + getMainVersion());
- System.out.println("Helpers version: " + getHelperVersion());
- System.out.println("Resource version: " + getResourceVersion());
- }
-
- public static int getMainVersion() {
- return MAIN_VERSION;
- }
-
- public static int getHelperVersion() {
- return testpackage.Helper.getHelperVersion();
- }
-
- public static int getResourceVersion() {
- ClassLoader cl = Main.class.getClassLoader();
- InputStream ris = cl.getResourceAsStream("versionResource");
- if (ris == null) {
- throw new Error("Test issue: resource versionResource"
- + " cannot be loaded!");
- }
- try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
- return Integer.parseInt(br.readLine());
- } catch (IOException ioe) {
- throw new Error("Unexpected issue", ioe);
- }
- }
-}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/versionResource Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-8
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Helper.java.template Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package testpackage;
+
+public class Helper {
+
+ private static final int HELPER_VERSION = $version;
+
+ public static int getHelperVersion() {
+ return HELPER_VERSION;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Main.java.template Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package testpackage;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class Main {
+
+ private static final int MAIN_VERSION = $version;
+
+ public static void main(String[] args) {
+ System.out.println("Main version: " + getMainVersion());
+ System.out.println("Helpers version: " + getHelperVersion());
+ System.out.println("Resource version: " + getResourceVersion());
+ }
+
+ public static int getMainVersion() {
+ return MAIN_VERSION;
+ }
+
+ public static int getHelperVersion() {
+ return testpackage.Helper.getHelperVersion();
+ }
+
+ public static int getResourceVersion() {
+ ClassLoader cl = Main.class.getClassLoader();
+ InputStream ris = cl.getResourceAsStream("versionResource");
+ if (ris == null) {
+ throw new Error("Test issue: resource versionResource"
+ + " cannot be loaded!");
+ }
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
+ return Integer.parseInt(br.readLine());
+ } catch (IOException ioe) {
+ throw new Error("Unexpected issue", ioe);
+ }
+ }
+}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Helper.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-public class Helper {
-
- private static final int HELPER_VERSION = 10;
-
- public static int getHelperVersion() {
- return HELPER_VERSION;
- }
-}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Main.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 testpackage;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class Main {
-
- private static final int MAIN_VERSION = 10;
-
- public static void main(String[] args) {
- System.out.println("Main version: " + getMainVersion());
- System.out.println("Helpers version: " + getHelperVersion());
- System.out.println("Resource version: " + getResourceVersion());
- }
-
- public static int getMainVersion() {
- return MAIN_VERSION;
- }
-
- public static int getHelperVersion() {
- return testpackage.Helper.getHelperVersion();
- }
-
- public static int getResourceVersion() {
- ClassLoader cl = Main.class.getClassLoader();
- InputStream ris = cl.getResourceAsStream("versionResource");
- if (ris == null) {
- throw new Error("Test issue: resource versionResource"
- + " cannot be loaded!");
- }
- try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
- return Integer.parseInt(br.readLine());
- } catch (IOException ioe) {
- throw new Error("Unexpected issue", ioe);
- }
- }
-}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/versionResource Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-10
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Helper.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-public class Helper {
-
- private static final int HELPER_VERSION = 9;
-
- public static int getHelperVersion() {
- return HELPER_VERSION;
- }
-}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Main.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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 testpackage;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class Main {
-
- private static final int MAIN_VERSION = 9;
-
- public static void main(String[] args) {
- System.out.println("Main version: " + getMainVersion());
- System.out.println("Helpers version: " + getHelperVersion());
- System.out.println("Resource version: " + getResourceVersion());
- }
-
- public static int getMainVersion() {
- return MAIN_VERSION;
- }
-
- public static int getHelperVersion() {
- return testpackage.Helper.getHelperVersion();
- }
-
- public static int getResourceVersion() {
- ClassLoader cl = Main.class.getClassLoader();
- InputStream ris = cl.getResourceAsStream("versionResource");
- if (ris == null) {
- throw new Error("Test issue: resource versionResource"
- + " cannot be loaded!");
- }
- try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
- return Integer.parseInt(br.readLine());
- } catch (IOException ioe) {
- throw new Error("Unexpected issue", ioe);
- }
- }
-}
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/versionResource Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/versionResource.template Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,1 @@
+$version
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import static jdk.testlibrary.ProcessTools.*;
@@ -39,9 +39,9 @@
/**
* @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler jdk.jlink
- * @build CompiledVersionTest CompilerUtils jdk.testlibrary.FileUtils jdk.testlibrary.ProcessTools
+ * @build CompiledVersionTest CompilerUtils jdk.testlibrary.ProcessTools
* @run testng CompiledVersionTest
*/
--- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.IOException;
-import java.lang.module.ModuleDescriptor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -33,7 +32,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import static jdk.testlibrary.ProcessTools.*;
@@ -44,11 +43,11 @@
/**
* @test
* @bug 8142968 8173381 8174740
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler jdk.jlink
* @modules java.base/jdk.internal.module
* @modules java.base/jdk.internal.org.objectweb.asm
- * @build ModuleTargetHelper UserModuleTest CompilerUtils jdk.testlibrary.FileUtils jdk.testlibrary.ProcessTools
+ * @build ModuleTargetHelper UserModuleTest CompilerUtils jdk.testlibrary.ProcessTools
* @run testng UserModuleTest
*/
--- a/jdk/test/tools/jmod/JmodNegativeTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jmod/JmodNegativeTest.java Wed Jul 05 23:33:35 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,10 +23,10 @@
/*
* @test
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler
* jdk.jlink
- * @build jdk.testlibrary.FileUtils CompilerUtils
+ * @build CompilerUtils
* @run testng JmodNegativeTest
* @summary Negative tests for jmod
*/
@@ -41,7 +41,7 @@
import java.util.function.Supplier;
import java.util.spi.ToolProvider;
import java.util.zip.ZipOutputStream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
--- a/jdk/test/tools/jmod/JmodTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/jmod/JmodTest.java Wed Jul 05 23:33:35 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,10 +25,10 @@
* @test
* @bug 8142968 8166568 8166286 8170618 8168149
* @summary Basic test for jmod
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler
* jdk.jlink
- * @build jdk.testlibrary.FileUtils CompilerUtils
+ * @build CompilerUtils
* @run testng/othervm -Djava.io.tmpdir=. JmodTest
*/
@@ -40,9 +40,8 @@
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.spi.ToolProvider;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/jdk/test/tools/launcher/ArgsEnvVar.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/launcher/ArgsEnvVar.java Wed Jul 05 23:33:35 2017 +0200
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8170832
+ * @bug 8170832 8180447
* @summary Arguments passed in environment variable
* @build TestHelper
* @run main ArgsEnvVar
@@ -224,6 +224,21 @@
verifyOptions(List.of("-p", "?", "-jar", "test.jar", "one", "two"), tr);
}
+ @Test
+ public void testTrailingSpaces() {
+ env.put(JDK_JAVA_OPTIONS, "--add-exports java.base/jdk.internal.misc=ALL-UNNAMED ");
+ TestResult tr = doExec(env, javaCmd, "-jar", "test.jar");
+ verifyOptions(List.of("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-jar", "test.jar"), tr);
+
+ env.put(JDK_JAVA_OPTIONS, "--class-path ' '");
+ tr = doExec(env, javaCmd, "-jar", "test.jar");
+ verifyOptions(List.of("--class-path", " ", "-jar", "test.jar"), tr);
+
+ env.put(JDK_JAVA_OPTIONS, " --add-exports java.base/jdk.internal.misc=ALL-UNNAMED ");
+ tr = doExec(env, javaCmd, "-jar", "test.jar");
+ verifyOptions(List.of("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-jar", "test.jar"), tr);
+ }
+
public static void main(String... args) throws Exception {
init();
ArgsEnvVar a = new ArgsEnvVar();
@@ -236,4 +251,3 @@
}
}
}
-
--- a/jdk/test/tools/launcher/LauncherMessageTest.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/launcher/LauncherMessageTest.java Wed Jul 05 23:33:35 2017 +0200
@@ -24,16 +24,16 @@
/**
* @test
* @bug 8167063
- * @library /lib/testlibrary
- * @build jdk.testlibrary.FileUtils
+ * @library /test/lib
* @run main LauncherMessageTest
* @summary LauncherHelper should not throw JNI error for LinkageError
*/
+
import java.io.File;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
public class LauncherMessageTest {
--- a/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java Wed May 31 17:42:17 2017 +0000
+++ b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java Wed Jul 05 23:33:35 2017 +0200
@@ -25,7 +25,7 @@
* @test
* @bug 8157068 8177844
* @summary Patch java.base and user module with ModuleHashes attribute
- * @library /lib/testlibrary
+ * @library /lib/testlibrary /test/lib
* @modules jdk.compiler
* @build CompilerUtils
* @run testng PatchSystemModules
@@ -39,7 +39,7 @@
import java.util.List;
import java.util.stream.Stream;
-import jdk.testlibrary.FileUtils;
+import jdk.test.lib.util.FileUtils;
import jdk.testlibrary.JDKToolFinder;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/make/CompileJavaModules.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/CompileJavaModules.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -42,7 +42,8 @@
################################################################################
-java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline
+java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline \
+ --doclint-format html4
java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
java.base_CLEAN := intrinsic.properties
@@ -95,7 +96,8 @@
################################################################################
java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \
- '-Xdoclint/package:java.*,javax.*' -Xlint:exports
+ '-Xdoclint/package:java.*,javax.*' -Xlint:exports \
+ --doclint-format html4
java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
java.desktop_CLEAN := iio-plugin.properties cursors.properties
--- a/make/Docs.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/Docs.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -55,7 +55,6 @@
LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
-
# In order to get a specific ordering it's necessary to specify the total
# ordering of tags as the tags are otherwise ordered in order of definition.
JAVADOC_TAGS := \
@@ -163,7 +162,7 @@
################################################################################
-JDK_DOCS_INDEX_HTML_TITLE := Java™ Platform, Standard Edition Development Kit \
+JDK_INDEX_TITLE := Java™ Platform, Standard Edition Development Kit \
(JDK™) $(VERSION_SPECIFICATION) Specification<br>$(DRAFT_MARKER_TITLE)
################################################################################
@@ -211,10 +210,10 @@
SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
define SetupApiDocsGenerationBody
- # Figure out all modules, both specified and transitive, that will be processed
- # by javadoc.
- $1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES))
- $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES))
+ # Figure out all modules, both specified and transitive indirect exports, that
+ # will be processed by javadoc.
+ $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
+ $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
ifeq ($$(ENABLE_FULL_DOCS), true)
# Tell the ModuleGraph taglet to generate html links to soon-to-be-created
@@ -334,7 +333,8 @@
################################################################################
# Setup generation of the Java SE API documentation (javadoc + modulegraph)
-# The Java SE module scope is just java.se.ee and it's transitive modules.
+# The Java SE module scope is just java.se.ee and it's transitive indirect
+# exports.
JAVASE_JAVADOC_MODULES := java.se.ee
JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
@@ -356,15 +356,27 @@
################################################################################
-JDK_DOCS_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
+JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
+JDK_INDEX_TOOLS_DIR := $(TOOLS_CLASSES_DIR)/build/tools/docs
-$(JDK_DOCS_INDEX_HTML): $(BUILD_JIGSAW_TOOLS)
+$(JDK_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) \
+ $(JDK_INDEX_TOOLS_DIR)/docs-bundle-page.html \
+ $(JDK_INDEX_TOOLS_DIR)/docs-module-groups.properties
$(call LogInfo, Generating docs bundle index page)
$(MKDIR) -p $(@D)
- $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_DOCS_INDEX_HTML_TITLE)' \
+ $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_INDEX_TITLE)' \
--output $@
-JDK_DOCS_INDEX_HTML_TARGETS := $(JDK_DOCS_INDEX_HTML)
+JDK_INDEX_TARGETS := $(JDK_INDEX_HTML)
+
+# Copy the global resources
+GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/
+$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
+ SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
+ FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
+ DEST := $(DOCS_OUTPUTDIR), \
+))
+JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
################################################################################
# Copy JDK specs files
@@ -389,20 +401,11 @@
) \
)
-# Copy the global resources
-GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs
-$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
- SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
- FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
- DEST := $(DOCS_OUTPUTDIR)/specs/, \
-))
-JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
-
ifeq ($(ENABLE_FULL_DOCS), true)
# For all markdown files in $module/share/specs directories, convert them to
# html.
- GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/specs/resources/jdk-default.css
+ GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
$(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
@@ -464,7 +467,7 @@
docs-jdk-specs: $(JDK_SPECS_TARGETS)
-docs-jdk-index: $(JDK_DOCS_INDEX_HTML_TARGETS)
+docs-jdk-index: $(JDK_INDEX_TARGETS)
docs-zip: $(ZIP_TARGETS)
--- a/make/Help.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/Help.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -56,6 +56,8 @@
$(info $(_) make test # Run tests, default is all tests (see TEST below))
$(info $(_) make run-test-<test> # Run test, e.g. run-test-tier1)
$(info $(_) make run-test TEST=<t> # Run test(s) given by TEST specification)
+ $(info $(_) make exploded-run-test TEST=<t> # Run test(s) on the exploded image instead of)
+ $(info $(_) # the full jdk image)
$(info )
$(info Targets for cleaning)
$(info $(_) make clean # Remove all files generated by make, but not those)
--- a/make/Main.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/Main.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -450,13 +450,18 @@
run-test-$1:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$1")
+ exploded-run-test-$1:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
+ TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
+
endef
# ALL_NAMED_TESTS is defined in FindTests.gmk
$(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
ALL_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
+ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-run-test-, $(ALL_NAMED_TESTS))
-ALL_TARGETS += $(ALL_TEST_TARGETS)
+ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
################################################################################
# Build tests
@@ -485,6 +490,10 @@
run-test:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
+exploded-run-test:
+ +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
+ TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
+
ifeq ($(BUILD_GTEST), true)
test-image-hotspot-gtest:
+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
@@ -514,7 +523,7 @@
test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
- run-test
+ run-test exploded-run-test
################################################################################
# Run tests
@@ -798,7 +807,8 @@
docs-javase-api-modulegraph: exploded-image buildtools-modules
# The gensrc steps for hotspot and jdk.jdi create html spec files.
- docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
+ docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
+ docs-jdk-index
docs-jdk-index: exploded-image buildtools-modules
@@ -807,9 +817,11 @@
test: jdk-image test-image
run-test: jdk-image test-image
+ exploded-run-test: exploded-image test-image
# Declare dependency for all generated test targets
$(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image))
+ $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
create-buildjdk-copy: jdk.jlink-java java.base-gendata \
$(addsuffix -java, $(INTERIM_IMAGE_MODULES))
--- a/make/common/Modules.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/common/Modules.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -151,6 +151,7 @@
jdk.crypto.ec \
jdk.dynalink \
jdk.editpad \
+ jdk.hotspot.agent \
jdk.httpserver \
jdk.incubator.httpclient \
jdk.jartool \
@@ -298,7 +299,8 @@
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
################################################################################
-# Extract module dependencies from module-info.java files.
+# Extract module dependencies from module-info.java files, both normal
+# dependencies ("requires"), and indirect exports ("requires transitive").
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
@@ -320,17 +322,31 @@
gsub(/^ +\*.*/, ""); \
gsub(/ /, ""); \
printf(" %s", $$0) } \
+ END { printf("\n") }' $m && \
+ $(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
+ $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
+ BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
+ /^ *requires *transitive/ { \
+ sub(/;/, ""); \
+ sub(/requires/, ""); \
+ sub(/transitive/, ""); \
+ sub(/\/\/.*/, ""); \
+ sub(/\/\*.*\*\//, ""); \
+ gsub(/^ +\*.*/, ""); \
+ gsub(/ /, ""); \
+ printf(" %s", $$0) } \
END { printf("\n") }' $m \
) >> $@ $(NEWLINE))
-include $(MODULE_DEPS_MAKEFILE)
-# Param 1: Module to find deps for
+# Find dependencies ("requires") for a given module.
+# Param 1: Module to find dependencies for.
FindDepsForModule = \
$(DEPS_$(strip $1))
-# Finds transitive dependencies in 3 levels.
-# Param 1: Module to find transitive deps for
+# Find dependencies ("requires") transitively in 3 levels for a given module.
+# Param 1: Module to find dependencies for.
FindTransitiveDepsForModule = \
$(sort $(call FindDepsForModule, $1) \
$(foreach m, $(call FindDepsForModule, $1), \
@@ -338,11 +354,30 @@
$(foreach n, $(call FindDepsForModule, $m), \
$(call FindDepsForModule, $n))))
-# Finds transitive dependencies in 3 levels for a set of modules.
-# Param 1: List of modules to find transitive deps for
+# Find dependencies ("requires") transitively in 3 levels for a set of modules.
+# Param 1: List of modules to find dependencies for.
FindTransitiveDepsForModules = \
$(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
+# Find indirect exported modules ("requires transitive") for a given module .
+# Param 1: Module to find indirect exported modules for.
+FindIndirectExportsForModule = \
+ $(TRANSITIVE_MODULES_$(strip $1))
+
+# Finds indirect exported modules transitively in 3 levels for a given module.
+# Param 1: Module to find indirect exported modules for.
+FindTransitiveIndirectDepsForModule = \
+ $(sort $(call FindIndirectExportsForModule, $1) \
+ $(foreach m, $(call FindIndirectExportsForModule, $1), \
+ $(call FindIndirectExportsForModule, $m) \
+ $(foreach n, $(call FindIndirectExportsForModule, $m), \
+ $(call FindIndirectExportsForModule, $n))))
+
+# Finds indirect exported modules transitively in 3 levels for a set of modules.
+# Param 1: List of modules to find indirect exported modules for.
+FindTransitiveIndirectDepsForModules = \
+ $(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m)))
+
# Upgradeable modules are those that are either defined as upgradeable or that
# require an upradeable module.
FindAllUpgradeableModules = \
--- a/make/common/ProcessMarkdown.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/common/ProcessMarkdown.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -36,7 +36,7 @@
ifneq ($$(findstring http:/, $$($1_CSS)), )
$1_$2_CSS_OPTION := --css '$$($1_CSS)'
else
- $1_$2_CSS := $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR))
+ $1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
$1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
endif
endif
@@ -51,7 +51,7 @@
$$(call LogInfo, Converting $2 to html)
$$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown)
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
- $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
+ $$(PANDOC) $$($1_OPTIONS) -f markdown -t html5 --standalone \
$$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@')
ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
--- a/make/common/SetupJavaCompilers.gmk Wed May 31 17:42:17 2017 +0000
+++ b/make/common/SetupJavaCompilers.gmk Wed Jul 05 23:33:35 2017 +0200
@@ -69,7 +69,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 10 -target 10 \
+ FLAGS := -source 10 -target 10 --doclint-format html5 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/nashorn/.hgtags Wed May 31 17:42:17 2017 +0000
+++ b/nashorn/.hgtags Wed Jul 05 23:33:35 2017 +0200
@@ -413,3 +413,5 @@
550bfc15779f8f339610793867fdc251125811b5 jdk-9+170
7e9cb37e6d6edbe56fdf4d510e5110f797823f09 jdk-10+7
edb825e2dfb140c8e57a61b5d45de19edebccccf jdk-10+8
+d7d69c89088aec56d13bbff81a6f0a8b68ca75f4 jdk-10+9
+fc416270a776409b74006262dd0a9f5f5ff31555 jdk-9+171
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/InfiniteLoop.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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;
+
+import java.util.Objects;
+
+/**
+ * Class which runs another Runnable in infinite loop with certain pauses
+ * between cycles.
+ */
+public class InfiniteLoop implements Runnable {
+ private final Runnable target;
+ private final long mills;
+
+
+ /**
+ * @param target a target to run in a loop
+ * @param mills the length of pause time in milliseconds
+ * @throws NullPointerException if target is null
+ * @throws IllegalArgumentException if the value of millis is negative
+ */
+ public InfiniteLoop(Runnable target, long mills) {
+ Objects.requireNonNull(target);
+ if (mills < 0) {
+ throw new IllegalArgumentException("mills < 0");
+ }
+ this.target = target;
+ this.mills = mills;
+ }
+
+ @Override
+ public void run() {
+ try {
+ while (true) {
+ target.run();
+ if (mills > 0) {
+ Thread.sleep(mills);
+ }
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new Error(e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/RandomFactory.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * 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 jdk.test.lib;
+
+import java.util.Random;
+import java.util.SplittableRandom;
+
+/**
+ * Factory class which generates and prints to STDOUT a long-valued seed
+ * for use in initializing a PRNG. An instance of {@code Random} or
+ * {@code SplittableRandom} may likewise be obtained.
+ */
+public class RandomFactory {
+ /**
+ * Attempt to obtain the seed from the value of the "seed" property.
+ * @return The seed or {@code null} if the "seed" property was not set or
+ * could not be parsed.
+ */
+ private static Long getSystemSeed() {
+ Long seed = null;
+ try {
+ // note that Long.valueOf(null) also throws a
+ // NumberFormatException so if the property is undefined this
+ // will still work correctly
+ seed = Long.valueOf(System.getProperty("seed"));
+ } catch (NumberFormatException e) {
+ // do nothing: seed is still null
+ }
+
+ return seed;
+ }
+
+ /**
+ * Obtain a seed from an independent PRNG.
+ *
+ * @return A random seed.
+ */
+ private static long getRandomSeed() {
+ return new Random().nextLong();
+ }
+
+ /**
+ * Obtain and print to STDOUT a seed appropriate for initializing a PRNG.
+ * If the system property "seed" is set and has value which may be correctly
+ * parsed it is used, otherwise a seed is generated using an independent
+ * PRNG.
+ *
+ * @return The seed.
+ */
+ public static long getSeed() {
+ Long seed = getSystemSeed();
+ if (seed == null) {
+ seed = getRandomSeed();
+ }
+ System.out.println("Seed from RandomFactory = "+seed+"L");
+ return seed;
+ }
+
+ /**
+ * Obtain and print to STDOUT a seed and use it to initialize a new
+ * {@code Random} instance which is returned. If the system
+ * property "seed" is set and has value which may be correctly parsed it
+ * is used, otherwise a seed is generated using an independent PRNG.
+ *
+ * @return The {@code Random} instance.
+ */
+ public static Random getRandom() {
+ return new Random(getSeed());
+ }
+
+ /**
+ * Obtain and print to STDOUT a seed and use it to initialize a new
+ * {@code SplittableRandom} instance which is returned. If the system
+ * property "seed" is set and has value which may be correctly parsed it
+ * is used, otherwise a seed is generated using an independent PRNG.
+ *
+ * @return The {@code SplittableRandom} instance.
+ */
+ public static SplittableRandom getSplittableRandom() {
+ return new SplittableRandom(getSeed());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/TimeLimitedRunner.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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;
+
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+/**
+ * Auxiliary class to run target w/ given timeout.
+ */
+public class TimeLimitedRunner implements Callable<Void> {
+ private final long stoptime;
+ private final long timeout;
+ private final double factor;
+ private final Callable<Boolean> target;
+
+ /**
+ * @param timeout a timeout. zero means no time limitation
+ * @param factor a multiplier used to estimate next iteration time
+ * @param target a target to run
+ * @throws NullPointerException if target is null
+ * @throws IllegalArgumentException if timeout is negative or
+ factor isn't positive
+ */
+ public TimeLimitedRunner(long timeout, double factor,
+ Callable<Boolean> target) {
+ Objects.requireNonNull(target, "target must not be null");
+ if (timeout < 0) {
+ throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
+ }
+ if (factor <= 0d) {
+ throw new IllegalArgumentException("factor[" + factor + "] <= 0");
+ }
+ this.stoptime = System.currentTimeMillis() + timeout;
+ this.timeout = timeout;
+ this.factor = factor;
+ this.target = target;
+ }
+
+ /**
+ * Runs @{linkplan target} while it returns true and timeout isn't exceeded
+ */
+ @Override
+ public Void call() throws Exception {
+ long maxDuration = 0L;
+ long iterStart = System.currentTimeMillis();
+ if (timeout != 0 && iterStart > stoptime) {
+ return null;
+ }
+ while (target.call()) {
+ if (timeout != 0) {
+ long iterDuration = System.currentTimeMillis() - iterStart;
+ maxDuration = Math.max(maxDuration, iterDuration);
+ iterStart = System.currentTimeMillis();
+ if (iterStart + (maxDuration * factor) > stoptime) {
+ System.out.println("Not enough time to continue execution. "
+ + "Interrupted.");
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/util/FileUtils.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,229 @@
+/*
+ * 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.util;
+
+import jdk.test.lib.Platform;
+
+import java.io.IOException;
+import java.nio.file.DirectoryNotEmptyException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * Common library for various test file utility functions.
+ */
+public final class FileUtils {
+ private static final boolean IS_WINDOWS = Platform.isWindows();
+ private static final int RETRY_DELETE_MILLIS = IS_WINDOWS ? 500 : 0;
+ private static final int MAX_RETRY_DELETE_TIMES = IS_WINDOWS ? 15 : 0;
+
+ /**
+ * Deletes a file, retrying if necessary.
+ *
+ * @param path the file to delete
+ *
+ * @throws NoSuchFileException
+ * if the file does not exist (optional specific exception)
+ * @throws DirectoryNotEmptyException
+ * if the file is a directory and could not otherwise be deleted
+ * because the directory is not empty (optional specific exception)
+ * @throws IOException
+ * if an I/O error occurs
+ */
+ public static void deleteFileWithRetry(Path path) throws IOException {
+ try {
+ deleteFileWithRetry0(path);
+ } catch (InterruptedException x) {
+ throw new IOException("Interrupted while deleting.", x);
+ }
+ }
+
+ /**
+ * Deletes a file, retrying if necessary.
+ * No exception thrown if file doesn't exist.
+ *
+ * @param path the file to delete
+ *
+ * @throws NoSuchFileException
+ * if the file does not exist (optional specific exception)
+ * @throws DirectoryNotEmptyException
+ * if the file is a directory and could not otherwise be deleted
+ * because the directory is not empty (optional specific exception)
+ * @throws IOException
+ * if an I/O error occurs
+ */
+ public static void deleteFileIfExistsWithRetry(Path path) throws IOException {
+ try {
+ if (Files.exists(path)) {
+ deleteFileWithRetry0(path);
+ }
+ } catch (InterruptedException x) {
+ throw new IOException("Interrupted while deleting.", x);
+ }
+ }
+
+ private static void deleteFileWithRetry0(Path path)
+ throws IOException, InterruptedException {
+ int times = 0;
+ IOException ioe = null;
+ while (true) {
+ try {
+ Files.delete(path);
+ while (Files.exists(path)) {
+ times++;
+ if (times > MAX_RETRY_DELETE_TIMES) {
+ throw new IOException("File still exists after " + times + " waits.");
+ }
+ Thread.sleep(RETRY_DELETE_MILLIS);
+ }
+ break;
+ } catch (NoSuchFileException | DirectoryNotEmptyException x) {
+ throw x;
+ } catch (IOException x) {
+ // Backoff/retry in case another process is accessing the file
+ times++;
+ if (ioe == null) {
+ ioe = x;
+ } else {
+ ioe.addSuppressed(x);
+ }
+
+ if (times > MAX_RETRY_DELETE_TIMES) {
+ throw ioe;
+ }
+ Thread.sleep(RETRY_DELETE_MILLIS);
+ }
+ }
+ }
+
+ /**
+ * Deletes a directory and its subdirectories, retrying if necessary.
+ *
+ * @param dir the directory to delete
+ *
+ * @throws IOException
+ * If an I/O error occurs. Any such exceptions are caught
+ * internally. If only one is caught, then it is re-thrown.
+ * If more than one exception is caught, then the second and
+ * following exceptions are added as suppressed exceptions of the
+ * first one caught, which is then re-thrown.
+ */
+ public static void deleteFileTreeWithRetry(Path dir) throws IOException {
+ IOException ioe = null;
+ final List<IOException> excs = deleteFileTreeUnchecked(dir);
+ if (!excs.isEmpty()) {
+ ioe = excs.remove(0);
+ for (IOException x : excs) {
+ ioe.addSuppressed(x);
+ }
+ }
+ if (ioe != null) {
+ throw ioe;
+ }
+ }
+
+ public static List<IOException> deleteFileTreeUnchecked(Path dir) {
+ final List<IOException> excs = new ArrayList<>();
+ try {
+ java.nio.file.Files.walkFileTree(dir, new SimpleFileVisitor<>() {
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ try {
+ deleteFileWithRetry0(file);
+ } catch (IOException x) {
+ excs.add(x);
+ } catch (InterruptedException x) {
+ excs.add(new IOException("Interrupted while deleting.", x));
+ return FileVisitResult.TERMINATE;
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+ try {
+ deleteFileWithRetry0(dir);
+ } catch (IOException x) {
+ excs.add(x);
+ } catch (InterruptedException x) {
+ excs.add(new IOException("Interrupted while deleting.", x));
+ return FileVisitResult.TERMINATE;
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
+ excs.add(exc);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ } catch (IOException x) {
+ excs.add(x);
+ }
+ return excs;
+ }
+
+ /**
+ * Checks whether all file systems are accessible. This is performed
+ * by checking free disk space on all mounted file systems via a
+ * separate, spawned process. File systems are considered to be
+ * accessible if this process completes successfully before a given
+ * fixed duration has elapsed.
+ *
+ * @implNote On Unix this executes the {@code df} command in a separate
+ * process and on Windows always returns {@code true}.
+ */
+ public static boolean areFileSystemsAccessible() throws IOException {
+ boolean areFileSystemsAccessible = true;
+ if (!IS_WINDOWS) {
+ // try to check whether 'df' hangs
+ System.out.println("\n--- df output ---");
+ System.out.flush();
+ Process proc = new ProcessBuilder("df").inheritIO().start();
+ try {
+ proc.waitFor(90, TimeUnit.SECONDS);
+ } catch (InterruptedException ignored) {
+ }
+ try {
+ int exitValue = proc.exitValue();
+ if (exitValue != 0) {
+ System.err.printf("df process exited with %d != 0%n",
+ exitValue);
+ areFileSystemsAccessible = false;
+ }
+ } catch (IllegalThreadStateException ignored) {
+ System.err.println("df command apparently hung");
+ areFileSystemsAccessible = false;
+ }
+ }
+ return areFileSystemsAccessible;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/util/JarUtils.java Wed Jul 05 23:33:35 2017 +0200
@@ -0,0 +1,148 @@
+/*
+ * 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 jdk.test.lib.util;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+/**
+ * Common library for various test jar file utility functions.
+ */
+public final class JarUtils {
+
+ /**
+ * Create jar file with specified files. If a specified file does not exist,
+ * a new jar entry will be created with the file name itself as the content.
+ */
+ public static void createJar(String dest, String... files)
+ throws IOException {
+ try (JarOutputStream jos = new JarOutputStream(
+ new FileOutputStream(dest), new Manifest())) {
+ for (String file : files) {
+ System.out.println(String.format("Adding %s to %s",
+ file, dest));
+
+ // add an archive entry, and write a file
+ jos.putNextEntry(new JarEntry(file));
+ try (FileInputStream fis = new FileInputStream(file)) {
+ fis.transferTo(jos);
+ } catch (FileNotFoundException e) {
+ jos.write(file.getBytes());
+ }
+ }
+ }
+ System.out.println();
+ }
+
+ /**
+ * Add or remove specified files to existing jar file. If a specified file
+ * to be updated or added does not exist, the jar entry will be created
+ * with the file name itself as the content.
+ *
+ * @param src the original jar file name
+ * @param dest the new jar file name
+ * @param files the files to update. The list is broken into 2 groups
+ * by a "-" string. The files before in the 1st group will
+ * be either updated or added. The files in the 2nd group
+ * will be removed. If no "-" exists, all files belong to
+ * the 1st group.
+ */
+ public static void updateJar(String src, String dest, String... files)
+ throws IOException {
+ try (JarOutputStream jos = new JarOutputStream(
+ new FileOutputStream(dest))) {
+
+ // copy each old entry into destination unless the entry name
+ // is in the updated list
+ List<String> updatedFiles = new ArrayList<>();
+ try (JarFile srcJarFile = new JarFile(src)) {
+ Enumeration<JarEntry> entries = srcJarFile.entries();
+ while (entries.hasMoreElements()) {
+ JarEntry entry = entries.nextElement();
+ String name = entry.getName();
+ boolean found = false;
+ boolean update = true;
+ for (String file : files) {
+ if (file.equals("-")) {
+ update = false;
+ } else if (name.equals(file)) {
+ updatedFiles.add(file);
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ if (update) {
+ System.out.println(String.format("Updating %s with %s",
+ dest, name));
+ jos.putNextEntry(new JarEntry(name));
+ try (FileInputStream fis = new FileInputStream(name)) {
+ fis.transferTo(jos);
+ } catch (FileNotFoundException e) {
+ jos.write(name.getBytes());
+ }
+ } else {
+ System.out.println(String.format("Removing %s from %s",
+ name, dest));
+ }
+ } else {
+ System.out.println(String.format("Copying %s to %s",
+ name, dest));
+ jos.putNextEntry(entry);
+ srcJarFile.getInputStream(entry).transferTo(jos);
+ }
+ }
+ }
+
+ // append new files
+ for (String file : files) {
+ if (file.equals("-")) {
+ break;
+ }
+ if (!updatedFiles.contains(file)) {
+ System.out.println(String.format("Adding %s with %s",
+ dest, file));
+ jos.putNextEntry(new JarEntry(file));
+ try (FileInputStream fis = new FileInputStream(file)) {
+ fis.transferTo(jos);
+ } catch (FileNotFoundException e) {
+ jos.write(file.getBytes());
+ }
+ }
+ }
+ }
+ System.out.println();
+ }
+
+}
--- a/test/lib/jdk/test/lib/wrappers/InfiniteLoop.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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.wrappers;
-
-import java.util.Objects;
-
-/**
- * Class which runs another Runnable in infinite loop with certain pauses
- * between cycles.
- */
-public class InfiniteLoop implements Runnable {
- private final Runnable target;
- private final long mills;
-
-
- /**
- * @param target a target to run in a loop
- * @param mills the length of pause time in milliseconds
- * @throws NullPointerException if target is null
- * @throws IllegalArgumentException if the value of millis is negative
- */
- public InfiniteLoop(Runnable target, long mills) {
- Objects.requireNonNull(target);
- if (mills < 0) {
- throw new IllegalArgumentException("mills < 0");
- }
- this.target = target;
- this.mills = mills;
- }
-
- @Override
- public void run() {
- try {
- while (true) {
- target.run();
- if (mills > 0) {
- Thread.sleep(mills);
- }
- }
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new Error(e);
- }
- }
-}
--- a/test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java Wed May 31 17:42:17 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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.wrappers;
-
-import java.util.Objects;
-import java.util.concurrent.Callable;
-
-/**
- * Auxiliary class to run target w/ given timeout.
- */
-public class TimeLimitedRunner implements Callable<Void> {
- private final long stoptime;
- private final long timeout;
- private final double factor;
- private final Callable<Boolean> target;
-
- /**
- * @param timeout a timeout. zero means no time limitation
- * @param factor a multiplier used to estimate next iteration time
- * @param target a target to run
- * @throws NullPointerException if target is null
- * @throws IllegalArgumentException if timeout is negative or
- factor isn't positive
- */
- public TimeLimitedRunner(long timeout, double factor,
- Callable<Boolean> target) {
- Objects.requireNonNull(target, "target must not be null");
- if (timeout < 0) {
- throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
- }
- if (factor <= 0d) {
- throw new IllegalArgumentException("factor[" + factor + "] <= 0");
- }
- this.stoptime = System.currentTimeMillis() + timeout;
- this.timeout = timeout;
- this.factor = factor;
- this.target = target;
- }
-
- /**
- * Runs @{linkplan target} while it returns true and timeout isn't exceeded
- */
- @Override
- public Void call() throws Exception {
- long maxDuration = 0L;
- long iterStart = System.currentTimeMillis();
- if (timeout != 0 && iterStart > stoptime) {
- return null;
- }
- while (target.call()) {
- if (timeout != 0) {
- long iterDuration = System.currentTimeMillis() - iterStart;
- maxDuration = Math.max(maxDuration, iterDuration);
- iterStart = System.currentTimeMillis();
- if (iterStart + (maxDuration * factor) > stoptime) {
- System.out.println("Not enough time to continue execution. "
- + "Interrupted.");
- break;
- }
- }
- }
- return null;
- }
-
-}