This README file contains build instructions for the OpenJDK. Building the source code for the OpenJDK requires a certain degree of technical expertise.
@@ -149,50 +151,50 @@
-
Package
-
Version
+
Package
+
Version
-
developer/solarisstudio-124/backend
-
12.4-1.0.6.0
+
developer/solarisstudio-124/backend
+
12.4-1.0.6.0
-
developer/solarisstudio-124/c++
-
12.4-1.0.10.0
+
developer/solarisstudio-124/c++
+
12.4-1.0.10.0
-
developer/solarisstudio-124/cc
-
12.4-1.0.4.0
+
developer/solarisstudio-124/cc
+
12.4-1.0.4.0
-
developer/solarisstudio-124/library/c++-libs
-
12.4-1.0.10.0
+
developer/solarisstudio-124/library/c++-libs
+
12.4-1.0.10.0
-
developer/solarisstudio-124/library/math-libs
-
12.4-1.0.0.1
+
developer/solarisstudio-124/library/math-libs
+
12.4-1.0.0.1
-
developer/solarisstudio-124/library/studio-gccrt
-
12.4-1.0.0.1
+
developer/solarisstudio-124/library/studio-gccrt
+
12.4-1.0.0.1
-
developer/solarisstudio-124/studio-common
-
12.4-1.0.0.1
+
developer/solarisstudio-124/studio-common
+
12.4-1.0.0.1
-
developer/solarisstudio-124/studio-ja
-
12.4-1.0.0.1
+
developer/solarisstudio-124/studio-ja
+
12.4-1.0.0.1
-
developer/solarisstudio-124/studio-legal
-
12.4-1.0.0.1
+
developer/solarisstudio-124/studio-legal
+
12.4-1.0.0.1
-
developer/solarisstudio-124/studio-zhCN
-
12.4-1.0.0.1
+
developer/solarisstudio-124/studio-zhCN
+
12.4-1.0.0.1
@@ -211,66 +213,66 @@
-
Binary Name
-
Category
-
Package
-
Description
+
Binary Name
+
Category
+
Package
+
Description
-
ar.exe
-
Devel
-
binutils
-
The GNU assembler, linker and binary utilities
+
ar.exe
+
Devel
+
binutils
+
The GNU assembler, linker and binary utilities
-
make.exe
-
Devel
-
make
-
The GNU version of the 'make' utility built for CYGWIN
+
make.exe
+
Devel
+
make
+
The GNU version of the 'make' utility built for CYGWIN
-
m4.exe
-
Interpreters
-
m4
-
GNU implementation of the traditional Unix macro processor
+
m4.exe
+
Interpreters
+
m4
+
GNU implementation of the traditional Unix macro processor
-
cpio.exe
-
Utils
-
cpio
-
A program to manage archives of files
+
cpio.exe
+
Utils
+
cpio
+
A program to manage archives of files
-
gawk.exe
-
Utils
-
awk
-
Pattern-directed scanning and processing language
+
gawk.exe
+
Utils
+
awk
+
Pattern-directed scanning and processing language
-
file.exe
-
Utils
-
file
-
Determines file type using 'magic' numbers
+
file.exe
+
Utils
+
file
+
Determines file type using 'magic' numbers
-
zip.exe
-
Archive
-
zip
-
Package and compress (archive) files
+
zip.exe
+
Archive
+
zip
+
Package and compress (archive) files
-
unzip.exe
-
Archive
-
unzip
-
Extract compressed files in a ZIP archive
+
unzip.exe
+
Archive
+
unzip
+
Extract compressed files in a ZIP archive
-
free.exe
-
System
-
procps
-
Display amount of free and used memory in the system
+
free.exe
+
System
+
procps
+
Display amount of free and used memory in the system
@@ -561,14 +563,14 @@
This is probably an issue with SELinux (See SELinux on Wikipedia). Parts of the VM is built without the -fPIC for performance reasons.
To completely disable SELinux:
-
+
$ su root
# system-config-securitylevel
In the window that appears, select the SELinux tab
Disable SELinux
Alternatively, instead of completely disabling it you could disable just this one check.
-
+
Select System->Administration->SELinux Management
In the SELinux Management Tool which appears, select "Boolean" from the menu on the left
Expand the "Memory Protection" group
@@ -616,62 +618,62 @@
-
Base OS and Architecture
-
OS
-
C/C++ Compiler
-
Processors
-
RAM Minimum
-
DISK Needs
+
Base OS and Architecture
+
OS
+
C/C++ Compiler
+
Processors
+
RAM Minimum
+
DISK Needs
-
Linux X86 (32-bit) and X64 (64-bit)
-
Oracle Enterprise Linux 6.4
-
gcc 4.9.2
-
2 or more
-
1 GB
-
6 GB
+
Linux X86 (32-bit) and X64 (64-bit)
+
Oracle Enterprise Linux 6.4
+
gcc 4.9.2
+
2 or more
+
1 GB
+
6 GB
-
Solaris SPARCV9 (64-bit)
-
Solaris 11 Update 1
-
Studio 12 Update 4 + patches
-
4 or more
-
4 GB
-
8 GB
+
Solaris SPARCV9 (64-bit)
+
Solaris 11 Update 1
+
Studio 12 Update 4 + patches
+
4 or more
+
4 GB
+
8 GB
-
Solaris X64 (64-bit)
-
Solaris 11 Update 1
-
Studio 12 Update 4 + patches
-
4 or more
-
4 GB
-
8 GB
+
Solaris X64 (64-bit)
+
Solaris 11 Update 1
+
Studio 12 Update 4 + patches
+
4 or more
+
4 GB
+
8 GB
-
Windows X86 (32-bit)
-
Windows Server 2012 R2 x64
-
Microsoft Visual Studio C++ 2013 Professional Edition
-
2 or more
-
2 GB
-
6 GB
+
Windows X86 (32-bit)
+
Windows Server 2012 R2 x64
+
Microsoft Visual Studio C++ 2013 Professional Edition
+
2 or more
+
2 GB
+
6 GB
-
Windows X64 (64-bit)
-
Windows Server 2012 R2 x64
-
Microsoft Visual Studio C++ 2013 Professional Edition
-
2 or more
-
2 GB
-
6 GB
+
Windows X64 (64-bit)
+
Windows Server 2012 R2 x64
+
Microsoft Visual Studio C++ 2013 Professional Edition
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.
+
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
$ 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"
+$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+$ make exploded-run-test TEST=hotspot_tier1
Test selection
All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the TEST variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.
For some common top-level tests, direct make targets have been generated. This includes all JTreg test groups, the hotspot gtest, and custom tests (if present). This means that make run-test-tier1 is equivalent to make run-test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the run-test TEST="x" solution needs to be used.
diff -r 957f1a2dc196 -r 098910995d15 common/doc/testing.md
--- a/common/doc/testing.md Sat May 27 12:52:18 2017 +0530
+++ b/common/doc/testing.md Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 corba/.hgtags
--- a/corba/.hgtags Sat May 27 12:52:18 2017 +0530
+++ b/corba/.hgtags Fri Jun 02 14:46:29 2017 -0700
@@ -422,3 +422,5 @@
8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170
aed5a4edc8275c1c50195503756ff92bfe0197f5 jdk-10+7
648b0a00824eb29e71936bc3258d309a25e3b8c0 jdk-10+8
+54c6621f7b34cc6ce6c0882d047f61fe0962c257 jdk-10+9
+c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171
diff -r 957f1a2dc196 -r 098910995d15 hotspot/.hgtags
--- a/hotspot/.hgtags Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/.hgtags Fri Jun 02 14:46:29 2017 -0700
@@ -582,3 +582,5 @@
38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170
9d4746eca95aec3e5a344bf2520745dcc1d17eed jdk-10+7
f5ded0cf954c770deeecb80f2ba1ba6a05cd979b jdk-10+8
+233647e3d3800e76d7612014b745b37a88098f63 jdk-10+9
+d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171
diff -r 957f1a2dc196 -r 098910995d15 hotspot/.mx.jvmci/mx_jvmci.py
--- a/hotspot/.mx.jvmci/mx_jvmci.py Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/.mx.jvmci/mx_jvmci.py Fri Jun 02 14:46:29 2017 -0700
@@ -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., /build/macosx-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2)
+ (e.g., /build/macosx-x86_64-normal-server-release/hotspot/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):
diff -r 957f1a2dc196 -r 098910995d15 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri Jun 02 14:46:29 2017 -0700
@@ -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) {
diff -r 957f1a2dc196 -r 098910995d15 hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Fri Jun 02 14:46:29 2017 -0700
@@ -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); }
diff -r 957f1a2dc196 -r 098910995d15 hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
--- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 hotspot/src/share/vm/oops/constMethod.cpp
--- a/hotspot/src/share/vm/oops/constMethod.cpp Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/src/share/vm/oops/constMethod.cpp Fri Jun 02 14:46:29 2017 -0700
@@ -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();
diff -r 957f1a2dc196 -r 098910995d15 hotspot/src/share/vm/opto/matcher.cpp
--- a/hotspot/src/share/vm/opto/matcher.cpp Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/src/share/vm/opto/matcher.cpp Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 hotspot/src/share/vm/opto/memnode.cpp
--- a/hotspot/src/share/vm/opto/memnode.cpp Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/src/share/vm/opto/memnode.cpp Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 hotspot/test/ProblemList.txt
--- a/hotspot/test/ProblemList.txt Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/test/ProblemList.txt Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
--- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 {
diff -r 957f1a2dc196 -r 098910995d15 hotspot/test/compiler/codecache/stress/Helper.java
--- a/hotspot/test/compiler/codecache/stress/Helper.java Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/test/compiler/codecache/stress/Helper.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 hotspot/test/serviceability/jdwp/AllModulesCommandTest.java
--- a/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java Sat May 27 12:52:18 2017 +0530
+++ b/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jaxp/.hgtags
--- a/jaxp/.hgtags Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/.hgtags Fri Jun 02 14:46:29 2017 -0700
@@ -422,3 +422,5 @@
6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170
09cae4c36242734f5450de739b8264523a030809 jdk-10+7
856998840907b67b7e1fc49259f785ac085a189b jdk-10+8
+3c75f07b2a49cb0a4f4eb5df8bbcbc64dda3153f jdk-10+9
+c27321c889cf4c8e465a61b84572c00ef7ee6004 jdk-9+171
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Fri Jun 02 14:46:29 2017 -0700
@@ -34,9 +34,9 @@
* The CatalogFeatures holds a collection of features and properties.
*
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.
Field by Field Conversion from
+ * {@link GregorianCalendar} to an {@link XMLGregorianCalendar}
*
*
- *
- * Field by Field Conversion from
- * {@link GregorianCalendar} to an {@link XMLGregorianCalendar}
- *
- *
- *
*
{@code java.util.GregorianCalendar} field
*
{@code javax.xml.datatype.XMLGregorianCalendar} field
*
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/Duration.java Fri Jun 02 14:46:29 2017 -0700
@@ -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}.
*
- *
+ *
+ *
Required fields for XML Schema 1.0 Date/Time Datatypes.
+ * (timezone is optional for all date/time datatypes)
*
*
- *
- * Required fields for XML Schema 1.0 Date/Time Datatypes.
- * (timezone is optional for all date/time datatypes)
- *
+ *
Datatype
+ *
year
+ *
month
+ *
day
+ *
hour
+ *
minute
+ *
second
*
*
*
*
- *
Datatype
- *
year
- *
month
- *
day
- *
hour
- *
minute
- *
second
- *
- *
*
{@link DatatypeConstants#DURATION}
*
X
*
X
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/XMLGregorianCalendar.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 @@
* W3C XML Schema 1.0 Part 2, Appendix D,
* ISO 8601 Date and Time Formats.
*
- *
- *
+ *
+ *
+ *
Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
*
*
- *
- * Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation
- *
Independent of month, max range is 1 to 31 or {@link DatatypeConstants#FIELD_UNDEFINED}.
* The normative value constraint stated relative to month
@@ -102,7 +98,7 @@
*
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.
*
- *
+ *
+ *
Required fields for XML Schema 1.0 Date/Time Datatypes.
+ * (timezone is optional for all date/time datatypes)
*
*
- *
- * Required fields for XML Schema 1.0 Date/Time Datatypes.
- * (timezone is optional for all date/time datatypes)
- *
W3C XML Schema data types that have a "natural" mapping to Java types are defined by
@@ -151,7 +152,7 @@
xs:unsignedShort
-
+
@@ -162,7 +163,7 @@
Since 1.5
-
+
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java Fri Jun 02 14:46:29 2017 -0700
@@ -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:
*
- *
+ *
+ *
Return value for specified prefixes
*
*
- *
- * {@code getNamespaceURI(prefix)}
- * return value for specified prefixes
- *
- *
- *
- *
prefix parameter
- *
Namespace URI return value
+ *
prefix parameter
+ *
Namespace URI return value
*
*
*
@@ -158,15 +153,10 @@
* table describes the returned prefix value for all Namespace URI
* values:
*
- *
+ *
+ *
Return value for specified Namespace URIs
*
*
- *
- * {@code getPrefix(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
- *
*
Namespace URI parameter
*
prefix value returned
*
@@ -230,14 +220,10 @@
* table describes the returned prefixes value for all Namespace
* URI values:
*
- *
+ *
+ *
Return value for specified Namespace URIs
*
*
- *
{@code
- * getPrefixes(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
*
Namespace URI parameter
*
prefixes value returned
*
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
- *
+ *
+ *
Required and optional fields for events added to the writer
*
*
- *
- * Required and optional fields for events added to the writer
- *
- *
- *
- *
- *
*
Event Type
*
Required Fields
*
Optional Fields
*
Required Behavior
*
+ *
+ *
*
*
START_ELEMENT
*
QName name
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
+ *
+ *
Configuration Parameters
*
*
- *
- * Configuration parameters
- *
- *
- *
- *
- *
*
Property Name
*
Behavior
*
Return type
*
Default Value
*
Required
*
+ *
+ *
*
javax.xml.stream.isValidating
Turns on/off implementation specific DTD validation
Boolean
False
No
*
javax.xml.stream.isNamespaceAware
Turns on/off namespace processing for XML 1.0 support
Boolean
True
True (required) / False (optional)
*
javax.xml.stream.isCoalescing
Requires the processor to coalesce adjacent character data
Boolean
False
Yes
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
+ *
+ *
Configuration Parameters
*
*
- *
- * Configuration parameters
- *
- *
- *
- *
- *
*
Property Name
*
Behavior
*
Return type
*
Default Value
*
Required
*
+ *
+ *
*
javax.xml.stream.isRepairingNamespaces
defaults prefixes
* on the output side
Boolean
False
Yes
*
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
+ *
+ *
Valid methods for each state
*
*
- *
- * Valid methods for each state
- *
- *
- *
- *
- *
*
Event Type
*
Valid Methods
*
+ *
+ *
*
*
All States
*
getProperty(), hasNext(), require(), close(),
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
+ *
+ *
XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour
*
- *
- *
XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour
Namespaces
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
Schema Language
+ *
Schema Language
*
* 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.
*
- *
+ *
+ *
URIs for Supported Schema languages
*
*
*
value
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
* @throws NullPointerException
- * If the schemaLanguage parameter is null.
+ * If the schemaLanguage parameter is null.
*
* @return null if the callee fails to create one.
*/
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 @@
*
This method places the following restrictions on the types of
* the {@link Source}/{@link Result} accepted.
*
- *
+ *
+ *
{@code Source} / {@code Result} Accepted
*
*
- *
{@code Source} / {@code Result} Accepted
- *
- *
*
*
{@link javax.xml.transform.stream.StreamSource}
*
{@link javax.xml.transform.sax.SAXSource}
@@ -144,7 +142,7 @@
*
{@link javax.xml.transform.stax.StAXSource}
*
*
- *
+ *
*
*
{@code null}
*
OK
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/validation/package.html
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html Fri Jun 02 14:46:29 2017 -0700
@@ -1,6 +1,6 @@
-
+
-
-
-
+
javax.xml.validation
@@ -86,7 +82,7 @@
process simple (see example below).
- Usage example. The following example demonstrates validating
+ Usage example. The following example demonstrates validating
an XML document with the Validation API (for readability, some exception handling is not shown):
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
- *
+ *
+ *
+ *
Evaluation of XPath Expressions
*
*
- *
Evaluation of XPath Expressions.
+ *
Factor
+ *
Behavior
*
*
+ *
*
*
context
*
@@ -84,6 +88,7 @@
* Conversion to the return type follows XPath conversion rules.
*
*
+ *
*
*
*
An XPath object is not thread-safe and not reentrant.
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.
*
- *
- *
+ *
+ *
+ *
Evaluation of XPath Expressions
*
*
- *
Evaluation of XPath Expressions.
+ *
Factor
+ *
Behavior
*
*
+ *
*
*
context
*
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html Fri Jun 02 14:46:29 2017 -0700
@@ -1,8 +1,8 @@
-
+
-
+
This package provides an object-model neutral API for the
evaluation of XPath expressions and access to the evaluation
@@ -36,7 +36,7 @@
The XPath API supports
XML Path Language (XPath) Version 1.0
-
+
The XPath language provides a simple, concise syntax for selecting
@@ -69,7 +69,7 @@
replace many lines of DOM API code.
-
+
2. XPath Expressions
An XPath expression is composed of a location
@@ -139,11 +139,15 @@
nodes. The following table gives examples of location paths for each
of these node types:
-
+
+
Examples of Location Path
+
-
Location Path
-
Description
+
Location Path
+
Description
+
+
/foo/bar/@id
@@ -171,6 +175,7 @@
<bar> element.
+
Predicates allow for refining the nodes selected by an XPath
@@ -194,7 +199,7 @@
-
+
3. XPath Data Types
While XPath expressions select nodes in the XML document, the XPath
@@ -207,7 +212,7 @@
String
-
+
3.1 QName types
The XPath API defines the following {@link javax.xml.namespace.QName} types to
represent return types of an XPath evaluation:
@@ -236,7 +241,7 @@
The Number return type attempts to coalesce the text
of a node to a double data type.
-
+
3.2 Class types
In addition to the QName types, the XPath API supports the use of Class types
through the XPathExpression.evaluteExpression(...) or
@@ -254,14 +259,14 @@
Of the subtypes of Number, only Double, Integer and Long are supported.
-
+
3.3 Enum types
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 XPathExpression.evaluteExpression(...)
or XPath.evaluateExpression(...) methods will be of one of these types.
-
+
4. XPath Context
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.
-
+
5. Using the XPath API
Consider the following XML document:
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java Fri Jun 02 14:46:29 2017 -0700
@@ -111,7 +111,9 @@
*
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:
- *
+ *
+ *
Examples of the Original, Normalized and Serialized Values
+ *
*
*
Examples
*
Parsed
@@ -119,6 +121,8 @@
*
Initial Attr.value
*
Serialized attribute value
*
+ *
+ *
*
*
* Character reference
@@ -126,7 +130,7 @@
*
"x²=5"
*
*
- *
"x\u00b2=5"
+ *
"x²=5"
*
*
*
"x²=5"
@@ -180,6 +184,7 @@
*
Dependent on Implementation and Load Options
*
Dependent on Implementation and Load/Save Options
*
+ *
*
*
See also the Document Object Model (DOM) Level 3 Core Specification.
*/
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java Fri Jun 02 14:46:29 2017 -0700
@@ -353,37 +353,42 @@
* instantiate.
* @return A new Element object with the following
* attributes:
- *
+ *
+ *
Attributes of the {@code Element} object
+ *
*
*
Attribute
*
Value
*
+ *
+ *
*
- *
Node.nodeName
- *
+ *
Node.nodeName
+ *
* qualifiedName
*
*
- *
Node.namespaceURI
- *
+ *
Node.namespaceURI
+ *
* namespaceURI
*
*
- *
Node.prefix
- *
prefix, extracted
+ *
Node.prefix
+ *
prefix, extracted
* from qualifiedName, or null if there is
* no prefix
*
*
- *
Node.localName
- *
local name, extracted from
+ *
Node.localName
+ *
local name, extracted from
* qualifiedName
*
*
- *
Element.tagName
- *
+ *
Element.tagName
+ *
* qualifiedName
*
+ *
*
* @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 Attr object with the following attributes:
- *
+ *
+ *
Attributes of the {@code Attr} object
+ *
*
*
* Attribute
*
Value
*
+ *
+ *
*
- *
Node.nodeName
- *
qualifiedName
+ *
Node.nodeName
+ *
qualifiedName
*
*
- *
+ *
* Node.namespaceURI
- *
namespaceURI
+ *
namespaceURI
*
*
- *
+ *
* Node.prefix
- *
prefix, extracted from
+ *
prefix, extracted from
* qualifiedName, or null if there is no
* prefix
*
*
- *
Node.localName
- *
local name, extracted from
+ *
Node.localName
+ *
local name, extracted from
* qualifiedName
*
*
- *
Attr.name
- *
+ *
Attr.name
+ *
* qualifiedName
*
*
- *
Node.nodeValue
- *
the empty
+ *
Node.nodeValue
+ *
the empty
* string
*
+ *
*
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java Fri Jun 02 14:46:29 2017 -0700
@@ -61,104 +61,109 @@
*
The values of nodeName,
* nodeValue, and attributes vary according to the
* node type as follows:
- *
+ *
+ *
Interface table
+ *
*
*
Interface
*
nodeName
*
nodeValue
*
attributes
*
+ *
+ *
*
- *
+ *
* Attr
- *
same as Attr.name
- *
same as
+ *
same as Attr.name
+ *
same as
* Attr.value
- *
null
+ *
null
*
*
- *
CDATASection
- *
+ *
CDATASection
+ *
* "#cdata-section"
- *
same as CharacterData.data, the
+ *
same as CharacterData.data, the
* content of the CDATA Section
- *
null
+ *
null
*
*
- *
Comment
- *
+ *
Comment
+ *
* "#comment"
- *
same as CharacterData.data, the
+ *
same as CharacterData.data, the
* content of the comment
- *
null
+ *
null
*
*
- *
Document
- *
+ *
Document
+ *
* "#document"
- *
null
- *
null
+ *
null
+ *
null
*
*
- *
+ *
* DocumentFragment
- *
"#document-fragment"
- *
+ *
"#document-fragment"
+ *
* null
- *
null
+ *
null
*
*
- *
DocumentType
- *
same as
+ *
DocumentType
+ *
same as
* DocumentType.name
- *
null
- *
null
+ *
null
+ *
null
*
*
- *
+ *
* Element
- *
same as Element.tagName
- *
null
- *
+ *
same as Element.tagName
+ *
null
+ *
* NamedNodeMap
*
*
- *
Entity
- *
entity name
- *
null
- *
+ *
Entity
+ *
entity name
+ *
null
+ *
* null
*
*
- *
EntityReference
- *
name of entity referenced
- *
+ *
EntityReference
+ *
name of entity referenced
+ *
* null
- *
null
+ *
null
*
*
- *
Notation
- *
notation name
- *
+ *
Notation
+ *
notation name
+ *
* null
- *
null
+ *
null
*
*
- *
ProcessingInstruction
- *
same
+ *
ProcessingInstruction
+ *
same
* as ProcessingInstruction.target
- *
same as
+ *
same as
* ProcessingInstruction.data
- *
null
+ *
null
*
*
- *
Text
- *
+ *
Text
+ *
* "#text"
- *
same as CharacterData.data, the content
+ *
same as CharacterData.data, the content
* of the text node
- *
null
+ *
null
*
+ *
*
*
See also the Document Object Model (DOM) Level 3 Core Specification.
*/
@@ -687,30 +692,35 @@
* textual content.
* The string returned is made of the text content of this node
* depending on its type, as defined below:
- *
concatenation of the textContent
* 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.
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
@@ -737,30 +747,35 @@
* textual content.
* The string returned is made of the text content of this node
* depending on its type, as defined below:
- *
concatenation of the textContent
* 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.
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 http://www.w3.org/Consortium/Legal/copyright-software-19980720
This W3C work (including software, documents, or other related items) is
being provided by the copyright holders under the following license. By
diff -r 957f1a2dc196 -r 098910995d15 jaxp/src/java.xml/share/classes/org/xml/sax/package.html
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/package.html Sat May 27 12:52:18 2017 +0530
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/package.html Fri Jun 02 14:46:29 2017 -0700
@@ -24,14 +24,18 @@
setFeature. Those standard identifiers are:
-
-
+
+
SAX2 Standard Features
+
+
Feature ID
Access
Default
Description
-
+
+
+
external-general-entities
read/write
@@ -208,7 +212,7 @@
Returns "false" if the parser supports only XML 1.0.
-
+
Support for the default values of the
@@ -236,11 +240,15 @@
dom-node. Manage those properties using
setProperty(). Those identifiers are:
-
-
+
+
SAX2 Standard Properties
+
+
Property ID
Description
+
+
declaration-handler
@@ -287,7 +295,7 @@
Readable only during a parser callback, this exposes a TBS
chunk of characters responsible for the current event.
-
+
All of these standard properties are optional;
diff -r 957f1a2dc196 -r 098910995d15 jaxws/.hgtags
--- a/jaxws/.hgtags Sat May 27 12:52:18 2017 +0530
+++ b/jaxws/.hgtags Fri Jun 02 14:46:29 2017 -0700
@@ -425,3 +425,5 @@
e75d3abe579a7b39b762fc0a1a337c49eb072d82 jdk-9+170
b0efae7df1dfa14926058baebaf999e4268c955c jdk-10+7
e705867d9989d00e4357f66f18b302c95e13b5e7 jdk-10+8
+2fe03e35bed54238bcaeeb298b011df240e3711d jdk-10+9
+139e7c786ee4885efe53eb650b72c7b5a2d3b964 jdk-9+171
diff -r 957f1a2dc196 -r 098910995d15 jdk/.hgtags
--- a/jdk/.hgtags Sat May 27 12:52:18 2017 +0530
+++ b/jdk/.hgtags Fri Jun 02 14:46:29 2017 -0700
@@ -422,3 +422,5 @@
ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170
cbd65760a005766610583949b3b5c9ace92e74b3 jdk-10+7
f0adc10ed8316e6cf316e3208c5ecf6835d22bc4 jdk-10+8
+b9409a7daa6c793dd631e52fe6ef79d08a3b337a jdk-10+9
+29bbedd4cce8e14742bdb22118c057b877c02f0f jdk-9+171
diff -r 957f1a2dc196 -r 098910995d15 jdk/make/data/docs-resources/resources/jdk-default.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/docs-resources/resources/jdk-default.css Fri Jun 02 14:46:29 2017 -0700
@@ -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;
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/make/data/docs-resources/specs/resources/jdk-default.css
--- a/jdk/make/data/docs-resources/specs/resources/jdk-default.css Sat May 27 12:52:18 2017 +0530
+++ /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;
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java
--- a/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 moduleGroups;
-
+ final Map> moduleGroups = new HashMap<>();
GenDocsBundlePage(String title, Path outputfile) throws IOException
{
this.outputfile = outputfile;
this.title = title;
- this.moduleGroups = moduleGroups();
- }
- static Map moduleGroups() throws IOException {
+ // read module groups
ModuleFinder finder = ModuleFinder.ofSystem();
- Map 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 mods = Stream.of(props.getProperty(key).split("\\s+"))
- .filter(mn -> finder.find(mn).isPresent())
- .map(String::trim)
- .collect(Collectors.toSet());
+ Set 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("\n
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Fri Jun 02 14:46:29 2017 -0700
@@ -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));
}
/**
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Fri Jun 02 14:46:29 2017 -0700
@@ -34,7 +34,6 @@
\ / 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
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.base/share/native/libjli/args.c
--- a/jdk/src/java.base/share/native/libjli/args.c Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.base/share/native/libjli/args.c Fri Jun 02 14:46:29 2017 -0700
@@ -456,6 +456,11 @@
env++;
}
+ // Trailing space
+ if (*env == '\0') {
+ break;
+ }
+
arg = p;
while (*env != '\0' && !isspace(*env)) {
if (*env == '"' || *env == '\'') {
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.base/share/native/libjli/emessages.h
--- a/jdk/src/java.base/share/native/libjli/emessages.h Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.base/share/native/libjli/emessages.h Fri Jun 02 14:46:29 2017 -0700
@@ -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"
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c
--- a/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java Fri Jun 02 14:46:29 2017 -0700
@@ -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,
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java Fri Jun 02 14:46:29 2017 -0700
@@ -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,
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 whenReceivingResponse() {
throw new UnsupportedOperationException("Not supported.");
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java Fri Jun 02 14:46:29 2017 -0700
@@ -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);
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java Fri Jun 02 14:46:29 2017 -0700
@@ -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);
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 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;
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java Fri Jun 02 14:46:29 2017 -0700
@@ -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();
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java Fri Jun 02 14:46:29 2017 -0700
@@ -157,11 +157,6 @@
}
@Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- return delegate.readImpl(buffer);
- }
-
- @Override
boolean isSecure() {
return false;
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java Fri Jun 02 14:46:29 2017 -0700
@@ -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> map) {
+ map.forEach((k,v) -> {
+ System.out.print (k + ": ");
+ for (String val : v) {
+ System.out.print(val + ", ");
+ }
+ System.out.println("");
+ });
+ }
+
private Map> 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
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java Fri Jun 02 14:46:29 2017 -0700
@@ -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();
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/ProblemList.txt
--- a/jdk/test/ProblemList.txt Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/ProblemList.txt Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java
--- a/jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/com/sun/crypto/provider/CICO/PBEFunc/CipherNCFuncTest.java
--- a/jdk/test/com/sun/crypto/provider/CICO/PBEFunc/CipherNCFuncTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/com/sun/crypto/provider/CICO/PBEFunc/CipherNCFuncTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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,
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/File/createTempFile/SecurityTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/File/createTempFile/SecurityTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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");
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/File/createTempFile/java.policy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/File/createTempFile/java.policy Fri Jun 02 14:46:29 2017 -0700
@@ -0,0 +1,2 @@
+grant {
+};
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/InputStream/ReadAllBytes.java
--- a/jdk/test/java/io/InputStream/ReadAllBytes.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/io/InputStream/ReadAllBytes.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/InputStream/ReadNBytes.java
--- a/jdk/test/java/io/InputStream/ReadNBytes.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/io/InputStream/ReadNBytes.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh
--- a/jdk/test/java/io/Serializable/evolution/AddedExternField/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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");
+ }
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh
--- a/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/failureAtomicity/FailureAtomicity.java
--- a/jdk/test/java/io/Serializable/failureAtomicity/FailureAtomicity.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/io/Serializable/failureAtomicity/FailureAtomicity.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/maskSyntheticModifier/MaskSyntheticModifierTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/maskSyntheticModifier/MaskSyntheticModifierTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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);
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/maskSyntheticModifier/Test.java
--- a/jdk/test/java/io/Serializable/maskSyntheticModifier/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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);
- }
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh
--- a/jdk/test/java/io/Serializable/maskSyntheticModifier/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/packageAccess/PackageAccessTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/packageAccess/PackageAccessTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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);
+ }
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/packageAccess/Test.java
--- a/jdk/test/java/io/Serializable/packageAccess/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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);
- }
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/packageAccess/run.sh
--- a/jdk/test/java/io/Serializable/packageAccess/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/consTest/ConsTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/resolveClass/consTest/ConsTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 });
+ }
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/consTest/SetupJar.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/resolveClass/consTest/SetupJar.java Fri Jun 02 14:46:29 2017 -0700
@@ -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"));
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/consTest/Test.java
--- a/jdk/test/java/io/Serializable/resolveClass/consTest/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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 });
- }
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/consTest/run.sh
--- a/jdk/test/java/io/Serializable/resolveClass/consTest/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/deserializeButton/DeserializeButtonTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/resolveClass/deserializeButton/DeserializeButtonTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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"));
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/deserializeButton/Test.java
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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();
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh
--- a/jdk/test/java/io/Serializable/resolveClass/deserializeButton/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/serialver/classpath/ClasspathTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/serialver/classpath/ClasspathTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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");
+ }
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/serialver/classpath/Test.java
--- a/jdk/test/java/io/Serializable/serialver/classpath/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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;
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/serialver/classpath/run.sh
--- a/jdk/test/java/io/Serializable/serialver/classpath/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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 $?
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/serialver/nested/NestedTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/serialver/nested/NestedTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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.");
+ }
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/serialver/nested/Test.java
--- a/jdk/test/java/io/Serializable/serialver/nested/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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;
- }
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/serialver/nested/run.sh
--- a/jdk/test/java/io/Serializable/serialver/nested/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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 $?
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/subclass/Allow.policy
--- a/jdk/test/java/io/Serializable/subclass/Allow.policy Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/io/Serializable/subclass/Allow.policy Fri Jun 02 14:46:29 2017 -0700
@@ -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.
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/subclass/SubclassTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/subclass/SubclassTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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();
+ }
+};
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/subclass/Test.java
--- a/jdk/test/java/io/Serializable/subclass/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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();
- }
-};
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/subclass/run.sh
--- a/jdk/test/java/io/Serializable/subclass/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/superclassDataLoss/SuperclassDataLossTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/superclassDataLoss/SuperclassDataLossTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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);
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/superclassDataLoss/Test.java
--- a/jdk/test/java/io/Serializable/superclassDataLoss/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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();
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/superclassDataLoss/run.sh
--- a/jdk/test/java/io/Serializable/superclassDataLoss/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/unnamedPackageSwitch/Test.java
--- a/jdk/test/java/io/Serializable/unnamedPackageSwitch/Test.java Sat May 27 12:52:18 2017 +0530
+++ /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();
- }
-}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/unnamedPackageSwitch/UnnamedPackageSwitchTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/io/Serializable/unnamedPackageSwitch/UnnamedPackageSwitchTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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();
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh
--- a/jdk/test/java/io/Serializable/unnamedPackageSwitch/run.sh Sat May 27 12:52:18 2017 +0530
+++ /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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Class/forName/modules/TestDriver.java
--- a/jdk/test/java/lang/Class/forName/modules/TestDriver.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Class/forName/modules/TestDriver.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
*/
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/ClassLoader/Assert.java
--- a/jdk/test/java/lang/ClassLoader/Assert.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/ClassLoader/Assert.java Fri Jun 02 14:46:29 2017 -0700
@@ -28,7 +28,7 @@
* @run main/othervm Assert
* @summary Test the assertion facility
* @author Mike McCloskey
- * @key randomness intermittent
+ * @key randomness
*/
import package1.*;
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Double/ParseHexFloatingPoint.java
--- a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java Fri Jun 02 14:46:29 2017 -0700
@@ -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(){}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Integer/BitTwiddle.java
--- a/jdk/test/java/lang/Integer/BitTwiddle.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Integer/BitTwiddle.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Long/BitTwiddle.java
--- a/jdk/test/java/lang/Long/BitTwiddle.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Long/BitTwiddle.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Math/CubeRootTests.java
--- a/jdk/test/java/lang/Math/CubeRootTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Math/CubeRootTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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(){}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Math/HypotTests.java
--- a/jdk/test/java/lang/Math/HypotTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Math/HypotTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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(){}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Math/IeeeRecommendedTests.java
--- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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(){}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Math/Log1pTests.java
--- a/jdk/test/java/lang/Math/Log1pTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Math/Log1pTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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(){}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/Math/MultiplicationTests.java
--- a/jdk/test/java/lang/Math/MultiplicationTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/Math/MultiplicationTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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(){}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/StackWalker/StackWalkTest.java
--- a/jdk/test/java/lang/StackWalker/StackWalkTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/StackWalker/StackWalkTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/StrictMath/CubeRootTests.java
--- a/jdk/test/java/lang/StrictMath/CubeRootTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/StrictMath/CubeRootTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/StrictMath/ExpTests.java
--- a/jdk/test/java/lang/StrictMath/ExpTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/StrictMath/ExpTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/StrictMath/HypotTests.java
--- a/jdk/test/java/lang/StrictMath/HypotTests.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/StrictMath/HypotTests.java Fri Jun 02 14:46:29 2017 -0700
@@ -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
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/String/LiteralReplace.java
--- a/jdk/test/java/lang/String/LiteralReplace.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/String/LiteralReplace.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
--- a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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,
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
+ EnumSet 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));
}
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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));
}
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 ctor, Collection testMethods) {
+ TestRun(Function ctor,
+ Collection 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 ctor, Collection testMethods) {
+ public static void runTests(Function ctor,
+ Collection 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) {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/LFCaching/TestMethods.java
--- a/jdk/test/java/lang/invoke/LFCaching/TestMethods.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/LFCaching/TestMethods.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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> 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 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> 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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> 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 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> 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 getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map 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 data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- return MethodHandles.invoker(mtTarget);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ return MethodHandles.invoker(mtTarget);
+ }
+ },
EXACT_INVOKER("exactInvoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map 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 data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- return MethodHandles.exactInvoker(mtTarget);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ return MethodHandles.exactInvoker(mtTarget);
+ }
+ },
SPREAD_INVOKER("spreadInvoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map getTestCaseData() {
- Map 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 getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map 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 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 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 getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map 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 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 getTestCaseData() {
- Map 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 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 getTestCaseData() {
+ Map 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 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 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 data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- throw new UnsupportedOperationException("TESTBUG: getMH method is not implemented for test method " + this);
+ protected MethodHandle getMH(Map 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));
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
--- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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> list = new ArrayList<>(constructors.length *
- throwables.length * ThrowMode.values().length);
+ List> list = new ArrayList<>(constructors.length
+ * throwables.length * ThrowMode.values().length);
//noinspection unchecked
for (PartialConstructor f : constructors) {
for (ThrowMode mode : ThrowMode.values()) {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/MethodHandlesTest.java
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
-
/**
*
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/PermuteArgsTest.java
--- a/jdk/test/java/lang/invoke/PermuteArgsTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/PermuteArgsTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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 done) throws Throwable {
+ static void testPermutations(MethodHandle mh, int[] perm, int start, int end,
+ Set 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 done) throws Throwable {
+ static void testRotations(MethodHandle mh, int[] perm, int start, int end,
+ Set 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;
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java
--- a/jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Fri Jun 02 14:46:29 2017 -0700
@@ -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);
}
}
}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/VarargsArrayTest.java
--- a/jdk/test/java/lang/invoke/VarargsArrayTest.java Sat May 27 12:52:18 2017 +0530
+++ b/jdk/test/java/lang/invoke/VarargsArrayTest.java Fri Jun 02 14:46:29 2017 -0700
@@ -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) {
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java Fri Jun 02 14:46:29 2017 -0700
@@ -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;
+ }
+}
diff -r 957f1a2dc196 -r 098910995d15 jdk/test/java/lang/invoke/common/test/java/lang/invoke/lib/Helper.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/common/test/java/lang/invoke/lib/Helper.java Fri Jun 02 14:46:29 2017 -0700
@@ -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> 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