check in the orb.properties file located in the user.home
- * directory (if any)
+ * directory, if any
*
- *
check in the orb.properties file located in the java.home/lib
- * directory (if any)
+ *
check in the orb.properties file located in the run-time image,
+ * if any
*
*
fall back on a hardcoded default behavior (use the Java IDL
* implementation)
@@ -170,9 +170,15 @@
* Thus, where appropriate, it is necessary that
* the classes for this alternative ORBSingleton are available on the application's class path.
* It should be noted that the singleton ORB is system wide.
- *
+ *
* When a per-application ORB is created via the 2-arg init methods,
* then it will be located using the thread context class loader.
+ *
+ * The IDL to Java Language OMG specification documents the ${java.home}/lib directory as the location,
+ * in the Java run-time image, to search for orb.properties.
+ * This location is not intended for user editable configuration files.
+ * Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties,
+ * and thereafter the ${java.home}/lib directory.
*
* @since JDK1.2
*/
@@ -271,14 +277,25 @@
}
String javaHome = System.getProperty("java.home");
- fileName = javaHome + File.separator
- + "lib" + File.separator + "orb.properties";
- props = getFileProperties( fileName ) ;
+
+ fileName = javaHome + File.separator + "conf"
+ + File.separator + "orb.properties";
+ props = getFileProperties(fileName);
+
+ if (props != null) {
+ String value = props.getProperty(name);
+ if (value != null)
+ return value;
+ }
+
+ fileName = javaHome + File.separator + "lib"
+ + File.separator + "orb.properties";
+ props = getFileProperties(fileName);
if (props == null)
- return null ;
+ return null;
else
- return props.getProperty( name ) ;
+ return props.getProperty(name);
}
}
);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/.hgtags
--- a/hotspot/.hgtags Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/.hgtags Mon Mar 13 19:58:33 2017 +0000
@@ -556,5 +556,9 @@
2a2ac7d9f52c8cb2b80077e515b5840b947e640c jdk-9+151
31f1d26c60df7b2e516a4f84160d76ba017d4e09 jdk-9+152
217ba81b9a4ce8698200370175aa2db86a39f66c jdk-9+153
+fc7e94cb748507366b839e859f865f724467446a jdk-10+0
a9fdfd55835ef9dccb7f317b07249bd66653b874 jdk-9+154
f3b3d77a1751897413aae43ac340a130b6fa2ae1 jdk-9+155
+43139c588ea48b6504e52b6c3dec530b17b1fdb4 jdk-9+156
+b2d0a906afd73dcf27f572217eb1be0f196ec16c jdk-9+157
+4e78f30935229f13ce7c43089621cf7169f5abac jdk-9+158
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/.jcheck/conf
--- a/hotspot/.jcheck/conf Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/.jcheck/conf Mon Mar 13 19:58:33 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1922,12 +1922,17 @@
}
if (opr2->is_constant()) {
+ bool is_32bit = false; // width of register operand
jlong imm;
+
switch(opr2->type()) {
+ case T_INT:
+ imm = opr2->as_constant_ptr()->as_jint();
+ is_32bit = true;
+ break;
case T_LONG:
imm = opr2->as_constant_ptr()->as_jlong();
break;
- case T_INT:
case T_ADDRESS:
imm = opr2->as_constant_ptr()->as_jint();
break;
@@ -1942,14 +1947,14 @@
}
if (Assembler::operand_valid_for_add_sub_immediate(imm)) {
- if (type2aelembytes(opr1->type()) <= 4)
+ if (is_32bit)
__ cmpw(reg1, imm);
else
__ cmp(reg1, imm);
return;
} else {
__ mov(rscratch1, imm);
- if (type2aelembytes(opr1->type()) <= 4)
+ if (is_32bit)
__ cmpw(reg1, rscratch1);
else
__ cmp(reg1, rscratch1);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/cpu/aarch64/vm/c1_globals_aarch64.hpp
--- a/hotspot/src/cpu/aarch64/vm/c1_globals_aarch64.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/c1_globals_aarch64.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,10 +45,8 @@
// We compile very aggressively with the builtin simulator because
// doing so greatly reduces run times and tests more code.
define_pd_global(intx, CompileThreshold, 150 );
-define_pd_global(intx, BackEdgeThreshold, 500);
#else
define_pd_global(intx, CompileThreshold, 1500 );
-define_pd_global(intx, BackEdgeThreshold, 100000);
#endif
define_pd_global(intx, OnStackReplacePercentage, 933 );
@@ -76,6 +74,4 @@
define_pd_global(bool, CSEArrayLength, false);
define_pd_global(bool, TwoOperandLIRForm, false );
-define_pd_global(intx, SafepointPollOffset, 0 );
-
#endif // CPU_AARCH64_VM_C1_GLOBALS_AARCH64_HPP
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp
--- a/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -43,7 +43,6 @@
define_pd_global(bool, ProfileInterpreter, true);
define_pd_global(bool, TieredCompilation, trueInTiered);
define_pd_global(intx, CompileThreshold, 10000);
-define_pd_global(intx, BackEdgeThreshold, 100000);
define_pd_global(intx, OnStackReplacePercentage, 140);
define_pd_global(intx, ConditionalMoveLimit, 3);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTStub.java Mon Mar 13 19:58:33 2017 +0000
@@ -25,6 +25,7 @@
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.core.target.Backend;
+import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder;
import org.graalvm.compiler.hotspot.stubs.Stub;
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
@@ -48,7 +49,7 @@
}
public HotSpotCompiledCode compiledCode(CompilationResult result) {
- return stub.getCompiledCode(backend);
+ return HotSpotCompiledCodeBuilder.createCompiledCode(null, null, result);
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c
--- a/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -50,7 +50,7 @@
}
- if (strlen(alt_root) + strlen(name) < PATH_MAX) {
+ if (strlen(alt_root) + strlen(name) > PATH_MAX) {
// Buffer too small.
return -1;
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -150,13 +150,7 @@
// Helper methods
private void printGCAlgorithm(Map flagMap) {
- // print about new generation
- long l = getFlagValue("UseParNewGC", flagMap);
- if (l == 1L) {
- System.out.println("using parallel threads in the new generation.");
- }
-
- l = getFlagValue("UseTLAB", flagMap);
+ long l = getFlagValue("UseTLAB", flagMap);
if (l == 1L) {
System.out.println("using thread-local object allocation.");
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2013, 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
@@ -114,6 +114,8 @@
}
});
+ writeHeapRecordPrologue();
+
// write JavaThreads
writeJavaThreads();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,8 +45,8 @@
* WARNING: This format is still under development, and is subject to
* change without notice.
*
- * header "JAVA PROFILE 1.0.1" or "JAVA PROFILE 1.0.2" (0-terminated)
- * u4 size of identifiers. Identifiers are used to represent
+ * header "JAVA PROFILE 1.0.2" (0-terminated)
+ * u4 size of identifiers. Identifiers are used to represent
* UTF8 strings, objects, stack traces, etc. They usually
* have the same size as host pointers. For example, on
* Solaris and Win32, the size is 4.
@@ -294,10 +294,9 @@
* u2 stack trace depth
*
*
- * When the header is "JAVA PROFILE 1.0.2" a heap dump can optionally
- * be generated as a sequence of heap dump segments. This sequence is
- * terminated by an end record. The additional tags allowed by format
- * "JAVA PROFILE 1.0.2" are:
+ * A heap dump can optionally be generated as a sequence of heap dump
+ * segments. This sequence is terminated by an end record. The additional
+ * tags allowed by format "JAVA PROFILE 1.0.2" are:
*
* HPROF_HEAP_DUMP_SEGMENT denote a heap dump segment
*
@@ -310,8 +309,6 @@
public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
- // The heap size threshold used to determine if segmented format
- // ("JAVA PROFILE 1.0.2") should be used.
private static final long HPROF_SEGMENTED_HEAP_DUMP_THRESHOLD = 2L * 0x40000000;
// The approximate size of a heap segment. Used to calculate when to create
@@ -319,7 +316,6 @@
private static final long HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE = 1L * 0x40000000;
// hprof binary file header
- private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1";
private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2";
// constants in enum HprofTag
@@ -380,6 +376,7 @@
private static final int JVM_SIGNATURE_ARRAY = '[';
private static final int JVM_SIGNATURE_CLASS = 'L';
+ private static final long MAX_U4_VALUE = 0xFFFFFFFFL;
int serialNum = 1;
public synchronized void write(String fileName) throws IOException {
@@ -469,7 +466,6 @@
// length later - hprof format requires length.
out.flush();
currentSegmentStart = fos.getChannel().position();
-
// write dummy length of 0 and we'll fix it later.
out.writeInt(0);
}
@@ -479,7 +475,7 @@
protected void writeHeapRecordEpilogue() throws IOException {
if (useSegmentedHeapDump) {
out.flush();
- if ((fos.getChannel().position() - currentSegmentStart - 4) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) {
+ if ((fos.getChannel().position() - currentSegmentStart - 4L) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) {
fillInHeapRecordLength();
currentSegmentStart = 0;
}
@@ -488,14 +484,14 @@
private void fillInHeapRecordLength() throws IOException {
- // now get current position to calculate length
+ // now get the current position to calculate length
long dumpEnd = fos.getChannel().position();
- // calculate length of heap data
+ // calculate the length of heap data
long dumpLenLong = (dumpEnd - currentSegmentStart - 4L);
// Check length boundary, overflow could happen but is _very_ unlikely
- if(dumpLenLong >= (4L * 0x40000000)){
+ if (dumpLenLong >= (4L * 0x40000000)) {
throw new RuntimeException("Heap segment size overflow.");
}
@@ -517,6 +513,71 @@
fos.getChannel().position(currentPosition);
}
+ // get the size in bytes for the requested type
+ private long getSizeForType(int type) throws IOException {
+ switch (type) {
+ case TypeArrayKlass.T_BOOLEAN:
+ return BOOLEAN_SIZE;
+ case TypeArrayKlass.T_INT:
+ return INT_SIZE;
+ case TypeArrayKlass.T_CHAR:
+ return CHAR_SIZE;
+ case TypeArrayKlass.T_SHORT:
+ return SHORT_SIZE;
+ case TypeArrayKlass.T_BYTE:
+ return BYTE_SIZE;
+ case TypeArrayKlass.T_LONG:
+ return LONG_SIZE;
+ case TypeArrayKlass.T_FLOAT:
+ return FLOAT_SIZE;
+ case TypeArrayKlass.T_DOUBLE:
+ return DOUBLE_SIZE;
+ default:
+ throw new RuntimeException(
+ "Should not reach here: Unknown type: " + type);
+ }
+ }
+
+ private int getArrayHeaderSize(boolean isObjectAarray) {
+ return isObjectAarray?
+ ((int) BYTE_SIZE + 2 * (int) INT_SIZE + 2 * (int) OBJ_ID_SIZE):
+ (2 * (int) BYTE_SIZE + 2 * (int) INT_SIZE + (int) OBJ_ID_SIZE);
+ }
+
+ // Check if we need to truncate an array
+ private int calculateArrayMaxLength(long originalArrayLength,
+ int headerSize,
+ long typeSize,
+ String typeName) throws IOException {
+
+ long length = originalArrayLength;
+
+ // now get the current position to calculate length
+ long dumpEnd = fos.getChannel().position();
+ long originalLengthInBytes = originalArrayLength * typeSize;
+
+ // calculate the length of heap data
+ long currentRecordLength = (dumpEnd - currentSegmentStart - 4L);
+ if (currentRecordLength > 0 &&
+ (currentRecordLength + headerSize + originalLengthInBytes) > MAX_U4_VALUE) {
+ fillInHeapRecordLength();
+ currentSegmentStart = 0;
+ writeHeapRecordPrologue();
+ currentRecordLength = 0;
+ }
+
+ // Calculate the max bytes we can use.
+ long maxBytes = (MAX_U4_VALUE - (headerSize + currentRecordLength));
+
+ if (originalLengthInBytes > maxBytes) {
+ length = maxBytes/typeSize;
+ System.err.println("WARNING: Cannot dump array of type " + typeName
+ + " with length " + originalArrayLength
+ + "; truncating to length " + length);
+ }
+ return (int) length;
+ }
+
private void writeClassDumpRecords() throws IOException {
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
ClassLoaderDataGraph cldGraph = VM.getVM().getClassLoaderDataGraph();
@@ -694,12 +755,16 @@
}
protected void writeObjectArray(ObjArray array) throws IOException {
+ int headerSize = getArrayHeaderSize(true);
+ final int length = calculateArrayMaxLength(array.getLength(),
+ headerSize,
+ OBJ_ID_SIZE,
+ "Object");
out.writeByte((byte) HPROF_GC_OBJ_ARRAY_DUMP);
writeObjectID(array);
out.writeInt(DUMMY_STACK_TRACE_ID);
- out.writeInt((int) array.getLength());
+ out.writeInt(length);
writeObjectID(array.getKlass().getJavaMirror());
- final int length = (int) array.getLength();
for (int index = 0; index < length; index++) {
OopHandle handle = array.getOopHandleAt(index);
writeObjectID(getAddressValue(handle));
@@ -707,101 +772,101 @@
}
protected void writePrimitiveArray(TypeArray array) throws IOException {
+ int headerSize = getArrayHeaderSize(false);
+ TypeArrayKlass tak = (TypeArrayKlass) array.getKlass();
+ final int type = (int) tak.getElementType();
+ final String typeName = tak.getElementTypeName();
+ final long typeSize = getSizeForType(type);
+ final int length = calculateArrayMaxLength(array.getLength(),
+ headerSize,
+ typeSize,
+ typeName);
out.writeByte((byte) HPROF_GC_PRIM_ARRAY_DUMP);
writeObjectID(array);
out.writeInt(DUMMY_STACK_TRACE_ID);
- out.writeInt((int) array.getLength());
- TypeArrayKlass tak = (TypeArrayKlass) array.getKlass();
- final int type = (int) tak.getElementType();
+ out.writeInt(length);
out.writeByte((byte) type);
switch (type) {
case TypeArrayKlass.T_BOOLEAN:
- writeBooleanArray(array);
+ writeBooleanArray(array, length);
break;
case TypeArrayKlass.T_CHAR:
- writeCharArray(array);
+ writeCharArray(array, length);
break;
case TypeArrayKlass.T_FLOAT:
- writeFloatArray(array);
+ writeFloatArray(array, length);
break;
case TypeArrayKlass.T_DOUBLE:
- writeDoubleArray(array);
+ writeDoubleArray(array, length);
break;
case TypeArrayKlass.T_BYTE:
- writeByteArray(array);
+ writeByteArray(array, length);
break;
case TypeArrayKlass.T_SHORT:
- writeShortArray(array);
+ writeShortArray(array, length);
break;
case TypeArrayKlass.T_INT:
- writeIntArray(array);
+ writeIntArray(array, length);
break;
case TypeArrayKlass.T_LONG:
- writeLongArray(array);
+ writeLongArray(array, length);
break;
default:
- throw new RuntimeException("should not reach here");
+ throw new RuntimeException(
+ "Should not reach here: Unknown type: " + type);
}
}
- private void writeBooleanArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeBooleanArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = BOOLEAN_BASE_OFFSET + index * BOOLEAN_SIZE;
out.writeBoolean(array.getHandle().getJBooleanAt(offset));
}
}
- private void writeByteArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeByteArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = BYTE_BASE_OFFSET + index * BYTE_SIZE;
out.writeByte(array.getHandle().getJByteAt(offset));
}
}
- private void writeShortArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeShortArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = SHORT_BASE_OFFSET + index * SHORT_SIZE;
out.writeShort(array.getHandle().getJShortAt(offset));
}
}
- private void writeIntArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeIntArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = INT_BASE_OFFSET + index * INT_SIZE;
out.writeInt(array.getHandle().getJIntAt(offset));
}
}
- private void writeLongArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeLongArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = LONG_BASE_OFFSET + index * LONG_SIZE;
out.writeLong(array.getHandle().getJLongAt(offset));
}
}
- private void writeCharArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeCharArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = CHAR_BASE_OFFSET + index * CHAR_SIZE;
out.writeChar(array.getHandle().getJCharAt(offset));
}
}
- private void writeFloatArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeFloatArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = FLOAT_BASE_OFFSET + index * FLOAT_SIZE;
out.writeFloat(array.getHandle().getJFloatAt(offset));
}
}
- private void writeDoubleArray(TypeArray array) throws IOException {
- final int length = (int) array.getLength();
+ private void writeDoubleArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = DOUBLE_BASE_OFFSET + index * DOUBLE_SIZE;
out.writeDouble(array.getHandle().getJDoubleAt(offset));
@@ -996,12 +1061,7 @@
// writes hprof binary file header
private void writeFileHeader() throws IOException {
// version string
- if(useSegmentedHeapDump) {
- out.writeBytes(HPROF_HEADER_1_0_2);
- }
- else {
- out.writeBytes(HPROF_HEADER_1_0_1);
- }
+ out.writeBytes(HPROF_HEADER_1_0_2);
out.writeByte((byte)'\0');
// write identifier size. we use pointers as identifiers.
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java Mon Mar 13 19:58:33 2017 +0000
@@ -27,8 +27,6 @@
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Iterator;
-import java.util.Map;
-import java.util.WeakHashMap;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaType;
@@ -147,21 +145,34 @@
}
}
- private final Map, WeakReference> typeMap = new WeakHashMap<>();
+ private final ClassValue> resolvedJavaType = new ClassValue>() {
+ @Override
+ protected WeakReference computeValue(Class> type) {
+ return new WeakReference<>(createClass(type));
+ }
+ };
/**
* Gets the JVMCI mirror for a {@link Class} object.
*
* @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
*/
- public synchronized ResolvedJavaType fromClass(Class> javaClass) {
- WeakReference typeRef = typeMap.get(javaClass);
- ResolvedJavaType type = typeRef != null ? typeRef.get() : null;
- if (type == null) {
- type = createClass(javaClass);
- typeMap.put(javaClass, new WeakReference<>(type));
+ public ResolvedJavaType fromClass(Class> javaClass) {
+ ResolvedJavaType javaType = null;
+ while (javaType == null) {
+ WeakReference type = resolvedJavaType.get(javaClass);
+ javaType = type.get();
+ if (javaType == null) {
+ /*
+ * If the referent has become null, clear out the current value
+ * and let computeValue above create a new value. Reload the
+ * value in a loop because in theory the WeakReference referent
+ * can be reclaimed at any point.
+ */
+ resolvedJavaType.remove(javaClass);
+ }
}
- return type;
+ return javaType;
}
/**
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java
--- a/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java Mon Mar 13 19:58:33 2017 +0000
@@ -90,17 +90,10 @@
protected InstalledCode code;
/**
- * Compilation result from which {@link #code} was created.
- */
- protected CompilationResult compResult;
-
- /**
* The registers destroyed by this stub (from the caller's perspective).
*/
private Set destroyedCallerRegisters;
- private HotSpotCompiledCode compiledCode;
-
public void initDestroyedCallerRegisters(Set registers) {
assert registers != null;
assert destroyedCallerRegisters == null || registers.equals(destroyedCallerRegisters) : "cannot redefine";
@@ -184,35 +177,13 @@
public synchronized InstalledCode getCode(final Backend backend) {
if (code == null) {
try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) {
- final StructuredGraph graph = getGraph(getStubCompilationId());
-
- // Stubs cannot be recompiled so they cannot be compiled with assumptions
- assert graph.getAssumptions() == null;
-
- if (!(graph.start() instanceof StubStartNode)) {
- StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
- newStart.setStateAfter(graph.start().stateAfter());
- graph.replaceFixed(graph.start(), newStart);
- }
-
CodeCacheProvider codeCache = providers.getCodeCache();
-
- compResult = new CompilationResult(toString(), GeneratePIC.getValue());
- try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) {
- Suites suites = createSuites();
- emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
- LIRSuites lirSuites = createLIRSuites();
- emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
- assert checkStubInvariants();
- } catch (Throwable e) {
- throw Debug.handle(e);
- }
-
- assert destroyedCallerRegisters != null;
+ CompilationResult compResult = buildCompilationResult(backend);
try (Scope s = Debug.scope("CodeInstall", compResult)) {
+ assert destroyedCallerRegisters != null;
// Add a GeneratePIC check here later, we don't want to install
// code if we don't have a corresponding VM global symbol.
- compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult);
+ HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult);
code = codeCache.installCode(null, compiledCode, null, null, false);
} catch (Throwable e) {
throw Debug.handle(e);
@@ -226,6 +197,44 @@
return code;
}
+ @SuppressWarnings("try")
+ private CompilationResult buildCompilationResult(final Backend backend) {
+ CompilationResult compResult = new CompilationResult(toString(), GeneratePIC.getValue());
+ final StructuredGraph graph = getGraph(getStubCompilationId());
+
+ // Stubs cannot be recompiled so they cannot be compiled with assumptions
+ assert graph.getAssumptions() == null;
+
+ if (!(graph.start() instanceof StubStartNode)) {
+ StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
+ newStart.setStateAfter(graph.start().stateAfter());
+ graph.replaceFixed(graph.start(), newStart);
+ }
+
+ try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) {
+ Suites suites = createSuites();
+ emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
+ LIRSuites lirSuites = createLIRSuites();
+ emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
+ assert checkStubInvariants(compResult);
+ } catch (Throwable e) {
+ throw Debug.handle(e);
+ }
+ return compResult;
+ }
+
+ /**
+ * Gets a {@link CompilationResult} that can be used for code generation. Required for AOT.
+ */
+ @SuppressWarnings("try")
+ public CompilationResult getCompilationResult(final Backend backend) {
+ try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) {
+ return buildCompilationResult(backend);
+ } catch (Throwable e) {
+ throw Debug.handle(e);
+ }
+ }
+
public CompilationIdentifier getStubCompilationId() {
return new StubCompilationIdentifier(this);
}
@@ -233,7 +242,7 @@
/**
* Checks the conditions a compilation must satisfy to be installed as a RuntimeStub.
*/
- private boolean checkStubInvariants() {
+ private boolean checkStubInvariants(CompilationResult compResult) {
assert compResult.getExceptionHandlers().isEmpty() : this;
// Stubs cannot be recompiled so they cannot be compiled with
@@ -278,24 +287,4 @@
}
return lirSuites;
}
-
- /**
- * Gets the HotSpotCompiledCode that was created during installation.
- */
- public synchronized HotSpotCompiledCode getCompiledCode(final Backend backend) {
- getCompilationResult(backend);
- assert compiledCode != null;
- return compiledCode;
- }
-
- /**
- * Gets the compilation result for this stub, compiling it first if necessary, and installing it
- * in code.
- */
- public synchronized CompilationResult getCompilationResult(final Backend backend) {
- if (code == null) {
- getCode(backend);
- }
- return compResult;
- }
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/os/solaris/vm/os_solaris.cpp
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3050,15 +3050,12 @@
thr_yield();
}
-// Interface for setting lwp priorities. If we are using T2 libthread,
-// which forces the use of BoundThreads or we manually set UseBoundThreads,
-// all of our threads will be assigned to real lwp's. Using the thr_setprio
-// function is meaningless in this mode so we must adjust the real lwp's priority
+// Interface for setting lwp priorities. We are using T2 libthread,
+// which forces the use of bound threads, so all of our threads will
+// be assigned to real lwp's. Using the thr_setprio function is
+// meaningless in this mode so we must adjust the real lwp's priority.
// The routines below implement the getting and setting of lwp priorities.
//
-// Note: T2 is now the only supported libthread. UseBoundThreads flag is
-// being deprecated and all threads are now BoundThreads
-//
// Note: There are three priority scales used on Solaris. Java priotities
// which range from 1 to 10, libthread "thr_setprio" scale which range
// from 0 to 127, and the current scheduling class of the process we
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/c1/c1_Canonicalizer.cpp
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -248,7 +248,9 @@
} else if ((lf = x->array()->as_LoadField()) != NULL) {
ciField* field = lf->field();
if (field->is_static_constant()) {
- assert(PatchALot || ScavengeRootsInCode < 2, "Constant field loads are folded during parsing");
+ // Constant field loads are usually folded during parsing.
+ // But it doesn't happen with PatchALot, ScavengeRootsInCode < 2, or when
+ // holder class is being initialized during parsing (for static fields).
ciObject* c = field->constant_value().as_object();
if (!c->is_null_object()) {
set_constant(c->as_array()->length());
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/c1/c1_LIR.cpp
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1413,6 +1413,17 @@
append(c);
}
+void LIR_List::null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null) {
+ if (deoptimize_on_null) {
+ // Emit an explicit null check and deoptimize if opr is null
+ CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_null_check, Deoptimization::Action_none);
+ cmp(lir_cond_equal, opr, LIR_OprFact::oopConst(NULL));
+ branch(lir_cond_equal, T_OBJECT, deopt);
+ } else {
+ // Emit an implicit null check
+ append(new LIR_Op1(lir_null_check, opr, info));
+ }
+}
void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/c1/c1_LIR.hpp
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -2113,7 +2113,7 @@
void pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64, src, dst, T_LONG, lir_patch_none, NULL)); }
void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
- void null_check(LIR_Opr opr, CodeEmitInfo* info) { append(new LIR_Op1(lir_null_check, opr, info)); }
+ void null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null = false);
void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1752,8 +1752,10 @@
if (x->needs_null_check() &&
(needs_patching ||
MacroAssembler::needs_explicit_null_check(x->offset()))) {
- // emit an explicit null check because the offset is too large
- __ null_check(object.result(), new CodeEmitInfo(info));
+ // Emit an explicit null check because the offset is too large.
+ // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
+ // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
+ __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
}
LIR_Address* address;
@@ -1838,8 +1840,10 @@
obj = new_register(T_OBJECT);
__ move(LIR_OprFact::oopConst(NULL), obj);
}
- // emit an explicit null check because the offset is too large
- __ null_check(obj, new CodeEmitInfo(info));
+ // Emit an explicit null check because the offset is too large.
+ // If the class is not loaded and the object is NULL, we need to deoptimize to throw a
+ // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
+ __ null_check(obj, new CodeEmitInfo(info), /* deoptimize */ needs_patching);
}
LIR_Opr reg = rlock_result(x, field_type);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/ci/ciEnv.cpp
--- a/hotspot/src/share/vm/ci/ciEnv.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -101,6 +101,7 @@
_debug_info = NULL;
_dependencies = NULL;
_failure_reason = NULL;
+ _inc_decompile_count_on_failure = true;
_compilable = MethodCompilable;
_break_at_compile = false;
_compiler_data = NULL;
@@ -161,6 +162,7 @@
_debug_info = NULL;
_dependencies = NULL;
_failure_reason = NULL;
+ _inc_decompile_count_on_failure = true;
_compilable = MethodCompilable_never;
_break_at_compile = false;
_compiler_data = NULL;
@@ -902,7 +904,12 @@
if (deps.is_klass_type()) continue; // skip klass dependencies
Klass* witness = deps.check_dependency();
if (witness != NULL) {
- record_failure("invalid non-klass dependency");
+ if (deps.type() == Dependencies::call_site_target_value) {
+ _inc_decompile_count_on_failure = false;
+ record_failure("call site target change");
+ } else {
+ record_failure("invalid non-klass dependency");
+ }
return;
}
}
@@ -1017,7 +1024,7 @@
if (failing()) {
// While not a true deoptimization, it is a preemptive decompile.
MethodData* mdo = method()->method_data();
- if (mdo != NULL) {
+ if (mdo != NULL && _inc_decompile_count_on_failure) {
mdo->inc_decompile_count();
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/ci/ciEnv.hpp
--- a/hotspot/src/share/vm/ci/ciEnv.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -55,6 +55,7 @@
DebugInformationRecorder* _debug_info;
Dependencies* _dependencies;
const char* _failure_reason;
+ bool _inc_decompile_count_on_failure;
int _compilable;
bool _break_at_compile;
int _num_inlined_bytecodes;
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/classfile/javaClasses.cpp
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -2269,6 +2269,7 @@
compute_offset(_monitors_offset, k, vmSymbols::monitors_name(), vmSymbols::object_array_signature());
compute_offset(_locals_offset, k, vmSymbols::locals_name(), vmSymbols::object_array_signature());
compute_offset(_operands_offset, k, vmSymbols::operands_name(), vmSymbols::object_array_signature());
+ compute_offset(_mode_offset, k, vmSymbols::mode_name(), vmSymbols::int_signature());
}
void java_lang_reflect_AccessibleObject::compute_offsets() {
@@ -3658,6 +3659,7 @@
int java_lang_LiveStackFrameInfo::_monitors_offset;
int java_lang_LiveStackFrameInfo::_locals_offset;
int java_lang_LiveStackFrameInfo::_operands_offset;
+int java_lang_LiveStackFrameInfo::_mode_offset;
int java_lang_AssertionStatusDirectives::classes_offset;
int java_lang_AssertionStatusDirectives::classEnabled_offset;
int java_lang_AssertionStatusDirectives::packages_offset;
@@ -3728,6 +3730,10 @@
element->obj_field_put(_operands_offset, value);
}
+void java_lang_LiveStackFrameInfo::set_mode(oop element, int value) {
+ element->int_field_put(_mode_offset, value);
+}
+
// Support for java Assertions - java_lang_AssertionStatusDirectives.
void java_lang_AssertionStatusDirectives::set_classes(oop o, oop val) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/classfile/javaClasses.hpp
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -1380,11 +1380,13 @@
static int _monitors_offset;
static int _locals_offset;
static int _operands_offset;
+ static int _mode_offset;
public:
static void set_monitors(oop info, oop value);
static void set_locals(oop info, oop value);
static void set_operands(oop info, oop value);
+ static void set_mode(oop info, int value);
static void compute_offsets();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/classfile/vmSymbols.hpp
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -325,14 +325,8 @@
template(java_lang_StackStreamFactory_AbstractStackWalker, "java/lang/StackStreamFactory$AbstractStackWalker") \
template(doStackWalk_signature, "(JIIII)Ljava/lang/Object;") \
template(asPrimitive_name, "asPrimitive") \
- template(asPrimitive_int_signature, "(I)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_long_signature, "(J)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_short_signature, "(S)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_byte_signature, "(B)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_char_signature, "(C)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_float_signature, "(F)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_double_signature, "(D)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
- template(asPrimitive_boolean_signature, "(Z)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
+ template(asPrimitive_int_signature, "(I)Ljava/lang/LiveStackFrame$PrimitiveSlot;") \
+ template(asPrimitive_long_signature, "(J)Ljava/lang/LiveStackFrame$PrimitiveSlot;") \
\
/* common method and field names */ \
template(object_initializer_name, "") \
@@ -444,6 +438,7 @@
template(monitors_name, "monitors") \
template(locals_name, "locals") \
template(operands_name, "operands") \
+ template(mode_name, "mode") \
template(oop_size_name, "oop_size") \
template(static_oop_field_count_name, "static_oop_field_count") \
template(protection_domain_name, "protection_domain") \
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/code/codeCache.cpp
--- a/hotspot/src/share/vm/code/codeCache.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/code/codeCache.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1211,7 +1211,7 @@
CompiledMethodIterator iter;
while(iter.next_alive()) {
CompiledMethod* nm = iter.method();
- if (nm->is_marked_for_deoptimization()) {
+ if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
nm->make_not_entrant();
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/code/nmethod.cpp
--- a/hotspot/src/share/vm/code/nmethod.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/code/nmethod.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1146,6 +1146,14 @@
assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
assert(!is_zombie(), "should not already be a zombie");
+ if (_state == state) {
+ // Avoid taking the lock if already in required state.
+ // This is safe from races because the state is an end-state,
+ // which the nmethod cannot back out of once entered.
+ // No need for fencing either.
+ return false;
+ }
+
// Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
nmethodLocker nml(this);
methodHandle the_method(method());
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -488,9 +488,6 @@
_gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
_cms_start_registered(false)
{
- if (ExplicitGCInvokesConcurrentAndUnloadsClasses) {
- ExplicitGCInvokesConcurrent = true;
- }
// Now expand the span and allocate the collection support structures
// (MUT, marking bit map etc.) to cover both generations subject to
// collection.
@@ -2559,10 +2556,8 @@
// Decide if we want to enable class unloading as part of the
// ensuing concurrent GC cycle. We will collect and
// unload classes if it's the case that:
-// (1) an explicit gc request has been made and the flag
-// ExplicitGCInvokesConcurrentAndUnloadsClasses is set, OR
-// (2) (a) class unloading is enabled at the command line, and
-// (b) old gen is getting really full
+// (a) class unloading is enabled at the command line, and
+// (b) old gen is getting really full
// NOTE: Provided there is no change in the state of the heap between
// calls to this method, it should have idempotent results. Moreover,
// its results should be monotonically increasing (i.e. going from 0 to 1,
@@ -2575,11 +2570,7 @@
// below.
void CMSCollector::update_should_unload_classes() {
_should_unload_classes = false;
- // Condition 1 above
- if (_full_gc_requested && ExplicitGCInvokesConcurrentAndUnloadsClasses) {
- _should_unload_classes = true;
- } else if (CMSClassUnloadingEnabled) { // Condition 2.a above
- // Disjuncts 2.b.(i,ii,iii) above
+ if (CMSClassUnloadingEnabled) {
_should_unload_classes = (concurrent_cycles_since_last_unload() >=
CMSClassUnloadingMaxInterval)
|| _cmsGen->is_too_full();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -711,29 +711,6 @@
guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity");
}
-#ifndef PRODUCT
-void HeapRegionRemSet::print() {
- HeapRegionRemSetIterator iter(this);
- size_t card_index;
- while (iter.has_next(card_index)) {
- HeapWord* card_start = _bot->address_for_index(card_index);
- tty->print_cr(" Card " PTR_FORMAT, p2i(card_start));
- }
- if (iter.n_yielded() != occupied()) {
- tty->print_cr("Yielded disagrees with occupied:");
- tty->print_cr(" " SIZE_FORMAT_W(6) " yielded (" SIZE_FORMAT_W(6)
- " coarse, " SIZE_FORMAT_W(6) " fine).",
- iter.n_yielded(),
- iter.n_yielded_coarse(), iter.n_yielded_fine());
- tty->print_cr(" " SIZE_FORMAT_W(6) " occ (" SIZE_FORMAT_W(6)
- " coarse, " SIZE_FORMAT_W(6) " fine).",
- occupied(), occ_coarse(), occ_fine());
- }
- guarantee(iter.n_yielded() == occupied(),
- "We should have yielded all the represented cards.");
-}
-#endif
-
void HeapRegionRemSet::cleanup() {
SparsePRT::cleanup_all();
}
@@ -917,10 +894,6 @@
// Otherwise...
break;
}
- assert(ParallelGCThreads > 1 ||
- n_yielded() == _hrrs->occupied(),
- "Should have yielded all the cards in the rem set "
- "(in the non-par case).");
return false;
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -290,8 +290,6 @@
// consumed by the strong code roots.
size_t strong_code_roots_mem_size();
- void print() PRODUCT_RETURN;
-
// Called during a stop-world phase to perform any deferred cleanups.
static void cleanup();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/oops/method.cpp
--- a/hotspot/src/share/vm/oops/method.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/oops/method.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2199,7 +2199,6 @@
ResourceMark rm;
assert(is_method(), "must be method");
st->print_cr("%s", internal_name());
- // get the effect of PrintOopAddress, always, for methods:
st->print_cr(" - this oop: " INTPTR_FORMAT, p2i(this));
st->print (" - method holder: "); method_holder()->print_value_on(st); st->cr();
st->print (" - constants: " INTPTR_FORMAT " ", p2i(constants()));
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/opto/type.cpp
--- a/hotspot/src/share/vm/opto/type.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/opto/type.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -373,7 +373,7 @@
if (con_type != NULL && field->is_call_site_target()) {
ciCallSite* call_site = holder->as_call_site();
if (!call_site->is_constant_call_site()) {
- ciMethodHandle* target = call_site->get_target();
+ ciMethodHandle* target = con.as_object()->as_method_handle();
Compile::current()->dependencies()->assert_call_site_target_value(call_site, target);
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/prims/jvm.cpp
--- a/hotspot/src/share/vm/prims/jvm.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/prims/jvm.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2967,14 +2967,7 @@
JVMWrapper("JVM_Yield");
if (os::dont_yield()) return;
HOTSPOT_THREAD_YIELD();
-
- // When ConvertYieldToSleep is off (default), this matches the classic VM use of yield.
- // Critical for similar threading behaviour
- if (ConvertYieldToSleep) {
- os::sleep(thread, MinSleepInterval, false);
- } else {
- os::naked_yield();
- }
+ os::naked_yield();
JVM_END
@@ -2998,18 +2991,7 @@
EventThreadSleep event;
if (millis == 0) {
- // When ConvertSleepToYield is on, this matches the classic VM implementation of
- // JVM_Sleep. Critical for similar threading behaviour (Win32)
- // It appears that in certain GUI contexts, it may be beneficial to do a short sleep
- // for SOLARIS
- if (ConvertSleepToYield) {
- os::naked_yield();
- } else {
- ThreadState old_state = thread->osthread()->get_state();
- thread->osthread()->set_state(SLEEPING);
- os::sleep(thread, MinSleepInterval, false);
- thread->osthread()->set_state(old_state);
- }
+ os::naked_yield();
} else {
ThreadState old_state = thread->osthread()->get_state();
thread->osthread()->set_state(SLEEPING);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/prims/jvmtiExport.cpp
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -1230,8 +1230,12 @@
assert(thread->is_VM_thread(), "wrong thread");
// get JavaThread for whom we are proxy
- JavaThread *real_thread =
- (JavaThread *)((VMThread *)thread)->vm_operation()->calling_thread();
+ Thread *calling_thread = ((VMThread *)thread)->vm_operation()->calling_thread();
+ if (!calling_thread->is_Java_thread()) {
+ // cannot post an event to a non-JavaThread
+ return;
+ }
+ JavaThread *real_thread = (JavaThread *)calling_thread;
JvmtiEnvIterator it;
for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/prims/methodHandles.cpp
--- a/hotspot/src/share/vm/prims/methodHandles.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1208,9 +1208,10 @@
if (reference_klass != NULL && reference_klass->is_instance_klass()) {
// Emulate LinkResolver::check_klass_accessability.
Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh));
- if (Reflection::verify_class_access(caller,
- reference_klass,
- true) != Reflection::ACCESS_OK) {
+ if (caller != SystemDictionary::Object_klass()
+ && Reflection::verify_class_access(caller,
+ reference_klass,
+ true) != Reflection::ACCESS_OK) {
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), reference_klass->external_name());
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/prims/stackwalk.cpp
--- a/hotspot/src/share/vm/prims/stackwalk.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -173,7 +173,11 @@
}
}
-oop LiveFrameStream::create_primitive_value_instance(StackValueCollection* values, int i, TRAPS) {
+// Create and return a LiveStackFrame.PrimitiveSlot (if needed) for the
+// StackValue at the given index. 'type' is expected to be T_INT, T_LONG,
+// T_OBJECT, or T_CONFLICT.
+oop LiveFrameStream::create_primitive_slot_instance(StackValueCollection* values,
+ int i, BasicType type, TRAPS) {
Klass* k = SystemDictionary::resolve_or_null(vmSymbols::java_lang_LiveStackFrameInfo(), CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
@@ -182,8 +186,8 @@
Symbol* signature = NULL;
// ## TODO: type is only available in LocalVariable table, if present.
- // ## StackValue type is T_INT or T_OBJECT.
- switch (values->at(i)->type()) {
+ // ## StackValue type is T_INT or T_OBJECT (or converted to T_LONG on 64-bit)
+ switch (type) {
case T_INT:
args.push_int(values->int_at(i));
signature = vmSymbols::asPrimitive_int_signature();
@@ -195,42 +199,26 @@
break;
case T_FLOAT:
- args.push_float(values->float_at(i));
- signature = vmSymbols::asPrimitive_float_signature();
- break;
-
case T_DOUBLE:
- args.push_double(values->double_at(i));
- signature = vmSymbols::asPrimitive_double_signature();
- break;
-
case T_BYTE:
- args.push_int(values->int_at(i));
- signature = vmSymbols::asPrimitive_byte_signature();
- break;
-
case T_SHORT:
- args.push_int(values->int_at(i));
- signature = vmSymbols::asPrimitive_short_signature();
- break;
-
case T_CHAR:
- args.push_int(values->int_at(i));
- signature = vmSymbols::asPrimitive_char_signature();
- break;
-
case T_BOOLEAN:
- args.push_int(values->int_at(i));
- signature = vmSymbols::asPrimitive_boolean_signature();
- break;
+ THROW_MSG_(vmSymbols::java_lang_InternalError(), "Unexpected StackValue type", NULL);
case T_OBJECT:
return values->obj_at(i)();
case T_CONFLICT:
// put a non-null slot
- args.push_int(0);
- signature = vmSymbols::asPrimitive_int_signature();
+ #ifdef _LP64
+ args.push_long(0);
+ signature = vmSymbols::asPrimitive_long_signature();
+ #else
+ args.push_int(0);
+ signature = vmSymbols::asPrimitive_int_signature();
+ #endif
+
break;
default: ShouldNotReachHere();
@@ -252,9 +240,19 @@
objArrayHandle array_h(THREAD, array_oop);
for (int i = 0; i < values->size(); i++) {
StackValue* st = values->at(i);
- oop obj = create_primitive_value_instance(values, i, CHECK_(empty));
- if (obj != NULL)
+ BasicType type = st->type();
+ int index = i;
+#ifdef _LP64
+ if (type != T_OBJECT && type != T_CONFLICT) {
+ intptr_t ret = st->get_int(); // read full 64-bit slot
+ type = T_LONG; // treat as long
+ index--; // undo +1 in StackValueCollection::long_at
+ }
+#endif
+ oop obj = create_primitive_slot_instance(values, index, type, CHECK_(empty));
+ if (obj != NULL) {
array_h->obj_at_put(i, obj);
+ }
}
return array_h;
}
@@ -286,6 +284,13 @@
StackValueCollection* expressions = _jvf->expressions();
GrowableArray* monitors = _jvf->monitors();
+ int mode = 0;
+ if (_jvf->is_interpreted_frame()) {
+ mode = MODE_INTERPRETED;
+ } else if (_jvf->is_compiled_frame()) {
+ mode = MODE_COMPILED;
+ }
+
if (!locals->is_empty()) {
objArrayHandle locals_h = values_to_object_array(locals, CHECK);
java_lang_LiveStackFrameInfo::set_locals(stackFrame(), locals_h());
@@ -298,6 +303,7 @@
objArrayHandle monitors_h = monitors_to_object_array(monitors, CHECK);
java_lang_LiveStackFrameInfo::set_monitors(stackFrame(), monitors_h());
}
+ java_lang_LiveStackFrameInfo::set_mode(stackFrame(), mode);
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/prims/stackwalk.hpp
--- a/hotspot/src/share/vm/prims/stackwalk.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/prims/stackwalk.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -92,11 +92,16 @@
class LiveFrameStream : public BaseFrameStream {
private:
+ enum {
+ MODE_INTERPRETED = 0x01,
+ MODE_COMPILED = 0x02
+ };
+
javaVFrame* _jvf;
void fill_live_stackframe(Handle stackFrame, const methodHandle& method, TRAPS);
- static oop create_primitive_value_instance(StackValueCollection* values,
- int i, TRAPS);
+ static oop create_primitive_slot_instance(StackValueCollection* values,
+ int i, BasicType type, TRAPS);
static objArrayHandle monitors_to_object_array(GrowableArray* monitors,
TRAPS);
static objArrayHandle values_to_object_array(StackValueCollection* values, TRAPS);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Mon Mar 13 19:58:33 2017 +0000
@@ -375,53 +375,17 @@
// -------------- Deprecated Flags --------------
// --- Non-alias flags - sorted by obsolete_in then expired_in:
{ "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
- { "AutoGCSelectPauseMillis", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "UseAutoGCSelectPolicy", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "UseParNewGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "ExplicitGCInvokesConcurrentAndUnloadsClasses", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "ConvertSleepToYield", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
- { "ConvertYieldToSleep", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
- { "CMSMarkStackSizeMax", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "CMSMarkStackSize", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "G1MarkStackSize", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "ParallelMarkingThreads", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
- { "ParallelCMSThreads", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
// -------------- Obsolete Flags - sorted by expired_in --------------
- { "UseOldInlining", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "SafepointPollOffset", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "UseBoundThreads", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "DefaultThreadPriority", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "NoYieldsInMicrolock", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "BackEdgeThreshold", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "UseNewReflection", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "ReflectionWrapResolutionErrors",JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "VerifyReflectionBytecodes", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "AutoShutdownNMT", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "NmethodSweepFraction", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "NmethodSweepCheckInterval", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "CodeCacheMinimumFreeSpace", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-#ifndef ZERO
- { "UseFastAccessorMethods", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "UseFastEmptyMethods", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
-#endif // ZERO
- { "UseCompilerSafepoints", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "AdaptiveSizePausePolicy", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "ParallelGCRetainPLAB", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "ThreadSafetyMargin", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "LazyBootClassLoader", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "StarvationMonitorInterval", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "PreInflateSpin", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "JNIDetachReleasesMonitors", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "UseAltSigs", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "SegmentedHeapDumpThreshold", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "PrintOopAddress", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(10) },
- { "PermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::jdk(10) },
- { "MaxPermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::jdk(10) },
+ { "ConvertSleepToYield", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
+ { "ConvertYieldToSleep", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
+ { "MinSleepInterval", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
+ { "PermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::undefined() },
+ { "MaxPermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::undefined() },
#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
{ "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
@@ -444,11 +408,6 @@
static AliasedFlag const aliased_jvm_flags[] = {
{ "DefaultMaxRAMFraction", "MaxRAMFraction" },
- { "CMSMarkStackSizeMax", "MarkStackSizeMax" },
- { "CMSMarkStackSize", "MarkStackSize" },
- { "G1MarkStackSize", "MarkStackSize" },
- { "ParallelMarkingThreads", "ConcGCThreads" },
- { "ParallelCMSThreads", "ConcGCThreads" },
{ "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" },
{ NULL, NULL}
};
@@ -1547,7 +1506,6 @@
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
"control point invariant");
assert(UseConcMarkSweepGC, "CMS is expected to be on here");
- assert(UseParNewGC, "ParNew should always be used with CMS");
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
@@ -1588,7 +1546,6 @@
void Arguments::set_cms_and_parnew_gc_flags() {
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
assert(UseConcMarkSweepGC, "CMS is expected to be on here");
- assert(UseParNewGC, "ParNew should always be used with CMS");
// Turn off AdaptiveSizePolicy by default for cms until it is complete.
disable_adaptive_size_policy("UseConcMarkSweepGC");
@@ -1728,16 +1685,6 @@
NOT_LP64(ShouldNotReachHere(); return 0);
}
-bool Arguments::should_auto_select_low_pause_collector() {
- if (UseAutoGCSelectPolicy &&
- !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
- (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
- log_trace(gc)("Automatic selection of the low pause collector based on pause goal of %d (ms)", (int) MaxGCPauseMillis);
- return true;
- }
- return false;
-}
-
void Arguments::set_use_compressed_oops() {
#ifndef ZERO
#ifdef _LP64
@@ -1841,16 +1788,7 @@
void Arguments::select_gc_ergonomically() {
#if INCLUDE_ALL_GCS
if (os::is_server_class_machine()) {
- if (!UseAutoGCSelectPolicy) {
- FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
- } else {
- if (should_auto_select_low_pause_collector()) {
- FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true);
- FLAG_SET_ERGO_IF_DEFAULT(bool, UseParNewGC, true);
- } else {
- FLAG_SET_ERGO_IF_DEFAULT(bool, UseParallelGC, true);
- }
- }
+ FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
} else {
FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
}
@@ -1859,7 +1797,6 @@
UNSUPPORTED_OPTION(UseParallelGC);
UNSUPPORTED_OPTION(UseParallelOldGC);
UNSUPPORTED_OPTION(UseConcMarkSweepGC);
- UNSUPPORTED_OPTION(UseParNewGC);
FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
#endif // INCLUDE_ALL_GCS
}
@@ -2073,7 +2010,6 @@
if (!ClassUnloading) {
FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
- FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false);
}
#endif // INCLUDE_ALL_GCS
}
@@ -2428,18 +2364,6 @@
return false;
}
- if (UseConcMarkSweepGC && !UseParNewGC) {
- jio_fprintf(defaultStream::error_stream(),
- "It is not possible to combine the DefNew young collector with the CMS collector.\n");
- return false;
- }
-
- if (UseParNewGC && !UseConcMarkSweepGC) {
- jio_fprintf(defaultStream::error_stream(),
- "It is not possible to combine the ParNew young collector with any collector other than CMS.\n");
- return false;
- }
-
return true;
}
@@ -3726,11 +3650,6 @@
}
}
- if (UseConcMarkSweepGC && FLAG_IS_DEFAULT(UseParNewGC) && !UseParNewGC) {
- // CMS can only be used with ParNew
- FLAG_SET_ERGO(bool, UseParNewGC, true);
- }
-
if (!check_vm_args_consistency()) {
return JNI_ERR;
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/runtime/arguments.hpp
--- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -480,9 +480,6 @@
static julong limit_by_allocatable_memory(julong size);
// Setup heap size
static void set_heap_size();
- // Based on automatic selection criteria, should the
- // low pause collector be used.
- static bool should_auto_select_low_pause_collector();
// Bytecode rewriting
static void set_bytecode_flags();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/runtime/globals.hpp Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1159,13 +1159,6 @@
product_pd(bool, DontYieldALot, \
"Throw away obvious excess yield calls") \
\
- product(bool, ConvertSleepToYield, true, \
- "Convert sleep(0) to thread yield ") \
- \
- product(bool, ConvertYieldToSleep, false, \
- "Convert yield to a sleep of MinSleepInterval to simulate Win32 " \
- "behavior") \
- \
develop(bool, UseDetachedThreads, true, \
"Use detached threads that are recycled upon termination " \
"(for Solaris only)") \
@@ -1479,11 +1472,6 @@
"A System.gc() request invokes a concurrent collection; " \
"(effective only when using concurrent collectors)") \
\
- product(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false, \
- "A System.gc() request invokes a concurrent collection and " \
- "also unloads classes during such a concurrent gc cycle " \
- "(effective only when UseConcMarkSweepGC)") \
- \
product(bool, GCLockerInvokesConcurrent, false, \
"The exit of a JNI critical section necessitating a scavenge, " \
"also kicks off a background concurrent collection") \
@@ -1501,9 +1489,6 @@
product(bool, UseCMSBestFit, true, \
"Use CMS best fit allocation strategy") \
\
- product(bool, UseParNewGC, false, \
- "Use parallel threads in the new generation") \
- \
product(uintx, ParallelGCBufferWastePct, 10, \
"Wasted fraction of parallel allocation buffer") \
range(0, 100) \
@@ -2059,13 +2044,6 @@
"Maximum fraction (1/n) of virtual memory used for ergonomically "\
"determining maximum heap size") \
\
- product(bool, UseAutoGCSelectPolicy, false, \
- "Use automatic collection selection policy") \
- \
- product(uintx, AutoGCSelectPauseMillis, 5000, \
- "Automatic GC selection pause threshold in milliseconds") \
- range(0, max_uintx) \
- \
product(bool, UseAdaptiveSizePolicy, true, \
"Use adaptive generation sizing policies") \
\
@@ -3003,10 +2981,6 @@
develop(intx, DontYieldALotInterval, 10, \
"Interval between which yields will be dropped (milliseconds)") \
\
- develop(intx, MinSleepInterval, 1, \
- "Minimum sleep() interval (milliseconds) when " \
- "ConvertSleepToYield is off (used for Solaris)") \
- \
develop(intx, ProfilerPCTickThreshold, 15, \
"Number of ticks in a PC buckets to be a hotspot") \
\
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/ProblemList.txt
--- a/hotspot/test/ProblemList.txt Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/ProblemList.txt Mon Mar 13 19:58:33 2017 +0000
@@ -73,6 +73,7 @@
serviceability/jdwp/AllModulesCommandTest.java 8168478 generic-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
+serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java 8173936 generic-all
#############################################################################
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/TEST.groups
--- a/hotspot/test/TEST.groups Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/TEST.groups Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -209,11 +209,8 @@
gc/g1/TestShrinkToOneRegion.java \
gc/metaspace/G1AddMetaspaceDependency.java \
gc/startup_warnings/TestCMS.java \
- gc/startup_warnings/TestDefNewCMS.java \
gc/startup_warnings/TestParallelGC.java \
gc/startup_warnings/TestParallelScavengeSerialOld.java \
- gc/startup_warnings/TestParNewCMS.java \
- gc/startup_warnings/TestParNewSerialOld.java \
runtime/SharedArchiveFile/SharedArchiveFile.java
# Minimal VM on Compact 2 adds in some compact2 tests
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/compiler/c1/TestUnresolvedField.jasm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c1/TestUnresolvedField.jasm Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+public class compiler/c1/TestUnresolvedField version 52:0 {
+ public static Method testGetField:"()V" stack 1 locals 1 {
+ aconst_null;
+ getfield Field T.f:I; // T does not exist
+ return;
+ }
+
+ public static Method testPutField:"()V" stack 2 locals 1 {
+ aconst_null;
+ iconst_0;
+ putfield Field T.f:I; // T does not exist
+ return;
+ }
+}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/compiler/c1/TestUnresolvedFieldMain.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/c1/TestUnresolvedFieldMain.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,48 @@
+/*
+ * 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 8173373
+ * @compile TestUnresolvedField.jasm
+ * @run main/othervm -XX:TieredStopAtLevel=1 -Xcomp
+ * -XX:CompileCommand=compileonly,compiler.c1.TestUnresolvedField::test*
+ * compiler.c1.TestUnresolvedFieldMain
+ */
+
+package compiler.c1;
+
+public class TestUnresolvedFieldMain {
+ public static void main(String[] args) {
+ try {
+ TestUnresolvedField.testGetField();
+ } catch (java.lang.NoClassDefFoundError error) {
+ // Expected
+ }
+ try {
+ TestUnresolvedField.testPutField();
+ } catch (java.lang.NoClassDefFoundError error) {
+ // Expected
+ }
+ }
+}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java
--- a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java Mon Mar 13 19:58:33 2017 +0000
@@ -23,7 +23,6 @@
/**
* @test
- * @modules java.base/jdk.internal.misc
* @library /test/lib /
*
* @run driver compiler.jsr292.ContinuousCallSiteTargetChange
@@ -31,6 +30,7 @@
package compiler.jsr292;
+import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
@@ -39,15 +39,26 @@
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.MutableCallSite;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class ContinuousCallSiteTargetChange {
- static void testServer() throws Exception {
+ static final int ITERATIONS = Integer.parseInt(System.getProperty("iterations", "50"));
+
+ static void runTest(Class> test, String... extraArgs) throws Exception {
+ List argsList = new ArrayList<>(
+ List.of("-XX:+IgnoreUnrecognizedVMOptions",
+ "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
+ "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining"));
+
+ argsList.addAll(Arrays.asList(extraArgs));
+
+ argsList.add(test.getName());
+ argsList.add(Integer.toString(ITERATIONS));
+
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-XX:+IgnoreUnrecognizedVMOptions",
- "-server", "-XX:-TieredCompilation", "-Xbatch",
- "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
- "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
- Test.class.getName(), "100");
+ argsList.toArray(new String[argsList.size()]));
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
@@ -55,30 +66,42 @@
analyzer.shouldNotContain("made not compilable");
analyzer.shouldNotContain("decompile_count > PerMethodRecompilationCutoff");
+
}
- static void testClient() throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-XX:+IgnoreUnrecognizedVMOptions",
- "-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch",
- "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
- "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
- Test.class.getName(), "100");
+ static void testServer(Class> test, String... args) throws Exception {
+ List extraArgsList = new ArrayList<>(
+ List.of("-server", "-XX:-TieredCompilation"));
+ extraArgsList.addAll(Arrays.asList(args));
- OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+ runTest(test, extraArgsList.toArray(new String[extraArgsList.size()]));
+ }
- analyzer.shouldHaveExitValue(0);
+ static void testClient(Class> test, String... args) throws Exception {
+ List extraArgsList = new ArrayList<>(
+ List.of("-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1"));
+ extraArgsList.addAll(Arrays.asList(args));
- analyzer.shouldNotContain("made not compilable");
- analyzer.shouldNotContain("decompile_count > PerMethodRecompilationCutoff");
+ runTest(test, extraArgsList.toArray(new String[extraArgsList.size()]));
}
public static void main(String[] args) throws Exception {
- testServer();
- testClient();
+ testServer(RecompilationTest.class, "-Xbatch");
+ testClient(RecompilationTest.class, "-Xbatch");
+
+ testServer(PingPongTest.class);
+ testClient(PingPongTest.class);
}
- static class Test {
+ static MethodHandle findStatic(Class> cls, String name, MethodType mt) {
+ try {
+ return MethodHandles.lookup().findStatic(cls, name, mt);
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ }
+
+ static class RecompilationTest {
static final MethodType mt = MethodType.methodType(void.class);
static final CallSite cs = new MutableCallSite(mt);
@@ -96,7 +119,7 @@
}
static void iteration() throws Throwable {
- MethodHandle mh1 = MethodHandles.lookup().findStatic(ContinuousCallSiteTargetChange.Test.class, "f", mt);
+ MethodHandle mh1 = findStatic(RecompilationTest.class, "f", mt);
cs.setTarget(mh1);
for (int i = 0; i < 20_000; i++) {
test1();
@@ -111,4 +134,38 @@
}
}
}
+
+ static class PingPongTest {
+ static final MethodType mt = MethodType.methodType(void.class);
+ static final CallSite cs = new MutableCallSite(mt);
+
+ static final MethodHandle mh = cs.dynamicInvoker();
+
+ static final MethodHandle ping = findStatic(PingPongTest.class, "ping", mt);
+ static final MethodHandle pong = findStatic(PingPongTest.class, "pong", mt);
+
+ static void ping() {
+ Asserts.assertEQ(cs.getTarget(), ping, "wrong call site target");
+ cs.setTarget(pong);
+ }
+
+ static void pong() {
+ Asserts.assertEQ(cs.getTarget(), pong, "wrong call site target");
+ cs.setTarget(ping);
+ }
+
+ static void iteration() throws Throwable {
+ cs.setTarget(ping);
+ for (int i = 0; i < 20_000; i++) {
+ mh.invokeExact();
+ }
+ }
+
+ public static void main(String[] args) throws Throwable {
+ int iterations = Integer.parseInt(args[0]);
+ for (int i = 0; i < iterations; i++) {
+ iteration();
+ }
+ }
+ }
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/compiler/jsr292/patches/java.base/java/lang/invoke/MethodHandleHelper.java
--- a/hotspot/test/compiler/jsr292/patches/java.base/java/lang/invoke/MethodHandleHelper.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/compiler/jsr292/patches/java.base/java/lang/invoke/MethodHandleHelper.java Mon Mar 13 19:58:33 2017 +0000
@@ -84,7 +84,7 @@
public static MethodHandle make(MethodHandle target) {
LambdaForm lform = DelegatingMethodHandle.makeReinvokerForm(
- target, -1, DelegatingMethodHandle.class, "reinvoker.dontInline",
+ target, -1, DelegatingMethodHandle.class,
/*forceInline=*/false, DelegatingMethodHandle.NF_getTarget, null);
return new NonInlinedReinvoker(target, lform);
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java Mon Mar 13 19:58:33 2017 +0000
@@ -44,6 +44,8 @@
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* -XX:CompileCommand=exclude,*::check
* -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
+ * -XX:CompileCommand=dontinline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,testFrame
+ * -XX:CompileCommand=inline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,recurse
* -Xbatch
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
@@ -119,14 +121,25 @@
}
Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
+ "Method unexpectedly not compiled");
+ Asserts.assertTrue(WB.getMethodCompilationLevel(METHOD) == 4, getName()
+ + "Method not compiled at level 4");
testFrame("someString", COMPILE_THRESHOLD);
}
private void testFrame(String str, int iteration) {
Helper helper = new Helper(str);
- check(iteration);
+ recurse(2, iteration);
Asserts.assertTrue((helper.string != null) && (this != null)
- && (helper != null), getName() + " : some locals are null");
+ && (helper != null), String.format("%s : some locals are null", getName()));
+ }
+ private void recurse(int depth, int iteration) {
+ if (depth == 0) {
+ check(iteration);
+ } else {
+ Integer s = new Integer(depth);
+ recurse(depth - 1, iteration);
+ Asserts.assertEQ(s.intValue(), depth, String.format("different values: %s != %s", s.intValue(), depth));
+ }
}
private void check(int iteration) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/gc/arguments/TestExplicitGCInvokesConcurrentAndUnloadsClasses.java
--- a/hotspot/test/gc/arguments/TestExplicitGCInvokesConcurrentAndUnloadsClasses.java Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test TestExplicitGCInvokesConcurrentAndUnloadsClasses
- * @summary Test that the flag ExplicitGCInvokesConcurrentAndUnloadsClasses is deprecated
- * @bug 8170388
- * @key gc
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * java.management
- * @run driver TestExplicitGCInvokesConcurrentAndUnloadsClasses
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-public class TestExplicitGCInvokesConcurrentAndUnloadsClasses {
- public static void main(String[] args) throws Exception {
- ProcessBuilder pb =
- ProcessTools.createJavaProcessBuilder("-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses",
- "-Xlog:gc",
- "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("ExplicitGCInvokesConcurrentAndUnloadsClasses was deprecated");
- output.shouldHaveExitValue(0);
- }
-}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/gc/arguments/TestSelectDefaultGC.java
--- a/hotspot/test/gc/arguments/TestSelectDefaultGC.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/gc/arguments/TestSelectDefaultGC.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -66,7 +66,6 @@
assertVMOption(output, "UseSerialGC", !isServer);
// CMS is never default
assertVMOption(output, "UseConcMarkSweepGC", false);
- assertVMOption(output, "UseParNewGC", false);
}
public static void main(String[] args) throws Exception {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/gc/startup_warnings/TestDefNewCMS.java
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
-* @test TestDefNewCMS
-* @key gc
-* @bug 8065972
-* @summary Test that the unsupported DefNew+CMS combination does not start
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-* java.management
-*/
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class TestDefNewCMS {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("It is not possible to combine the DefNew young collector with the CMS collector.");
- output.shouldContain("Error");
- output.shouldHaveExitValue(1);
- }
-
-}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/gc/startup_warnings/TestParNewCMS.java
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
-* @test TestParNewCMS
-* @key gc
-* @bug 8065972
-* @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-* java.management
-*/
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-
-public class TestParNewCMS {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Option UseParNewGC was deprecated in version");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
- }
-
-}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
-* @test TestParNewSerialOld
-* @key gc
-* @bug 8065972
-* @summary Test that the unsupported ParNew+SerialOld combination does not start
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-* java.management
-*/
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-
-public class TestParNewSerialOld {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("It is not possible to combine the ParNew young collector with any collector other than CMS.");
- output.shouldContain("Error");
- output.shouldHaveExitValue(1);
- }
-
-}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java
--- a/hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test TestUseAutoGCSelectPolicy
- * @key gc
- * @bug 8166461 8167494
- * @summary Test that UseAutoGCSelectPolicy and AutoGCSelectPauseMillis do print a warning message
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * java.management
- */
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class TestUseAutoGCSelectPolicy {
-
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseAutoGCSelectPolicy", "-XX:AutoGCSelectPauseMillis=3000", "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("UseAutoGCSelectPolicy was deprecated in version 9.0");
- output.shouldContain("AutoGCSelectPauseMillis was deprecated in version 9.0");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
- }
-}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
--- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -37,18 +37,18 @@
// Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449)
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-XX:UseOldInliningPlusJunk", "-version");
+ "-XX:ConvertSleepToYieldPlusJunk", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("Unrecognized VM option 'UseOldInliningPlusJunk'"); // Must identify bad option.
+ output.shouldContain("Unrecognized VM option 'ConvertSleepToYieldPlusJunk'"); // Must identify bad option.
output.shouldHaveExitValue(1);
- // Case 2: Newly obsolete integer-valued flags should be recognized as newly obsolete (8073989)
+ // Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989)
ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder(
- "-XX:NmethodSweepFraction=10", "-version");
+ "-XX:+ConvertSleepToYield", "-version");
OutputAnalyzer output2 = new OutputAnalyzer(pb2.start());
output2.shouldContain("Ignoring option").shouldContain("support was removed");
- output2.shouldContain("NmethodSweepFraction");
+ output2.shouldContain("ConvertSleepToYield");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/CommandLine/VMAliasOptions.java
--- a/hotspot/test/runtime/CommandLine/VMAliasOptions.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/VMAliasOptions.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,6 @@
*/
public static final String[][] ALIAS_OPTIONS = {
{"DefaultMaxRAMFraction", "MaxRAMFraction", "1032"},
- {"CMSMarkStackSizeMax", "MarkStackSizeMax", "1032"},
- {"CMSMarkStackSize", "MarkStackSize", "1032"},
- {"G1MarkStackSize", "MarkStackSize", "1032"},
- {"ParallelMarkingThreads", "ConcGCThreads", "2"},
- {"ParallelCMSThreads", "ConcGCThreads", "2"},
{"CreateMinidumpOnCrash", "CreateCoredumpOnCrash", "false" },
};
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java
--- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,17 +41,9 @@
public static final String[][] DEPRECATED_OPTIONS = {
// deprecated non-alias flags:
{"MaxGCMinorPauseMillis", "1032"},
- {"UseParNewGC", "false"},
- {"ConvertSleepToYield", "false" },
- {"ConvertYieldToSleep", "false" },
// deprecated alias flags (see also aliased_jvm_flags):
{"DefaultMaxRAMFraction", "4"},
- {"CMSMarkStackSizeMax", "1032"},
- {"CMSMarkStackSize", "1032"},
- {"G1MarkStackSize", "1032"},
- {"ParallelMarkingThreads", "2"},
- {"ParallelCMSThreads", "2"},
{"CreateMinidumpOnCrash", "false"}
};
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/LocalLong/LocalLongHelper.java
--- a/hotspot/test/runtime/LocalLong/LocalLongHelper.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/LocalLong/LocalLongHelper.java Mon Mar 13 19:58:33 2017 +0000
@@ -30,10 +30,10 @@
public class LocalLongHelper {
static StackWalker sw;
- static Method intValue;
+ static Method longValue;
static Method getLocals;
static Class> primitiveValueClass;
- static Method primitiveType;
+ static Method primitiveSize;
static Method getMethodType;
static Field memberName;
static Field offset;
@@ -43,27 +43,29 @@
new LocalLongHelper().longArg(0xC0FFEE, 0x1234567890ABCDEFL);
}
- // locals[2] contains the high byte of the long argument.
+ // locals[2] contains the unused slot of the long argument.
public long longArg(int i, long l) throws Throwable {
List frames = sw.walk(s -> s.collect(Collectors.toList()));
Object[] locals = (Object[]) getLocals.invoke(frames.get(0));
- int locals_2 = (int) intValue.invoke(locals[2]);
- if (locals_2 != 0){
- throw new RuntimeException("Expected locals_2 == 0");
+ if (8 == (int) primitiveSize.invoke(locals[2])) { // Only test 64-bit
+ long locals_2 = (long) longValue.invoke(locals[2]);
+ if (locals_2 != 0){
+ throw new RuntimeException("Expected locals_2 == 0");
+ }
}
return l; // Don't want l to become a dead var
}
private static void setupReflectionStatics() throws Throwable {
Class> liveStackFrameClass = Class.forName("java.lang.LiveStackFrame");
- primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveValue");
+ primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveSlot");
getLocals = liveStackFrameClass.getDeclaredMethod("getLocals");
getLocals.setAccessible(true);
- intValue = primitiveValueClass.getDeclaredMethod("intValue");
- intValue.setAccessible(true);
+ longValue = primitiveValueClass.getDeclaredMethod("longValue");
+ longValue.setAccessible(true);
Class> stackFrameInfoClass = Class.forName("java.lang.StackFrameInfo");
memberName = stackFrameInfoClass.getDeclaredField("memberName");
@@ -80,20 +82,8 @@
f.setAccessible(true);
Object localsAndOperandsOption = f.get(null);
- primitiveType = primitiveValueClass.getDeclaredMethod("type");
- primitiveType.setAccessible(true);
-
+ primitiveSize = primitiveValueClass.getDeclaredMethod("size");
+ primitiveSize.setAccessible(true);
sw = (StackWalker) ewsNI.invoke(null, java.util.Collections.emptySet(), localsAndOperandsOption);
}
-
- private static String type(Object o) throws Throwable {
- if (primitiveValueClass.isInstance(o)) {
- final char c = (char) primitiveType.invoke(o);
- return String.valueOf(c);
- } else if (o != null) {
- return o.getClass().getName();
- } else {
- return "null";
- }
- }
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/NMT/AutoshutdownNMT.java
--- a/hotspot/test/runtime/NMT/AutoshutdownNMT.java Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key nmt
- * @summary Test for deprecated message if -XX:-AutoShutdownNMT is specified
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * java.management
- */
-
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.process.OutputAnalyzer;
-
-public class AutoshutdownNMT {
-
- public static void main(String args[]) throws Exception {
-
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-XX:NativeMemoryTracking=detail",
- "-XX:-AutoShutdownNMT",
- "-version");
- OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("Ignoring option AutoShutdownNMT");
- }
-}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java
--- a/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java Mon Mar 13 19:58:33 2017 +0000
@@ -68,7 +68,7 @@
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_first_mod =
- ModuleDescriptor.module("first_mod")
+ ModuleDescriptor.newModule("first_mod")
.requires("java.base")
.requires("second_mod")
.build();
@@ -78,7 +78,7 @@
// Packages: p2
// Packages exported: p2 is exported to first_mod
ModuleDescriptor descriptor_second_mod =
- ModuleDescriptor.module("second_mod")
+ ModuleDescriptor.newModule("second_mod")
.requires("java.base")
.exports("p2", Set.of("first_mod"))
.build();
@@ -89,7 +89,7 @@
// Resolves "first_mod"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("first_mod"));
+ .resolve(finder, ModuleFinder.of(), Set.of("first_mod"));
// Map each module to the same class loader
Map map = new HashMap<>();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java
--- a/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java Mon Mar 13 19:58:33 2017 +0000
@@ -66,9 +66,9 @@
// Packages: p1, p4
// Packages exported: none
ModuleDescriptor descriptor_first_mod =
- ModuleDescriptor.module("first_mod")
+ ModuleDescriptor.newModule("first_mod")
.requires("java.base")
- .contains(Set.of("p1", "p4"))
+ .packages(Set.of("p1", "p4"))
.build();
// Define module: second_mod
@@ -76,7 +76,7 @@
// Packages: p2
// Packages exported: p2 is exported to first_mod
ModuleDescriptor descriptor_second_mod =
- ModuleDescriptor.module("second_mod")
+ ModuleDescriptor.newModule("second_mod")
.requires("java.base")
.exports("p2", Set.of("first_mod"))
.build();
@@ -87,7 +87,7 @@
// Resolves "first_mod" and "second_mod"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
+ .resolve(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
// Map each module to this class loader
Map map = new HashMap<>();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/CheckRead.java
--- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can not read module m2, then class p1.c1
- * in module m1 can not access p2.c2 in module m2.
+ * @summary Test that if module m1x can not read module m2x, then class p1.c1
+ * in module m1x can not access p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// defines m2 --> packages p2
-// defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// defines m2x --> packages p2
+// defines m3x --> packages p3
//
-// m1 can not read m2
-// package p2 in m2 is exported to m1
+// m1x can not read m2x
+// package p2 in m2x is exported to m1x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
-// Access denied since m1 can not read m2.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
+// Access denied since m1x can not read m2x.
//
public class CheckRead {
@@ -64,65 +64,65 @@
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m3
+ // Define module: m1x
+ // Can read: java.base, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m3")
+ .requires("m3x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: p2 is exported to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p2 is exported to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
- // Define module: m3
- // Can read: java.base, m2
+ // Define module: m3x
+ // Can read: java.base, m2x
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
- .requires("m2")
- .contains("p3")
+ .requires("m2x")
+ .packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
- map.put("m3", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
+ map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1, m2 and m3
+ // Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1 but m2 is not readable from m1)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x but m2x is not readable from m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("cannot access")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can not read module m2, then class p1.c1
- * in module m1 can not access p2.c2 in module m2.
+ * @summary Test that if module m1x can not read module m2x, then class p1.c1
+ * in module m1x can not access p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
-// defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
+// defines m3x --> packages p3
//
-// m1 can not read m2
-// package p2 in m2 is exported to m1
+// m1x can not read m2x
+// package p2 in m2x is exported to m1x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
-// Access denied since m1 can not read m2.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
+// Access denied since m1x can not read m2x.
//
public class DiffCL_CheckRead {
@@ -64,65 +64,65 @@
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m3
+ // Define module: m1x
+ // Can read: java.base, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m3")
+ .requires("m3x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: p2 is exported to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p2 is exported to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
- // Define module: m3
- // Can read: java.base, m2
+ // Define module: m3x
+ // Can read: java.base, m2x
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
- .requires("m2")
- .contains("p3")
+ .requires("m2x")
+ .packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
- map.put("m3", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
+ map.put("m3x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1, m2 and m3
+ // Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
- assertTrue(layer.findLoader("m3") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m3x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1 but m2 is not readable from m1)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x but m2x is not readable from m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("cannot access")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2
- * is exported specifically to module m3, then class p1.c1 in m1 can not
- * access p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x
+ * is exported specifically to module m3x, then class p1.c1 in m1x can not
+ * access p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -48,15 +48,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
-// defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
+// defines m3x --> packages p3
//
-// m1 can read m2
-// package p2 in m2 is exported to m3
+// m1x can read m2x
+// package p2 in m2x is exported to m3x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access denied since although m1 can read m2, p2 is exported only to m3.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access denied since although m1x can read m2x, p2 is exported only to m3x.
//
public class DiffCL_ExpQualOther {
@@ -65,66 +65,66 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2, m3
+ // Define module: m1x
+ // Can read: java.base, m2x, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
- .requires("m3")
+ .requires("m2x")
+ .requires("m3x")
.exports("p1")
.build();
- // Define module: m2
- // Can read: java.base, m3
+ // Define module: m2x
+ // Can read: java.base, m3x
// Packages: p2
- // Packages exported: p2 is exported to m3
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p2 is exported to m3x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m3"))
+ .exports("p2", Set.of("m3x"))
.build();
- // Define module: m3
- // Can read: java.base, m2
+ // Define module: m3x
+ // Can read: java.base, m2x
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
- .requires("m2")
- .contains("p3")
+ .requires("m2x")
+ .packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
- map.put("m3", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
+ map.put("m3x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
- assertTrue(layer.findLoader("m3") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m3x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3 not to m1)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x not to m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
- * Access allowed since m1 can read m2 and package p2 is exported to m1.
+ * @summary class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
+ * Access allowed since m1x can read m2x and package p2 is exported to m1x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -47,14 +47,14 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is exported to m1
+// m1x can read m2x
+// package p2 in m2x is exported to m1x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported to m1.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported to m1x.
//
public class DiffCL_ExpQualToM1 {
@@ -63,45 +63,45 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported to unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: package p2 is exported to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: package p2 is exported to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@@ -109,7 +109,7 @@
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+ throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, and package p2 in m2 is
- * exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, and package p2 in m2x is
+ * exported unqualifiedly, then class p1.c1 in m1x can read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -47,14 +47,14 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is exported to m1
+// m1x can read m2x
+// package p2 in m2x is exported to m1x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported
// unqualifiedly.
//
public class DiffCL_ExpUnqual {
@@ -64,45 +64,45 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: package p2 is exported to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: package p2 is exported to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@@ -110,7 +110,7 @@
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+ throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2 is not
- * exported, then class p1.c1 in m1 can not read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x is not
+ * exported, then class p1.c1 in m1x can not read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -47,13 +47,13 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since p2 is not exported.
//
public class DiffCL_PkgNotExp {
@@ -63,52 +63,52 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .contains("p2")
+ .packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
/*
* @test
- * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module.
+ * @summary class p1.c1 defined in m1x tries to access p2.c2 defined in unnamed module.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
@@ -50,10 +50,10 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// package p1 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p1
+// package p1 in m1x is exported unqualifiedly
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in
+// class p1.c1 defined in m1x tries to access p2.c2 defined in
// in unnamed module.
//
// Three access attempts occur in this test:
@@ -62,7 +62,7 @@
// 2. In this scenario a strict module establishes readability
// to the particular unnamed module it is trying to access.
// Access is allowed.
-// 3. Module m1 in the test_looseModuleLayer() method
+// 3. Module m1x in the test_looseModuleLayer() method
// is transitioned to a loose module, access
// to all unnamed modules is allowed.
//
@@ -71,41 +71,41 @@
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
+ map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@@ -114,109 +114,109 @@
// Attempt access
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Test Failed, strict module m1 should not be able " +
+ throw new RuntimeException("Test Failed, strict module m1x should not be able " +
"to access public type p2.c2 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
+ map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1ReadEdgeDiffLoader
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1ReadEdgeDiffLoader");
try {
- // Read edge between m1 and the unnamed module that loads p2.c2 is established in
+ // Read edge between m1x and the unnamed module that loads p2.c2 is established in
// c1ReadEdgeDiffLoader's ctor before attempting access.
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, module m1 has established readability to p2/c2 loader's " +
+ throw new RuntimeException("Test Failed, module m1x has established readability to p2/c2 loader's " +
"unnamed module, access should be allowed: " + e.getMessage());
}
}
- // Module m1 is a loose module and thus can read all unnamed modules.
+ // Module m1x is a loose module and thus can read all unnamed modules.
public void test_looseModuleLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
+ map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1Loose
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1Loose");
- // change m1 to read all unnamed modules
- Module m1 = layer.findModule("m1").get();
- jdk.internal.module.Modules.addReadsAllUnnamed(m1);
+ // change m1x to read all unnamed modules
+ Module m1x = layer.findModule("m1x").get();
+ jdk.internal.module.Modules.addReadsAllUnnamed(m1x);
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, loose module m1 should be able to access " +
+ throw new RuntimeException("Test Failed, loose module m1x should be able to access " +
"public type p2.c2 defined in unnamed module: " + e.getMessage());
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java
--- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
/*
* @test
- * @summary class p3.c3 defined in module m1 tries to access c4 defined in an unnamed package
+ * @summary class p3.c3 defined in module m1x tries to access c4 defined in an unnamed package
* and an unnamed module.
* @modules java.base/jdk.internal.misc
* @library /test/lib
@@ -48,10 +48,10 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p3
-// package p3 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p3
+// package p3 in m1x is exported unqualifiedly
//
-// class p3.c3 defined in m1 tries to access c4 defined in
+// class p3.c3 defined in m1x tries to access c4 defined in
// in unnamed module.
//
// Two access attempts occur in this test:
@@ -66,41 +66,41 @@
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
+ map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3
@@ -109,58 +109,58 @@
// Attempt access
try {
p3_c3_class.newInstance();
- throw new RuntimeException("Test Failed, strict module m1 should not be able to access " +
+ throw new RuntimeException("Test Failed, strict module m1x should not be able to access " +
"public type c4 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
+ map.put("m1x", MyDiffClassLoader.loader1);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3ReadEdgeDiffLoader
Class p3_c3_class = MyDiffClassLoader.loader1.loadClass("p3.c3ReadEdgeDiffLoader");
try {
- // Read edge between m1 and the unnamed module that loads c4 is established in
+ // Read edge between m1x and the unnamed module that loads c4 is established in
// C3ReadEdgeDiffLoader's ctor before attempting access.
p3_c3_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, module m1 has established readability to " +
+ throw new RuntimeException("Test Failed, module m1x has established readability to " +
"c4 loader's unnamed module, access should be allowed: " + e.getMessage());
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2
- * is exported specifically to module m3, then class p1.c1 in m1 can not
- * access p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x
+ * is exported specifically to module m3x, then class p1.c1 in m1x can not
+ * access p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -48,15 +48,15 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// defines m2 --> packages p2
-// defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// defines m2x --> packages p2
+// defines m3x --> packages p3
//
-// m1 can read m2
-// package p2 in m2 is exported to m3
+// m1x can read m2x
+// package p2 in m2x is exported to m3x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access denied since although m1 can read m2, p2 is exported only to m3.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access denied since although m1x can read m2x, p2 is exported only to m3x.
//
public class ExpQualOther {
@@ -65,66 +65,66 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2, m3
+ // Define module: m1x
+ // Can read: java.base, m2x, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
- .requires("m3")
+ .requires("m2x")
+ .requires("m3x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: p2 is exported to m3
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p2 is exported to m3x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m3"))
+ .exports("p2", Set.of("m3x"))
.build();
- // Define module: m3
- // Can read: java.base, m2
+ // Define module: m3x
+ // Can read: java.base, m2x
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
- .requires("m2")
- .contains("p3")
+ .requires("m2x")
+ .packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
- map.put("m3", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
+ map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3 not to m1)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x not to m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java
--- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, AND package p2 in m2 is
- * exported qualifiedly to m1, then class p1.c1 in m1 can read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, AND package p2 in m2x is
+ * exported qualifiedly to m1x, then class p1.c1 in m1x can read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -53,52 +53,52 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: p2 is exported qualifiedly to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p2 is exported qualifiedly to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+ throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java
--- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, AND package p2 in module2 is
- * exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, AND package p2 in module_two is
+ * exported unqualifiedly, then class p1.c1 in m1x can read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -53,45 +53,45 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported unqualifiedly
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java
--- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test if package p2 in module m2 is exported to all unnamed,
- * then class p1.c1 in an unnamed module can read p2.c2 in module m2.
+ * @summary Test if package p2 in module m2x is exported to all unnamed,
+ * then class p1.c1 in an unnamed module can read p2.c2 in module m2x.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
@@ -49,15 +49,15 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is exported unqualifiedly
+// m1x can read m2x
+// package p2 in m2x is exported unqualifiedly
//
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access allowed, an unnamed module can read all modules and p2 in module
-// m2 is exported to all unnamed modules.
+// m2x is exported to all unnamed modules.
public class ExportAllUnnamed {
@@ -66,51 +66,51 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported unqualifiedly
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
Class p2_c2_class = MySameClassLoader.loader1.loadClass("p2.c2");
- Module m2 = p2_c2_class.getModule();
+ Module m2x = p2_c2_class.getModule();
- // Export m2/p2 to all unnamed modules.
- jdk.internal.module.Modules.addExportsToAllUnnamed(m2, "p2");
+ // Export m2x/p2 to all unnamed modules.
+ jdk.internal.module.Modules.addExportsToAllUnnamed(m2x, "p2");
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java
--- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if module m1 can read module m2, but package p2 in m2 is not
- * exported, then class p1.c1 in m1 can not read p2.c2 in m2.
+ * @summary Test that if module m1x can read module m2x, but package p2 in m2x is not
+ * exported, then class p1.c1 in m1x can not read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -47,13 +47,13 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since p2 is not exported.
//
public class PkgNotExp {
@@ -63,51 +63,51 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .contains("p2")
+ .packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 and m2
+ // Create Layer that contains m1x and m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/Umod.java
--- a/hotspot/test/runtime/modules/AccessCheck/Umod.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
/*
* @test
- * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module.
+ * @summary class p1.c1 defined in m1x tries to access p2.c2 defined in unnamed module.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
@@ -50,10 +50,10 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// package p1 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p1
+// package p1 in m1x is exported unqualifiedly
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in
+// class p1.c1 defined in m1x tries to access p2.c2 defined in
// in unnamed module.
//
// Three access attempts occur in this test:
@@ -62,7 +62,7 @@
// 2. In this scenario a strict module establishes readability
// to the particular unnamed module it is trying to access.
// Access is allowed.
-// 3. Module m1 in the test_looseModuleLayer() method
+// 3. Module m1x in the test_looseModuleLayer() method
// is transitioned to a loose module, access
// to all unnamed modules is allowed.
//
@@ -71,38 +71,38 @@
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader.
MySameClassLoader loader = new MySameClassLoader();
Map map = new HashMap<>();
- map.put("m1", loader);
+ map.put("m1x", loader);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == loader);
+ assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@@ -111,103 +111,103 @@
// Attempt access
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Test Failed, strict module m1, type p1.c1, should not be able " +
+ throw new RuntimeException("Test Failed, strict module m1x, type p1.c1, should not be able " +
"to access public type p2.c2 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MySameClassLoader loader = new MySameClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader.
Map map = new HashMap<>();
- map.put("m1", loader);
+ map.put("m1x", loader);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == loader);
+ assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1ReadEdge
Class p1_c1_class = loader.loadClass("p1.c1ReadEdge");
try {
- // Read edge between m1 and the unnamed module that loads p2.c2 is established in
+ // Read edge between m1x and the unnamed module that loads p2.c2 is established in
// c1ReadEdge's ctor before attempting access.
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, strict module m1, type p1.c1ReadEdge, should be able to acccess public type " +
+ throw new RuntimeException("Test Failed, strict module m1x, type p1.c1ReadEdge, should be able to acccess public type " +
"p2.c2 defined in unnamed module: " + e.getMessage());
}
}
- // Module m1 is a loose module and thus can read all unnamed modules.
+ // Module m1x is a loose module and thus can read all unnamed modules.
public void test_looseModuleLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MySameClassLoader loader = new MySameClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader.
Map map = new HashMap<>();
- map.put("m1", loader);
+ map.put("m1x", loader);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == loader);
+ assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1Loose
Class p1_c1_class = loader.loadClass("p1.c1Loose");
- // change m1 to read all unnamed modules
- Module m1 = layer.findModule("m1").get();
- jdk.internal.module.Modules.addReadsAllUnnamed(m1);
+ // change m1x to read all unnamed modules
+ Module m1x = layer.findModule("m1x").get();
+ jdk.internal.module.Modules.addReadsAllUnnamed(m1x);
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, strict module m1, type p1.c1Loose, should be able to acccess public type " +
+ throw new RuntimeException("Test Failed, strict module m1x, type p1.c1Loose, should be able to acccess public type " +
"p2.c2 defined in unnamed module: " + e.getMessage());
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@
/*
* @test
- * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2.
+ * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x.
* Access is denied, since an unnamed module can read all modules but p2 in module
- * m2 is exported specifically to module m1, not to all modules.
+ * m2x is exported specifically to module m1x, not to all modules.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -48,15 +48,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
//
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access denied, an unnamed module can read all modules but p2 in module
-// m2 is exported specifically to module m1 not to all modules.
+// m2x is exported specifically to module m1x not to all modules.
//
public class UmodDiffCL_ExpQualOther {
@@ -65,53 +65,53 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
- // NOTE: module m1 does not define a package named p1.
+ // NOTE: module m1x does not define a package named p1.
// p1 will be loaded in an unnamed module.
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1, not unqualifiedly");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x, not unqualifiedly");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2.
- * Access allowed, an unnamed module can read all modules and p2 in module m2
+ * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x.
+ * Access allowed, an unnamed module can read all modules and p2 in module m2x
* which is exported unqualifiedly.
* @modules java.base/jdk.internal.misc
* @library /test/lib
@@ -48,15 +48,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is exported unqualifiedly.
+// m1x can read m2x
+// package p2 in m2x is exported unqualifiedly.
//
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access allowed, an unnamed module can read all modules and p2 in module
-// m2 which is exported unqualifiedly.
+// m2x which is exported unqualifiedly.
//
public class UmodDiffCL_ExpUnqual {
@@ -65,53 +65,53 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
- // NOTE: module m1 does not define a package named p1.
+ // NOTE: module m1x does not define a package named p1.
// p1 will be loaded in an unnamed module.
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, p1.c1 defined in unnamed module can access p2.c2 in module m2");
+ throw new RuntimeException("Test Failed, p1.c1 defined in unnamed module can access p2.c2 in module m2x");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@
/*
* @test
- * @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2.
+ * @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2x.
* Access is denied since even though unnamed module can read all modules, p2
- * in module m2 is not exported at all.
+ * in module m2x is not exported at all.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
//
-// class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2x
// Access denied since even though unnamed module can read all modules, p2
-// in module m2 is not exported at all.
+// in module m2x is not exported at all.
//
public class UmodDiffCL_PkgNotExp {
@@ -64,53 +64,53 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .contains("p2")
+ .packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
- // NOTE: module m1 does not define a package named p1.
+ // NOTE: module m1x does not define a package named p1.
// p1 will be loaded in an unnamed module.
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported to an unnamed module)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported to an unnamed module)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
/*
* @test
- * @summary class p3.c3 defined in module m1 tries to access c4 defined in unnamed module.
+ * @summary class p3.c3 defined in module m1x tries to access c4 defined in unnamed module.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -48,10 +48,10 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> packages p3
-// package p3 in m1 is exported unqualifiedly
+// ClassLoader1 --> defines m1x --> packages p3
+// package p3 in m1x is exported unqualifiedly
//
-// class p3.c3 defined in m1 tries to access c4 defined in
+// class p3.c3 defined in m1x tries to access c4 defined in
// in unnamed module.
//
// Two access attempts occur in this test:
@@ -66,38 +66,38 @@
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
- // Module m1 is a strict module and has not established
+ // Module m1x is a strict module and has not established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c4 will be loaded in an unnamed module/loader.
MySameClassLoader loader = new MySameClassLoader();
Map map = new HashMap<>();
- map.put("m1", loader);
+ map.put("m1x", loader);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == loader);
+ assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3
@@ -106,55 +106,55 @@
// Attempt access
try {
p3_c3_class.newInstance();
- throw new RuntimeException("Test Failed, strict module m1, type p3.c3, should not be able to access " +
+ throw new RuntimeException("Test Failed, strict module m1x, type p3.c3, should not be able to access " +
"public type c4 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
- // Module m1 is a strict module and has established
+ // Module m1x is a strict module and has established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
- // Define module: m1
+ // Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MySameClassLoader loader = new MySameClassLoader();
- // map module m1 to class loader.
+ // map module m1x to class loader.
// class c4 will be loaded in an unnamed module/loader.
Map map = new HashMap<>();
- map.put("m1", loader);
+ map.put("m1x", loader);
- // Create Layer that contains m1
+ // Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == loader);
+ assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3ReadEdge
Class p3_c3_class = loader.loadClass("p3.c3ReadEdge");
try {
- // Read edge between m1 and the unnamed module that loads c4 is established in
+ // Read edge between m1x and the unnamed module that loads c4 is established in
// c3ReadEdge's ctor before attempting access.
p3_c3_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, module m1, type p3.c3ReadEdge, has established readability to " +
+ throw new RuntimeException("Test Failed, module m1x, type p3.c3ReadEdge, has established readability to " +
"c4 loader's unnamed module, access should be allowed: " + e.getMessage());
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@
/*
* @test
- * @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2.
+ * @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2x.
* Access is denied, since an unnamed module can read all modules but p6 in module
- * m2 is exported specifically to module m1, not to all modules.
+ * m2x is exported specifically to module m1x, not to all modules.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -48,15 +48,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p6
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p6
//
-// m1 can read m2
-// package p6 in m2 is not exported
+// m1x can read m2x
+// package p6 in m2x is not exported
//
-// class c5 defined in an unnamed module tries to access p6.c6 defined in m2
+// class c5 defined in an unnamed module tries to access p6.c6 defined in m2x
// Access denied, an unnamed module can read all modules but p6 in module
-// m2 is exported specifically to module m1 not to all modules.
+// m2x is exported specifically to module m1x not to all modules.
//
public class UmodUpkgDiffCL_ExpQualOther {
@@ -65,51 +65,51 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p6
- // Packages exported: p6 exported to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p6 exported to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p6", Set.of("m1"))
+ .exports("p6", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
Class c5_class = MyDiffClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p6 in m2 is exported to m1, not unqualifiedly");
+ throw new RuntimeException("Failed to get IAE (p6 in m2x is exported to m1x, not unqualifiedly");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary class c5 in an unnamed module can read module m2, but package p6 in module m2 is not exported.
- * Access denied since even though unnamed module can read all modules, p6 in module m2 is not exported at all.
+ * @summary class c5 in an unnamed module can read module m2x, but package p6 in module m2x is not exported.
+ * Access denied since even though unnamed module can read all modules, p6 in module m2x is not exported at all.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MyDiffClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// ClassLoader2 --> defines m2 --> packages p6
+// ClassLoader1 --> defines m1x --> no packages
+// ClassLoader2 --> defines m2x --> packages p6
//
-// m1 can read m2
-// package p6 in m2 is not exported
+// m1x can read m2x
+// package p6 in m2x is not exported
//
-// class c5 defined in unnamed module tries to access p6.c6 defined in m2
+// class c5 defined in unnamed module tries to access p6.c6 defined in m2x
// Access denied since even though unnamed module can read all modules, p6
-// in module m2 is not exported at all.
+// in module m2x is not exported at all.
//
public class UmodUpkgDiffCL_NotExp {
@@ -64,53 +64,53 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p6
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .contains("p6")
+ .packages(Set.of("p6"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MyDiffClassLoader.loader1);
- map.put("m2", MyDiffClassLoader.loader2);
+ map.put("m1x", MyDiffClassLoader.loader1);
+ map.put("m2x", MyDiffClassLoader.loader2);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
+ assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
- // NOTE: module m1 does not define any packages.
+ // NOTE: module m1x does not define any packages.
// c5 will be loaded in an unnamed module.
Class c5_class = MyDiffClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p6 in m2 is not exported to " +
+ throw new RuntimeException("Failed to get IAE (p6 in m2x is not exported to " +
"an unnamed module that c5 is defined within)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if class c5 in an unnamed module can read package p6 in module m2, but package p6 in module m2 is
- * exported qualifiedly to module m3, then class c5 in an unnamed module can not read p6.c6 in module m2.
+ * @summary Test that if class c5 in an unnamed module can read package p6 in module m2x, but package p6 in module m2x is
+ * exported qualifiedly to module m3x, then class c5 in an unnamed module can not read p6.c6 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// defines m2 --> packages p6
-// defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> no packages
+// defines m2x --> packages p6
+// defines m3x --> packages p3
//
-// m1 can read m2
-// package p6 in m2 is exported to m3
+// m1x can read m2x
+// package p6 in m2x is exported to m3x
//
-// class c5 defined in m1 tries to access p6.c6 defined in m2
-// Access denied since although m1 can read m2, p6 is exported only to m3.
+// class c5 defined in m1x tries to access p6.c6 defined in m2x
+// Access denied since although m1x can read m2x, p6 is exported only to m3x.
//
public class UmodUpkg_ExpQualOther {
@@ -64,63 +64,63 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1 (need to define m1 to establish the Layer successfully)
- // Can read: java.base, m2, m3
+ // Define module: m1x (need to define m1x to establish the Layer successfully)
+ // Can read: java.base, m2x, m3x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
- .requires("m3")
+ .requires("m2x")
+ .requires("m3x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p6
- // Packages exported: p6 is exported to m3
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p6 is exported to m3x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p6", Set.of("m3"))
+ .exports("p6", Set.of("m3x"))
.build();
- // Define module: m3
+ // Define module: m3x
// Can read: java.base
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
- map.put("m3", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
+ map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1, m2 and m3
+ // Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
Class c5_class = MySameClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p6 in m2 is exported to m3, not unqualifiedly to everyone)");
+ throw new RuntimeException("Failed to get IAE (p6 in m2x is exported to m3x, not unqualifiedly to everyone)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java
--- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test if package p6 in module m2 is not exported, then class c5
- * in an unnamed module can not access p6.c2 in module m2.
+ * @summary Test if package p6 in module m2x is not exported, then class c5
+ * in an unnamed module can not access p6.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -46,13 +46,13 @@
import java.util.Set;
import myloaders.MySameClassLoader;
-// ClassLoader1 --> defines m1 --> no packages
-// defines m2 --> packages p6
+// ClassLoader1 --> defines m1x --> no packages
+// defines m2x --> packages p6
//
-// m1 can read m2
-// package p6 in m2 is not exported
+// m1x can read m2x
+// package p6 in m2x is not exported
//
-// class c5 defined in an unnamed module tries to access p6.c2 defined in m2
+// class c5 defined in an unnamed module tries to access p6.c2 defined in m2x
// Access denied since p6 is not exported.
//
public class UmodUpkg_NotExp {
@@ -62,51 +62,51 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p6
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .contains("p6")
+ .packages(Set.of("p6"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 and m2
+ // Create Layer that contains m1x and m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
Class c5_class = MySameClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p6 in m2 is not exported)");
+ throw new RuntimeException("Failed to get IAE (p6 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test that if package p2 in module m2 is exported to module m3,
- * then class p1.c1 in an unnamed module can not read p2.c2 in module m2.
+ * @summary Test that if package p2 in module m2x is exported to module m3x,
+ * then class p1.c1 in an unnamed module can not read p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// defines m2 --> packages p2
-// defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> no packages
+// defines m2x --> packages p2
+// defines m3x --> packages p3
//
-// m1 can read m2
-// package p2 in m2 is exported to m3
+// m1x can read m2x
+// package p2 in m2x is exported to m3x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access denied since although m1 can read m2, p2 is exported only to m3.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access denied since although m1x can read m2x, p2 is exported only to m3x.
//
public class Umod_ExpQualOther {
@@ -64,63 +64,63 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1 (need to define m1 to establish the Layer successfully)
- // Can read: java.base, m2, m3
+ // Define module: m1x (need to define m1x to establish the Layer successfully)
+ // Can read: java.base, m2x, m3x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
- .requires("m3")
+ .requires("m2x")
+ .requires("m3x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: p2 is exported to m3
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: p2 is exported to m3x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m3"))
+ .exports("p2", Set.of("m3x"))
.build();
- // Define module: m3
+ // Define module: m3x
// Can read: java.base
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
- map.put("m3", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
+ map.put("m3x", MySameClassLoader.loader1);
- // Create Layer that contains m1, m2 and m3
+ // Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3, not unqualifiedly to everyone)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x, not unqualifiedly to everyone)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test if package p2 in module m2 is exported unqualifiedly,
- * then class p1.c1 in an unnamed module can read p2.c2 in module m2.
+ * @summary Test if package p2 in module m2x is exported unqualifiedly,
+ * then class p1.c1 in an unnamed module can read p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -47,15 +47,15 @@
import myloaders.MySameClassLoader;
//
-// ClassLoader1 --> defines m1 --> no packages
-// defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is exported unqualifiedly
+// m1x can read m2x
+// package p2 in m2x is exported unqualifiedly
//
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access allowed, an unnamed module can read all modules and p2 in module
-// m2 which is exported unqualifiedly.
+// m2x which is exported unqualifiedly.
public class Umod_ExpUnqual {
@@ -64,44 +64,44 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported unqualifiedly
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java
--- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
/*
* @test
- * @summary Test if package p2 in module m2 is not exported, then class p1.c1
- * in an unnamed module can not access p2.c2 in module m2.
+ * @summary Test if package p2 in module m2x is not exported, then class p1.c1
+ * in an unnamed module can not access p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@@ -46,13 +46,13 @@
import java.util.Set;
import myloaders.MySameClassLoader;
-// ClassLoader1 --> defines m1 --> no packages
-// defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> no packages
+// defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is not exported
+// m1x can read m2x
+// package p2 in m2x is not exported
//
-// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
+// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access denied since p2 is not exported.
//
public class Umod_PkgNotExp {
@@ -62,51 +62,51 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: none
// Packages exported: none
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .contains("p2")
+ .packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map map = new HashMap<>();
- map.put("m1", MySameClassLoader.loader1);
- map.put("m2", MySameClassLoader.loader1);
+ map.put("m1x", MySameClassLoader.loader1);
+ map.put("m2x", MySameClassLoader.loader1);
- // Create Layer that contains m1 and m2
+ // Create Layer that contains m1x and m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
- assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
+ assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/p1/c1Loose.java
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1Loose.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1Loose.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
public class c1Loose {
public c1Loose() {
- // Attempt access - access should succeed since m1 is a loose module
+ // Attempt access - access should succeed since m1x is a loose module
p2.c2 c2_obj = new p2.c2();
c2_obj.method2();
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java Mon Mar 13 19:58:33 2017 +0000
@@ -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,12 +27,12 @@
public class c1ReadEdge {
public c1ReadEdge() {
- // Establish read edge from module m1, where c1ReadEdge is defined,
+ // Establish read edge from module m1x, where c1ReadEdge is defined,
// to the unnamed module, where p2.c2 will be defined.
- Module m1 = c1ReadEdge.class.getModule();
+ Module m1x = c1ReadEdge.class.getModule();
ClassLoader loader = c1ReadEdge.class.getClassLoader();
Module unnamed_module = loader.getUnnamedModule();
- m1.addReads(unnamed_module);
+ m1x.addReads(unnamed_module);
// Attempt access - access should succeed
p2.c2 c2_obj = new p2.c2();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java
--- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -28,32 +28,32 @@
public class c1ReadEdgeDiffLoader {
public c1ReadEdgeDiffLoader() {
- // The goal is to establish a read edge between module m1
+ // The goal is to establish a read edge between module m1x
// which is the module where p1.c1ReadEdgeDiffLoader is defined,
// and the unnamed module that defines p2.c2. This must be
// done in 2 steps:
//
- // Step #1: Establish a read edge between m1, where c1ReadEdgeDiffLoader
+ // Step #1: Establish a read edge between m1x, where c1ReadEdgeDiffLoader
// is defined, and the System ClassLoader's unnamed module,
// where MyDiffClassLoader is defined. This read edge
// is needed before we can obtain MyDiffClassLoader.loader2's unnamed module.
//
- // Step #2: Establish a read edge between m1, where c1ReadEdgeDiffLoader
+ // Step #2: Establish a read edge between m1x, where c1ReadEdgeDiffLoader
// is defined, and the MyDiffClassLoader.loader2's unnamed module,
// where p2.c2 will be defined.
- // Step #1: read edge m1 -> System ClassLoader's unnamed module
- Module m1 = c1ReadEdgeDiffLoader.class.getModule();
+ // Step #1: read edge m1x -> System ClassLoader's unnamed module
+ Module m1x = c1ReadEdgeDiffLoader.class.getModule();
ClassLoader system_loader = ClassLoader.getSystemClassLoader();
- Module unnamed_module1 = system_loader.getUnnamedModule();
- m1.addReads(unnamed_module1);
+ Module unnamed_module_one = system_loader.getUnnamedModule();
+ m1x.addReads(unnamed_module_one);
- // Step #2: read edge m1 -> MyDiffClassLoader.loader2's unnamed module
+ // Step #2: read edge m1x -> MyDiffClassLoader.loader2's unnamed module
ClassLoader loader2 = MyDiffClassLoader.loader2;
- Module unnamed_module2 = loader2.getUnnamedModule();
- m1.addReads(unnamed_module2);
+ Module unnamed_module_two = loader2.getUnnamedModule();
+ m1x.addReads(unnamed_module_two);
- // Attempt access - access should succeed since m1 can read
+ // Attempt access - access should succeed since m1x can read
// MyDiffClassLoader.loader2's unnamed module
p2.c2 c2_obj = new p2.c2();
c2_obj.method2();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,12 @@
* import java.lang.reflect.*;
* public class c3ReadEdge {
* public c3ReadEdge() {
- * // Establish read edge from module m1, where c3ReadEdge is defined,
+ * // Establish read edge from module m1x, where c3ReadEdge is defined,
* // to the unnamed module, where c4 will be defined.
- * Module m1 = c3ReadEdge.class.getModule();
+ * Module m1x = c3ReadEdge.class.getModule();
* ClassLoader loader = c3ReadEdge.class.getClassLoader();
* Module unnamed_module = loader.getUnnamedModule();
- * m1.addReads(unnamed_module);
+ * m1x.addReads(unnamed_module);
* // Attempt access - access should succeed
* c4 c4_obj = new c4();
* c4_obj.method4();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod
--- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -28,32 +28,32 @@
*
* public class c3ReadEdgeDiffLoader {
* public c3ReadEdgeDiffLoader() {
- * // The goal is to establish a read edge between module m1
+ * // The goal is to establish a read edge between module m1x
* // which is the module where p3.c3ReadEdgeDiffLoader is defined,
* // and the unnamed module that defines c4. This must be
* // done in 2 steps:
* //
- * // Step #1: Establish a read edge between m1, where c3ReadEdgeDiffLoader
+ * // Step #1: Establish a read edge between m1x, where c3ReadEdgeDiffLoader
* // is defined, and the System ClassLoader's unnamed module,
* // where MyDiffClassLoader is defined. This read edge
* // is needed before we can obtain MyDiffClassLoader.loader2's unnamed module.
* //
- * // Step #2: Establish a read edge between m1, where c3ReadEdgeDiffLoader
+ * // Step #2: Establish a read edge between m1x, where c3ReadEdgeDiffLoader
* // is defined, and the MyDiffClassLoader.loader2's unnamed module,
* // where c4 will be defined.
*
- * // Step #1: read edge m1 -> System ClassLoader's unnamed module
- * Module m1 = c3ReadEdgeDiffLoader.class.getModule();
+ * // Step #1: read edge m1x -> System ClassLoader's unnamed module
+ * Module m1x = c3ReadEdgeDiffLoader.class.getModule();
* ClassLoader system_loader = ClassLoader.getSystemClassLoader();
- * Module unnamed_module1 = system_loader.getUnnamedModule();
- * m1.addReads(unnamed_module1);
+ * Module unnamed_module_one = system_loader.getUnnamedModule();
+ * m1x.addReads(unnamed_module_one);
*
- * // Step #2: read edge m1 -> MyDiffClassLoader.loader2's unnamed module
+ * // Step #2: read edge m1x -> MyDiffClassLoader.loader2's unnamed module
* ClassLoader loader2 = MyDiffClassLoader.loader2;
- * Module unnamed_module2 = loader2.getUnnamedModule();
- * m1.addReads(unnamed_module2);
+ * Module unnamed_module_two = loader2.getUnnamedModule();
+ * m1x.addReads(unnamed_module_two);
*
- * // Attempt access - should succeed since m1 can read
+ * // Attempt access - should succeed since m1x can read
* // MyDiffClassLoader.loader2's unnamed module
* c4 c4_obj = new c4();
* c4_obj.method4();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckAllUnnamed.java
--- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -43,7 +43,7 @@
// and then test that a class in the unnamed module can access a package in a
// named module that has been exported to all unnamed modules.
public static void main(String args[]) throws Throwable {
- Object m1, m2;
+ Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -55,16 +55,16 @@
ClassLoader this_cldr = AccessCheckAllUnnamed.class.getClassLoader();
// Define a module for p3.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p3" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/there", new String[] { "p3" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
try {
ModuleHelper.AddModuleExportsToAllUnnamed((Module)null, "p2");
@@ -74,7 +74,7 @@
}
try {
- ModuleHelper.AddModuleExportsToAllUnnamed(m2, null);
+ ModuleHelper.AddModuleExportsToAllUnnamed(m2x, null);
throw new RuntimeException("Failed to get the expected NPE for null package");
} catch(NullPointerException e) {
// Expected
@@ -88,21 +88,21 @@
}
try {
- ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p3");
+ ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p3");
throw new RuntimeException("Failed to get the expected IAE for package in other module");
} catch(IllegalArgumentException e) {
// Expected
}
try {
- ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p4");
+ ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p4");
throw new RuntimeException("Failed to get the expected IAE for package not in module");
} catch(IllegalArgumentException e) {
// Expected
}
- // Export package p2 in m2 to allUnnamed.
- ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p2");
+ // Export package p2 in m2x to allUnnamed.
+ ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p2");
// p1.c1's ctor tries to call a method in p2.c2. This should succeed because
// p1 is in an unnamed module and p2.c2 is exported to all unnamed modules.
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckExp.java
--- a/hotspot/test/runtime/modules/AccessCheckExp.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckExp.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -39,10 +39,10 @@
public class AccessCheckExp {
- // Test that if module1 can read module2, but package p2 in module2 is not
- // exported then class p1.c1 in module1 can not read p2.c2 in module2.
+ // Test that if module_one can read module_two, but package p2 in module_two is not
+ // exported then class p1.c1 in module_one can not read p2.c2 in module_two.
public static void main(String args[]) throws Throwable {
- Object m1, m2;
+ Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -54,28 +54,28 @@
ClassLoader this_cldr = AccessCheckExp.class.getClassLoader();
// Define a module for p1.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
- // Make package p1 in m1 visible to everyone.
- ModuleHelper.AddModuleExportsToAll(m1, "p1");
+ // Make package p1 in m1x visible to everyone.
+ ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// p1.c1's ctor tries to call a method in p2.c2, but p2.c2 is not
// exported. So should get IllegalAccessError.
- ModuleHelper.AddReadsModule(m1, m2);
+ ModuleHelper.AddReadsModule(m1x, m2x);
Class p1_c1_class = Class.forName("p1.c1");
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported");
} catch (IllegalAccessError f) {
System.out.println(f.getMessage());
if (!f.getMessage().contains("does not export")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckJavaBase.java
--- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,16 +38,16 @@
public class AccessCheckJavaBase {
- // Test that a class defined to module2 always can read java.base.
+ // Test that a class defined to module_two always can read java.base.
public static void main(String args[]) throws Throwable {
// Get the class loader for AccessCheckJavaBase and assume it's also used to
// load class p2.c2.
ClassLoader this_cldr = AccessCheckJavaBase.class.getClassLoader();
// Define a module for p2.
- Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
+ Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
// p2.c2 can read its superclass java.lang.Object defined within java.base
try {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckRead.java
--- a/hotspot/test/runtime/modules/AccessCheckRead.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckRead.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -39,10 +39,10 @@
public class AccessCheckRead {
- // Test that a class in a package in module1 cannot access a class in
- // a package n module2 if module1 cannot read module2.
+ // Test that a class in a package in module_one cannot access a class in
+ // a package in module_two if module_one cannot read module_two.
public static void main(String args[]) throws Throwable {
- Object m1, m2;
+ Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -54,19 +54,19 @@
ClassLoader this_cldr = AccessCheckRead.class.getClassLoader();
// Define a module for p1.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
- // Make package p1 in m1 visible to everyone.
- ModuleHelper.AddModuleExportsToAll(m1, "p1");
+ // Make package p1 in m1x visible to everyone.
+ ModuleHelper.AddModuleExportsToAll(m1x, "p1");
Class p1_c1_class = Class.forName("p1.c1");
@@ -74,7 +74,7 @@
// cannot read p2's module. So should get IllegalAccessError.
try {
p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (m1 can't read m2)");
+ throw new RuntimeException("Failed to get IAE (m1x can't read m2x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not read") ||
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckSuper.java
--- a/hotspot/test/runtime/modules/AccessCheckSuper.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckSuper.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -48,17 +48,17 @@
ClassLoader this_cldr = AccessCheckSuper.class.getClassLoader();
// Define a module for p2.
- Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
+ Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
// Define a module for p3.
- Object m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p3" });
- assertNotNull(m3, "Module should not be null");
- ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p3" });
+ Object m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
+ assertNotNull(m3x, "Module should not be null");
+ ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
- // Since a readability edge has not been established between module2
- // and module3, p3.c3 cannot read its superclass p2.c2.
+ // Since a readability edge has not been established between module_two
+ // and module_three, p3.c3 cannot read its superclass p2.c2.
try {
Class p3_c3_class = Class.forName("p3.c3");
throw new RuntimeException("Failed to get IAE (can't read superclass)");
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckUnnamed.java
--- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
// Test that a class in the unnamed module can not access a package in a
// named module that has not been unqualifiedly exported.
public static void main(String args[]) throws Throwable {
- Object m1, m2;
+ Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -54,17 +54,17 @@
ClassLoader this_cldr = AccessCheckUnnamed.class.getClassLoader();
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// p1.c1's ctor tries to call a method in p2.c2. This should fail because
// p1 is in the unnamed module and p2.c2 is not unqualifiedly exported.
Class p1_c1_class = Class.forName("p1.c1");
try {
Object c1_obj = p1_c1_class.newInstance();
- throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported to unnamed module)");
+ throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported to unnamed module)");
} catch (IllegalAccessError f) {
System.out.println(f.getMessage());
if (!f.getMessage().contains("does not export p2 to unnamed module")) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/AccessCheckWorks.java
--- a/hotspot/test/runtime/modules/AccessCheckWorks.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/AccessCheckWorks.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -39,11 +39,11 @@
public class AccessCheckWorks {
- // Check that a class in a package in module1 can successfully access a
- // class in module2 when module1 can read module2 and the class's package
+ // Check that a class in a package in module_one can successfully access a
+ // class in module_two when module_one can read module_two and the class's package
// has been exported.
public static void main(String args[]) throws Throwable {
- Object m1, m2;
+ Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -55,24 +55,24 @@
ClassLoader this_cldr = AccessCheckWorks.class.getClassLoader();
// Define a module for p1.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
- // Make package p1 in m1 visible to everyone.
- ModuleHelper.AddModuleExportsToAll(m1, "p1");
+ // Make package p1 in m1x visible to everyone.
+ ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// p1.c1's ctor tries to call a method in p2.c2. This should work because
// p1's module can read p2's module and p2 is exported to p1's module.
- ModuleHelper.AddReadsModule(m1, m2);
- ModuleHelper.AddModuleExports(m2, "p2", m1);
+ ModuleHelper.AddReadsModule(m1x, m2x);
+ ModuleHelper.AddModuleExports(m2x, "p2", m1x);
Class p1_c1_class = Class.forName("p1.c1");
p1_c1_class.newInstance();
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/CCE_module_msg.java
--- a/hotspot/test/runtime/modules/CCE_module_msg.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/CCE_module_msg.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -83,21 +83,21 @@
ClassLoader this_cldr = CCE_module_msg.class.getClassLoader();
// Define a module for p2.
- Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
try {
- ModuleHelper.AddModuleExportsToAll(m2, "p2");
+ ModuleHelper.AddModuleExportsToAll(m2x, "p2");
Object p2Obj = new p2.c2();
System.out.println((String)p2Obj);
throw new RuntimeException("ClassCastException wasn't thrown, test failed.");
} catch (ClassCastException cce) {
String exception = cce.getMessage();
System.out.println(exception);
- if (exception.contains("module2/p2.c2") ||
- !(exception.contains("module2@") &&
+ if (exception.contains("module_two/p2.c2") ||
+ !(exception.contains("module_two@") &&
exception.contains("/p2.c2 cannot be cast to java.base/java.lang.String"))) {
throw new RuntimeException("Wrong message: " + exception);
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ExportTwice.java
--- a/hotspot/test/runtime/modules/ExportTwice.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ExportTwice.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -44,7 +44,7 @@
// Also, check that a package can be exported to a specific package and then
// exported unqualifiedly.
public static void main(String args[]) throws Throwable {
- Object m1, m2, m3;
+ Object m1x, m2x, m3x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -56,37 +56,37 @@
ClassLoader this_cldr = ExportTwice.class.getClassLoader();
// Define a module for p1.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// Define a module for p3.
- m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p3" });
- assertNotNull(m3, "Module should not be null");
- ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p3" });
- ModuleHelper.AddReadsModule(m3, jlObject_jlrM);
+ m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
+ assertNotNull(m3x, "Module should not be null");
+ ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
+ ModuleHelper.AddReadsModule(m3x, jlObject_jlrM);
- // Make package p1 in m1 visible to everyone.
- ModuleHelper.AddModuleExportsToAll(m1, "p1");
+ // Make package p1 in m1x visible to everyone.
+ ModuleHelper.AddModuleExportsToAll(m1x, "p1");
- // Try to export p1 only to m2 after it was exported unqualifiedly. It
+ // Try to export p1 only to m2x after it was exported unqualifiedly. It
// should silently succeed.
- ModuleHelper.AddModuleExports(m1, "p1", m2);
+ ModuleHelper.AddModuleExports(m1x, "p1", m2x);
- // Export p2 to m3 then export it again unqualifiedly.
- ModuleHelper.AddModuleExports(m2, "p2", m3);
- ModuleHelper.AddModuleExportsToAll(m2, "p2");
+ // Export p2 to m3x then export it again unqualifiedly.
+ ModuleHelper.AddModuleExports(m2x, "p2", m3x);
+ ModuleHelper.AddModuleExportsToAll(m2x, "p2");
// p1.c1's ctor tries to call a method in p2.c2. This should work because
// p1's module can read p2's module and p2 is now exported unqualifiedly.
- ModuleHelper.AddReadsModule(m1, m2);
+ ModuleHelper.AddReadsModule(m1x, m2x);
Class p1_c1_class = Class.forName("p1.c1");
p1_c1_class.newInstance();
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java
--- a/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java Mon Mar 13 19:58:33 2017 +0000
@@ -67,8 +67,8 @@
}
public static void main(String[] args) throws Exception {
- testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.ResolutionException");
- testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
+ testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.FindException");
+ testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.FindException");
testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "WARNING: Unknown module: xyzz");
testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0",
"WARNING: package xyzz not in java.base");
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java
--- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -39,10 +39,10 @@
public class JVMAddModuleExportToAllUnnamed {
- // Check that a class in a package in module1 cannot access a class
+ // Check that a class in a package in module_one cannot access a class
// that is in the unnamed module if the accessing package is strict.
public static void main(String args[]) throws Throwable {
- Object m1;
+ Object m1x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -54,13 +54,13 @@
ClassLoader this_cldr = JVMAddModuleExportToAllUnnamed.class.getClassLoader();
// Define a module for p1.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
- // Make package p1 in m1 visible to everyone.
- ModuleHelper.AddModuleExportsToAll(m1, "p1");
+ // Make package p1 in m1x visible to everyone.
+ ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// p1.c1's ctor tries to call a method in p2.c2. This should not work
// because p2 is in the unnamed module and p1.c1 is strict.
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java
--- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -43,7 +43,7 @@
// and then test that a class in the unnamed module can access a package in
// a named module that has been exported unqualifiedly.
public static void main(String args[]) throws Throwable {
- Object m1, m2, m3;
+ Object m1x, m2x, m3x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@@ -55,16 +55,16 @@
ClassLoader this_cldr = JVMAddModuleExportsToAll.class.getClassLoader();
// Define a module for p3.
- m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p3" });
- assertNotNull(m1, "Module should not be null");
- ModuleHelper.DefineModule(m1, "9.0", "m1/there", new String[] { "p3" });
- ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
+ m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
+ assertNotNull(m1x, "Module should not be null");
+ ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
+ ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
- m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
- assertNotNull(m2, "Module should not be null");
- ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
- ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
+ m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
+ assertNotNull(m2x, "Module should not be null");
+ ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
+ ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
try {
ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
@@ -74,7 +74,7 @@
}
try {
- ModuleHelper.AddModuleExportsToAll(m2, null);
+ ModuleHelper.AddModuleExportsToAll(m2x, null);
throw new RuntimeException("Failed to get the expected NPE for null package");
} catch(NullPointerException e) {
// Expected
@@ -88,26 +88,26 @@
}
try {
- ModuleHelper.AddModuleExportsToAll(m2, "p3");
+ ModuleHelper.AddModuleExportsToAll(m2x, "p3");
throw new RuntimeException("Failed to get the expected IAE for package that is in another module");
} catch(IllegalArgumentException e) {
// Expected
}
try {
- ModuleHelper.AddModuleExportsToAll(m2, "p4");
+ ModuleHelper.AddModuleExportsToAll(m2x, "p4");
throw new RuntimeException("Failed to get the expected IAE for package not in any module");
} catch(IllegalArgumentException e) {
// Expected
}
- // Export package p2 in m2 unqualifiedly. Then, do a qualified export
- // of p2 in m2 to m3. This should not affect the unqualified export.
- m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p4" });
- assertNotNull(m3, "Module m3 should not be null");
- ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p4" });
- ModuleHelper.AddModuleExportsToAll(m2, "p2");
- ModuleHelper.AddModuleExports(m2, "p2", m3);
+ // Export package p2 in m2x unqualifiedly. Then, do a qualified export
+ // of p2 in m2x to m3x. This should not affect the unqualified export.
+ m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p4" });
+ assertNotNull(m3x, "Module m3x should not be null");
+ ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p4" });
+ ModuleHelper.AddModuleExportsToAll(m2x, "p2");
+ ModuleHelper.AddModuleExports(m2x, "p2", m3x);
// p1.c1's ctor tries to call a method in p2.c2. This should succeed because
// p1 is in an unnamed module and p2.c2 is exported unqualifiedly.
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/JVMAddModulePackage.java
--- a/hotspot/test/runtime/modules/JVMAddModulePackage.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 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
@@ -40,25 +40,25 @@
public static void main(String args[]) throws Throwable {
MyClassLoader cl1 = new MyClassLoader();
MyClassLoader cl3 = new MyClassLoader();
- Object module1, module2, module3;
+ Object module_one, module_two, module_three;
boolean result;
- module1 = ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
- assertNotNull(module1, "Module should not be null");
- ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
- module2 = ModuleHelper.ModuleObject("module2", cl1, new String[] { "yourpackage" });
- assertNotNull(module2, "Module should not be null");
- ModuleHelper.DefineModule(module2, "9.0", "module2/here", new String[] { "yourpackage" });
- module3 = ModuleHelper.ModuleObject("module3", cl3, new String[] { "package/num3" });
- assertNotNull(module3, "Module should not be null");
- ModuleHelper.DefineModule(module3, "9.0", "module3/here", new String[] { "package/num3" });
+ module_one = ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
+ assertNotNull(module_one, "Module should not be null");
+ ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
+ module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" });
+ assertNotNull(module_two, "Module should not be null");
+ ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" });
+ module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "package/num3" });
+ assertNotNull(module_three, "Module should not be null");
+ ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" });
// Simple call
- ModuleHelper.AddModulePackage(module1, "new_package");
+ ModuleHelper.AddModulePackage(module_one, "new_package");
// Add a package and export it
- ModuleHelper.AddModulePackage(module1, "package/num3");
- ModuleHelper.AddModuleExportsToAll(module1, "package/num3");
+ ModuleHelper.AddModulePackage(module_one, "package/num3");
+ ModuleHelper.AddModuleExportsToAll(module_one, "package/num3");
// Null module argument, expect an NPE
try {
@@ -78,7 +78,7 @@
// Null package argument, expect an NPE
try {
- ModuleHelper.AddModulePackage(module1, null);
+ ModuleHelper.AddModulePackage(module_one, null);
throw new RuntimeException("Failed to get the expected NPE");
} catch(NullPointerException e) {
// Expected
@@ -86,7 +86,7 @@
// Existing package, expect an ISE
try {
- ModuleHelper.AddModulePackage(module1, "yourpackage");
+ ModuleHelper.AddModulePackage(module_one, "yourpackage");
throw new RuntimeException("Failed to get the expected ISE");
} catch(IllegalStateException e) {
// Expected
@@ -94,7 +94,7 @@
// Invalid package name, expect an IAE
try {
- ModuleHelper.AddModulePackage(module1, "your.package");
+ ModuleHelper.AddModulePackage(module_one, "your.package");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@@ -102,7 +102,7 @@
// Invalid package name, expect an IAE
try {
- ModuleHelper.AddModulePackage(module1, ";your/package");
+ ModuleHelper.AddModulePackage(module_one, ";your/package");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@@ -110,7 +110,7 @@
// Invalid package name, expect an IAE
try {
- ModuleHelper.AddModulePackage(module1, "7[743");
+ ModuleHelper.AddModulePackage(module_one, "7[743");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@@ -118,7 +118,7 @@
// Empty package name, expect an IAE
try {
- ModuleHelper.AddModulePackage(module1, "");
+ ModuleHelper.AddModulePackage(module_one, "");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@@ -126,8 +126,8 @@
// Add package named "java" to an module defined to a class loader other than the boot or platform loader.
try {
- // module1 is defined to a MyClassLoader class loader.
- ModuleHelper.AddModulePackage(module1, "java/foo");
+ // module_one is defined to a MyClassLoader class loader.
+ ModuleHelper.AddModulePackage(module_one, "java/foo");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
if (!e.getMessage().contains("prohibited package name")) {
@@ -136,10 +136,10 @@
}
// Package "javabar" should be ok
- ModuleHelper.AddModulePackage(module1, "javabar");
+ ModuleHelper.AddModulePackage(module_one, "javabar");
// Package named "java" defined to the boot class loader, should be ok
- Object module_javabase = module1.getClass().getModule();
+ Object module_javabase = module_one.getClass().getModule();
ModuleHelper.AddModulePackage(module_javabase, "java/foo");
// Package named "java" defined to the platform class loader, should be ok
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/JVMDefineModule.java
--- a/hotspot/test/runtime/modules/JVMDefineModule.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMDefineModule.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 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
@@ -49,7 +49,7 @@
/* Invalid test, won't compile.
// Invalid classloader argument, expect an IAE
try {
- m = ModuleHelper.ModuleObject("mymodule1", new Object(), new String[] { "mypackage1" });
+ m = ModuleHelper.ModuleObject("mymodule_one", new Object(), new String[] { "mypackage1" });
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage1" });
throw new RuntimeException("Failed to get expected IAE for bad loader");
} catch(IllegalArgumentException e) {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/JVMGetModuleByPkgName.java
--- a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -79,10 +79,10 @@
}
MyClassLoader cl1 = new MyClassLoader();
- Module module1 = (Module)ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
- assertNotNull(module1, "Module should not be null");
- ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
- if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module1) {
+ Module module_one = (Module)ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
+ assertNotNull(module_one, "Module should not be null");
+ ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
+ if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module_one) {
throw new RuntimeException("Wrong module returned for cl1 mypackage");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleHelper.java
--- a/hotspot/test/runtime/modules/ModuleHelper.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleHelper.java Mon Mar 13 19:58:33 2017 +0000
@@ -84,7 +84,7 @@
}
ModuleDescriptor descriptor =
- ModuleDescriptor.module(name).contains(pkg_set).build();
+ ModuleDescriptor.newModule(name).packages(pkg_set).build();
URI uri = URI.create("module:/" + name);
return java.lang.reflect.ModuleHelper.newModule(loader, descriptor);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleOptionsTest.java
--- a/hotspot/test/runtime/modules/ModuleOptionsTest.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleOptionsTest.java Mon Mar 13 19:58:33 2017 +0000
@@ -43,7 +43,7 @@
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"--add-modules=i_dont_exist", "--add-modules=java.base", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("ResolutionException");
+ output.shouldContain("FindException");
output.shouldContain("i_dont_exist");
output.shouldHaveExitValue(1);
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleStress/CustomSystemClassLoader.java
--- a/hotspot/test/runtime/modules/ModuleStress/CustomSystemClassLoader.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/CustomSystemClassLoader.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
*/
/**
- * A custom system ClassLoader to define the module "m2" to during iterations of
+ * A custom system ClassLoader to define the module "m2x" to during iterations of
* differing test runs within the test ModuleStress.java
*/
public class CustomSystemClassLoader extends ClassLoader {
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -35,15 +35,15 @@
import java.util.Set;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader2 --> defines m2 --> packages p2
-// Java System Class Loader --> defines m3 --> packages p3
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader2 --> defines m2x --> packages p2
+// Java System Class Loader --> defines m3x --> packages p3
//
-// m1 can read m2
-// package p2 in m2 is exported to m1 and m3
+// m1x can read m2x
+// package p2 in m2x is exported to m1x and m3x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported to m1.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported to m1x.
//
public class ModuleNonBuiltinCLMain {
@@ -52,62 +52,62 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported to unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
- // Can read: java.base, m3
+ // Define module: m2x
+ // Can read: java.base, m3x
// Packages: p2
- // Packages exported: package p2 is exported to m1 and m3
+ // Packages exported: package p2 is exported to m1x and m3x
Set targets = new HashSet<>();
- targets.add("m1");
- targets.add("m3");
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ targets.add("m1x");
+ targets.add("m3x");
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .requires("m3")
+ .requires("m3x")
.exports("p2", targets)
.build();
- // Define module: m3
+ // Define module: m3x
// Can read: java.base
// Packages: p3
// Packages exported: none
- ModuleDescriptor descriptor_m3 =
- ModuleDescriptor.module("m3")
+ ModuleDescriptor descriptor_m3x =
+ ModuleDescriptor.newModule("m3x")
.requires("java.base")
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing user defined class loaders for this test
Map map = new HashMap<>();
Loader1 cl1 = new Loader1();
Loader2 cl2 = new Loader2();
ClassLoader cl3 = ClassLoader.getSystemClassLoader();
- map.put("m1", cl1);
- map.put("m2", cl2);
- map.put("m3", cl3);
+ map.put("m1x", cl1);
+ map.put("m2x", cl2);
+ map.put("m3x", cl3);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == cl1);
- assertTrue(layer.findLoader("m2") == cl2);
- assertTrue(layer.findLoader("m3") == cl3);
+ assertTrue(layer.findLoader("m1x") == cl1);
+ assertTrue(layer.findLoader("m2x") == cl2);
+ assertTrue(layer.findLoader("m3x") == cl3);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@@ -115,7 +115,7 @@
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+ throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,14 +34,14 @@
import java.util.Set;
//
-// ClassLoader1 --> defines m1 --> packages p1
-// ClassLoader1 --> defines m2 --> packages p2
+// ClassLoader1 --> defines m1x --> packages p1
+// ClassLoader1 --> defines m2x --> packages p2
//
-// m1 can read m2
-// package p2 in m2 is exported to m1
+// m1x can read m2x
+// package p2 in m2x is exported to m1x
//
-// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
-// Access allowed since m1 can read m2 and package p2 is exported to m1.
+// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
+// Access allowed since m1x can read m2x and package p2 is exported to m1x.
//
public class ModuleSameCLMain {
@@ -50,45 +50,45 @@
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
- // Define module: m1
- // Can read: java.base, m2
+ // Define module: m1x
+ // Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported to unqualifiedly
- ModuleDescriptor descriptor_m1 =
- ModuleDescriptor.module("m1")
+ ModuleDescriptor descriptor_m1x =
+ ModuleDescriptor.newModule("m1x")
.requires("java.base")
- .requires("m2")
+ .requires("m2x")
.exports("p1")
.build();
- // Define module: m2
+ // Define module: m2x
// Can read: java.base
// Packages: p2
- // Packages exported: package p2 is exported to m1
- ModuleDescriptor descriptor_m2 =
- ModuleDescriptor.module("m2")
+ // Packages exported: package p2 is exported to m1x
+ ModuleDescriptor descriptor_m2x =
+ ModuleDescriptor.newModule("m2x")
.requires("java.base")
- .exports("p2", Set.of("m1"))
+ .exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
- ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
+ ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
- // Resolves "m1"
+ // Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
- .resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
+ .resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map map = new HashMap<>();
Loader1 cl1 = new Loader1();
- map.put("m1", cl1);
- map.put("m2", cl1);
+ map.put("m1x", cl1);
+ map.put("m2x", cl1);
- // Create Layer that contains m1 & m2
+ // Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
- assertTrue(layer.findLoader("m1") == cl1);
- assertTrue(layer.findLoader("m2") == cl1);
+ assertTrue(layer.findLoader("m1x") == cl1);
+ assertTrue(layer.findLoader("m2x") == cl1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@@ -96,7 +96,7 @@
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
- throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
+ throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleStress/ModuleStress.java
--- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -83,7 +83,7 @@
InMemoryJavaCompiler.compile("p1.c1", source1), System.getProperty("test.classes"));
// Test #2: Load two modules defined to the same customer class loader.
- // m1's module readability list and package p2's exportability should
+ // m1x's module readability list and package p2's exportability should
// not be walked at a GC safepoint since both modules are defined to
// the same loader and thus have the exact same life cycle.
pb = ProcessTools.createJavaProcessBuilder(
@@ -97,7 +97,7 @@
.shouldHaveExitValue(0);
// Test #3: Load two modules in differing custom class loaders.
- // m1's module readability list and package p2's exportability list must
+ // m1x's module readability list and package p2's exportability list must
// be walked at a GC safepoint since both modules are defined to non-builtin
// class loaders which could die and thus be unloaded.
pb = ProcessTools.createJavaProcessBuilder(
@@ -106,15 +106,15 @@
"ModuleNonBuiltinCLMain");
oa = new OutputAnalyzer(pb.start());
- oa.shouldContain("module m1 reads list must be walked")
- .shouldContain("package p2 defined in module m2, exports list must be walked")
- .shouldNotContain("module m2 reads list must be walked")
+ oa.shouldContain("module m1x reads list must be walked")
+ .shouldContain("package p2 defined in module m2x, exports list must be walked")
+ .shouldNotContain("module m2x reads list must be walked")
.shouldHaveExitValue(0);
// Test #4: Load two modules in differing custom class loaders,
// of which one has been designated as the custom system class loader
// via -Djava.system.class.loader=CustomSystemClassLoader. Since
- // m3 is defined to the system class loader, m2's module readability
+ // m3x is defined to the system class loader, m2x's module readability
// list does not have to be walked at a GC safepoint, but package p2's
// exportability list does.
pb = ProcessTools.createJavaProcessBuilder(
@@ -124,8 +124,8 @@
"ModuleNonBuiltinCLMain");
oa = new OutputAnalyzer(pb.start());
- oa.shouldContain("package p2 defined in module m2, exports list must be walked")
- .shouldNotContain("module m2 reads list must be walked")
+ oa.shouldContain("package p2 defined in module m2x, exports list must be walked")
+ .shouldNotContain("module m2x reads list must be walked")
.shouldHaveExitValue(0);
}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java Mon Mar 13 19:58:33 2017 +0000
@@ -48,7 +48,7 @@
Configuration cf = layerBoot
.configuration()
- .resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
+ .resolve(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
Module testModule = Main.class.getModule();
ClassLoader scl = ClassLoader.getSystemClassLoader();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java
--- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java Mon Mar 13 19:58:33 2017 +0000
@@ -48,7 +48,7 @@
Configuration cf = layerBoot
.configuration()
- .resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
+ .resolve(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
Module testModule = MainGC.class.getModule();
ClassLoader scl = ClassLoader.getSystemClassLoader();
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java
--- a/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,8 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "--patch-module=module1=module1_dir",
- "--patch-module=module1=module1_dir",
+ "--patch-module=module_one=module_one_dir",
+ "--patch-module=module_one=module_one_dir",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("java.lang.ExceptionInInitializerError");
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java
--- a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java Mon Mar 13 19:58:33 2017 +0000
@@ -82,12 +82,11 @@
Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI());
// Load a new named module
- ModuleDescriptor descriptor
- = ModuleDescriptor.module(MY_MODULE_NAME).build();
+ ModuleDescriptor descriptor = ModuleDescriptor.newModule(MY_MODULE_NAME).build();
ModuleFinder finder = finderOf(descriptor);
ClassLoader loader = new ClassLoader() {};
Configuration parent = Layer.boot().configuration();
- Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
+ Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
Layer my = Layer.boot().defineModules(cf, m -> loader);
// Verify that the loaded module is indeed reported by JVMTI
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/serviceability/sa/LingeredAppWithLargeArray.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/LingeredAppWithLargeArray.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.apps.LingeredApp;
+
+public class LingeredAppWithLargeArray extends LingeredApp {
+ public static void main(String args[]) {
+ int[] hugeArray = new int[Integer.MAX_VALUE/2];
+ LingeredApp.main(args);
+ }
+ }
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/serviceability/sa/TestHeapDumpForLargeArray.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/sa/TestHeapDumpForLargeArray.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,117 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.nio.file.Files;
+import java.io.IOException;
+import java.io.BufferedInputStream;
+import java.util.stream.Collectors;
+import java.io.FileInputStream;
+
+import sun.jvm.hotspot.HotSpotAgent;
+import sun.jvm.hotspot.debugger.*;
+
+import jdk.test.lib.apps.LingeredApp;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.Utils;
+import jdk.test.lib.Asserts;
+
+/*
+ * @test
+ * @library /test/lib
+ * @bug 8171084
+ * @requires (vm.bits == "64" & os.maxMemory > 8g)
+ * @modules java.base/jdk.internal.misc
+ * jdk.hotspot.agent/sun.jvm.hotspot
+ * jdk.hotspot.agent/sun.jvm.hotspot.utilities
+ * jdk.hotspot.agent/sun.jvm.hotspot.oops
+ * jdk.hotspot.agent/sun.jvm.hotspot.debugger
+ * @run main/timeout=1800/othervm -Xmx8g TestHeapDumpForLargeArray
+ */
+
+public class TestHeapDumpForLargeArray {
+
+ private static LingeredAppWithLargeArray theApp = null;
+
+ private static void attachAndDump(String heapDumpFileName,
+ long lingeredAppPid) throws Exception {
+
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
+ launcher.addToolArg("jmap");
+ launcher.addToolArg("--binaryheap");
+ launcher.addToolArg("--dumpfile");
+ launcher.addToolArg(heapDumpFileName);
+ launcher.addToolArg("--pid");
+ launcher.addToolArg(Long.toString(lingeredAppPid));
+
+ ProcessBuilder processBuilder = new ProcessBuilder();
+ processBuilder.command(launcher.getCommand());
+ System.out.println(
+ processBuilder.command().stream().collect(Collectors.joining(" ")));
+
+ OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
+ SAOutput.shouldHaveExitValue(0);
+ SAOutput.shouldNotContain("Heap segment size overflow");
+ SAOutput.shouldContain("truncating to");
+ SAOutput.shouldContain("heap written to");
+ SAOutput.shouldContain(heapDumpFileName);
+ System.out.println(SAOutput.getOutput());
+
+ }
+
+ public static void main (String... args) throws Exception {
+
+ String heapDumpFileName = "LargeArrayHeapDump.bin";
+
+ if (!Platform.shouldSAAttach()) {
+ System.out.println(
+ "SA attach not expected to work - test skipped.");
+ return;
+ }
+
+ File heapDumpFile = new File(heapDumpFileName);
+ if (heapDumpFile.exists()) {
+ heapDumpFile.delete();
+ }
+
+ try {
+ List vmArgs = new ArrayList();
+ vmArgs.add("-XX:+UsePerfData");
+ vmArgs.add("-Xmx8g");
+ vmArgs.addAll(Utils.getVmOptions());
+
+ theApp = new LingeredAppWithLargeArray();
+ LingeredApp.startApp(vmArgs, theApp);
+ attachAndDump(heapDumpFileName, theApp.getPid());
+ } finally {
+ LingeredApp.stopApp(theApp);
+ heapDumpFile.delete();
+ }
+ }
+}
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java
--- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java Mon Mar 13 19:58:33 2017 +0000
@@ -53,7 +53,6 @@
public class JMapHProfLargeHeapTest {
private static final String HEAP_DUMP_FILE_NAME = "heap.bin";
- private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1";
private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2";
private static final long M = 1024L;
private static final long G = 1024L * M;
@@ -65,9 +64,7 @@
}
// All heap dumps should create 1.0.2 file format
- // Hotspot internal heapdumper always use HPROF_HEADER_1_0_2 format,
- // but SA heapdumper still use HPROF_HEADER_1_0_1 for small heaps
- testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_1);
+ testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2);
/**
* This test was deliberately commented out since the test system lacks
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/testlibrary/jittester/Makefile
--- a/hotspot/test/testlibrary/jittester/Makefile Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/testlibrary/jittester/Makefile Mon Mar 13 19:58:33 2017 +0000
@@ -108,7 +108,7 @@
$(shell if [ ! -d $(CLASSES_DIR) ]; then mkdir -p $(CLASSES_DIR); fi)
install: clean_testbase testgroup testroot copytestlibrary copyaot JAR cleantmp
- $(JAVA) --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED -ea -jar $(DIST_JAR) $(APPLICATION_ARGS)
+ $(JAVA) --add-exports=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED -ea -jar $(DIST_JAR) $(APPLICATION_ARGS)
clean_testbase:
@rm -rf $(TESTBASE_DIR)
diff -r 40f9a2b0c304 -r a26be46f6bac hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java Thu Mar 09 21:35:18 2017 +0000
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java Mon Mar 13 19:58:33 2017 +0000
@@ -43,6 +43,7 @@
protected final Path generatorDir;
protected final Function preRunActions;
protected final String jtDriverOptions;
+ private static final String DISABLE_WARNINGS = "-XX:-PrintWarnings";
protected TestsGenerator(String suffix) {
this(suffix, s -> new String[0], "");
@@ -57,8 +58,8 @@
protected void generateGoldenOut(String mainClassName) {
String classPath = getRoot() + File.pathSeparator + generatorDir;
- ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", "-Xverify", "-cp", classPath,
- mainClassName);
+ ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", DISABLE_WARNINGS, "-Xverify",
+ "-cp", classPath, mainClassName);
String goldFile = mainClassName + ".gold";
try {
runProcess(pb, generatorDir.resolve(goldFile).toString());
@@ -128,6 +129,8 @@
.append("\n");
}
header.append(" * @run driver jdk.test.lib.jittester.jtreg.JitTesterDriver ")
+ .append(DISABLE_WARNINGS)
+ .append(" ")
.append(jtDriverOptions)
.append(" ")
.append(mainClassName)
diff -r 40f9a2b0c304 -r a26be46f6bac jaxp/.hgtags
--- a/jaxp/.hgtags Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxp/.hgtags Mon Mar 13 19:58:33 2017 +0000
@@ -396,6 +396,7 @@
13c6906bfc861d99dc35a19c80b7a99f0b0ac58d jdk-9+151
7e3da313b1746578da648155e37dd8526e83153d jdk-9+152
1384504d2cd0e55c5e0becaeaf40ab05cae959d6 jdk-9+153
+0908877116d17c6e59092ec7d53ef687a96d3278 jdk-10+0
7fa738305436d14c0926df0f04892890cacc766b jdk-9+154
48fa77af153288b08ba794e1616a7b0685f3b67e jdk-9+155
e930c373aaa4e0e712c9a25ba4b03d473b48c294 jdk-9+156
diff -r 40f9a2b0c304 -r a26be46f6bac jaxp/.jcheck/conf
--- a/jaxp/.jcheck/conf Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxp/.jcheck/conf Mon Mar 13 19:58:33 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/.hgtags
--- a/jaxws/.hgtags Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/.hgtags Mon Mar 13 19:58:33 2017 +0000
@@ -399,5 +399,9 @@
c48b4d4768b1c2b8fe5d1a844ca13732e5dfbe2a jdk-9+151
6f8fb1cf7e5f61c40dcc3654f9a623c505f6de1f jdk-9+152
7a532a9a227137155b905341d4b99939db51220e jdk-9+153
+34af95c7dbff74f3448fcdb7d745524e8a1cc88a jdk-10+0
34af95c7dbff74f3448fcdb7d745524e8a1cc88a jdk-9+154
9b9918656c97724fd89c04a8547043bbd37f5935 jdk-9+155
+7c829eba781409b4fe15392639289af1553dcf63 jdk-9+156
+b7e70e1e0154e1d2c69f814e03a8800ef8634fe0 jdk-9+157
+e53b322357382209fb553b9a1541ccfd12cbcb6c jdk-9+158
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/.jcheck/conf
--- a/jaxws/.jcheck/conf Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/.jcheck/conf Mon Mar 13 19:58:33 2017 +0000
@@ -1,1 +1,1 @@
-project=jdk9
+project=jdk10
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.activation/share/classes/META-INF/mimetypes.default
--- a/jaxws/src/java.activation/share/classes/META-INF/mimetypes.default Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.activation/share/classes/META-INF/mimetypes.default Mon Mar 13 19:58:33 2017 +0000
@@ -7,6 +7,7 @@
image/ief ief
image/jpeg jpeg jpg jpe JPG
image/tiff tiff tif
+image/png png PNG
image/x-xwindowdump xwd
application/postscript ai eps ps
application/rtf rtf
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.activation/share/classes/module-info.java
--- a/jaxws/src/java.activation/share/classes/module-info.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.activation/share/classes/module-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -25,6 +25,8 @@
/**
* Defines the JavaBeans Activation Framework (JAF) API.
+ *
+ * @since 9
*/
module java.activation {
requires transitive java.datatransfer;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,9 +54,7 @@
public Object[] getArguments();
public String getResourceBundleName();
- public default ResourceBundle getResourceBundle(Locale locale) {
- return null;
- }
+ public ResourceBundle getResourceBundle(Locale locale);
/**
* Special constant that represents a message that
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
import java.util.Locale;
import java.util.ResourceBundle;
+
/**
* @author WS Development Team
*/
@@ -42,13 +43,9 @@
private final String _key;
private final Object[] _args;
+ @Deprecated
public LocalizableMessage(String bundlename, String key, Object... args) {
- _bundlename = bundlename;
- _rbSupplier = null;
- _key = key;
- if(args==null)
- args = new Object[0];
- _args = args;
+ this(bundlename, null, key, args);
}
public LocalizableMessage(String bundlename, ResourceBundleSupplier rbSupplier,
@@ -61,15 +58,17 @@
_args = args;
}
-
+ @Override
public String getKey() {
return _key;
}
+ @Override
public Object[] getArguments() {
return Arrays.copyOf(_args, _args.length);
}
+ @Override
public String getResourceBundleName() {
return _bundlename;
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
private final String _bundlename;
private final ResourceBundleSupplier _rbSupplier;
+ @Deprecated
public LocalizableMessageFactory(String bundlename) {
_bundlename = bundlename;
_rbSupplier = null;
@@ -58,4 +59,5 @@
*/
ResourceBundle getResourceBundle(Locale locale);
}
+
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
package com.sun.istack.internal.localization;
-import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Locale;
@@ -41,7 +40,7 @@
public class Localizer {
private final Locale _locale;
- private final HashMap _resourceBundles;
+ private final HashMap _resourceBundles;
public Localizer() {
this(Locale.getDefault());
@@ -49,7 +48,7 @@
public Localizer(Locale l) {
_locale = l;
- _resourceBundles = new HashMap();
+ _resourceBundles = new HashMap<>();
}
public Locale getLocale() {
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/NullLocalizable.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/NullLocalizable.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/NullLocalizable.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
package com.sun.istack.internal.localization;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
/**
* {@link Localizable} that wraps a non-localizable string.
*
@@ -39,13 +42,20 @@
this.msg = msg;
}
+ @Override
public String getKey() {
return Localizable.NOT_LOCALIZABLE;
}
+ @Override
public Object[] getArguments() {
return new Object[]{msg};
}
+ @Override
public String getResourceBundleName() {
return "";
}
+ @Override
+ public ResourceBundle getResourceBundle(Locale locale) {
+ return null;
+ }
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/JAXBRIContext.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/JAXBRIContext.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/JAXBRIContext.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -533,4 +533,14 @@
* @since 2.2.6
*/
public static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity";
+
+ /**
+ * If true and element namespace is not specified, namespace of parent element will be used.
+ * The default value is false.
+ *
+ * Boolean
+ * @since 2.3.0
+ */
+ public static final String BACKUP_WITH_PARENT_NAMESPACE = "com.sun.xml.internal.bind.backupWithParentNamespace";
+
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ContextFactory.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ContextFactory.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ContextFactory.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,8 @@
"is not active. Using JAXB's implementation");
}
+ Boolean backupWithParentNamespace = getPropertyValue(properties, JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE, Boolean.class);
+
RuntimeAnnotationReader ar = getPropertyValue(properties,JAXBRIContext.ANNOTATION_READER,RuntimeAnnotationReader.class);
Collection tr = getPropertyValue(properties, JAXBRIContext.TYPE_REFERENCES, Collection.class);
@@ -144,6 +146,7 @@
builder.setSupressAccessorWarnings(supressAccessorWarnings);
builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling);
builder.setDisableSecurityProcessing(disablesecurityProcessing);
+ builder.setBackupWithParentNamespace(backupWithParentNamespace);
return builder.build();
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Code that deals with low level byte code manipulation.
+ */
+package com.sun.xml.internal.bind.v2.bytecode;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-
-
-
-
-
-
- Code that deals with low level byte code manipulation.
-
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Abstraction around reading annotations, to support internal/external annotations.
+ */
+package com.sun.xml.internal.bind.v2.model.annotation;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-
-
-
-
-
- Abstraction around reading annotations, to support internal/external annotations.
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ErrorHandler.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ErrorHandler.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ErrorHandler.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,24 +29,25 @@
/**
* listen to static errors found during building a JAXB model from a set of classes.
- * Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
+ * Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
*
*
* All the static errors have to be reported while constructing a
- * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder#link} completes.
- * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder} wraps an {@link ErrorHandler} and all the model
+ * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} completes.
+ * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} wraps an {@link ErrorHandler} and all the model
* components should report errors through it.
*
*
* {@link IllegalAnnotationException} is a checked exception to remind
* the model classes to report it rather than to throw it.
*
- * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
+ * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI
* @author Kohsuke Kawaguchi
*/
public interface ErrorHandler {
/**
* Receives a notification for an error in the annotated code.
+ * @param e
*/
void error( IllegalAnnotationException e );
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
public final boolean isOrdered;
/**
- * {@link com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
+ * {@code com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
* {@link #ELEMENT}, {@link #REFERENCE}, and {@link #MAP} in this order.
*/
public final int propertyIndex;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,18 +34,22 @@
*
*
* This interface is only meant to be used as a return type from
- * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
+ * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
*
* @author Kohsuke Kawaguchi
+ * @param
+ * @param
*/
public interface RegistryInfo {
/**
* Returns all the references to other types in this registry.
+ * @return
*/
Set> getReferences();
/**
* Returns the class with {@link XmlRegistry}.
+ * @return
*/
C getClazz();
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Implementation of the com.sun.xml.internal.bind.j2s.model package.
+ */
+package com.sun.xml.internal.bind.v2.model.impl;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-Implementation of the com.sun.xml.internal.bind.j2s.model package.
-
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing).
+ */
+package com.sun.xml.internal.bind.v2.model.nav;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-
-
-
-
-
- Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing).
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -242,6 +242,16 @@
private Set xmlNsSet = null;
/**
+ * If true, despite the specification, unmarshall child element with parent namespace, if child namespace is not specified.
+ * The default value is null for System {code}com.sun.xml.internal.bind.backupWithParentNamespace{code} property to be used,
+ * and false is assumed if it's not set either.
+ *
+ * Boolean
+ * @since 2.3.0
+ */
+ public Boolean backupWithParentNamespace = null;
+
+ /**
* Returns declared XmlNs annotations (from package-level annotation XmlSchema
*
* @return set of all present XmlNs annotations
@@ -263,6 +273,7 @@
this.supressAccessorWarnings = builder.supressAccessorWarnings;
this.improvedXsiTypeHandling = builder.improvedXsiTypeHandling;
this.disableSecurityProcessing = builder.disableSecurityProcessing;
+ this.backupWithParentNamespace = builder.backupWithParentNamespace;
Collection typeRefs = builder.typeRefs;
@@ -1024,6 +1035,7 @@
private boolean allNillable;
private boolean improvedXsiTypeHandling = true;
private boolean disableSecurityProcessing = true;
+ private Boolean backupWithParentNamespace = null; // null for System property to be used
public JAXBContextBuilder() {};
@@ -1039,6 +1051,7 @@
this.xmlAccessorFactorySupport = baseImpl.xmlAccessorFactorySupport;
this.allNillable = baseImpl.allNillable;
this.disableSecurityProcessing = baseImpl.disableSecurityProcessing;
+ this.backupWithParentNamespace = baseImpl.backupWithParentNamespace;
}
public JAXBContextBuilder setRetainPropertyInfo(boolean val) {
@@ -1101,6 +1114,11 @@
return this;
}
+ public JAXBContextBuilder setBackupWithParentNamespace(Boolean backupWithParentNamespace) {
+ this.backupWithParentNamespace = backupWithParentNamespace;
+ return this;
+ }
+
public JAXBContextImpl build() throws JAXBException {
// fool-proof
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Code that implements JAXBContext, Unmarshaller, and Marshaller.
+ */
+package com.sun.xml.internal.bind.v2.runtime;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-Code that implements JAXBContext, Unmarshaller, and Marshaller.
-
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
private static final Logger logger = Util.getClassLogger();
- protected static final boolean noOptimize = Runtime.version().major() >= 9 ||
+ protected static final boolean noOptimize =
Util.getSystemProperty(ClassTailor.class.getName()+".noOptimize")!=null;
static {
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,11 @@
import com.sun.xml.internal.bind.Util;
import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
+import java.lang.reflect.Field;
+import java.security.CodeSource;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
/**
* A {@link ClassLoader} used to "inject" optimized accessor classes
@@ -131,7 +136,7 @@
/**
* Injected classes keyed by their names.
*/
- private final Map classes = new HashMap();
+ private final Map classes = new HashMap<>();
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
private final Lock r = rwl.readLock();
private final Lock w = rwl.writeLock();
@@ -141,26 +146,59 @@
* False otherwise, which happens if this classloader can't see {@link Accessor}.
*/
private final boolean loadable;
- private static final Method defineClass;
- private static final Method resolveClass;
- private static final Method findLoadedClass;
+ private static Method defineClass;
+ private static Method resolveClass;
+ private static Method findLoadedClass;
+ private static Object U;
static {
- Method[] m = AccessController.doPrivileged(
- new PrivilegedAction() {
+ try {
+ Method[] m = AccessController.doPrivileged(
+ new PrivilegedAction() {
+ @Override
+ public Method[] run() {
+ return new Method[]{
+ getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
+ getMethod(ClassLoader.class, "resolveClass", Class.class),
+ getMethod(ClassLoader.class, "findLoadedClass", String.class)
+ };
+ }
+ }
+ );
+ defineClass = m[0];
+ resolveClass = m[1];
+ findLoadedClass = m[2];
+ } catch (Throwable t) {
+ try {
+ U = AccessController.doPrivileged(new PrivilegedExceptionAction() {
@Override
- public Method[] run() {
- return new Method[]{
- getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
- getMethod(ClassLoader.class, "resolveClass", Class.class),
- getMethod(ClassLoader.class, "findLoadedClass", String.class)
- };
+ public Object run() throws Exception {
+ Class u = Class.forName("sun.misc.Unsafe");
+ Field theUnsafe = u.getDeclaredField("theUnsafe");
+ theUnsafe.setAccessible(true);
+ return theUnsafe.get(null);
}
- }
- );
- defineClass = m[0];
- resolveClass = m[1];
- findLoadedClass = m[2];
+ });
+ defineClass = AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ @Override
+ public Method run() throws Exception {
+ try {
+ return U.getClass().getMethod("defineClass",
+ new Class[]{String.class,
+ byte[].class,
+ Integer.TYPE,
+ Integer.TYPE,
+ ClassLoader.class,
+ ProtectionDomain.class});
+ } catch (NoSuchMethodException | SecurityException ex) {
+ throw ex;
+ }
+ }
+ });
+ } catch (SecurityException | PrivilegedActionException ex) {
+ Logger.getLogger(Injector.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
}
private static Method getMethod(final Class> c, final String methodname, final Class>... params) {
@@ -210,13 +248,11 @@
rlocked = false;
//find loaded class from classloader
- if (c == null) {
+ if (c == null && findLoadedClass != null) {
try {
c = (Class) findLoadedClass.invoke(parent, className.replace('/', '.'));
- } catch (IllegalArgumentException e) {
- logger.log(Level.FINE, "Unable to find " + className, e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
logger.log(Level.FINE, "Unable to find " + className, e);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
@@ -253,9 +289,13 @@
// we need to inject a class into the
try {
- c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length);
- resolveClass.invoke(parent, c);
- } catch (IllegalAccessException e) {
+ if (resolveClass != null) {
+ c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length);
+ resolveClass.invoke(parent, c);
+ } else {
+ c = (Class) defineClass.invoke(U, className.replace('/', '.'), image, 0, image.length, parent, Injector.class.getProtectionDomain());
+ }
+ } catch (IllegalAccessException e) {
logger.log(Level.FINE, "Unable to inject " + className, e);
return null;
} catch (InvocationTargetException e) {
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+/**
+ * Hosts optimized
+ * {@link com.sun.xml.internal.bind.v2.runtime.reflect.Accessor},
+ * {@link com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor}, and {@link com.sun.xml.internal.bind.v2.runtime.Transducer}.
+ *
+ *
How it works
+ *
+ * Most of the classes in this package are "templates." At run-time, A template class file is slightly modified to match
+ * the target Java Bean, then it will be loaded into the VM.
+ */
+package com.sun.xml.internal.bind.v2.runtime.reflect.opt;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-
-
-
- Most of the classes in this package are "templates." At run-time,
- A template class file is slightly modified to match the target Java Bean,
- then it will be loaded into the VM.
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Abstraction around accessing data of actual objects.
+ */
+package com.sun.xml.internal.bind.v2.runtime.reflect;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-
-
-
-
-
- Abstraction around accessing data of actual objects.
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
import org.w3c.dom.Node;
/**
- * Object that returns the current location that the {@link com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor}
+ * Object that returns the current location that the {@code com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor}
* is parsing.
*
* @author Kohsuke Kawaguchi
@@ -41,6 +41,7 @@
public interface LocatorEx extends Locator {
/**
* Gets the current location in a {@link ValidationEventLocator} object.
+ * @return
*/
ValidationEventLocator getLocation();
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,9 @@
import javax.xml.namespace.QName;
+import com.sun.xml.internal.bind.Util;
import com.sun.xml.internal.bind.api.AccessorException;
+import com.sun.xml.internal.bind.api.JAXBRIContext;
import com.sun.xml.internal.bind.v2.WellKnownNamespace;
import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl;
import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
@@ -231,11 +233,26 @@
@Override
public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException {
ChildLoader child = childUnmarshallers.get(arg.uri,arg.local);
- if (child == null) {
- child = catchAll;
- if (child==null) {
- super.childElement(state,arg);
- return;
+ if(child == null) {
+ Boolean backupWithParentNamespace = ((JAXBContextImpl) state.getContext().getJAXBContext()).backupWithParentNamespace;
+ backupWithParentNamespace = backupWithParentNamespace != null
+ ? backupWithParentNamespace
+ : Boolean.parseBoolean(Util.getSystemProperty(JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE));
+ if ((beanInfo != null) && (beanInfo.getTypeNames() != null) && backupWithParentNamespace) {
+ Iterator> typeNamesIt = beanInfo.getTypeNames().iterator();
+ QName parentQName = null;
+ if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) {
+ parentQName = (QName) typeNamesIt.next();
+ String parentUri = parentQName.getNamespaceURI();
+ child = childUnmarshallers.get(parentUri, arg.local);
+ }
+ }
+ if (child == null) {
+ child = catchAll;
+ if(child==null) {
+ super.childElement(state,arg);
+ return;
+ }
}
}
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package-info.java
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package-info.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package-info.java Mon Mar 13 19:58:33 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,5 +23,8 @@
* questions.
*/
+/**
+ * XML Schema writer generated by TXW.
+ */
@com.sun.xml.internal.txw2.annotation.XmlNamespace("http://www.w3.org/2001/XMLSchema")
package com.sun.xml.internal.bind.v2.schemagen.xmlschema;
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package.html
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package.html Thu Mar 09 21:35:18 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-XML Schema writer generated by TXW.
-
-
diff -r 40f9a2b0c304 -r a26be46f6bac jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java Thu Mar 09 21:35:18 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java Mon Mar 13 19:58:33 2017 +0000
@@ -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
@@ -158,7 +158,7 @@
Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
return newInstance(contextPath, spFactory, classLoader, properties);
} catch (ClassNotFoundException x) {
- throw new JAXBException(Messages.format(Messages.PROVIDER_NOT_FOUND, className), x);
+ throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
} catch (RuntimeException | JAXBException x) {
// avoid wrapping RuntimeException to JAXBException,
@@ -228,7 +228,7 @@
}
}
- private static Object instantiateProviderIfNecessary(Class> implClass) throws JAXBException {
+ private static Object instantiateProviderIfNecessary(final Class> implClass) throws JAXBException {
try {
if (JAXBContextFactory.class.isAssignableFrom(implClass)) {
return AccessController.doPrivileged(new PrivilegedExceptionAction