From d76b89606e1d8a523de4b40e0cbe0f543428bcce Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Mon, 3 Apr 2017 12:34:30 -0700 Subject: [PATCH 01/75] 8177856: [AOT] EliminateRedundantInitializationPhase is not working Looks for constants of a correct type Reviewed-by: kvn --- .../phases/aot/EliminateRedundantInitializationPhase.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java index 46d8be12171..caa04c2c979 100644 --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/aot/EliminateRedundantInitializationPhase.java @@ -28,9 +28,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; -import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant; -import jdk.vm.ci.meta.JavaConstant; - import org.graalvm.compiler.graph.Node; import org.graalvm.compiler.graph.iterators.NodeIterable; import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode; @@ -43,6 +40,9 @@ import org.graalvm.compiler.nodes.cfg.ControlFlowGraph; import org.graalvm.compiler.phases.BasePhase; import org.graalvm.compiler.phases.tiers.PhaseContext; +import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant; +import jdk.vm.ci.meta.Constant; + public class EliminateRedundantInitializationPhase extends BasePhase { /** * Find blocks with class initializing nodes for the class identified the by the constant node. @@ -202,7 +202,7 @@ public class EliminateRedundantInitializationPhase extends BasePhase redundantInits = new ArrayList<>(); for (ConstantNode node : getConstantNodes(graph)) { - JavaConstant constant = node.asJavaConstant(); + Constant constant = node.asConstant(); if (constant instanceof HotSpotMetaspaceConstant) { redundantInits.addAll(processConstantNode(cfg, node)); } From d28f63fb9e34ff0ef25918b61dc89986351da82f Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Mon, 3 Apr 2017 14:58:17 -0700 Subject: [PATCH 02/75] 8177673: [JVMCI] missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail Reviewed-by: never, iveresov --- .../HotSpotConstantReflectionProvider.java | 9 +- .../hotspot/HotSpotMemoryAccessProvider.java | 4 + .../HotSpotMemoryAccessProviderImpl.java | 157 ++++++++++++++---- .../HotSpotResolvedObjectTypeImpl.java | 9 + .../jdk/vm/ci/meta/MemoryAccessProvider.java | 12 +- .../test/MemoryAccessProviderData.java | 134 ++++++++++----- .../test/MemoryAccessProviderTest.java | 33 +++- 7 files changed, 273 insertions(+), 85 deletions(-) diff --git a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java index e74027f2dd1..1256cf02584 100644 --- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java @@ -179,11 +179,14 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv if (hotspotField.isStatic()) { HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass(); if (holder.isInitialized()) { - return memoryAccess.readUnsafeConstant(hotspotField.getJavaKind(), HotSpotObjectConstantImpl.forObject(holder.mirror()), hotspotField.offset()); + return memoryAccess.readFieldValue(hotspotField, holder.mirror()); } } else { - if (receiver.isNonNull() && hotspotField.isInObject(((HotSpotObjectConstantImpl) receiver).object())) { - return memoryAccess.readUnsafeConstant(hotspotField.getJavaKind(), receiver, hotspotField.offset()); + if (receiver.isNonNull()) { + Object object = ((HotSpotObjectConstantImpl) receiver).object(); + if (hotspotField.isInObject(object)) { + return memoryAccess.readFieldValue(hotspotField, object); + } } } return null; diff --git a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java index a4d68b56f19..15250e2c7d1 100644 --- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java @@ -31,6 +31,10 @@ import jdk.vm.ci.meta.MemoryAccessProvider; */ public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider { + /** + * @throws IllegalArgumentException if the address computed from {@code base} and + * {@code displacement} does not denote a location holding a narrow oop + */ JavaConstant readNarrowOopConstant(Constant base, long displacement); Constant readKlassPointerConstant(Constant base, long displacement); diff --git a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java index be8e3a32067..9f262aa71ae 100644 --- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java @@ -22,13 +22,21 @@ */ package jdk.vm.ci.hotspot; +import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset; +import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; +import java.lang.reflect.Array; + +import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MemoryAccessProvider; +import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.PrimitiveConstant; +import jdk.vm.ci.meta.ResolvedJavaField; +import jdk.vm.ci.meta.ResolvedJavaType; /** * HotSpot implementation of {@link MemoryAccessProvider}. @@ -41,12 +49,93 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { this.runtime = runtime; } - private static Object asObject(Constant base) { + /** + * Gets the object boxed by {@code base} that is about to have a value of kind {@code kind} read + * from it at the offset {@code displacement}. + * + * @param base constant value containing the base address for a pending read + * @return {@code null} if {@code base} does not box an object otherwise the object boxed in + * {@code base} + */ + private Object asObject(Constant base, JavaKind kind, long displacement) { if (base instanceof HotSpotObjectConstantImpl) { - return ((HotSpotObjectConstantImpl) base).object(); - } else { - return null; + HotSpotObjectConstantImpl constant = (HotSpotObjectConstantImpl) base; + HotSpotResolvedObjectType type = constant.getType(); + Object object = constant.object(); + checkRead(kind, displacement, type, object); + return object; } + return null; + } + + /** + * Offset of injected {@code java.lang.Class::oop_size} field. No need to make {@code volatile} + * as initialization is idempotent. + */ + private long oopSizeOffset; + + private static int computeOopSizeOffset(HotSpotJVMCIRuntimeProvider runtime) { + MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess(); + ResolvedJavaType staticType = metaAccess.lookupJavaType(Class.class); + for (ResolvedJavaField f : staticType.getInstanceFields(false)) { + if (f.getName().equals("oop_size")) { + int offset = ((HotSpotResolvedJavaField) f).offset(); + assert offset != 0 : "not expecting offset of java.lang.Class::oop_size to be 0"; + return offset; + } + } + throw new JVMCIError("Could not find injected java.lang.Class::oop_size field"); + } + + private boolean checkRead(JavaKind kind, long displacement, HotSpotResolvedObjectType type, Object object) { + if (type.isArray()) { + ResolvedJavaType componentType = type.getComponentType(); + JavaKind componentKind = componentType.getJavaKind(); + final int headerSize = getArrayBaseOffset(componentKind); + int sizeOfElement = getArrayIndexScale(componentKind); + int length = Array.getLength(object); + long arrayEnd = headerSize + (sizeOfElement * length); + boolean aligned = ((displacement - headerSize) % sizeOfElement) == 0; + if (displacement < 0 || displacement > (arrayEnd - sizeOfElement) || (kind == JavaKind.Object && !aligned)) { + int index = (int) ((displacement - headerSize) / sizeOfElement); + throw new AssertionError("Unsafe array access: reading element of kind " + kind + + " at offset " + displacement + " (index ~ " + index + ") in " + + type.toJavaName() + " object of length " + length); + } + } else if (kind != JavaKind.Object) { + long size; + if (object instanceof Class) { + if (oopSizeOffset == 0) { + oopSizeOffset = computeOopSizeOffset(runtime); + } + int wordSize = runtime.getHostJVMCIBackend().getCodeCache().getTarget().wordSize; + size = UNSAFE.getInt(object, oopSizeOffset) * wordSize; + } else { + size = Math.abs(type.instanceSize()); + } + int bytesToRead = kind.getByteCount(); + if (displacement + bytesToRead > size || displacement < 0) { + throw new IllegalArgumentException("Unsafe access: reading " + bytesToRead + " bytes at offset " + displacement + " in " + + type.toJavaName() + " object of size " + size); + } + } else { + ResolvedJavaField field = type.findInstanceFieldWithOffset(displacement, JavaKind.Object); + if (field == null && object instanceof Class) { + // Read of a static field + MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess(); + HotSpotResolvedObjectTypeImpl staticFieldsHolder = (HotSpotResolvedObjectTypeImpl) metaAccess.lookupJavaType((Class) object); + field = staticFieldsHolder.findStaticFieldWithOffset(displacement, JavaKind.Object); + } + if (field == null) { + throw new IllegalArgumentException("Unsafe object access: field not found for read of kind Object" + + " at offset " + displacement + " in " + type.toJavaName() + " object"); + } + if (field.getJavaKind() != JavaKind.Object) { + throw new IllegalArgumentException("Unsafe object access: field " + field.format("%H.%n:%T") + " not of expected kind Object" + + " at offset " + displacement + " in " + type.toJavaName() + " object"); + } + } + return true; } private boolean isValidObjectFieldDisplacement(Constant base, long displacement) { @@ -77,8 +166,8 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { throw new IllegalArgumentException(String.valueOf(base)); } - private static long readRawValue(Constant baseConstant, long displacement, int bits) { - Object base = asObject(baseConstant); + private long readRawValue(Constant baseConstant, long displacement, JavaKind kind, int bits) { + Object base = asObject(baseConstant, kind, displacement); if (base != null) { switch (bits) { case Byte.SIZE: @@ -123,9 +212,8 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { private Object readRawObject(Constant baseConstant, long initialDisplacement, boolean compressed) { long displacement = initialDisplacement; - Object ret; - Object base = asObject(baseConstant); + Object base = asObject(baseConstant, JavaKind.Object, displacement); if (base == null) { assert !compressed; displacement += asRawPointer(baseConstant); @@ -138,34 +226,43 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { return ret; } - /** - * Reads a value of this kind using a base address and a displacement. No bounds checking or - * type checking is performed. Returns {@code null} if the value is not available at this point. - * - * @param baseConstant the base address from which the value is read. - * @param displacement the displacement within the object in bytes - * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the - * value cannot be read. - * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not - * {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind - */ - JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) { - if (kind == null) { - throw new IllegalArgumentException("null JavaKind"); - } - if (kind == JavaKind.Object) { - Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops); + JavaConstant readFieldValue(HotSpotResolvedJavaField field, Object obj) { + assert obj != null; + assert !field.isStatic() || obj instanceof Class; + long displacement = field.offset(); + assert checkRead(field.getJavaKind(), displacement, (HotSpotResolvedObjectType) runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(obj.getClass()), obj); + if (field.getJavaKind() == JavaKind.Object) { + Object o = UNSAFE.getObject(obj, displacement); return HotSpotObjectConstantImpl.forObject(o); } else { - int bits = kind.getByteCount() * Byte.SIZE; - return readPrimitiveConstant(kind, baseConstant, displacement, bits); + JavaKind kind = field.getJavaKind(); + switch (kind) { + case Boolean: + return JavaConstant.forBoolean(UNSAFE.getBoolean(obj, displacement)); + case Byte: + return JavaConstant.forByte(UNSAFE.getByte(obj, displacement)); + case Char: + return JavaConstant.forChar(UNSAFE.getChar(obj, displacement)); + case Short: + return JavaConstant.forShort(UNSAFE.getShort(obj, displacement)); + case Int: + return JavaConstant.forInt(UNSAFE.getInt(obj, displacement)); + case Long: + return JavaConstant.forLong(UNSAFE.getLong(obj, displacement)); + case Float: + return JavaConstant.forFloat(UNSAFE.getFloat(obj, displacement)); + case Double: + return JavaConstant.forDouble(UNSAFE.getDouble(obj, displacement)); + default: + throw new IllegalArgumentException("Unsupported kind: " + kind); + } } } @Override public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) { try { - long rawValue = readRawValue(baseConstant, initialDisplacement, bits); + long rawValue = readRawValue(baseConstant, initialDisplacement, kind, bits); switch (kind) { case Boolean: return JavaConstant.forBoolean(rawValue != 0); @@ -193,6 +290,10 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider { @Override public JavaConstant readObjectConstant(Constant base, long displacement) { + if (base instanceof HotSpotObjectConstantImpl) { + Object o = readRawObject(base, displacement, runtime.getConfig().useCompressedOops); + return HotSpotObjectConstantImpl.forObject(o); + } if (!isValidObjectFieldDisplacement(base, displacement)) { return null; } diff --git a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java index 88974c3b415..8d969a45918 100644 --- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @@ -847,6 +847,15 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem @Override public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedEntryKind) { ResolvedJavaField[] declaredFields = getInstanceFields(true); + return findFieldWithOffset(offset, expectedEntryKind, declaredFields); + } + + public ResolvedJavaField findStaticFieldWithOffset(long offset, JavaKind expectedEntryKind) { + ResolvedJavaField[] declaredFields = getStaticFields(); + return findFieldWithOffset(offset, expectedEntryKind, declaredFields); + } + + private static ResolvedJavaField findFieldWithOffset(long offset, JavaKind expectedEntryKind, ResolvedJavaField[] declaredFields) { for (ResolvedJavaField field : declaredFields) { HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field; long resolvedFieldOffset = resolvedField.offset(); diff --git a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java index 81c5f395549..9eba9d0f8ac 100644 --- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java @@ -35,9 +35,9 @@ public interface MemoryAccessProvider { * @param displacement the displacement within the object in bytes * @param bits the number of bits to read from memory * @return the read value encapsulated in a {@link JavaConstant} object of {@link JavaKind} kind - * @throws IllegalArgumentException if {@code kind} is {@link JavaKind#Void} or not - * {@linkplain JavaKind#isPrimitive() primitive} kind or {@code bits} is not 8, 16, - * 32 or 64 + * @throws IllegalArgumentException if the read is out of bounds of the object or {@code kind} + * is {@link JavaKind#Void} or not {@linkplain JavaKind#isPrimitive() primitive} + * kind or {@code bits} is not 8, 16, 32 or 64 */ JavaConstant readPrimitiveConstant(JavaKind kind, Constant base, long displacement, int bits) throws IllegalArgumentException; @@ -46,9 +46,9 @@ public interface MemoryAccessProvider { * * @param base the base address from which the value is read * @param displacement the displacement within the object in bytes - * @return the read value encapsulated in a {@link Constant} object or {@code null} if the - * address computed from {@code base} and {@code displacement} does not denote a - * location holding an {@code Object} value + * @return the read value encapsulated in a {@link Constant} object + * @throws IllegalArgumentException if the address computed from {@code base} and + * {@code displacement} does not denote a location holding an {@code Object} value */ JavaConstant readObjectConstant(Constant base, long displacement); } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java index fcbc721caa8..1122bd7eb5d 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java @@ -27,6 +27,7 @@ import java.lang.reflect.Field; import org.testng.annotations.DataProvider; +import sun.hotspot.WhiteBox; import jdk.internal.misc.Unsafe; import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; @@ -36,6 +37,10 @@ import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.runtime.JVMCI; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; public class MemoryAccessProviderData { private static final Unsafe UNSAFE = Unsafe.getUnsafe(); @@ -43,6 +48,18 @@ public class MemoryAccessProviderData { private static final TestClass TEST_OBJECT = new TestClass(); private static final JavaConstant TEST_CONSTANT = CONSTANT_REFLECTION.forObject(TEST_OBJECT); private static final JavaConstant TEST_CLASS_CONSTANT = CONSTANT_REFLECTION.forObject(TestClass.class); + private static KindData[] PRIMITIVE_KIND_DATA = { + new KindData(JavaKind.Boolean, TEST_OBJECT), + new KindData(JavaKind.Byte, TEST_OBJECT), + new KindData(JavaKind.Char, TEST_OBJECT), + new KindData(JavaKind.Short, TEST_OBJECT), + new KindData(JavaKind.Int, TEST_OBJECT), + new KindData(JavaKind.Float, TEST_OBJECT), + new KindData(JavaKind.Long, TEST_OBJECT), + new KindData(JavaKind.Double, TEST_OBJECT) + }; + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + @DataProvider(name = "positiveObject") public static Object[][] getPositiveObjectJavaKind() { @@ -54,51 +71,40 @@ public class MemoryAccessProviderData { @DataProvider(name = "positivePrimitive") public static Object[][] getPositivePrimitiveJavaKinds() { - Field booleanField; - Field byteField; - Field shortField; - Field intField; - Field longField; - Field floatField; - Field doubleField; - Field charField; - try { - booleanField = MemoryAccessProviderData.TestClass.class.getDeclaredField("booleanField"); - byteField = MemoryAccessProviderData.TestClass.class.getDeclaredField("byteField"); - shortField = MemoryAccessProviderData.TestClass.class.getDeclaredField("shortField"); - intField = MemoryAccessProviderData.TestClass.class.getDeclaredField("intField"); - longField = MemoryAccessProviderData.TestClass.class.getDeclaredField("longField"); - floatField = MemoryAccessProviderData.TestClass.class.getDeclaredField("floatField"); - doubleField = MemoryAccessProviderData.TestClass.class.getDeclaredField("doubleField"); - charField = MemoryAccessProviderData.TestClass.class.getDeclaredField("charField"); - } catch (NoSuchFieldException e) { - throw new Error("TESTBUG: can't find test field " + e, e); + List result = new ArrayList<>(); + for (KindData k : PRIMITIVE_KIND_DATA) { + result.add(new Object[] {k.kind, TEST_CONSTANT, k.instanceFieldOffset, k.instanceFieldValue, Math.max(8, k.kind.getBitCount())}); + result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, k.staticFieldOffset, k.staticFieldValue, Math.max(8, k.kind.getBitCount())}); } - long booleanFieldOffset = UNSAFE.objectFieldOffset(booleanField); - long byteFieldOffset = UNSAFE.objectFieldOffset(byteField); - long shortFieldOffset = UNSAFE.objectFieldOffset(shortField); - long intFieldOffset = UNSAFE.objectFieldOffset(intField); - long longFieldOffset = UNSAFE.objectFieldOffset(longField); - long floatFieldOffset = UNSAFE.objectFieldOffset(floatField); - long doubleFieldOffset = UNSAFE.objectFieldOffset(doubleField); - long charFieldOffset = UNSAFE.objectFieldOffset(charField); - return new Object[][]{ - new Object[]{JavaKind.Boolean, TEST_CONSTANT, booleanFieldOffset, - JavaConstant.forBoolean(TEST_OBJECT.booleanField), 8}, - new Object[]{JavaKind.Byte, TEST_CONSTANT, byteFieldOffset, - JavaConstant.forByte(TEST_OBJECT.byteField), 8}, - new Object[]{JavaKind.Short, TEST_CONSTANT, shortFieldOffset, - JavaConstant.forShort(TEST_OBJECT.shortField), 16}, - new Object[]{JavaKind.Int, TEST_CONSTANT, intFieldOffset, - JavaConstant.forInt(TEST_OBJECT.intField), 32}, - new Object[]{JavaKind.Long, TEST_CONSTANT, longFieldOffset, - JavaConstant.forLong(TEST_OBJECT.longField), 64}, - new Object[]{JavaKind.Float, TEST_CONSTANT, floatFieldOffset, - JavaConstant.forFloat(TEST_OBJECT.floatField), 32}, - new Object[]{JavaKind.Double, TEST_CONSTANT, doubleFieldOffset, - JavaConstant.forDouble(TEST_OBJECT.doubleField), 64}, - new Object[]{JavaKind.Char, TEST_CONSTANT, charFieldOffset, - JavaConstant.forChar(TEST_OBJECT.charField), 16}}; + return result.toArray(new Object[result.size()][]); + } + + @DataProvider(name = "outOfBoundsInstanceFields") + public static Object[][] getOutOfBoundsStaticFieldReads() { + long instanceSize = WHITE_BOX.getObjectSize(TEST_OBJECT); + List result = new ArrayList<>(); + for (KindData k : PRIMITIVE_KIND_DATA) { + long lastValidOffset = instanceSize - (k.kind.getByteCount()); + result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset, false}); + result.add(new Object[] {k.kind, TEST_CONSTANT, (long) -1, true}); + result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset + 1, true}); + result.add(new Object[] {k.kind, TEST_CONSTANT, lastValidOffset + 100, true}); + } + return result.toArray(new Object[result.size()][]); + } + + @DataProvider(name = "outOfBoundsStaticFields") + public static Object[][] getOutOfBoundsInstanceFieldReads() { + long staticsSize = WHITE_BOX.getObjectSize(TEST_OBJECT.getClass()); + List result = new ArrayList<>(); + for (KindData k : PRIMITIVE_KIND_DATA) { + long lastValidOffset = staticsSize - (k.kind.getByteCount()); + result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset, false}); + result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, (long) -1, true}); + result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset + 1, true}); + result.add(new Object[] {k.kind, TEST_CLASS_CONSTANT, lastValidOffset + 100, true}); + } + return result.toArray(new Object[result.size()][]); } @DataProvider(name = "negative") @@ -108,6 +114,7 @@ public class MemoryAccessProviderData { new Object[]{JavaKind.Illegal, JavaConstant.INT_1}}; } + private static class TestClass { public final boolean booleanField = true; public final byte byteField = 2; @@ -117,6 +124,43 @@ public class MemoryAccessProviderData { public final double doubleField = 6.0d; public final float floatField = 7.0f; public final char charField = 'a'; - public final String stringField = "abc"; + public final String objectField = "abc"; + + public static final boolean booleanStaticField = true; + public static final byte byteStaticField = 2; + public static final short shortStaticField = 3; + public static final int intStaticField = 4; + public static final long longStaticField = 5L; + public static final double doubleStaticField = 6.0d; + public static final float floatStaticField = 7.0f; + public static final char charStaticField = 'a'; + public static final String objectStaticField = "abc"; + } + + + static class KindData { + final JavaKind kind; + final Field instanceField; + final Field staticField; + final long instanceFieldOffset; + final long staticFieldOffset; + final JavaConstant instanceFieldValue; + final JavaConstant staticFieldValue; + KindData(JavaKind kind, Object testObject) { + this.kind = kind; + try { + Class c = testObject.getClass(); + instanceField = c.getDeclaredField(kind.getJavaName() + "Field"); + staticField = c.getDeclaredField(kind.getJavaName() + "StaticField"); + instanceField.setAccessible(true); + staticField.setAccessible(true); + instanceFieldOffset = UNSAFE.objectFieldOffset(instanceField); + staticFieldOffset = UNSAFE.staticFieldOffset(staticField); + instanceFieldValue = JavaConstant.forBoxedPrimitive(instanceField.get(testObject)); + staticFieldValue = JavaConstant.forBoxedPrimitive(staticField.get(null)); + } catch (Exception e) { + throw new Error("TESTBUG for kind " + kind, e); + } + } } } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java index 4381c2264c3..783294da7d9 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java @@ -31,12 +31,19 @@ * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.hotspot * java.base/jdk.internal.misc - * @run testng/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run testng/othervm -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * jdk.vm.ci.hotspot.test.MemoryAccessProviderTest */ package jdk.vm.ci.hotspot.test; +import sun.hotspot.WhiteBox; + import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MemoryAccessProvider; @@ -59,7 +66,27 @@ public class MemoryAccessProviderTest { @Test(dataProvider = "negative", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class}) public void testNegativeReadPrimitiveConstant(JavaKind kind, Constant base) { - PROVIDER.readPrimitiveConstant(kind, base, 0L, kind == null ? 0 : kind.getBitCount()); + PROVIDER.readPrimitiveConstant(kind, base, 0L, kind == null ? 0 : kind.getByteCount() / 8); + } + + @Test(dataProvider = "outOfBoundsInstanceFields", dataProviderClass = MemoryAccessProviderData.class) + public void testReadPrimitiveInstanceFieldOutOfBounds(JavaKind kind, Constant base, Long offset, boolean isOutOfBounds) { + try { + PROVIDER.readPrimitiveConstant(kind, base, offset, kind.getByteCount() * 8); + Assert.assertFalse(isOutOfBounds); + } catch (IllegalArgumentException iae) { + Assert.assertTrue(isOutOfBounds); + } + } + + @Test(dataProvider = "outOfBoundsStaticFields", dataProviderClass = MemoryAccessProviderData.class) + public void testReadPrimitiveStaticFieldOutOFBounds(JavaKind kind, Constant base, Long offset, boolean isOutOfBounds) { + try { + PROVIDER.readPrimitiveConstant(kind, base, offset, kind.getByteCount() * 8); + Assert.assertFalse(isOutOfBounds); + } catch (IllegalArgumentException iae) { + Assert.assertTrue(isOutOfBounds); + } } @Test(dataProvider = "positiveObject", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class}) @@ -87,7 +114,7 @@ public class MemoryAccessProviderTest { Assert.assertNull(PROVIDER.readObjectConstant(base, offset + 1), "Expected null"); } - @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class) + @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class}) public void testNegativeReadObjectConstantPrimitiveBase(JavaKind kind, Constant base, Long offset, Object expected, int bitsCount) { Assert.assertNull(PROVIDER.readObjectConstant(base, offset), "Expected null"); } From 1fb49ba49f63060cbdca3c71eeb6b86813f5babd Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Mon, 3 Apr 2017 16:40:49 -0700 Subject: [PATCH 03/75] 8177526: BufferedReader readLine() javadoc does not match the implementation regarding EOF Improve the verbiage of the method and return value descriptions Reviewed-by: lancea, smarks --- .../share/classes/java/io/BufferedReader.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/io/BufferedReader.java b/jdk/src/java.base/share/classes/java/io/BufferedReader.java index 1f6a66490cd..8cb4f73e597 100644 --- a/jdk/src/java.base/share/classes/java/io/BufferedReader.java +++ b/jdk/src/java.base/share/classes/java/io/BufferedReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -297,14 +297,15 @@ public class BufferedReader extends Reader { /** * Reads a line of text. A line is considered to be terminated by any one - * of a line feed ('\n'), a carriage return ('\r'), or a carriage return - * followed immediately by a linefeed. + * of a line feed ('\n'), a carriage return ('\r'), a carriage return + * followed immediately by a line feed, or by reaching the end-of-file + * (EOF). * * @param ignoreLF If true, the next '\n' will be skipped * * @return A String containing the contents of the line, not including * any line-termination characters, or null if the end of the - * stream has been reached + * stream has been reached without reading any characters * * @see java.io.LineNumberReader#readLine() * @@ -375,12 +376,13 @@ public class BufferedReader extends Reader { /** * Reads a line of text. A line is considered to be terminated by any one - * of a line feed ('\n'), a carriage return ('\r'), or a carriage return - * followed immediately by a linefeed. + * of a line feed ('\n'), a carriage return ('\r'), a carriage return + * followed immediately by a line feed, or by reaching the end-of-file + * (EOF). * * @return A String containing the contents of the line, not including * any line-termination characters, or null if the end of the - * stream has been reached + * stream has been reached without reading any characters * * @exception IOException If an I/O error occurs * From 32f7e3afd62487b92541c993f12792264270d5fe Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 3 Apr 2017 17:07:27 -0700 Subject: [PATCH 04/75] 8177507: line number sensitive tests for jdi should be unified Reviewed-by: dholmes, mseledtsov, sspitsyn --- jdk/test/com/sun/jdi/ArgumentValuesTest.java | 67 ++++++++---- jdk/test/com/sun/jdi/BreakpointTest.java | 24 ++--- jdk/test/com/sun/jdi/FetchLocals.java | 45 ++++++-- jdk/test/com/sun/jdi/GetLocalVariables.java | 46 ++++++-- jdk/test/com/sun/jdi/GetSetLocalTest.java | 48 +++++++-- .../com/sun/jdi/LambdaBreakpointTest.java | 53 ++++++---- .../com/sun/jdi/LineNumberOnBraceTest.java | 71 ++++++++----- jdk/test/com/sun/jdi/PopAndStepTest.java | 100 ++++++++++++------ 8 files changed, 312 insertions(+), 142 deletions(-) diff --git a/jdk/test/com/sun/jdi/ArgumentValuesTest.java b/jdk/test/com/sun/jdi/ArgumentValuesTest.java index 13c6b2a48fb..bcce51bc562 100644 --- a/jdk/test/com/sun/jdi/ArgumentValuesTest.java +++ b/jdk/test/com/sun/jdi/ArgumentValuesTest.java @@ -1,13 +1,38 @@ -/** hard coded linenumbers in other tests - DO NOT CHANGE - * @test/nodynamiccopyright/ - * @bug 4490824 - * @summary JDI: provide arguments when no debug attributes present +/* + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * @author jjh + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. * - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile ArgumentValuesTest.java - * @run driver ArgumentValuesTest + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * @test + * @bug 4490824 + * @summary JDI: provide arguments when no debug attributes present + * + * @author jjh + * + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile ArgumentValuesTest.java + * @run driver ArgumentValuesTest */ import com.sun.jdi.*; import com.sun.jdi.event.*; @@ -35,26 +60,26 @@ class ArgumentValuesTarg { static List intList; public static void noArgs() { - int index = 0; // line 38 + int index = 0; // line NO_ARGS_LINE_1 } public static void allArgs(char p_char, byte p_byte, short p_short, int p_int, long p_long, float p_float, double p_double, int p_iarray[], int p_marray[][], String p_sarray1[], String p_string) { - int index = 0; // line 45 + int index = 0; // line ALL_ARGS_LINE_1 } public static void varArgs(String ... p1) { - int index = 0; // line 49 + int index = 0; // line VAR_ARGS_LINE_1 } public static void genericArgs(List p1) { - int index = 0; // line 53 + int index = 0; // line GENERIC_ARGS_LINE_1 } public void instanceMethod(char p_char, byte p_byte) { - int index = 0; // line 57 + int index = 0; // line INSTANCE_METHOD_LINE_1 } public static void main(String[] args) { @@ -81,6 +106,12 @@ class ArgumentValuesTarg { /********** test program **********/ public class ArgumentValuesTest extends TestScaffold { + static final int NO_ARGS_LINE_1 = 63; + static final int ALL_ARGS_LINE_1 = 70; + static final int VAR_ARGS_LINE_1 = 74; + static final int GENERIC_ARGS_LINE_1 = 78; + static final int INSTANCE_METHOD_LINE_1 = 82; + // Must be in same order as args to allArgs(....) String fieldNames[] = {"s_char1", "s_byte1", "s_short1", "s_int1", "s_long1", "s_float1", "s_double1", "s_iarray1", @@ -118,7 +149,7 @@ public class ArgumentValuesTest extends TestScaffold { { System.out.println("----- Testing each type of arg"); - bpe = resumeTo("ArgumentValuesTarg", 45); + bpe = resumeTo("ArgumentValuesTarg", ALL_ARGS_LINE_1); StackFrame frame = bpe.thread().frame(0); Method mmm = frame.location().method(); @@ -147,7 +178,7 @@ public class ArgumentValuesTest extends TestScaffold { // a method with no params { System.out.println("----- Testing no args"); - bpe = resumeTo("ArgumentValuesTarg", 38); + bpe = resumeTo("ArgumentValuesTarg", NO_ARGS_LINE_1); StackFrame frame = bpe.thread().frame(0); Method mmm = frame.location().method(); @@ -165,7 +196,7 @@ public class ArgumentValuesTest extends TestScaffold { // as a String[3] in the method. { System.out.println("----- Testing var args"); - bpe = resumeTo("ArgumentValuesTarg", 49); + bpe = resumeTo("ArgumentValuesTarg", VAR_ARGS_LINE_1); StackFrame frame = bpe.thread().frame(0); Method mmm = frame.location().method(); @@ -199,7 +230,7 @@ public class ArgumentValuesTest extends TestScaffold { // a method with with one generic param { System.out.println("----- Testing generic args"); - bpe = resumeTo("ArgumentValuesTarg", 53); + bpe = resumeTo("ArgumentValuesTarg", GENERIC_ARGS_LINE_1); StackFrame frame = bpe.thread().frame(0); Method mmm = frame.location().method(); @@ -224,7 +255,7 @@ public class ArgumentValuesTest extends TestScaffold { // test instance method call { System.out.println("----- Testing instance method call"); - bpe = resumeTo("ArgumentValuesTarg", 57); + bpe = resumeTo("ArgumentValuesTarg", INSTANCE_METHOD_LINE_1); StackFrame frame = bpe.thread().frame(0); Method mmm = frame.location().method(); diff --git a/jdk/test/com/sun/jdi/BreakpointTest.java b/jdk/test/com/sun/jdi/BreakpointTest.java index 1266f0a274b..9012c1c2033 100644 --- a/jdk/test/com/sun/jdi/BreakpointTest.java +++ b/jdk/test/com/sun/jdi/BreakpointTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,19 +21,20 @@ * questions. */ +// THIS TEST IS LINE NUMBER SENSITIVE + /** - * @test - * @bug 6496524 - * @summary Setting breakpoint in jdb crashes Hotspot JVM + * @test + * @bug 6496524 + * @key intermittent + * @summary Setting breakpoint in jdb crashes Hotspot JVM + * @author jjh * - * @author jjh - * - * @key intermittent - * @modules jdk.jdi - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile -g BreakpointTest.java - * @run driver BreakpointTest + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g BreakpointTest.java + * @run driver BreakpointTest */ + import com.sun.jdi.*; import com.sun.jdi.event.*; import com.sun.jdi.request.*; @@ -47,7 +48,6 @@ import java.util.*; class BreakpointTarg { public final static int BKPT_LINE = 56; - // LINE NUMBER SENSITIVE public static long count; static void doit() { diff --git a/jdk/test/com/sun/jdi/FetchLocals.java b/jdk/test/com/sun/jdi/FetchLocals.java index 67d865d9c32..1195a8db14d 100644 --- a/jdk/test/com/sun/jdi/FetchLocals.java +++ b/jdk/test/com/sun/jdi/FetchLocals.java @@ -1,13 +1,37 @@ -/** hard coded linenumbers in test - DO NOT CHANGE - * @test/nodynamiccopyright/ - * @bug 4386002 4429245 - * @summary Test fix for: Incorrect values reported for some locals of type long +/* + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * @author Tim Bell + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. * - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile -g FetchLocals.java - * @run driver FetchLocals + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * @test + * @bug 4386002 4429245 + * @summary Test fix for: Incorrect values reported for some locals of type long + * @author Tim Bell + * + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g FetchLocals.java + * @run driver FetchLocals */ import com.sun.jdi.*; import com.sun.jdi.event.*; @@ -59,7 +83,7 @@ class FetchLocalsDebugee { System.out.println(f); System.out.print("d is: "); System.out.println(d); - System.out.println(); // Thie is Line 63... + System.out.println(); // This is FetchLocals::LINE if (w == 0xde00ad00be00ef00L) { System.out.print ("The debugger was here. w modified to: 0x"); System.out.println(Long.toHexString(w)); @@ -87,6 +111,7 @@ class FetchLocalsDebugee { } public class FetchLocals extends TestScaffold { + static final int LINE = 86; FetchLocals (String args[]) { super(args); @@ -355,7 +380,7 @@ public class FetchLocals extends TestScaffold { * Get to the bottom of testMethod(): */ try { - BreakpointEvent bpe = resumeTo("FetchLocalsDebugee", 63); + BreakpointEvent bpe = resumeTo("FetchLocalsDebugee", LINE); /* * Fetch values from fields; what did we get? */ diff --git a/jdk/test/com/sun/jdi/GetLocalVariables.java b/jdk/test/com/sun/jdi/GetLocalVariables.java index bc21ffde62d..866048f92f0 100644 --- a/jdk/test/com/sun/jdi/GetLocalVariables.java +++ b/jdk/test/com/sun/jdi/GetLocalVariables.java @@ -1,14 +1,39 @@ -/** hard coded linenumbers in this test - DO NOT CHANGE - * @test/nodynamiccopyright/ - * @bug 4359312 4450091 - * @summary Test PTR 1421 JVM exceptions making a call to LocalVariable.type().name() +/* + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * @author Tim Bell (based on the PTR 1421 report submitted by IBM). + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. * - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile -g GetLocalVariables.java - * @run driver GetLocalVariables + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * @test + * @bug 4359312 4450091 + * @summary Test PTR 1421 JVM exceptions making a call to LocalVariable.type().name() + * @author Tim Bell (based on the PTR 1421 report submitted by IBM). + * + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g GetLocalVariables.java + * @run driver GetLocalVariables + */ + import com.sun.jdi.*; import com.sun.jdi.event.*; import com.sun.jdi.request.*; @@ -194,7 +219,7 @@ class GetLocalVariablesTarg { l_long, l_float, l_double, l_iarray, l_marray, l_string); - e1.test_1(); // <-- this is line 197 + e1.test_1(); // RESUME_TO_LINE e3.test_1(); e4.test_1(); e5.test_1(); @@ -231,6 +256,7 @@ class GetLocalVariablesTarg { /********** test program **********/ public class GetLocalVariables extends TestScaffold { + static final int RESUME_TO_LINE = 222; ReferenceType targetClass; ThreadReference mainThread; @@ -257,7 +283,7 @@ public class GetLocalVariables extends TestScaffold { mainThread = bpe.thread(); EventRequestManager erm = vm().eventRequestManager(); - bpe = resumeTo("GetLocalVariablesTarg", 197); + bpe = resumeTo("GetLocalVariablesTarg", RESUME_TO_LINE); /* * We've arrived. Look around at some variables. */ diff --git a/jdk/test/com/sun/jdi/GetSetLocalTest.java b/jdk/test/com/sun/jdi/GetSetLocalTest.java index deaa0b4ac80..e4420e94af2 100644 --- a/jdk/test/com/sun/jdi/GetSetLocalTest.java +++ b/jdk/test/com/sun/jdi/GetSetLocalTest.java @@ -1,13 +1,37 @@ -/** hard coded linenumbers in other tests - DO NOT CHANGE - * @test/nodynamiccopyright/ - * @bug 4300412 - * @summary Test GetLocal* and SetLocal* functions +/* + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * @author Serguei Spitsyn + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. * - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile -g GetSetLocalTest.java - * @run driver GetSetLocalTest + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// THIS TEST IS LINE NUMBER SENSITIVE + +/** + * @test + * @bug 4300412 + * @summary Test GetLocal* and SetLocal* functions + * @author Serguei Spitsyn + * + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g GetSetLocalTest.java + * @run driver GetSetLocalTest */ import com.sun.jdi.*; import com.sun.jdi.event.*; @@ -35,7 +59,7 @@ class GetSetLocalTarg { int result; { { boolean bool_1 = false; - intArg++; + intArg++; // START_LINE } boolean bool_2 = true; @@ -111,7 +135,7 @@ class GetSetLocalTarg { } Object obj_2 = new Object(); - intArg++; // <-- Last stop is at this point. + intArg++; // STOP_LINE. Last stop is at this point. // Only obj_2 and intArg are valid // Note: even result is not valid here! } @@ -125,6 +149,8 @@ class GetSetLocalTarg { /********** test program **********/ public class GetSetLocalTest extends TestScaffold { + static final int START_LINE = 62; + static final int STOP_LINE = 138; ReferenceType targetClass; ThreadReference mainThread; @@ -635,7 +661,7 @@ public class GetSetLocalTest extends TestScaffold { println("EventRequestManager"); StackFrame frame = null; - for (int line = 38; line < 118; line += 4) { + for (int line = START_LINE; line <= STOP_LINE; line += 4) { println("\n resumeTo(GetSetLocalTarg, " + line + ")"); bpe = resumeTo("GetSetLocalTarg", line); frame = bpe.thread().frame(0); diff --git a/jdk/test/com/sun/jdi/LambdaBreakpointTest.java b/jdk/test/com/sun/jdi/LambdaBreakpointTest.java index 2423b737e47..c0a31bead1b 100644 --- a/jdk/test/com/sun/jdi/LambdaBreakpointTest.java +++ b/jdk/test/com/sun/jdi/LambdaBreakpointTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,19 +21,18 @@ * questions. */ -/********** LINE NUMBER SENSITIVE! *****************************************************************/ +// THIS TEST IS LINE NUMBER SENSITIVE /** - * @test - * @summary Test setting breakpoints on lambda calls + * @test + * @summary Test setting breakpoints on lambda calls + * @author Staffan Larsen * - * @author Staffan Larsen - * - * @modules jdk.jdi - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile -g LambdaBreakpointTest.java - * @run driver LambdaBreakpointTest + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g LambdaBreakpointTest.java + * @run driver LambdaBreakpointTest */ + import java.util.List; import com.sun.jdi.LocalVariable; @@ -50,22 +49,17 @@ import com.sun.jdi.event.StepEvent; /********** target program **********/ class LambdaBreakpointTestTarg { - - static int[] breakpointLines = { - 63, 67, 64, 65, 66, 68 - }; - public static void main(String[] args) { test(); } private static void test() { - Runnable r = () -> { // B1: L62 - String from = "lambda"; // B3: L63 - System.out.println("Hello from " + from); // B4: L64 - }; // B5: L65 - r.run(); // B2: L66 - System.out.println("Goodbye."); // B6: L67 + Runnable r = () -> { // LambdaBreakpointTest::TEST_LINE_1, BKPT_LINES[0] + String from = "lambda"; // LambdaBreakpointTest::TEST_LINE_2, BKPT_LINES[2] + System.out.println("Hello from " + from); // LambdaBreakpointTest::TEST_LINE_3, BKPT_LINES[3] + }; // LambdaBreakpointTest::TEST_LINE_4, BKPT_LINES[4] + r.run(); // LambdaBreakpointTest::TEST_LINE_5, BKPT_LINES[1] + System.out.println("Goodbye."); // LambdaBreakpointTest::TEST_LINE_6, BKPT_LINES[5] } } @@ -73,6 +67,21 @@ class LambdaBreakpointTestTarg { /********** test program **********/ public class LambdaBreakpointTest extends TestScaffold { + private static final int TEST_LINE_1 = 57; + private static final int TEST_LINE_2 = TEST_LINE_1 + 1; + private static final int TEST_LINE_3 = TEST_LINE_1 + 2; + private static final int TEST_LINE_4 = TEST_LINE_1 + 3; + private static final int TEST_LINE_5 = TEST_LINE_1 + 4; + private static final int TEST_LINE_6 = TEST_LINE_1 + 5; + + private static final int[] BKPT_LINES = { + TEST_LINE_1, + TEST_LINE_5, + TEST_LINE_2, + TEST_LINE_3, + TEST_LINE_4, + TEST_LINE_6, + }; LambdaBreakpointTest (String args[]) { super(args); @@ -92,7 +101,7 @@ public class LambdaBreakpointTest extends TestScaffold { startToMain("LambdaBreakpointTestTarg"); // Put a breakpoint on each location in the order they should happen - for (int line : LambdaBreakpointTestTarg.breakpointLines) { + for (int line : BKPT_LINES) { System.out.println("Running to line: " + line); BreakpointEvent be = resumeTo("LambdaBreakpointTestTarg", line); int stoppedAt = be.location().lineNumber(); diff --git a/jdk/test/com/sun/jdi/LineNumberOnBraceTest.java b/jdk/test/com/sun/jdi/LineNumberOnBraceTest.java index 49b558c76cd..413ea98270f 100644 --- a/jdk/test/com/sun/jdi/LineNumberOnBraceTest.java +++ b/jdk/test/com/sun/jdi/LineNumberOnBraceTest.java @@ -1,13 +1,37 @@ +/* + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// THIS TEST IS LINE NUMBER SENSITIVE + /** - * @test/nodynamiccopyright/ - * @bug 4952629 4870514 - * @summary REGRESSION: javac generates a spurious line number entry on } else { + * @test + * @bug 4952629 4870514 + * @summary REGRESSION: javac generates a spurious line number entry on } else { + * @author jjh * - * @author jjh - * - * @run build VMConnection TargetListener TargetAdapter - * @run compile -g LineNumberOnBraceTest.java - * @run driver LineNumberOnBraceTest + * @run build VMConnection TargetListener TargetAdapter + * @run compile -g LineNumberOnBraceTest.java + * @run driver LineNumberOnBraceTest */ import com.sun.jdi.*; import com.sun.jdi.event.*; @@ -15,29 +39,27 @@ import com.sun.jdi.request.*; import java.util.*; - /********** LINE NUMBER SENSITIVE! *****************************************************************/ class LineNumberOnBraceTarg { - public final static int stopLine = 29; // THIS MUST BE THE LINE NUMBER OF THE // stopline LINE - public final static int stopLine2 = 35; // THIS MUST BE THE LINE NUMBER OF THE // stopline2 LINE - + public final static int STOP_LINE = 50; // THIS MUST BE THE LINE NUMBER OF // STOP_LINE LINE + public final static int STOP_LINE_2 = 56; // THIS MUST BE THE LINE NUMBER OF // STOP_LINE_2 LINE public static void main(String[] args){ System.out.println("Howdy!"); if (args.length == 0) { - System.out.println("No args to debuggee"); // stopLine + System.out.println("No args to debuggee"); // STOP_LINE } else { System.out.println("Some args to debuggee"); } - if (args.length == 0) { + if (args.length == 0) { // STOP_LINE + 4 boolean b1 = false; - if (b1) { // stopLine2 + if (b1) { // STOP_LINE_2 System.out.println("In 2nd else"); // bug 4870514 is that we stop here. } } else { System.out.println("In 2nd else"); } - System.out.println("Goodbye from LineNumberOnBraceTarg!"); // stopLine2 + 6 + System.out.println("Goodbye from LineNumberOnBraceTarg!"); } // This isn't part of the test; it is just here @@ -78,7 +100,7 @@ public class LineNumberOnBraceTest extends TestScaffold { targetClass = bpe.location().declaringType(); mainThread = bpe.thread(); - resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.stopLine); + resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.STOP_LINE); StepEvent stepev = stepOverLine(mainThread); // step to 2nd if (args.length // Bug 4952629 is that javac outputs a line number @@ -87,24 +109,23 @@ public class LineNumberOnBraceTest extends TestScaffold { int ln = stepev.location().lineNumber(); System.out.println("Debuggee is stopped at line " + ln); - if (ln != LineNumberOnBraceTarg.stopLine + 4) { + if (ln != LineNumberOnBraceTarg.STOP_LINE + 4) { failure("FAIL: Bug 4952629: Should be at line " + - (LineNumberOnBraceTarg.stopLine + 4) + + (LineNumberOnBraceTarg.STOP_LINE + 4) + ", am at " + ln); } else { System.out.println("Passed test for 4952629"); } // Test for bug 4870514 - System.out.println("Resuming to " + LineNumberOnBraceTarg.stopLine2); - resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.stopLine2); - System.out.println("Stopped at " + LineNumberOnBraceTarg.stopLine2); + System.out.println("Resuming to " + LineNumberOnBraceTarg.STOP_LINE_2); + resumeTo("LineNumberOnBraceTarg", LineNumberOnBraceTarg.STOP_LINE_2); + System.out.println("Stopped at " + LineNumberOnBraceTarg.STOP_LINE_2); stepev = stepOverLine(mainThread); ln = stepev.location().lineNumber(); System.out.println("Debuggee is stopped at line " + ln); - if (ln == LineNumberOnBraceTarg.stopLine2 + 1) { - failure("FAIL: bug 4870514: Incorrectly stopped at " + - (LineNumberOnBraceTarg.stopLine2 + 1)); + if (ln <= LineNumberOnBraceTarg.STOP_LINE_2 + 1) { + failure("FAIL: bug 4870514: Incorrectly stopped at " + ln); } else { System.out.println("Passed test for 4870514"); } diff --git a/jdk/test/com/sun/jdi/PopAndStepTest.java b/jdk/test/com/sun/jdi/PopAndStepTest.java index a0150fae110..598a78bf34c 100644 --- a/jdk/test/com/sun/jdi/PopAndStepTest.java +++ b/jdk/test/com/sun/jdi/PopAndStepTest.java @@ -1,17 +1,39 @@ -/* /nodynamiccopyright/ */ // DO NOT DELETE ANY LINES!!!! +/* + * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + // THIS TEST IS LINE NUMBER SENSITIVE + /** - * @test - * @bug 4530424 - * @summary Hin says that doing a step over after a popframe acts like a resume. + * @test + * @bug 4530424 + * @summary Hin says that doing a step over after a popframe acts like a resume. + * @author jjh * - * @author jjh + * @library .. * - * @library .. - * @modules jdk.jdi - * @run build TestScaffold VMConnection TargetListener TargetAdapter - * @run compile -g PopAndStepTest.java - * @run driver PopAndStepTest + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g PopAndStepTest.java + * @run driver PopAndStepTest */ import com.sun.jdi.*; import com.sun.jdi.event.*; @@ -19,25 +41,23 @@ import com.sun.jdi.request.*; import java.util.*; - /********** LINE NUMBER SENSITIVE! *****************************************************************/ - class PopAndStepTarg { public void B() { - System.out.println("debuggee: in B"); - System.out.println("debuggee: in B, back to A"); // add line breakpoint here line 27 !!! + System.out.println("debuggee: in B"); // B_LINE_1 + System.out.println("debuggee: in B, back to A"); // B_LINE_2 } public void A() { - System.out.println("debuggee: in A, about to call B"); // line 31 - B(); - System.out.println("debuggee: in A, back from B"); // line 33 - throw new RuntimeException("debuggee: Got to line 34"); + System.out.println("debuggee: in A, about to call B"); // A_LINE_1 + B(); // A_LINE_2 + System.out.println("debuggee: in A, back from B"); // A_LINE_3 + throw new RuntimeException("debuggee: Got to line A_LINE_4:" + PopAndStepTest.A_LINE_4); // A_LINE_4 } public static void main(String[] args) { - System.out.println("debuggee: Howdy!"); // line 38 - PopAndStepTarg xxx = new PopAndStepTarg(); // line 40 - xxx.A(); // line 41 + System.out.println("debuggee: Howdy!"); // MAIN_LINE_1 + PopAndStepTarg xxx = new PopAndStepTarg(); // MAIN_LINE_2 + xxx.A(); // MAIN_LINE_3 System.out.println("debugee: Goodbye from PopAndStepTarg!"); } } @@ -46,6 +66,18 @@ class PopAndStepTarg { /********** test program **********/ public class PopAndStepTest extends TestScaffold { + static final int B_LINE_1 = 46; + static final int B_LINE_2 = B_LINE_1 + 1; + + static final int A_LINE_1 = 51; + static final int A_LINE_2 = A_LINE_1 + 1; + static final int A_LINE_3 = A_LINE_1 + 2; + static final int A_LINE_4 = A_LINE_1 + 3; + + static final int MAIN_LINE_1 = 58; + static final int MAIN_LINE_2 = MAIN_LINE_1 + 1; + static final int MAIN_LINE_3 = MAIN_LINE_1 + 2; + ReferenceType targetClass; ThreadReference mainThread; @@ -116,10 +148,10 @@ public class PopAndStepTest extends TestScaffold { BreakpointEvent bpe = startToMain("PopAndStepTarg"); targetClass = bpe.location().declaringType(); mainThread = bpe.thread(); - getDebuggeeLineNum(38); + getDebuggeeLineNum(MAIN_LINE_1); - println("Resuming to line 27"); - bpe = resumeTo("PopAndStepTarg", 27); getDebuggeeLineNum(27); + println("Resuming to line B_LINE_2 : " + B_LINE_2); + bpe = resumeTo("PopAndStepTarg", B_LINE_2); getDebuggeeLineNum(B_LINE_2); // The failure is this: // create step request @@ -141,21 +173,21 @@ public class PopAndStepTest extends TestScaffold { srInto.enable(); // This fails mainThread.popFrames(frameFor("A")); //srInto.enable(); // if the enable is moved here, it passes - println("Popped back to line 41 in main, the call to A()"); - println("Stepping into line 31"); - waitForRequestedEvent(srInto); // println + println("Popped back to line MAIN_LINE_3(" + MAIN_LINE_3 + ") in main, the call to A()"); + println("Stepping into line A_LINE_1:" + A_LINE_1); + waitForRequestedEvent(srInto); // println srInto.disable(); - getDebuggeeLineNum(31); + getDebuggeeLineNum(A_LINE_1); // The failure occurs here. - println("Stepping over to line 32"); - stepOverLine(mainThread); // println - getDebuggeeLineNum(32); + println("Stepping over to line A_LINE_2:" + A_LINE_2); + stepOverLine(mainThread); // println + getDebuggeeLineNum(A_LINE_2); - println("Stepping over to line 33"); - stepOverLine(mainThread); // call to B() - getDebuggeeLineNum(33); + println("Stepping over to line A_LINE_3:" + A_LINE_3); + stepOverLine(mainThread); // call to B() + getDebuggeeLineNum(A_LINE_3); vm().exit(0); From b0c8a3bfc9291bad667a50f5594bcae9b8532dd2 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 4 Apr 2017 10:19:11 +0200 Subject: [PATCH 05/75] 8177955: Add testing documentation Reviewed-by: erikj --- common/doc/testing.html | 112 +++++++++++++++++++++ common/doc/testing.md | 207 +++++++++++++++++++++++++++++++++++++++ make/RunTests.gmk | 2 + make/UpdateBuildDocs.gmk | 23 +++-- 4 files changed, 336 insertions(+), 8 deletions(-) create mode 100644 common/doc/testing.html create mode 100644 common/doc/testing.md diff --git a/common/doc/testing.html b/common/doc/testing.html new file mode 100644 index 00000000000..71965f3e336 --- /dev/null +++ b/common/doc/testing.html @@ -0,0 +1,112 @@ + + + + + + + Testing OpenJDK + + + + + + + + +

Using the run-test framework

+

This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.

+

Some example command-lines:

+
$ make run-test-tier1
+$ make run-test-jdk_lang JTREG="JOBS=8"
+$ make run-test TEST=jdk_lang
+$ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
+$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
+$ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+

Test selection

+

All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the TEST variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.

+

For some common top-level tests, direct make targets have been generated. This includes all JTreg test groups, the hotspot gtest, and custom tests (if present). This means that make run-test-tier1 is equivalent to make run-test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the run-test TEST="x" solution needs to be used.

+

The test specifications given in TEST is parsed into fully qualified test descriptors, which clearly and unambigously show which tests will be run. As an example, :tier1 will expand to jtreg:jdk/test:tier1 jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1. You can always submit a list of fully qualified test descriptors in the TEST variable if you want to shortcut the parser.

+

JTreg

+

JTreg test groups can be specified either without a test root, e.g. :tier1 (or tier1, the initial colon is optional), or with, e.g. hotspot/test:tier1, jdk/test:jdk_util.

+

When specified without a test root, all matching groups from all tests roots will be added. Otherwise, only the group from the specified test root will be added.

+

Individual JTreg tests or directories containing JTreg tests can also be specified, like hotspot/test/native_sanity/JniVersion.java or hotspot/test/native_sanity. You can also specify an absolute path, to point to a JTreg test outside the source tree.

+

As long as the test groups or test paths can be uniquely resolved, you do not need to enter the jtreg: prefix. If this is not possible, or if you want to use a fully qualified test descriptor, add jtreg:, e.g. jtreg:hotspot/test/native_sanity.

+

Gtest

+

Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just gtest, or as a fully qualified test descriptor gtest:all.

+

If you want, you can single out an individual test or a group of tests, for instance gtest:LogDecorations or gtest:LogDecorations.level_test_vm. This can be particularly useful if you want to run a shaky test repeatedly.

+

Test results and summary

+

At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:

+
==============================
+Test summary
+==============================
+   TEST                                          TOTAL  PASS  FAIL ERROR
+>> jtreg:jdk/test:tier1                           1867  1865     2     0 <<
+   jtreg:langtools/test:tier1                     4711  4711     0     0
+   jtreg:nashorn/test:tier1                        133   133     0     0
+==============================
+TEST FAILURE
+

Tests where the number of TOTAL tests does not equal the number of PASSed tests will be considered a test failure. These are marked with the >> ... << marker for easy identification.

+

The classification of non-passed tests differs a bit between test suites. In the summary, ERROR is used as a catch-all for tests that neither passed nor are classified as failed by the framework. This might indicate test framework error, timeout or other problems.

+

In case of test failures, make run-test will exit with a non-zero exit value.

+

All tests have their result stored in build/$BUILD/test-result/$TEST_ID, where TEST_ID is a path-safe conversion from the fully qualified test descriptor, e.g. for jtreg:jdk/test:tier1 the TEST_ID is jtreg_jdk_test_tier1. This path is also printed in the log at the end of the test run.

+

Additional work data is stored in build/$BUILD/test-support/$TEST_ID. For some frameworks, this directory might contain information that is useful in determining the cause of a failed test.

+

Test suite control

+

It is possible to control various aspects of the test suites using make control variables.

+

These variables use a keyword=value approach to allow multiple values to be set. So, for instance, JTREG="JOBS=1;TIMEOUT=8" will set the JTreg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting JTREG_JOBS=1 JTREG_TIMEOUT=8, but using the keyword format means that the JTREG variable is parsed and verified for correctness, so JTREG="TMIEOUT=8" would give an error, while JTREG_TMIEOUT=8 would just pass unnoticed.

+

To separate multiple keyword=value pairs, use ; (semicolon). Since the shell normally eats ;, the recommended usage is to write the assignment inside qoutes, e.g. JTREG="...;...". This will also make sure spaces are preserved, as in JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug".

+

(Other ways are possible, e.g. using backslash: JTREG=JOBS=1\;TIMEOUT=8. Also, as a special technique, the string %20 will be replaced with space for certain options, e.g. JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)

+

As far as possible, the names of the keywords have been standardized between test suites.

+

JTreg keywords

+

JOBS

+

The test concurrency (-concurrency).

+

Defaults to TEST_JOBS (if set by --with-test-jobs=), otherwise it defaults to JOBS, except for Hotspot, where the default is number of CPU cores/2, but never more than 12.

+

TIMEOUT

+

The timeout factor (-timeoutFactor).

+

Defaults to 4.

+

TEST_MODE

+

The test mode (-agentvm, -samevm or -othervm).

+

Defaults to -agentvm.

+

ASSERT

+

Enable asserts (-ea -esa, or none).

+

Set to true or false. If true, adds -ea -esa. Defaults to true, except for hotspot.

+

VERBOSE

+

The verbosity level (-verbose).

+

Defaults to fail,error,summary.

+

RETAIN

+

What test data to retain (-retain).

+

Defaults to fail,error.

+

MAX_MEM

+

Limit memory consumption (-Xmx and -vmoption:-Xmx, or none).

+

Limit memory consumption for JTreg test framework and VM under test. Set to 0 to disable the limits.

+

Defaults to 512m, except for hotspot, where it defaults to 0 (no limit).

+

OPTIONS

+

Additional options to the JTreg test framework.

+

Use JTREG="OPTIONS=--help all" to see all available JTreg options.

+

JAVA_OPTIONS

+

Additional Java options to JTreg (-javaoption).

+

VM_OPTIONS

+

Additional VM options to JTreg (-vmoption).

+

Gtest keywords

+

REPEAT

+

The number of times to repeat the tests (--gtest_repeat).

+

Default is 1. Set to -1 to repeat indefinitely. This can be especially useful combined with OPTIONS=--gtest_break_on_failure to reproduce an intermittent problem.

+

OPTIONS

+

Additional options to the Gtest test framework.

+

Use GTEST="OPTIONS=--help" to see all available Gtest options.

+ + diff --git a/common/doc/testing.md b/common/doc/testing.md new file mode 100644 index 00000000000..46f32f911e3 --- /dev/null +++ b/common/doc/testing.md @@ -0,0 +1,207 @@ +% Testing OpenJDK + +## Using the run-test framework + +This new way of running tests is developer-centric. It assumes that you have +built a jdk locally and want to test it. Running common test targets is simple, +and more complex ad-hoc combination of tests is possible. The user interface is +forgiving, and clearly report errors it cannot resolve. + +Some example command-lines: + + $ make run-test-tier1 + $ make run-test-jdk_lang JTREG="JOBS=8" + $ make run-test TEST=jdk_lang + $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1" + $ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug" + $ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java" + +## Test selection + +All functionality is available using the run-test make target. In this use +case, the test or tests to be executed is controlled using the `TEST` variable. +To speed up subsequent test runs with no source code changes, run-test-only can +be used instead, which do not depend on the source and test image build. + +For some common top-level tests, direct make targets have been generated. This +includes all JTreg test groups, the hotspot gtest, and custom tests (if +present). This means that `make run-test-tier1` is equivalent to `make run-test +TEST="tier1"`, but the latter is more tab-completion friendly. For more complex +test runs, the `run-test TEST="x"` solution needs to be used. + +The test specifications given in `TEST` is parsed into fully qualified test +descriptors, which clearly and unambigously show which tests will be run. As an +example, `:tier1` will expand to `jtreg:jdk/test:tier1 +jtreg:langtools/test:tier1 jtreg:nashorn/test:tier1 jtreg:jaxp/test:tier1`. You +can always submit a list of fully qualified test descriptors in the `TEST` +variable if you want to shortcut the parser. + +### JTreg + +JTreg test groups can be specified either without a test root, e.g. `:tier1` +(or `tier1`, the initial colon is optional), or with, e.g. +`hotspot/test:tier1`, `jdk/test:jdk_util`. + +When specified without a test root, all matching groups from all tests roots +will be added. Otherwise, only the group from the specified test root will be +added. + +Individual JTreg tests or directories containing JTreg tests can also be +specified, like `hotspot/test/native_sanity/JniVersion.java` or +`hotspot/test/native_sanity`. You can also specify an absolute path, to point +to a JTreg test outside the source tree. + +As long as the test groups or test paths can be uniquely resolved, you do not +need to enter the `jtreg:` prefix. If this is not possible, or if you want to +use a fully qualified test descriptor, add `jtreg:`, e.g. +`jtreg:hotspot/test/native_sanity`. + +### Gtest + +Since the Hotspot Gtest suite is so quick, the default is to run all tests. +This is specified by just `gtest`, or as a fully qualified test descriptor +`gtest:all`. + +If you want, you can single out an individual test or a group of tests, for +instance `gtest:LogDecorations` or `gtest:LogDecorations.level_test_vm`. This +can be particularly useful if you want to run a shaky test repeatedly. + +## Test results and summary + +At the end of the test run, a summary of all tests run will be presented. This +will have a consistent look, regardless of what test suites were used. This is +a sample summary: + + ============================== + Test summary + ============================== + TEST TOTAL PASS FAIL ERROR + >> jtreg:jdk/test:tier1 1867 1865 2 0 << + jtreg:langtools/test:tier1 4711 4711 0 0 + jtreg:nashorn/test:tier1 133 133 0 0 + ============================== + TEST FAILURE + +Tests where the number of TOTAL tests does not equal the number of PASSed tests +will be considered a test failure. These are marked with the `>> ... <<` marker +for easy identification. + +The classification of non-passed tests differs a bit between test suites. In +the summary, ERROR is used as a catch-all for tests that neither passed nor are +classified as failed by the framework. This might indicate test framework +error, timeout or other problems. + +In case of test failures, `make run-test` will exit with a non-zero exit value. + +All tests have their result stored in `build/$BUILD/test-result/$TEST_ID`, +where TEST_ID is a path-safe conversion from the fully qualified test +descriptor, e.g. for `jtreg:jdk/test:tier1` the TEST_ID is +`jtreg_jdk_test_tier1`. This path is also printed in the log at the end of the +test run. + +Additional work data is stored in `build/$BUILD/test-support/$TEST_ID`. For +some frameworks, this directory might contain information that is useful in +determining the cause of a failed test. + +## Test suite control + +It is possible to control various aspects of the test suites using make control +variables. + +These variables use a keyword=value approach to allow multiple values to be +set. So, for instance, `JTREG="JOBS=1;TIMEOUT=8"` will set the JTreg +concurrency level to 1 and the timeout factor to 8. This is equivalent to +setting `JTREG_JOBS=1 JTREG_TIMEOUT=8`, but using the keyword format means that +the `JTREG` variable is parsed and verified for correctness, so +`JTREG="TMIEOUT=8"` would give an error, while `JTREG_TMIEOUT=8` would just +pass unnoticed. + +To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell +normally eats `;`, the recommended usage is to write the assignment inside +qoutes, e.g. `JTREG="...;..."`. This will also make sure spaces are preserved, +as in `JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"`. + +(Other ways are possible, e.g. using backslash: `JTREG=JOBS=1\;TIMEOUT=8`. +Also, as a special technique, the string `%20` will be replaced with space for +certain options, e.g. `JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug`. +This can be useful if you have layers of scripts and have trouble getting +proper quoting of command line arguments through.) + +As far as possible, the names of the keywords have been standardized between +test suites. + +### JTreg keywords + +#### JOBS +The test concurrency (`-concurrency`). + +Defaults to TEST_JOBS (if set by `--with-test-jobs=`), otherwise it defaults to +JOBS, except for Hotspot, where the default is *number of CPU cores/2*, but +never more than 12. + +#### TIMEOUT +The timeout factor (`-timeoutFactor`). + +Defaults to 4. + +#### TEST_MODE +The test mode (`-agentvm`, `-samevm` or `-othervm`). + +Defaults to `-agentvm`. + +#### ASSERT +Enable asserts (`-ea -esa`, or none). + +Set to `true` or `false`. If true, adds `-ea -esa`. Defaults to true, except +for hotspot. + +#### VERBOSE +The verbosity level (`-verbose`). + +Defaults to `fail,error,summary`. + +#### RETAIN +What test data to retain (`-retain`). + +Defaults to `fail,error`. + +#### MAX_MEM +Limit memory consumption (`-Xmx` and `-vmoption:-Xmx`, or none). + +Limit memory consumption for JTreg test framework and VM under test. Set to 0 +to disable the limits. + +Defaults to 512m, except for hotspot, where it defaults to 0 (no limit). + +#### OPTIONS +Additional options to the JTreg test framework. + +Use `JTREG="OPTIONS=--help all"` to see all available JTreg options. + +#### JAVA_OPTIONS +Additional Java options to JTreg (`-javaoption`). + +#### VM_OPTIONS +Additional VM options to JTreg (`-vmoption`). + +### Gtest keywords + +#### REPEAT +The number of times to repeat the tests (`--gtest_repeat`). + +Default is 1. Set to -1 to repeat indefinitely. This can be especially useful +combined with `OPTIONS=--gtest_break_on_failure` to reproduce an intermittent +problem. + +#### OPTIONS +Additional options to the Gtest test framework. + +Use `GTEST="OPTIONS=--help"` to see all available Gtest options. + +--- +# Override some definitions in http://openjdk.java.net/page.css that are +# unsuitable for this document. +header-includes: + - '' + - '' +--- diff --git a/make/RunTests.gmk b/make/RunTests.gmk index fad1ae7b37c..18e7f482360 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -160,6 +160,7 @@ endef ifeq ($(TEST), ) $(info No test selection given in TEST!) $(info Please use e.g. 'run-test TEST=tier1' or 'run-test-tier1') + $(info See common/doc/testing.[md|html] for help) $(error Cannot continue) endif @@ -182,6 +183,7 @@ $(foreach test, $(TEST), \ ifneq ($(UNKNOWN_TEST), ) $(info Unknown test selection: '$(UNKNOWN_TEST)') + $(info See common/doc/testing.[md|html] for help) $(error Cannot continue) endif diff --git a/make/UpdateBuildDocs.gmk b/make/UpdateBuildDocs.gmk index fd2587ea28b..42f5ee03594 100644 --- a/make/UpdateBuildDocs.gmk +++ b/make/UpdateBuildDocs.gmk @@ -47,6 +47,7 @@ endif # Remaining parameters are named arguments. These include: # SOURCE_FILE The markdown source file # TARGET_DIR The directory where to store the generated html file +# OPTIONS Additional options to pandoc # SetupMarkdownToHtml = $(NamedParamsMacroTemplate) define SetupMarkdownToHtmlBody @@ -65,12 +66,13 @@ $$($1_OUTPUT_FILE): $$($1_SOURCE_FILE) $$(call LogInfo, Converting $$(notdir $1) to html) $$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown) $$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \ - $$(PANDOC) -f markdown -t html --standalone '$$<' -o '$$@') - TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` ; \ - if [ "x$$TOO_LONG_LINES" != x ]; then \ + $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \ + --css 'http://openjdk.java.net/page.css' '$$<' -o '$$@') + TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \ + if [ "x$$$$TOO_LONG_LINES" != x ]; then \ $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \ $$(ECHO) "The following lines are longer than 80 characters:" ; \ - $$(GREP) -E -e '^.{80}.+$$$$' $$< ; \ + $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \ fi $1 := $$($1_OUTPUT_FILE) @@ -80,12 +82,17 @@ endef ################################################################################ -BUILD_DOCS_DIR := $(TOPDIR)/common/doc -BUILD_DOCS_MD_FILE := building.md +DOCS_DIR := $(TOPDIR)/common/doc $(eval $(call SetupMarkdownToHtml, building, \ - SOURCE_FILE := $(BUILD_DOCS_DIR)/$(BUILD_DOCS_MD_FILE), \ - TARGET_DIR := $(BUILD_DOCS_DIR), \ + SOURCE_FILE := $(DOCS_DIR)/building.md, \ + TARGET_DIR := $(DOCS_DIR), \ +)) + +$(eval $(call SetupMarkdownToHtml, testing, \ + SOURCE_FILE := $(DOCS_DIR)/testing.md, \ + TARGET_DIR := $(DOCS_DIR), \ + OPTIONS := --toc, \ )) ################################################################################ From 0b9e3433dd0619c415bcb91eb292bc086a384072 Mon Sep 17 00:00:00 2001 From: Ramanand Patil Date: Tue, 4 Apr 2017 19:27:38 +0530 Subject: [PATCH 06/75] 8177449: (tz) Support tzdata2017b Reviewed-by: martin, naoto --- jdk/make/data/tzdata/VERSION | 2 +- jdk/make/data/tzdata/africa | 25 ++++++++++++------- jdk/make/data/tzdata/iso3166.tab | 4 +-- jdk/make/data/tzdata/northamerica | 8 ++++++ jdk/test/sun/util/calendar/zi/tzdata/VERSION | 2 +- jdk/test/sun/util/calendar/zi/tzdata/africa | 25 ++++++++++++------- .../sun/util/calendar/zi/tzdata/iso3166.tab | 4 +-- .../sun/util/calendar/zi/tzdata/northamerica | 8 ++++++ 8 files changed, 54 insertions(+), 24 deletions(-) diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION index afe013e29f4..eb5b4595f3e 100644 --- a/jdk/make/data/tzdata/VERSION +++ b/jdk/make/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2017a +tzdata2017b diff --git a/jdk/make/data/tzdata/africa b/jdk/make/data/tzdata/africa index f2fc2bbcdcf..d3de96d1431 100644 --- a/jdk/make/data/tzdata/africa +++ b/jdk/make/data/tzdata/africa @@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte # See Africa/Johannesburg. # Liberia -# From Paul Eggert (2006-03-22): -# In 1972 Liberia was the last country to switch -# from a UTC offset that was not a multiple of 15 or 20 minutes. -# Howse reports that it was in honor of their president's birthday. -# Shank & Pottenger report the date as May 1, whereas Howse reports Jan; -# go with Shanks & Pottenger. -# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and -# Whitman each report -0:44:30; go with the more precise figure. +# +# From Paul Eggert (2017-03-02): +# +# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30. +# +# In 1972 Liberia was the last country to switch from a UTC offset +# that was not a multiple of 15 or 20 minutes. The 1972 change was on +# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of: +# Presidential Papers: First year of the administration of +# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972. +# Monrovia: Executive Mansion. +# +# Use the abbreviation "MMT" before 1972, as the more-accurate numeric +# abbreviation "-004430" would be one byte over the POSIX limit. +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Monrovia -0:43:08 - LMT 1882 -0:43:08 - MMT 1919 Mar # Monrovia Mean Time - -0:44:30 - -004430 1972 May + -0:44:30 - MMT 1972 Jan 7 # approximately MMT 0:00 - GMT ############################################################################### diff --git a/jdk/make/data/tzdata/iso3166.tab b/jdk/make/data/tzdata/iso3166.tab index 004a4a70556..38a3a1ed52b 100644 --- a/jdk/make/data/tzdata/iso3166.tab +++ b/jdk/make/data/tzdata/iso3166.tab @@ -32,8 +32,8 @@ # All text uses UTF-8 encoding. The columns of the table are as follows: # # 1. ISO 3166-1 alpha-2 country code, current as of -# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166 -# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm +# ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1 +# http://isotc.iso.org/livelink/livelink/Open/16944257 # 2. The usual English name for the coded region, # chosen so that alphabetic sorting of subsets produces helpful lists. # This is not the same as the English name in the ISO 3166 tables. diff --git a/jdk/make/data/tzdata/northamerica b/jdk/make/data/tzdata/northamerica index 85a5bb44414..d59d2705b99 100644 --- a/jdk/make/data/tzdata/northamerica +++ b/jdk/make/data/tzdata/northamerica @@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5 # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/ # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/ +# From Steffen Thorsen (2017-03-12): +# We have received 4 mails from different people telling that Haiti +# has started DST again today, and this source seems to confirm that, +# I have not been able to find a more authoritative source: +# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Haiti 1983 only - May 8 0:00 1:00 D Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D @@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S +Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D +Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Port-au-Prince -4:49:20 - LMT 1890 -4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT diff --git a/jdk/test/sun/util/calendar/zi/tzdata/VERSION b/jdk/test/sun/util/calendar/zi/tzdata/VERSION index afe013e29f4..eb5b4595f3e 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION +++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2017a +tzdata2017b diff --git a/jdk/test/sun/util/calendar/zi/tzdata/africa b/jdk/test/sun/util/calendar/zi/tzdata/africa index f2fc2bbcdcf..d3de96d1431 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/africa +++ b/jdk/test/sun/util/calendar/zi/tzdata/africa @@ -443,18 +443,25 @@ Link Africa/Nairobi Indian/Mayotte # See Africa/Johannesburg. # Liberia -# From Paul Eggert (2006-03-22): -# In 1972 Liberia was the last country to switch -# from a UTC offset that was not a multiple of 15 or 20 minutes. -# Howse reports that it was in honor of their president's birthday. -# Shank & Pottenger report the date as May 1, whereas Howse reports Jan; -# go with Shanks & Pottenger. -# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and -# Whitman each report -0:44:30; go with the more precise figure. +# +# From Paul Eggert (2017-03-02): +# +# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30. +# +# In 1972 Liberia was the last country to switch from a UTC offset +# that was not a multiple of 15 or 20 minutes. The 1972 change was on +# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of: +# Presidential Papers: First year of the administration of +# President William R. Tolbert, Jr., July 23, 1971-July 31, 1972. +# Monrovia: Executive Mansion. +# +# Use the abbreviation "MMT" before 1972, as the more-accurate numeric +# abbreviation "-004430" would be one byte over the POSIX limit. +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Monrovia -0:43:08 - LMT 1882 -0:43:08 - MMT 1919 Mar # Monrovia Mean Time - -0:44:30 - -004430 1972 May + -0:44:30 - MMT 1972 Jan 7 # approximately MMT 0:00 - GMT ############################################################################### diff --git a/jdk/test/sun/util/calendar/zi/tzdata/iso3166.tab b/jdk/test/sun/util/calendar/zi/tzdata/iso3166.tab index 004a4a70556..38a3a1ed52b 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/iso3166.tab +++ b/jdk/test/sun/util/calendar/zi/tzdata/iso3166.tab @@ -32,8 +32,8 @@ # All text uses UTF-8 encoding. The columns of the table are as follows: # # 1. ISO 3166-1 alpha-2 country code, current as of -# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166 -# http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm +# ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1 +# http://isotc.iso.org/livelink/livelink/Open/16944257 # 2. The usual English name for the coded region, # chosen so that alphabetic sorting of subsets produces helpful lists. # This is not the same as the English name in the ISO 3166 tables. diff --git a/jdk/test/sun/util/calendar/zi/tzdata/northamerica b/jdk/test/sun/util/calendar/zi/tzdata/northamerica index 85a5bb44414..d59d2705b99 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica +++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica @@ -3162,6 +3162,12 @@ Zone America/Guatemala -6:02:04 - LMT 1918 Oct 5 # http://www.vantbefinfo.com/changement-dheure-pas-pour-haiti/ # http://news.anmwe.com/haiti-lheure-nationale-ne-sera-ni-avancee-ni-reculee-cette-annee/ +# From Steffen Thorsen (2017-03-12): +# We have received 4 mails from different people telling that Haiti +# has started DST again today, and this source seems to confirm that, +# I have not been able to find a more authoritative source: +# https://www.haitilibre.com/en/news-20319-haiti-notices-time-change-in-haiti.html + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Haiti 1983 only - May 8 0:00 1:00 D Rule Haiti 1984 1987 - Apr lastSun 0:00 1:00 D @@ -3174,6 +3180,8 @@ Rule Haiti 2005 2006 - Apr Sun>=1 0:00 1:00 D Rule Haiti 2005 2006 - Oct lastSun 0:00 0 S Rule Haiti 2012 2015 - Mar Sun>=8 2:00 1:00 D Rule Haiti 2012 2015 - Nov Sun>=1 2:00 0 S +Rule Haiti 2017 max - Mar Sun>=8 2:00 1:00 D +Rule Haiti 2017 max - Nov Sun>=1 2:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Port-au-Prince -4:49:20 - LMT 1890 -4:49 - PPMT 1917 Jan 24 12:00 # P-a-P MT From 6b38dd561d318bb3e0c24d2ad39e8301bdeae0a2 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 4 Apr 2017 08:10:13 -0700 Subject: [PATCH 07/75] 8177984: (ch) java/nio/channels/SocketChannel/VectorIO.java should use RandomFactory Obtain Random from RandomFactory instead of directly. Reviewed-by: clanger --- .../java/nio/channels/SocketChannel/VectorIO.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java index 4242be4dfa2..907d1b21716 100644 --- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java +++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java @@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,10 @@ */ /* @test - * @summary Test socketchannel vector IO - * @library .. + * @summary Test socketchannel vector IO (use -Dseed=X to set PRNG seed) + * @library .. /lib/testlibrary/ + * @build jdk.testlibrary.RandomFactory + * @run main VectorIO * @key randomness */ @@ -32,11 +34,11 @@ import java.net.*; import java.nio.*; import java.nio.channels.*; import java.util.*; - +import jdk.testlibrary.RandomFactory; public class VectorIO { - static Random generator = new Random(); + private static Random generator = RandomFactory.getRandom(); static int testSize; @@ -100,8 +102,6 @@ public class VectorIO { static class Server extends TestThread { - static Random generator = new Random(); - final int testSize; final ServerSocketChannel ssc; From 01b13bd9df4a0751fbc2f8d4d26b1a0defc37393 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 4 Apr 2017 11:13:02 -0700 Subject: [PATCH 08/75] 8177949: @link tag arguments need correction for ElementType documentation Reviewed-by: lancea --- .../share/classes/java/lang/annotation/ElementType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java b/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java index 14780fe6827..bbab9cdacc2 100644 --- a/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java +++ b/jdk/src/java.base/share/classes/java/lang/annotation/ElementType.java @@ -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 @@ -28,7 +28,7 @@ package java.lang.annotation; /** * The constants of this enumerated type provide a simple classification of the * syntactic locations where annotations may appear in a Java program. These - * constants are used in {@link Target java.lang.annotation.Target} + * constants are used in {@link java.lang.annotation.Target Target} * meta-annotations to specify where it is legal to write annotations of a * given type. * From 3977b2c53021f4f62a18a36f594d566260ccdd06 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Tue, 4 Apr 2017 11:27:06 -0700 Subject: [PATCH 09/75] 8176901: Internal error running javadoc over jdk internal classes Reviewed-by: jjg --- .../toolkit/util/JavaScriptScanner.java | 4 +- .../doclet/testBadHtml/TestBadHtml.java | 52 +++++++++++++++++++ .../javadoc/doclet/testBadHtml/pkg1/A.java | 42 +++++++++++++++ 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 langtools/test/jdk/javadoc/doclet/testBadHtml/TestBadHtml.java create mode 100644 langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/JavaScriptScanner.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/JavaScriptScanner.java index c476c536dab..8699bed356b 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/JavaScriptScanner.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/JavaScriptScanner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ public class JavaScriptScanner extends DocTreePathScanner value = tree.getValue(); - if (!value.isEmpty() && value.get(0).getKind() == Kind.TEXT) { + if (value != null && !value.isEmpty() && value.get(0).getKind() == Kind.TEXT) { String v = value.get(0).toString().trim().toLowerCase(Locale.ENGLISH); if (v.startsWith("javascript:")) { f.accept(getCurrentPath()); diff --git a/langtools/test/jdk/javadoc/doclet/testBadHtml/TestBadHtml.java b/langtools/test/jdk/javadoc/doclet/testBadHtml/TestBadHtml.java new file mode 100644 index 00000000000..1b2b0535d34 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testBadHtml/TestBadHtml.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8176901 + * @summary The doclet should cope with bad HTML form + * @library ../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build JavadocTester + * @run main TestBadHtml + */ + +public class TestBadHtml extends JavadocTester { + + public static void main(String... args) throws Exception { + TestBadHtml tester = new TestBadHtml(); + tester.runTests(); + } + + @Test + void testNegative() { + javadoc("-d", "out1", + "-sourcepath", testSrc, + "pkg1"); + + checkExit(Exit.ERROR); + + checkOutput(Output.STDERR, false, "NullPointerException"); + checkOutput(Output.OUT, false, "NullPointerException"); + } +} diff --git a/langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java b/langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java new file mode 100644 index 00000000000..f33d1420385 --- /dev/null +++ b/langtools/test/jdk/javadoc/doclet/testBadHtml/pkg1/A.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +/** + * The first sentence. + * + * + * + * + * + * + * + * + * + * + * + * + */ + +public class A {} From 3fd763e24f832d8f42094ca2fbdec4844ab17d0f Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 4 Apr 2017 14:02:03 -0700 Subject: [PATCH 10/75] 8177562: Small updates to module summary page Reviewed-by: bpatel, ksrini --- .../doclets/formats/html/Contents.java | 2 + .../formats/html/ModuleWriterImpl.java | 126 +++++++++--------- .../formats/html/markup/HtmlWriter.java | 15 +-- .../html/resources/standard.properties | 1 + .../doclets/toolkit/resources/doclet.xml | 4 +- .../toolkit/resources/doclets.properties | 17 +-- .../doclet/testModules/TestModules.java | 53 ++++---- 7 files changed, 109 insertions(+), 109 deletions(-) diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java index f0d28672792..827053db261 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java @@ -130,6 +130,7 @@ public class Contents { public final Content nextPackageLabel; public final Content noFramesLabel; public final Content noScriptMessage; + public final Content openModuleLabel; public final Content overridesLabel; public final Content overviewLabel; public final Content packageHierarchies; @@ -244,6 +245,7 @@ public class Contents { nextPackageLabel = getNonBreakContent("doclet.Next_Package"); noFramesLabel = getNonBreakContent("doclet.No_Frames"); noScriptMessage = getContent("doclet.No_Script_Message"); + openModuleLabel = getContent("doclet.Open_Module"); overridesLabel = getContent("doclet.Overrides"); overviewLabel = getContent("doclet.Overview"); packageHierarchies = getContent("doclet.Package_Hierarchies"); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java index e5a733c23d1..70b56accaa0 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java @@ -98,19 +98,19 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW = new TreeMap<>(utils.makeModuleComparator()); /** - * Map of additional modules and modifiers, transitive closure, required by this module. + * Map of indirect modules and modifiers, transitive closure, required by this module. */ - private final Map additionalModules + private final Map indirectModules = new TreeMap<>(utils.makeModuleComparator()); /** - * Map of packages exported by this module and the modules it's been exported to. + * Map of packages exported by this module and the modules it has been exported to. */ private final Map> exportedPackages = new TreeMap<>(utils.makePackageComparator()); /** - * Map of opened packages by this module and the modules it's been opened to. + * Map of opened packages by this module and the modules it has been opened to. */ private final Map> openedPackages = new TreeMap<>(utils.makePackageComparator()); @@ -121,15 +121,15 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW private final SortedSet concealedPackages = new TreeSet<>(utils.makePackageComparator()); /** - * Map of additional modules (transitive closure) and its exported packages. + * Map of indirect modules (transitive closure) and their exported packages. */ - private final Map> additionalPackages + private final Map> indirectPackages = new TreeMap<>(utils.makeModuleComparator()); /** - * Map of additional modules (transitive closure) and its open packages. + * Map of indirect modules (transitive closure) and their open packages. */ - private final Map> additionalOpenPackages + private final Map> indirectOpenPackages = new TreeMap<>(utils.makeModuleComparator()); /** @@ -212,8 +212,10 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW Content annotationContent = new HtmlTree(HtmlTag.P); addAnnotationInfo(mdle, annotationContent); div.addContent(annotationContent); + Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL) + ? contents.openModuleLabel : contents.moduleLabel; Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, - HtmlStyle.title, contents.moduleLabel); + HtmlStyle.title, label); tHeading.addContent(Contents.SPACE); Content moduleHead = new RawHtml(heading); tHeading.addContent(moduleHead); @@ -264,12 +266,12 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW CommentHelper ch = utils.getCommentHelper(mdle); // Get module dependencies using the module's transitive closure. Map dependentModules = utils.getDependentModules(mdle); - // Add all dependent modules to additional modules set. We will remove the modules, - // listed using the requires directive, from this set to come up with the table of additional + // Add all dependent modules to indirect modules set. We will remove the modules, + // listed using the requires directive, from this set to come up with the table of indirect // required modules. dependentModules.forEach((module, mod) -> { if (shouldDocument(module)) { - additionalModules.put(module, new StringContent(mod)); + indirectModules.put(module, new StringContent(mod)); } }); (ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> { @@ -278,11 +280,11 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW if (moduleMode == ModuleMode.ALL || directive.isTransitive()) { requires.put(m, new StringContent(utils.getModifiers(directive))); } else { - // For api mode, just keep the public requires in dependentModules for display of - // additional packages in the "Packages" section. + // For api mode, just keep the public requires in dependentModules for display of + // indirect packages in the "Packages" section. dependentModules.remove(m); - } - additionalModules.remove(m); + } + indirectModules.remove(m); } }); @@ -320,7 +322,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW mdleList.addAll(targetMdles); } // Qualified opens should not be displayed in the api mode. So if mdleList is empty, - // it's opened to all modules and hence can be added. + // it is opened to all modules and hence can be added. if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) { openedPackages.put(p, mdleList); } @@ -331,7 +333,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW concealedPackages.removeAll(exportedPackages.keySet()); concealedPackages.removeAll(openedPackages.keySet()); // Get all the exported and opened packages, for the transitive closure of the module, to be displayed in - // the additional packages tables. + // the indirect packages tables. dependentModules.forEach((module, mod) -> { SortedSet pkgList = new TreeSet<>(utils.makePackageComparator()); (ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> { @@ -343,7 +345,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW // If none of the transitive modules have exported packages to be displayed, we should not be // displaying the table and so it should not be added to the map. if (!pkgList.isEmpty()) { - additionalPackages.put(module, pkgList); + indirectPackages.put(module, pkgList); } SortedSet openPkgList = new TreeSet<>(utils.makePackageComparator()); (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> { @@ -355,7 +357,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW // If none of the transitive modules have opened packages to be displayed, we should not be // displaying the table and so it should not be added to the map. if (!openPkgList.isEmpty()) { - additionalOpenPackages.put(module, openPkgList); + indirectOpenPackages.put(module, openPkgList); } }); // Get all the services listed as uses directive. @@ -471,31 +473,31 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW * {@inheritDoc} */ public void addModulesSummary(Content summaryContentTree) { - if (display(requires) || display(additionalModules)) { + if (display(requires) || display(indirectModules)) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES, contents.navModules, li); if (display(requires)) { - String text = configuration.getText("doclet.Requires_Summary"); - String tableSummary = configuration.getText("doclet.Member_Table_Summary", - configuration.getText("doclet.Requires_Summary"), - configuration.getText("doclet.modules")); + String text = configuration.getText("doclet.Requires_Summary"); + String tableSummary = configuration.getText("doclet.Member_Table_Summary", + configuration.getText("doclet.Requires_Summary"), + configuration.getText("doclet.modules")); Content table = getTableHeader(text, tableSummary, HtmlStyle.requiresSummary, requiresTableHeader); Content tbody = new HtmlTree(HtmlTag.TBODY); addModulesList(requires, tbody); table.addContent(tbody); li.addContent(table); } - // Display additional modules table in both "api" and "all" mode. - if (display(additionalModules)) { - String amrText = configuration.getText("doclet.Additional_Modules_Required_Summary"); + // Display indirect modules table in both "api" and "all" mode. + if (display(indirectModules)) { + String amrText = configuration.getText("doclet.Indirect_Requires_Summary"); String amrTableSummary = configuration.getText("doclet.Member_Table_Summary", - configuration.getText("doclet.Additional_Modules_Required_Summary"), + configuration.getText("doclet.Indirect_Requires_Summary"), configuration.getText("doclet.modules")); Content amrTable = getTableHeader(amrText, amrTableSummary, HtmlStyle.requiresSummary, requiresTableHeader); Content amrTbody = new HtmlTree(HtmlTag.TBODY); - addModulesList(additionalModules, amrTbody); + addModulesList(indirectModules, amrTbody); amrTable.addContent(amrTbody); li.addContent(amrTable); } @@ -530,7 +532,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW public void addPackagesSummary(Content summaryContentTree) { if (display(exportedPackages) || display(openedPackages) || display(concealedPackages) - || display(additionalPackages) || display(additionalOpenPackages)) { + || display(indirectPackages) || display(indirectOpenPackages)) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, @@ -541,29 +543,29 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) { addPackageSummary(tableSummary, li); } - if (display(additionalPackages)) { - String aepText = configuration.getText("doclet.Additional_Exported_Packages_Summary"); - String aepTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary", - configuration.getText("doclet.Additional_Exported_Packages_Summary"), + if (display(indirectPackages)) { + String aepText = configuration.getText("doclet.Indirect_Exports_Summary"); + String aepTableSummary = configuration.getText("doclet.Indirect_Packages_Table_Summary", + configuration.getText("doclet.Indirect_Exports_Summary"), configuration.getText("doclet.modules"), configuration.getText("doclet.packages")); Content aepTable = getTableHeader(aepText, aepTableSummary, HtmlStyle.packagesSummary, - additionalPackagesTableHeader); + indirectPackagesTableHeader); Content aepTbody = new HtmlTree(HtmlTag.TBODY); - addAdditionalPackages(aepTbody, additionalPackages); + addIndirectPackages(aepTbody, indirectPackages); aepTable.addContent(aepTbody); li.addContent(aepTable); } - if (display(additionalOpenPackages)) { - String aopText = configuration.getText("doclet.Additional_Opened_Packages_Summary"); - String aopTableSummary = configuration.getText("doclet.Additional_Packages_Table_Summary", - configuration.getText("doclet.Additional_Opened_Packages_Summary"), + if (display(indirectOpenPackages)) { + String aopText = configuration.getText("doclet.Indirect_Opens_Summary"); + String aopTableSummary = configuration.getText("doclet.Indirect_Packages_Table_Summary", + configuration.getText("doclet.Indirect_Opens_Summary"), configuration.getText("doclet.modules"), configuration.getText("doclet.packages")); Content aopTable = getTableHeader(aopText, aopTableSummary, HtmlStyle.packagesSummary, - additionalPackagesTableHeader); + indirectPackagesTableHeader); Content aopTbody = new HtmlTree(HtmlTag.TBODY); - addAdditionalPackages(aopTbody, additionalOpenPackages); + addIndirectPackages(aopTbody, indirectOpenPackages); aopTable.addContent(aopTbody); li.addContent(aopTable); } @@ -734,14 +736,14 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW } /** - * Add the additional packages for the module being documented. + * Add the indirect packages for the module being documented. * * @param tbody the content tree to which the table will be added - * @param ap additional packages to be added + * @param ip indirect packages to be added */ - public void addAdditionalPackages(Content tbody, Map> ap) { + public void addIndirectPackages(Content tbody, Map> ip) { boolean altColor = true; - for (Map.Entry> entry : ap.entrySet()) { + for (Map.Entry> entry : ip.entrySet()) { ModuleElement m = entry.getKey(); SortedSet pkgList = entry.getValue(); Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName())); @@ -773,19 +775,6 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW contents.navServices, li); String text; String tableSummary; - if (display(uses)) { - text = configuration.getText("doclet.Uses_Summary"); - tableSummary = configuration.getText("doclet.Member_Table_Summary", - configuration.getText("doclet.Uses_Summary"), - configuration.getText("doclet.types")); - Content table = getTableHeader(text, tableSummary, HtmlStyle.usesSummary, usesTableHeader); - Content tbody = new HtmlTree(HtmlTag.TBODY); - addUsesList(tbody); - if (!tbody.isEmpty()) { - table.addContent(tbody); - li.addContent(table); - } - } if (display(provides)) { text = configuration.getText("doclet.Provides_Summary"); tableSummary = configuration.getText("doclet.Member_Table_Summary", @@ -799,6 +788,19 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW li.addContent(table); } } + if (display(uses)) { + text = configuration.getText("doclet.Uses_Summary"); + tableSummary = configuration.getText("doclet.Member_Table_Summary", + configuration.getText("doclet.Uses_Summary"), + configuration.getText("doclet.types")); + Content table = getTableHeader(text, tableSummary, HtmlStyle.usesSummary, usesTableHeader); + Content tbody = new HtmlTree(HtmlTag.TBODY); + addUsesList(tbody); + if (!tbody.isEmpty()) { + table.addContent(tbody); + li.addContent(table); + } + } HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); summaryContentTree.addContent(ul); } @@ -975,12 +977,12 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW ? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription) : contents.navModuleDescription); addNavGap(liNav); - liNav.addContent((display(requires) || display(additionalModules)) + liNav.addContent((display(requires) || display(indirectModules)) ? getHyperLink(SectionName.MODULES, contents.navModules) : contents.navModules); addNavGap(liNav); liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages) - || display(additionalPackages) || display(additionalOpenPackages)) + || display(indirectPackages) || display(indirectOpenPackages)) ? getHyperLink(SectionName.PACKAGES, contents.navPackages) : contents.navPackages); addNavGap(liNav); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java index 706d7294e45..f1f1b9ebe7f 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFile; import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants; -import jdk.javadoc.internal.doclets.toolkit.util.ModulePackageTypes; import jdk.javadoc.internal.doclets.toolkit.util.TableTabTypes; @@ -88,7 +87,7 @@ public class HtmlWriter { /** * Header for tables displaying modules and exported packages. */ - protected final List additionalPackagesTableHeader; + protected final List indirectPackagesTableHeader; /** * Header for tables displaying types and description. @@ -136,18 +135,18 @@ public class HtmlWriter { packageTableHeader.add(resources.getText("doclet.Package")); packageTableHeader.add(resources.getText("doclet.Description")); requiresTableHeader = new ArrayList<>(); - requiresTableHeader.add(resources.getText("doclet.Modifier")); + requiresTableHeader.add(resources.getText("doclet.Modifier")); requiresTableHeader.add(resources.getText("doclet.Module")); requiresTableHeader.add(resources.getText("doclet.Description")); exportedPackagesTableHeader = new ArrayList<>(); exportedPackagesTableHeader.add(resources.getText("doclet.Package")); if (configuration.docEnv.getModuleMode() == ModuleMode.ALL) { - exportedPackagesTableHeader.add(resources.getText("doclet.Module")); + exportedPackagesTableHeader.add(resources.getText("doclet.Module")); } exportedPackagesTableHeader.add(resources.getText("doclet.Description")); - additionalPackagesTableHeader = new ArrayList<>(); - additionalPackagesTableHeader.add(resources.getText("doclet.Module")); - additionalPackagesTableHeader.add(resources.getText("doclet.Packages")); + indirectPackagesTableHeader = new ArrayList<>(); + indirectPackagesTableHeader.add(resources.getText("doclet.From")); + indirectPackagesTableHeader.add(resources.getText("doclet.Packages")); usesTableHeader = new ArrayList<>(); usesTableHeader.add(resources.getText("doclet.Type")); usesTableHeader.add(resources.getText("doclet.Description")); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties index 8990c4d2ef4..6fa91217571 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties @@ -6,6 +6,7 @@ doclet.Window_Overview_Summary=Overview doclet.Element=Element doclet.Package=Package doclet.Module=Module +doclet.Open_Module=Open Module doclet.All_Packages=All Packages doclet.All_Modules=All Modules doclet.None=None diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml index 7a6c54d145a..3148605db46 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml @@ -1,7 +1,7 @@ "); + + ""); checkOutput("moduleB-summary.html", found, "
\n" + "
    \n" @@ -372,7 +372,7 @@ public class TestModules extends JavadocTester { + "
  • \n" + "
      \n" + "
    • \n" - + ""); + + ""); checkOutput("moduleB-summary.html", found, "
      \n" + "
        \n" @@ -595,7 +595,7 @@ public class TestModules extends JavadocTester { + "TestInterface2InModuleB\n" + " \n" + "", - "Opened Packages \n" + "Opens \n" + "\n" + "Package\n" + "Description\n" @@ -730,17 +730,12 @@ public class TestModules extends JavadocTester { checkOutput("moduleA-summary.html", true, "
      • Description | " + "Modules | Packages | Services
      • ", - "transitive\n" - + "moduleB\n" - + "\n" - + "
        This is a test description for the moduleB module.
        \n" - + "", - "\n" - + "", - "
        Additional Exported Packages 
        \n" - + "\n" + "
        Additional Opened Packages 
        \n" + + "", + "
        Indirect Exports 
        \n" + + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n", "\n" @@ -751,15 +746,15 @@ public class TestModules extends JavadocTester { checkOutput("moduletags-summary.html", true, "
      • Description | Modules" + " | Packages | Services
      • ", - "
        Indirect Opens 
        ModuleFromPackages
        moduleB
        \n" - + "", + "
        Additional Modules Required 
        \n" + + "", "\n" + "\n" + "", - "
        Indirect Requires 
        transitivemoduleB\n" + "
        This is a test description for the moduleB module.
        \n" + "
        \n" - + "", + "
        Additional Exported Packages 
        \n" + + "", "\n" + "\n" + "\n" + "\n" + "", - "
        Indirect Exports 
        transitive staticmoduleA\n" @@ -771,16 +766,16 @@ public class TestModules extends JavadocTester { + "ModifierModuleDescription
        \n" - + "\n" + "
        Additional Modules Required 
        \n" + + "\n" + "\n" + "\n" + "\n" + "", - "
        Indirect Requires 
        ModifierModuleDescription
        \n" - + "\n" + "
        Additional Opened Packages 
        \n" + + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n", "\n" @@ -797,7 +792,7 @@ public class TestModules extends JavadocTester { "\n" + "", "
        Indirect Opens 
        ModuleFromPackages
        moduleBtestpkgmdlB 
        \n" - + "\n" + + "\n" + "\n" + "\n" + "\n" @@ -830,9 +825,9 @@ public class TestModules extends JavadocTester { + "\n" + "", "", + + "Concealed ", "\n" + "\n" + ""); @@ -854,10 +849,10 @@ public class TestModules extends JavadocTester { + "", ""); + + "Exports " + + "Opens "); checkOutput("moduleC-summary.html", found, - "\n" + "\n" + "\n" + "\n" + "\n" From 543364d22cc7842f117c81a01d2669a37006bce1 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Tue, 4 Apr 2017 14:06:54 -0700 Subject: [PATCH 11/75] 8177417: Constructor Summary readability problems in jdk9 javadoc Reviewed-by: jjg, ksrini --- .../formats/html/ConstructorWriterImpl.java | 6 +----- .../doclets/formats/html/markup/HtmlStyle.java | 1 + .../doclets/toolkit/resources/stylesheet.css | 12 +++++++----- .../testMemberSummary/TestMemberSummary.java | 14 +++++++++++--- .../testMemberSummary/pkg/PrivateParent.java | 8 +++++++- .../doclet/testStylesheet/TestStylesheet.java | 6 +++--- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java index c44087e07f2..9a4eb9f8a52 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java @@ -169,11 +169,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter */ @Override public void setSummaryColumnStyleAndScope(HtmlTree thTree) { - if (foundNonPubConstructor) { - thTree.addStyle(HtmlStyle.colSecond); - } else { - thTree.addStyle(HtmlStyle.colFirst); - } + thTree.addStyle(HtmlStyle.colConstructorName); thTree.addAttr(HtmlAttr.SCOPE, "row"); } diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java index 4010138211d..941538e83d3 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java @@ -46,6 +46,7 @@ public enum HtmlStyle { bottomNav, circle, classUseContainer, + colConstructorName, colFirst, colLast, colSecond, diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css index 470fd9d3010..c0eeeb42590 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css @@ -540,14 +540,14 @@ Table styles text-align:left; padding:0px 0px 12px 10px; } -th.colFirst, th.colSecond, th.colLast, .useSummary th, .constantsSummary th, .packagesSummary th, +th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .useSummary th, .constantsSummary th, .packagesSummary th, td.colFirst, td.colSecond, td.colLast, .useSummary td, .constantsSummary td { vertical-align:top; padding-right:0px; padding-top:8px; padding-bottom:3px; } -th.colFirst, th.colSecond, th.colLast, .constantsSummary th, .packagesSummary th { +th.colFirst, th.colSecond, th.colLast, th.colConstructorName, .constantsSummary th, .packagesSummary th { background:#dee3e9; text-align:left; padding:8px 3px 3px 7px; @@ -556,7 +556,7 @@ td.colFirst, th.colFirst { white-space:nowrap; font-size:13px; } -td.colSecond, th.colSecond, td.colLast, th.colLast { +td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colLast { font-size:13px; } .constantsSummary th, .packagesSummary th { @@ -573,8 +573,8 @@ td.colSecond, th.colSecond, td.colLast, th.colLast { .usesSummary td.colFirst, .usesSummary th.colFirst, .providesSummary td.colFirst, .providesSummary th.colFirst, .memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colSecond, .memberSummary th.colSecond, -.typeSummary td.colFirst{ +.memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName, +.typeSummary td.colFirst { vertical-align:top; } .packagesSummary th.colLast, .packagesSummary td.colLast { @@ -584,6 +584,8 @@ td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:h td.colSecond a:link, td.colSecond a:active, td.colSecond a:visited, td.colSecond a:hover, th.colFirst a:link, th.colFirst a:active, th.colFirst a:visited, th.colFirst a:hover, th.colSecond a:link, th.colSecond a:active, th.colSecond a:visited, th.colSecond a:hover, +th.colConstructorName a:link, th.colConstructorName a:active, th.colConstructorName a:visited, +th.colConstructorName a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { diff --git a/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java b/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java index 404ff945291..1b443469f09 100644 --- a/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java +++ b/langtools/test/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 + * @bug 4951228 6290760 8025633 8026567 8081854 8162363 8175200 8177417 * @summary Test the case where the overriden method returns a different * type than the method in the child class. Make sure the * documentation is inherited but the return type isn't. @@ -43,7 +43,7 @@ public class TestMemberSummary extends JavadocTester { @Test void test() { - javadoc("-d", "out", + javadoc("-d", "out", "-private", "-sourcepath", testSrc, "pkg","pkg2"); checkExit(Exit.OK); @@ -55,7 +55,15 @@ public class TestMemberSummary extends JavadocTester { + "returnTypeTest​()", // Check return type in member detail. "
        public "
        -                + "PublicChild returnTypeTest​()
        "); + + "PublicChild returnTypeTest​()", + "
        "); + + checkOutput("pkg/PrivateParent.html", true, + "\n" + + ""); // Legacy anchor dimensions (6290760) checkOutput("pkg2/A.html", true, diff --git a/langtools/test/jdk/javadoc/doclet/testMemberSummary/pkg/PrivateParent.java b/langtools/test/jdk/javadoc/doclet/testMemberSummary/pkg/PrivateParent.java index a3fa4bd0f0b..86d671db7d4 100644 --- a/langtools/test/jdk/javadoc/doclet/testMemberSummary/pkg/PrivateParent.java +++ b/langtools/test/jdk/javadoc/doclet/testMemberSummary/pkg/PrivateParent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,12 @@ package pkg; class PrivateParent { + /** + * Test private constructor. + * @param i a test parameter. + */ + private PrivateParent(int i) { + } /** * Test to make sure the member summary inherits documentation diff --git a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java index 944d99494b7..b5b9c373f02 100644 --- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java +++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 + * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417 * @summary Run tests on doclet stylesheet. * @author jamieh * @library ../lib @@ -140,8 +140,8 @@ public class TestStylesheet extends JavadocTester { + ".usesSummary td.colFirst, .usesSummary th.colFirst,\n" + ".providesSummary td.colFirst, .providesSummary th.colFirst,\n" + ".memberSummary td.colFirst, .memberSummary th.colFirst,\n" - + ".memberSummary td.colSecond, .memberSummary th.colSecond,\n" - + ".typeSummary td.colFirst{\n" + + ".memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,\n" + + ".typeSummary td.colFirst {\n" + " vertical-align:top;\n" + "}", ".overviewSummary td, .memberSummary td, .typeSummary td,\n" From 97a88e5a275e23b5e203f667a1285ebe907892ee Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Tue, 4 Apr 2017 15:15:59 -0700 Subject: [PATCH 12/75] 8177332: The presence of a file with a Japanese ShiftJIS name can cause javac to fail Reviewed-by: jjg, jlahoda --- .../com/sun/tools/javac/file/JavacFileManager.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java index 5689334fdcd..959c88bc789 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java @@ -473,10 +473,14 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil } } else { if (isValidFile(fname, fileKinds)) { - RelativeFile file = new RelativeFile(subdirectory, fname); - JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this, - file.resolveAgainst(directory), userPath, file); - resultList.append(fe); + try { + RelativeFile file = new RelativeFile(subdirectory, fname); + JavaFileObject fe = PathFileObject.forDirectoryPath(JavacFileManager.this, + file.resolveAgainst(directory), userPath, file); + resultList.append(fe); + } catch (InvalidPathException e) { + throw new IOException("error accessing directory " + directory + e); + } } } } From 66b1b4dc54975b3a62597742ba86927340eea35e Mon Sep 17 00:00:00 2001 From: John Jiang Date: Tue, 4 Apr 2017 19:58:24 -0700 Subject: [PATCH 13/75] 8165367: Additional tests for JEP 288: Disable SHA-1 Certificates The new tests just focus on the usage constraints TLSSever and TLSClient with TLS communication Reviewed-by: ascarpino --- .../ssl/CertPathRestrictions/JSSEClient.java | 48 ++ .../ssl/CertPathRestrictions/JSSEServer.java | 65 +++ .../CertPathRestrictions/TLSRestrictions.java | 544 ++++++++++++++++++ ...A1-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key | 26 + ...TY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256.cer | 81 +++ ...SHA256-INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key | 26 + ...TITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1.cer | 81 +++ ...A256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key | 26 + ...TY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256.cer | 81 +++ ...A256-INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key | 26 + ...TY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1.cer | 81 +++ ...56-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key | 26 + ..._SHA256-INTER_CA_SHA256-ROOT_CA_SHA256.cer | 81 +++ .../certs/INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key | 26 + .../certs/INTER_CA_SHA1-ROOT_CA_SHA1.cer | 80 +++ .../INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key | 26 + .../certs/INTER_CA_SHA1-ROOT_CA_SHA256.cer | 80 +++ .../INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key | 26 + .../certs/INTER_CA_SHA256-ROOT_CA_SHA1.cer | 80 +++ .../INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key | 26 + .../certs/INTER_CA_SHA256-ROOT_CA_SHA256.cer | 80 +++ .../certs/ROOT_CA_SHA1-PRIV.key | 26 + .../certs/ROOT_CA_SHA1.cer | 80 +++ .../certs/ROOT_CA_SHA256-PRIV.key | 26 + .../certs/ROOT_CA_SHA256.cer | 80 +++ 25 files changed, 1828 insertions(+) create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1.cer create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256-PRIV.key create mode 100644 jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256.cer diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java new file mode 100644 index 00000000000..636809ba9d2 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEClient.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetSocketAddress; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; + +/* + * A SSL socket client. + */ +public class JSSEClient { + + public static void main(String[] args) throws Exception { + System.out.println("Client: arguments=" + String.join("; ", args)); + + int port = Integer.valueOf(args[0]); + String[] trustNames = args[1].split(TLSRestrictions.DELIMITER); + String[] certNames = args[2].split(TLSRestrictions.DELIMITER); + String constraint = args[3]; + + TLSRestrictions.setConstraint("Client", constraint); + + SSLContext context = TLSRestrictions.createSSLContext( + trustNames, certNames); + SSLSocketFactory socketFactory = context.getSocketFactory(); + try (SSLSocket socket = (SSLSocket) socketFactory.createSocket()) { + socket.connect(new InetSocketAddress("localhost", port), + TLSRestrictions.TIMEOUT); + socket.setSoTimeout(TLSRestrictions.TIMEOUT); + System.out.println("Client: connected"); + + InputStream sslIS = socket.getInputStream(); + OutputStream sslOS = socket.getOutputStream(); + sslOS.write('C'); + sslOS.flush(); + sslIS.read(); + System.out.println("Client: finished"); + } catch (Exception e) { + throw new RuntimeException("Client: failed.", e); + } + } +} diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java new file mode 100644 index 00000000000..80d76e9b58d --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/JSSEServer.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ + +import java.io.InputStream; +import java.io.OutputStream; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.SSLSocket; + +/* + * A SSL socket server. + */ +public class JSSEServer { + + private SSLServerSocket server = null; + + private Exception exception = null; + + public JSSEServer(SSLContext context, String constraint, + boolean needClientAuth) throws Exception { + TLSRestrictions.setConstraint("Server", constraint); + + SSLServerSocketFactory serverFactory = context.getServerSocketFactory(); + server = (SSLServerSocket) serverFactory.createServerSocket(0); + server.setSoTimeout(TLSRestrictions.TIMEOUT); + server.setNeedClientAuth(needClientAuth); // for dual authentication + System.out.println("Server: port=" + getPort()); + } + + public void start() { + new Thread(new Runnable() { + + @Override + public void run() { + try { + System.out.println("Server: started"); + try (SSLSocket socket = (SSLSocket) server.accept()) { + socket.setSoTimeout(TLSRestrictions.TIMEOUT); + InputStream sslIS = socket.getInputStream(); + OutputStream sslOS = socket.getOutputStream(); + sslIS.read(); + sslOS.write('S'); + sslOS.flush(); + System.out.println("Server: finished"); + } + } catch (Exception e) { + e.printStackTrace(System.out); + exception = e; + } + } + }).start(); + } + + public int getPort() { + return server.getLocalPort(); + } + + public Exception getException() { + return exception; + } +} diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java new file mode 100644 index 00000000000..35293d1b8a6 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java @@ -0,0 +1,544 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.SocketTimeoutException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.KeyFactory; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.Security; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Base64; +import java.util.stream.Collectors; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLHandshakeException; +import javax.net.ssl.TrustManagerFactory; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +/* + * @test + * @summary Verify the restrictions for certificate path on JSSE with custom trust store. + * @library /test/lib + * @compile JSSEClient.java + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions DEFAULT + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C1 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S1 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C2 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S2 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C3 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S3 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C4 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S4 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C5 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S5 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C6 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S6 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C7 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S7 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C8 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S8 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions C9 + * @run main/othervm -Djava.security.debug=certpath TLSRestrictions S9 + */ +public class TLSRestrictions { + + private static final String TEST_CLASSES = System.getProperty("test.classes"); + private static final char[] PASSWORD = "".toCharArray(); + private static final String CERT_DIR = System.getProperty("cert.dir", + System.getProperty("test.src") + "/certs"); + + static final String PROP = "jdk.certpath.disabledAlgorithms"; + static final String NOSHA1 = "MD2, MD5"; + private static final String TLSSERVER = "SHA1 usage TLSServer"; + private static final String TLSCLIENT = "SHA1 usage TLSClient"; + static final String JDKCATLSSERVER = "SHA1 jdkCA & usage TLSServer"; + static final String JDKCATLSCLIENT = "SHA1 jdkCA & usage TLSClient"; + + // This is a space holder in command arguments, and stands for none certificate. + static final String NONE_CERT = "NONE_CERT"; + + static final String DELIMITER = ","; + static final int TIMEOUT = 30000; + + // It checks if java.security contains constraint "SHA1 jdkCA & usage TLSServer" + // for jdk.certpath.disabledAlgorithms by default. + private static void checkDefaultConstraint() { + System.out.println( + "Case: Checks the default value of jdk.certpath.disabledAlgorithms"); + if (!Security.getProperty(PROP).contains(JDKCATLSSERVER)) { + throw new RuntimeException(String.format( + "%s doesn't contain constraint \"%s\", the real value is \"%s\".", + PROP, JDKCATLSSERVER, Security.getProperty(PROP))); + } + } + + /* + * This method creates trust store and key store with specified certificates + * respectively. And then it creates SSL context with the stores. + * If trustNames contains NONE_CERT only, it does not create a custom trust + * store, but the default one in JDK. + * + * @param trustNames Trust anchors, which are used to create custom trust store. + * If null, no custom trust store is created and the default + * trust store in JDK is used. + * @param certNames Certificate chain, which is used to create key store. + * It cannot be null. + */ + static SSLContext createSSLContext(String[] trustNames, + String[] certNames) throws Exception { + CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); + + TrustManagerFactory tmf = null; + if (trustNames != null && trustNames.length > 0 + && !trustNames[0].equals(NONE_CERT)) { + KeyStore trustStore = KeyStore.getInstance("JKS"); + trustStore.load(null, null); + for (int i = 0; i < trustNames.length; i++) { + try (InputStream is = new ByteArrayInputStream( + loadCert(trustNames[i]).getBytes())) { + Certificate trustCert = certFactory.generateCertificate(is); + trustStore.setCertificateEntry("trustCert-" + i, trustCert); + } + } + + tmf = TrustManagerFactory.getInstance("PKIX"); + tmf.init(trustStore); + } + + Certificate[] certChain = new Certificate[certNames.length]; + for (int i = 0; i < certNames.length; i++) { + try (InputStream is = new ByteArrayInputStream( + loadCert(certNames[i]).getBytes())) { + Certificate cert = certFactory.generateCertificate(is); + certChain[i] = cert; + } + } + + PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec( + Base64.getMimeDecoder().decode(loadPrivKey(certNames[0]))); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privKey = keyFactory.generatePrivate(privKeySpec); + + KeyStore keyStore = KeyStore.getInstance("JKS"); + keyStore.load(null, null); + keyStore.setKeyEntry("keyCert", privKey, PASSWORD, certChain); + + KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509"); + kmf.init(keyStore, PASSWORD); + + SSLContext context = SSLContext.getInstance("TLS"); + context.init(kmf.getKeyManagers(), + tmf == null ? null : tmf.getTrustManagers(), null); + return context; + } + + /* + * This method sets jdk.certpath.disabledAlgorithms, and then retrieves + * and prints its value. + */ + static void setConstraint(String side, String constraint) { + System.out.printf("%s: Old %s=%s%n", side, PROP, + Security.getProperty(PROP)); + Security.setProperty(PROP, constraint); + System.out.printf("%s: New %s=%s%n", side, PROP, + Security.getProperty(PROP)); + } + + /* + * This method is used to run a variety of cases. + * It launches a server, and then takes a client to connect the server. + * Both of server and client use the same certificates. + * + * @param trustNames Trust anchors, which are used to create custom trust store. + * If null, the default trust store in JDK is used. + * @param certNames Certificate chain, which is used to create key store. + * It cannot be null. The first certificate is regarded as + * the end entity. + * @param serverConstraint jdk.certpath.disabledAlgorithms value on server side. + * @param clientConstraint jdk.certpath.disabledAlgorithms value on client side. + * @param needClientAuth If true, server side acquires client authentication; + * otherwise, false. + * @param pass If true, the connection should be blocked; otherwise, false. + */ + static void testConstraint(String[] trustNames, String[] certNames, + String serverConstraint, String clientConstraint, + boolean needClientAuth, boolean pass) throws Exception { + String trustNameStr = trustNames == null ? "" + : String.join(DELIMITER, trustNames); + String certNameStr = certNames == null ? "" + : String.join(DELIMITER, certNames); + + System.out.printf("Case:%n" + + " trustNames=%s; certNames=%s%n" + + " serverConstraint=%s; clientConstraint=%s%n" + + " needClientAuth=%s%n" + + " pass=%s%n%n", + trustNameStr, certNameStr, + serverConstraint, clientConstraint, + needClientAuth, + pass); + + JSSEServer server = new JSSEServer( + createSSLContext(trustNames, certNames), + serverConstraint, + needClientAuth); + int port = server.getPort(); + server.start(); + + // Run client on another JVM so that its properties cannot be in conflict + // with server's. + OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm( + "-Dcert.dir=" + CERT_DIR, + "-Djava.security.debug=certpath", + "-classpath", + TEST_CLASSES, + "JSSEClient", + port + "", + trustNameStr, + certNameStr, + clientConstraint); + int exitValue = outputAnalyzer.getExitValue(); + String clientOut = outputAnalyzer.getOutput(); + + Exception serverException = server.getException(); + if (serverException != null) { + System.out.println("Server: failed"); + } + + System.out.println("---------- Client output start ----------"); + System.out.println(clientOut); + System.out.println("---------- Client output end ----------"); + + if (serverException instanceof SocketTimeoutException + || clientOut.contains("SocketTimeoutException")) { + System.out.println("The communication gets timeout and skips the test."); + return; + } + + if (pass) { + if (serverException != null || exitValue != 0) { + throw new RuntimeException( + "Unexpected failure. Operation was blocked."); + } + } else { + if (serverException == null && exitValue == 0) { + throw new RuntimeException( + "Unexpected pass. Operation was allowed."); + } + + // The test may encounter non-SSL issues, like network problem. + if (!(serverException instanceof SSLHandshakeException + || clientOut.contains("SSLHandshakeException"))) { + throw new RuntimeException("Failure with unexpected exception."); + } + } + } + + /* + * This method is used to run a variety of cases, which don't require client + * authentication by default. + */ + static void testConstraint(String[] trustNames, String[] certNames, + String serverConstraint, String clientConstraint, boolean pass) + throws Exception { + testConstraint(trustNames, certNames, serverConstraint, clientConstraint, + false, pass); + } + + public static void main(String[] args) throws Exception { + switch (args[0]) { + // Case DEFAULT only checks one of default settings for + // jdk.certpath.disabledAlgorithms in JDK/conf/security/java.security. + case "DEFAULT": + checkDefaultConstraint(); + break; + + // Cases C1 and S1 use SHA256 root CA in trust store, + // and use SHA256 end entity in key store. + // C1 only sets constraint "SHA1 usage TLSServer" on client side; + // S1 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should not be blocked. + case "C1": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { "INTER_CA_SHA256-ROOT_CA_SHA256" }, + NOSHA1, + TLSSERVER, + true); + break; + case "S1": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { "INTER_CA_SHA256-ROOT_CA_SHA256" }, + TLSCLIENT, + NOSHA1, + true, + true); + break; + + // Cases C2 and S2 use SHA256 root CA in trust store, + // and use SHA1 end entity in key store. + // C2 only sets constraint "SHA1 usage TLSServer" on client side; + // S2 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should be blocked. + case "C2": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { "INTER_CA_SHA1-ROOT_CA_SHA256" }, + NOSHA1, + TLSSERVER, + false); + break; + case "S2": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { "INTER_CA_SHA1-ROOT_CA_SHA256" }, + TLSCLIENT, + NOSHA1, + true, + false); + break; + + // Cases C3 and S3 use SHA1 root CA in trust store, + // and use SHA1 end entity in key store. + // C3 only sets constraint "SHA1 usage TLSServer" on client side; + // S3 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should be blocked. + case "C3": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { "INTER_CA_SHA1-ROOT_CA_SHA1" }, + NOSHA1, + TLSSERVER, + false); + break; + case "S3": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { "INTER_CA_SHA1-ROOT_CA_SHA1" }, + TLSCLIENT, + NOSHA1, + true, + false); + break; + + // Cases C4 and S4 use SHA1 root CA as trust store, + // and use SHA256 end entity in key store. + // C4 only sets constraint "SHA1 usage TLSServer" on client side; + // S4 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should not be blocked. + case "C4": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { "INTER_CA_SHA256-ROOT_CA_SHA1" }, + NOSHA1, + TLSSERVER, + true); + break; + case "S4": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { "INTER_CA_SHA256-ROOT_CA_SHA1" }, + TLSCLIENT, + NOSHA1, + true, + true); + break; + + // Cases C5 and S5 use SHA1 root CA in trust store, + // and use SHA256 intermediate CA and SHA256 end entity in key store. + // C5 only sets constraint "SHA1 usage TLSServer" on client side; + // S5 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should not be blocked. + case "C5": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1", + "INTER_CA_SHA256-ROOT_CA_SHA1" }, + NOSHA1, + TLSSERVER, + true); + break; + case "S5": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1", + "INTER_CA_SHA256-ROOT_CA_SHA1" }, + TLSCLIENT, + NOSHA1, + true, + true); + break; + + // Cases C6 and S6 use SHA1 root CA as trust store, + // and use SHA1 intermediate CA and SHA256 end entity in key store. + // C6 only sets constraint "SHA1 usage TLSServer" on client side; + // S6 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should be blocked. + case "C6": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1", + "INTER_CA_SHA1-ROOT_CA_SHA1" }, + NOSHA1, + TLSSERVER, + false); + break; + case "S6": + testConstraint( + new String[] { "ROOT_CA_SHA1" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1", + "INTER_CA_SHA1-ROOT_CA_SHA1" }, + TLSCLIENT, + NOSHA1, + true, + false); + break; + + // Cases C7 and S7 use SHA256 root CA in trust store, + // and use SHA256 intermediate CA and SHA1 end entity in key store. + // C7 only sets constraint "SHA1 usage TLSServer" on client side; + // S7 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should be blocked. + case "C7": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { + "END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256", + "INTER_CA_SHA256-ROOT_CA_SHA256" }, + NOSHA1, + TLSSERVER, + false); + break; + case "S7": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { + "END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256", + "INTER_CA_SHA256-ROOT_CA_SHA256" }, + TLSCLIENT, + NOSHA1, + true, + false); + break; + + // Cases C8 and S8 use SHA256 root CA in trust store, + // and use SHA1 intermediate CA and SHA256 end entity in key store. + // C8 only sets constraint "SHA1 usage TLSServer" on client side; + // S8 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should be blocked. + case "C8": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256", + "INTER_CA_SHA1-ROOT_CA_SHA256" }, + NOSHA1, + TLSSERVER, + false); + break; + case "S8": + testConstraint( + new String[] { "ROOT_CA_SHA256" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256", + "INTER_CA_SHA1-ROOT_CA_SHA256" }, + TLSCLIENT, + NOSHA1, + true, + false); + break; + + // Cases C9 and S9 use SHA256 root CA and SHA1 intermediate CA in trust store, + // and use SHA256 end entity in key store. + // C9 only sets constraint "SHA1 usage TLSServer" on client side; + // S9 only sets constraint "SHA1 usage TLSClient" on server side with client auth. + // The connection of the both cases should not be blocked. + case "C9": + testConstraint( + new String[] { + "ROOT_CA_SHA256", + "INTER_CA_SHA1-ROOT_CA_SHA256" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256" }, + NOSHA1, + TLSSERVER, + true); + break; + case "S9": + testConstraint( + new String[] { + "ROOT_CA_SHA256", + "INTER_CA_SHA1-ROOT_CA_SHA256" }, + new String[] { + "END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256" }, + TLSCLIENT, + NOSHA1, + true, + true); + break; + } + + System.out.println("Case passed"); + System.out.println("========================================"); + } + + private static String loadCert(String certName) { + try { + Path certFilePath = Paths.get(CERT_DIR, certName + ".cer"); + return String.join("\n", + Files.lines(certFilePath).filter((String line) -> { + return !line.startsWith("Certificate") + && !line.startsWith(" "); + }).collect(Collectors.toList())); + } catch (IOException e) { + throw new RuntimeException("Load certificate failed", e); + } + } + + private static String loadPrivKey(String certName) { + Path priveKeyFilePath = Paths.get(CERT_DIR, certName + "-PRIV.key"); + try { + return new String(Files.readAllBytes(priveKeyFilePath)); + } catch (IOException e) { + throw new RuntimeException("Load private key failed", e); + } + } +} diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key new file mode 100644 index 00000000000..8da367c7055 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCYQDZxHxNJV8dQ +I6mfJjuIZxAe5CX9GCrS3Fajh5DXIQwdcvQ4s6YdKzwFn+8dUdspdNTnS+bWjfYw +0iAbsMt6L6ewutaZf6aufh1EBYiwNOvN8C8Cx0iiE8NiBo833AYWHKhDC4qu63QR +dYwb9j+Jg8t6p0lQ64sFLDN/RJOcWlaPQbJbSNBKePQR7WOFvdJgFAdQmQjL+ND6 +PSui9QByyXQ+3nfs7ID4paUxYbCrJMh5/AJqaT04DYDEumfmURUn5+ZOIqmqvI2I +pNXN5gVzL3b8mM2WGr5dpRY5cZ1X//BQ91SNjrKNJlmKFr7nMCfAdzxIW4b/sArv +eYNE2Vy7AgMBAAECggEBAJNtkopFoiJiKnFypxyiJAG4cwbGu/ZxwX3/uLGPY3S9 +3oJhvxVs+IzEQdHchempSwTAyizS9cuLGfs6bbcConZF0Sa0NXvb/SZ4npQwm6St +Ci2Xx530JWQ0qPyyB1r65rXguBp8AaXR/8msPqkQ8YOSqKWzea4u96Zhn9g8Koe6 +AD/8FeSzJBDVbJ+C7jKX/7sKsHbYqulzLMQf0lqXFxpGW+5UJaozoQOWXnnmqU3T +0i4uaGUCXHbQM8eh3fvMFCU4UQMYVS1QOSvZJTnO5bSb8SqeQnCMnQ18ltq4sL43 +qFsEcmAjrlhNoBwslqvfY1bX9NtXyFZ8PuD8OvoFxPkCgYEAxlVfD2qcrAoOcbDe +Em9hDVPizRuzGuCHi9K2YLDrLVDNd6NF3Pk65JiTsd1fA2AZdi+ljKGEwBhNFOyk +qwmK2K4sYy7zvyV3Blmwvyo7+OaeexYF8RIw5keGlRsgHTGarzlQAlJu91UmyAmE +C/99fZbSWo9QndJ0FVR6G3ti71UCgYEAxITBJqVtNFnv4PGdc3FNsYXlRQcSWjs9 +/1lsppLQjC6HMsb6JpxYUF3D4oFiUESKe/9kZzl1H/65Cm2mYq8sj+7lug8P5tz7 +DQa91dFM02r8JLO6TitSuZfbc0XH0K450ntuQlKX581icYSGBUwQHGApespuNVlh +Mg7CmwNse88CgYAienrhEjaUTdc++nFQoR4tE/UslPEo7fmCXCoqWvc3VIGzl6Ww +iX8seD3MwOAglRc4DYZpETcjsdXMmmrx9OG3U2gSAfqLszai2vq38N6mIWlRmn2D +8BaiIbMKvsFxccsjRQJctPnnc10fj0/uSgcFyy9cYOex2AEoKBxmJKgJVQKBgA0c +HhaJ6qMXbN1AwRQ2dsxk9kqIkjzavuQN/yWNncP8RqCojX+N5oZV+v9dSkW4jNSA +0R3hw2KDB60ea38h2IMxmLm0z4bDLyxLSta8w7dG59M6+i7EzRv8eXNTMGVHeiwE +d/KMt/2Kwgp4oMgxrtF1yM6cOoXslINWYL0emVoZAoGAcEKzO8LgPJsIVjRFz3ri +0AQqiXQzYek2WAXYhlQCvBVn8in3MYcxKhjA3Og3Lym0xvZ+/8SbII9QNaidbgIH +HDreeJW4KE5EfVnDaYcxwK/9LXZXndIxrpR0YKNSvZT7DuuQtFCoxJcASxb1k9Tc +5MPT+pyPL+9v2q56ry56qas= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256.cer new file mode 100644 index 00000000000..21872d79ba9 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256.cer @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + e8:33:78:c7:69:9c:28:c2 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA256 + Validity + Not Before: Mar 30 04:51:07 2017 GMT + Not After : Mar 28 04:51:07 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA1-INTER_CA_SHA256-ROOT_CA_SHA256 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:98:40:36:71:1f:13:49:57:c7:50:23:a9:9f:26: + 3b:88:67:10:1e:e4:25:fd:18:2a:d2:dc:56:a3:87: + 90:d7:21:0c:1d:72:f4:38:b3:a6:1d:2b:3c:05:9f: + ef:1d:51:db:29:74:d4:e7:4b:e6:d6:8d:f6:30:d2: + 20:1b:b0:cb:7a:2f:a7:b0:ba:d6:99:7f:a6:ae:7e: + 1d:44:05:88:b0:34:eb:cd:f0:2f:02:c7:48:a2:13: + c3:62:06:8f:37:dc:06:16:1c:a8:43:0b:8a:ae:eb: + 74:11:75:8c:1b:f6:3f:89:83:cb:7a:a7:49:50:eb: + 8b:05:2c:33:7f:44:93:9c:5a:56:8f:41:b2:5b:48: + d0:4a:78:f4:11:ed:63:85:bd:d2:60:14:07:50:99: + 08:cb:f8:d0:fa:3d:2b:a2:f5:00:72:c9:74:3e:de: + 77:ec:ec:80:f8:a5:a5:31:61:b0:ab:24:c8:79:fc: + 02:6a:69:3d:38:0d:80:c4:ba:67:e6:51:15:27:e7: + e6:4e:22:a9:aa:bc:8d:88:a4:d5:cd:e6:05:73:2f: + 76:fc:98:cd:96:1a:be:5d:a5:16:39:71:9d:57:ff: + f0:50:f7:54:8d:8e:b2:8d:26:59:8a:16:be:e7:30: + 27:c0:77:3c:48:5b:86:ff:b0:0a:ef:79:83:44:d9: + 5c:bb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256 + serial:84:A1:70:1D:0A:92:D3:CC + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 22:63:2a:de:80:70:92:f7:53:e4:7f:ea:01:2b:13:b3:1b:02: + 2e:10:b4:1d:b7:33:7f:6f:0d:88:46:5a:b8:db:83:95:77:e2: + db:da:2e:31:0a:85:c6:9a:75:84:ca:73:5c:be:e3:30:22:7e: + bc:60:43:49:7c:69:06:14:4a:89:e4:23:ca:25:99:85:d6:06: + 16:d5:9e:a8:fd:25:43:88:07:12:0a:7e:de:24:33:71:ab:a4: + 23:aa:4e:dc:0f:89:ef:a9:09:89:55:a1:1d:ee:48:35:ea:10: + 42:ff:98:15:2a:e8:5c:46:e0:e4:4f:4c:b9:07:e0:da:08:6f: + ce:4a:fe:98:3e:ae:c5:e5:6a:6e:50:0f:2d:39:01:55:ed:59: + 0b:65:30:54:e8:72:26:ee:9f:cf:3f:ce:6a:20:c8:87:c9:81: + bc:f8:b3:ec:77:bb:bc:5b:8c:3f:18:fd:08:76:ad:27:59:fc: + b8:74:96:0d:cd:ed:97:91:6b:95:89:3a:f3:78:de:9f:06:a6: + ce:36:01:f0:be:ae:d8:d6:c4:3d:51:8a:2a:e0:43:59:8c:b4: + eb:63:93:9d:53:72:f8:4b:a3:c7:4a:da:2e:56:33:b6:46:1b: + 45:a8:23:1b:82:de:6d:4e:e0:18:cf:9b:ba:22:68:8b:8c:de: + 6f:08:2d:bc +-----BEGIN CERTIFICATE----- +MIID/jCCAuagAwIBAgIJAOgzeMdpnCjCMA0GCSqGSIb3DQEBBQUAMG8xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMScwJQYDVQQDDB5JTlRFUl9DQV9TSEEyNTYtUk9PVF9D +QV9TSEEyNTYwHhcNMTcwMzMwMDQ1MTA3WhcNMjcwMzI4MDQ1MTA3WjB/MQswCQYD +VQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09y +ZzENMAsGA1UECwwESmF2YTE3MDUGA1UEAwwuRU5EX0VOVElUWV9TSEExLUlOVEVS +X0NBX1NIQTI1Ni1ST09UX0NBX1NIQTI1NjCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAJhANnEfE0lXx1AjqZ8mO4hnEB7kJf0YKtLcVqOHkNchDB1y9Diz +ph0rPAWf7x1R2yl01OdL5taN9jDSIBuwy3ovp7C61pl/pq5+HUQFiLA0683wLwLH +SKITw2IGjzfcBhYcqEMLiq7rdBF1jBv2P4mDy3qnSVDriwUsM39Ek5xaVo9BsltI +0Ep49BHtY4W90mAUB1CZCMv40Po9K6L1AHLJdD7ed+zsgPilpTFhsKskyHn8Ampp +PTgNgMS6Z+ZRFSfn5k4iqaq8jYik1c3mBXMvdvyYzZYavl2lFjlxnVf/8FD3VI2O +so0mWYoWvucwJ8B3PEhbhv+wCu95g0TZXLsCAwEAAaOBjDCBiTB5BgNVHSMEcjBw +oWOkYTBfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkx +DDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEXMBUGA1UEAwwOUk9PVF9DQV9T +SEEyNTaCCQCEoXAdCpLTzDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IB +AQAiYyregHCS91Pkf+oBKxOzGwIuELQdtzN/bw2IRlq424OVd+Lb2i4xCoXGmnWE +ynNcvuMwIn68YENJfGkGFEqJ5CPKJZmF1gYW1Z6o/SVDiAcSCn7eJDNxq6Qjqk7c +D4nvqQmJVaEd7kg16hBC/5gVKuhcRuDkT0y5B+DaCG/OSv6YPq7F5WpuUA8tOQFV +7VkLZTBU6HIm7p/PP85qIMiHyYG8+LPsd7u8W4w/GP0Idq0nWfy4dJYNze2XkWuV +iTrzeN6fBqbONgHwvq7Y1sQ9UYoq4ENZjLTrY5OdU3L4S6PHStouVjO2RhtFqCMb +gt5tTuAYz5u6ImiLjN5vCC28 +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key new file mode 100644 index 00000000000..cd99ead5d10 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDaYlKNTU1iQes/ +BtivvM1ixjCk1muM1RdMkJQItZB21y1kM1OLp3EmGKqVqwKbS5OTrMIxjPUwD9Ly +aRJMvSP1xve7zwmNXOngA8eukmQ2olQU58ble6IAHcj4qg7a38E1ITvDmAswhTzK +fI4Z6okLCjKfYafnfbi5JA+E6fiArB3zimjne+tiUNYZh2eYspsOOw6cmaLtIbMP +ZyXy4iP6OCNIikb08Da27zjVn04i1SeUEv1YFmn4B9GWcNLAXyM1LmCNi70+SATp +aZYRjr/BBR6LNZMBsNKJblWFXK3UtfYFiypyirgQjzPtLb1XsuMhfqMt8QZDh8n3 +YvYTW59xAgMBAAECggEAb4NPdhnoDulsL5XWZf55vhtH0ZQv/Qz+xbj57myQJS8B +Xa4b1i8dRv/Hc3+MaDIyXHEWBGle9jjOVbwzfP4D88eyzrMMxKOSRTKI72qPQ5qm +ZrpnxNzZv0d2TQvBZCBnrzKWKu1joVYX0anCghdR/VIqwVoDe+Clx9xTFGLI4yKO +7v0dkr4Hxn3NT6bTV18V6PoGbUgIsmpNYQPFyUM/IHG2ewDffLP+tm7RsEfKYmcx +Hr70pmWBpM9hwTAC+uXHuNXnsX4IjEQOXmm4PJ/A/sm2Bad93SPwi15e29MV8YbO +vvirGLaepa7AUvqoK0DFNCLU6vCeFJ7DUZ/u2P8x8QKBgQDxNOWvy3EV4/P/ocSf +itMtXZWj4driT4vUGwFZWfr3CVpZVaUmqXYeVdzNGuoWlmXOiOAuOepnlA36FCb5 +aGE4cq/hbdtbr+v6awEj5/A2me/ax1W1z6lD0pg0QJ7KvqFCBzVol5yTiWZKBVE+ +jp2waPfes770AUHczw9KKvEGtQKBgQDnxxiZAxtoNmOaB/NZmPNBKvWDw858+QX2 ++u/jEH3pW393tUnipgIoo6yvd6djhJ6/4ViOxdioMIQCBab/xuSB4lfQsrJsWvS9 +uYB794s7CV2r3kUa3ux8wAovW6Fc369nD7JjUPX/Cq3zdlyTDt9LVLRCpZ6Li1xB +r0ZVlpgPTQKBgQCgKay+X0tW6sdxHfyOp8Lz46liaa1LCuDhVZE+wHXZpXc9zJXe +JzZMjF0SQGXh27n8O30IlOJmJrRlMw5yG/I6ZkUNXkIDDryVyom2SuOBjhPrZOMv +15UgeO0h/Sqzm4M+ccTwD4Qjn1+xlPhOnqpsoja8xQPtyAvwz/jqGbtz5QKBgH01 +pSgj8Y5es3fmi6P/aInv9ynzgX0p2fsOnMEBi8Og1j+JBB0YqVni8crozNiKMGhg +CEM4xk41x1qASzMp8w/ngqEPqCu5BzXnHG3b0K9X4+6Q6KwXeZH6/IWQ7p8Jh+wZ +IrlcZ0gcMNSxQFmBU0eSvr6yUe/4nSIu2cQq0oKRAoGAUEFd0LxZw50BdCdpJlcQ ++oTbSUYQhAzPF2ybfR6i8IxXoOjVxpvRehlbwXIQV7XEqamXFTmBLIvuAlF1yWoH +hzxNJuEgPRTPztnHD6LVzvuf2ain+CFZuDrXBT2l8PyF9BNL4/DMRrbgdCxr9F0O +Ti0VJo1TRE8vVzUfVc9w1RI= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1.cer new file mode 100644 index 00000000000..c2cb37cb0eb --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1.cer @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 86:09:85:57:41:bf:86:65 + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA1 + Validity + Not Before: Mar 30 04:51:06 2017 GMT + Not After : Mar 28 04:51:06 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:da:62:52:8d:4d:4d:62:41:eb:3f:06:d8:af:bc: + cd:62:c6:30:a4:d6:6b:8c:d5:17:4c:90:94:08:b5: + 90:76:d7:2d:64:33:53:8b:a7:71:26:18:aa:95:ab: + 02:9b:4b:93:93:ac:c2:31:8c:f5:30:0f:d2:f2:69: + 12:4c:bd:23:f5:c6:f7:bb:cf:09:8d:5c:e9:e0:03: + c7:ae:92:64:36:a2:54:14:e7:c6:e5:7b:a2:00:1d: + c8:f8:aa:0e:da:df:c1:35:21:3b:c3:98:0b:30:85: + 3c:ca:7c:8e:19:ea:89:0b:0a:32:9f:61:a7:e7:7d: + b8:b9:24:0f:84:e9:f8:80:ac:1d:f3:8a:68:e7:7b: + eb:62:50:d6:19:87:67:98:b2:9b:0e:3b:0e:9c:99: + a2:ed:21:b3:0f:67:25:f2:e2:23:fa:38:23:48:8a: + 46:f4:f0:36:b6:ef:38:d5:9f:4e:22:d5:27:94:12: + fd:58:16:69:f8:07:d1:96:70:d2:c0:5f:23:35:2e: + 60:8d:8b:bd:3e:48:04:e9:69:96:11:8e:bf:c1:05: + 1e:8b:35:93:01:b0:d2:89:6e:55:85:5c:ad:d4:b5: + f6:05:8b:2a:72:8a:b8:10:8f:33:ed:2d:bd:57:b2: + e3:21:7e:a3:2d:f1:06:43:87:c9:f7:62:f6:13:5b: + 9f:71 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1 + serial:8D:A0:D2:8A:EE:0B:CF:65 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 29:b0:10:dc:45:ee:68:77:5f:12:9b:fc:de:eb:70:41:2e:6a: + a2:5f:a9:cc:ca:97:24:01:4a:1d:c2:78:52:57:34:9c:83:7f: + 60:f5:d9:68:a2:32:89:e9:d7:25:71:72:71:e5:76:e3:37:af: + 41:25:cc:8b:a4:fd:81:ef:6b:15:2b:91:3c:68:a5:25:53:cf: + c1:b9:aa:49:b4:cd:e3:3c:a2:8e:38:ea:e8:51:7c:7b:92:41: + bd:a3:22:7d:97:59:ad:55:e2:7d:9d:6a:bb:1f:95:84:1c:50: + 00:e9:6c:74:1d:bb:6c:07:ca:bc:6a:a2:dd:c1:66:37:64:bd: + fe:1a:c0:8c:a7:8c:a1:60:b8:c3:d2:5f:92:80:ee:ad:79:29: + f2:ad:e2:9f:74:39:bf:3b:a4:b6:25:2a:87:3f:36:49:b9:52: + fd:91:33:be:1d:41:a9:76:29:47:6e:c7:db:a8:ab:6e:78:91: + c0:13:56:1c:25:41:51:a7:64:4f:07:c0:2a:a8:80:63:8d:98: + e0:54:7d:a6:f4:22:6b:70:fa:1c:16:82:f4:07:2e:e1:ba:94: + 96:ec:c7:9e:8e:0a:24:1e:a4:e9:c0:92:ca:bd:32:98:ef:1f: + e1:a6:e6:4d:1f:c5:68:1b:77:d0:e0:35:1a:a9:c9:ee:98:72: + 7b:c3:e7:51 +-----BEGIN CERTIFICATE----- +MIID9jCCAt6gAwIBAgIJAIYJhVdBv4ZlMA0GCSqGSIb3DQEBCwUAMGsxCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMSMwIQYDVQQDDBpJTlRFUl9DQV9TSEExLVJPT1RfQ0Ff +U0hBMTAeFw0xNzAzMzAwNDUxMDZaFw0yNzAzMjgwNDUxMDZaMH0xCzAJBgNVBAYT +AlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0w +CwYDVQQLDARKYXZhMTUwMwYDVQQDDCxFTkRfRU5USVRZX1NIQTI1Ni1JTlRFUl9D +QV9TSEExLVJPT1RfQ0FfU0hBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBANpiUo1NTWJB6z8G2K+8zWLGMKTWa4zVF0yQlAi1kHbXLWQzU4uncSYYqpWr +AptLk5OswjGM9TAP0vJpEky9I/XG97vPCY1c6eADx66SZDaiVBTnxuV7ogAdyPiq +DtrfwTUhO8OYCzCFPMp8jhnqiQsKMp9hp+d9uLkkD4Tp+ICsHfOKaOd762JQ1hmH +Z5iymw47DpyZou0hsw9nJfLiI/o4I0iKRvTwNrbvONWfTiLVJ5QS/VgWafgH0ZZw +0sBfIzUuYI2LvT5IBOlplhGOv8EFHos1kwGw0oluVYVcrdS19gWLKnKKuBCPM+0t +vVey4yF+oy3xBkOHyfdi9hNbn3ECAwEAAaOBijCBhzB3BgNVHSMEcDBuoWGkXzBd +MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkxDDAKBgNV +BAoMA09yZzENMAsGA1UECwwESmF2YTEVMBMGA1UEAwwMUk9PVF9DQV9TSEExggkA +jaDSiu4Lz2UwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAKbAQ3EXu +aHdfEpv83utwQS5qol+pzMqXJAFKHcJ4Ulc0nIN/YPXZaKIyienXJXFyceV24zev +QSXMi6T9ge9rFSuRPGilJVPPwbmqSbTN4zyijjjq6FF8e5JBvaMifZdZrVXifZ1q +ux+VhBxQAOlsdB27bAfKvGqi3cFmN2S9/hrAjKeMoWC4w9JfkoDurXkp8q3in3Q5 +vzuktiUqhz82SblS/ZEzvh1BqXYpR27H26irbniRwBNWHCVBUadkTwfAKqiAY42Y +4FR9pvQia3D6HBaC9Acu4bqUluzHno4KJB6k6cCSyr0ymO8f4abmTR/FaBt30OA1 +GqnJ7phye8PnUQ== +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key new file mode 100644 index 00000000000..3f9ad5384df --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDaCsiXcNnu7WpV +t+FarvFhtaRr4RMQbKGhiIHi4aV0vqWmpX/eFde01eQZTZcPGJzEnjJrkyFo3Wbd +31bjBLpt40kkI7kbODHrA2L+vY/hoCQeXK8+BrGioX9qHOpD7OLI3Esm1+KDiPPK +w6qr9O9nS/fOID3zly92r+obY2ZuW6jQC0Yah3K9INrSIjH+rHXsmj2U5dCnktfi +LzRcocvqtQHASYXFXEhWr1TCMnSz7h+l07O5YgYpmhwkRIPCkcdP+9wGhO2eOJYU +kfaBteodDh7vHj2F+A6Lheosa4mi/nysyhQJl8uBFw97dqab9ul5Tb03iHmaY/q0 +xJKcEohnAgMBAAECggEBAJsa6K6yHJWWVfo8IBb+M7+qExiat5ELdb8O+DaJBcYS +iIwPVvKI3zVIokZNp5OZkotbbcqQk0ehl7dlVM2RY30gHbuTne36/6eKdTV5a4y4 ++niOviqFYH+sGpNFlnBTZtAzxVIQaJXhKmum3RYN2u/EXrdGwEsz1RO89/AbuZXu +VdtEKkjPHXrIjnBkiT4271sm3OiPwOe6g0NKBMJ4InTyB+YtpgxlXtF+vv5cv6Vt +ayT3sNsdsD8HLrenMmwv/k7nTYgNbhaJX2YCs9W7ZEscU2th6F7Cx6Z0z9h1SElC ++OKKhU6HnG/pWFMfWu80ZNjb3NTpXzTv4CLKjEYvz6ECgYEA8qEe+Ga7+XD0XwPB +bFjoKmhOQhv0VCIiu9RgvIxQn5DuGX4H2hO1GP8LYOQZBm25nICIa+DyDZEaFGgL +QgfPI4boK/rdV8syFTUNfw1Wq+W/pHhqzgUGHAnzRpX8jBQa9of14O+B7//ZFdGj +5nt0qFTOAgNGslXMvSicKD/g0mMCgYEA5g7MpMmZI8zPf/PKLBkrQegdX2TBBiI5 +3KzvQuA29tEFdVwUIuhkgQkmy1u9Ujw0jZZ8NVBOsqfg7e7XkVr6/OF+MVWBjWl3 +Jn3DMCHl/HCLIZ4ZOM6/ydIMpBX6Ii53nvpO6vxRaOUg2T2gVHadVjjQAN9Oj68r +TKUHfs4rTy0CgYB/g5QuQnfqKaYUxXmDQtqJZxYyAlUPXn1Yr85DaY75vYaVGTpx +L0hPIcNOIbLRQRt6l8aaw7cS0D6fmOrJwibn6f/dFVP8zwq8QIyeSFlTsERe4PZo +3hUO6V/UqgD3cZ2WEXB0zgtBIfpqUCpOeHWf/inivuwJz7PxegVP1fqHNwKBgA0p +CZHfqm/+1lvmcUlGg0/43D1JwTT9nju+dM1pkBtcZ6iIBOreSmmLQXnenJzorsTu +t9pA5s+XhOl3gUNiZfszVwmxb4DMaLF9/j1xovtm4L6ikaTLRvNfnbOBQlbUO6mP +fhY5KtsKSG/E87gBNQzqoRN7sr3Lcnmm8x/Q4W9dAoGAITDcOI7UgPcnKMO8JUI5 +96Po3c/S7nBilVZRFOwjn0z6jrjzNTd+1IqkzIKBWfs5WlRkzXI6LPJVghwPUqUa +q2C/3hQATD3FchEIohLfd8bj/wObaZNlKJB59a1RjxRZxuVQl3jvovvpn/hdXuJB +nGIx7MryEG/yRpfrk2DL0bI= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256.cer new file mode 100644 index 00000000000..22390ed7d7e --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256.cer @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 9e:f7:d7:79:1c:06:83:d5 + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA256 + Validity + Not Before: Mar 30 04:51:05 2017 GMT + Not After : Mar 28 04:51:05 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA1-ROOT_CA_SHA256-PRIV + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:da:0a:c8:97:70:d9:ee:ed:6a:55:b7:e1:5a:ae: + f1:61:b5:a4:6b:e1:13:10:6c:a1:a1:88:81:e2:e1: + a5:74:be:a5:a6:a5:7f:de:15:d7:b4:d5:e4:19:4d: + 97:0f:18:9c:c4:9e:32:6b:93:21:68:dd:66:dd:df: + 56:e3:04:ba:6d:e3:49:24:23:b9:1b:38:31:eb:03: + 62:fe:bd:8f:e1:a0:24:1e:5c:af:3e:06:b1:a2:a1: + 7f:6a:1c:ea:43:ec:e2:c8:dc:4b:26:d7:e2:83:88: + f3:ca:c3:aa:ab:f4:ef:67:4b:f7:ce:20:3d:f3:97: + 2f:76:af:ea:1b:63:66:6e:5b:a8:d0:0b:46:1a:87: + 72:bd:20:da:d2:22:31:fe:ac:75:ec:9a:3d:94:e5: + d0:a7:92:d7:e2:2f:34:5c:a1:cb:ea:b5:01:c0:49: + 85:c5:5c:48:56:af:54:c2:32:74:b3:ee:1f:a5:d3: + b3:b9:62:06:29:9a:1c:24:44:83:c2:91:c7:4f:fb: + dc:06:84:ed:9e:38:96:14:91:f6:81:b5:ea:1d:0e: + 1e:ef:1e:3d:85:f8:0e:8b:85:ea:2c:6b:89:a2:fe: + 7c:ac:ca:14:09:97:cb:81:17:0f:7b:76:a6:9b:f6: + e9:79:4d:bd:37:88:79:9a:63:fa:b4:c4:92:9c:12: + 88:67 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256 + serial:84:A1:70:1D:0A:92:D3:CD + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 89:84:ce:6d:80:83:e7:19:80:21:a5:d3:79:ac:c4:2f:5c:5f: + 47:f1:1c:e7:40:2a:57:ec:76:01:a9:10:b6:a2:2b:1b:02:ac: + f7:46:b1:67:b3:36:0f:fa:f0:a3:40:c2:5a:38:00:67:a9:9d: + e8:59:be:2f:5b:d0:c6:6c:20:90:c0:3b:6b:af:75:8c:93:ac: + 5a:1e:8b:66:2c:79:0b:6d:9d:0d:d3:68:b5:b6:df:d6:04:6b: + 24:f7:5a:b9:f0:18:08:81:b1:50:1c:ac:1b:7a:b7:b8:d8:8e: + 6f:15:78:7e:23:5f:41:5c:df:76:09:1a:67:36:15:35:6a:77: + 36:09:19:50:12:6d:60:20:c1:7a:36:cb:4c:ee:a8:d7:b7:c7: + 29:26:31:04:0a:44:48:25:be:dd:00:92:ea:8c:00:ee:b4:eb: + 52:4a:da:47:97:d7:42:df:dd:7d:17:de:e3:a1:14:49:3b:2d: + aa:ac:e7:83:0f:c0:2d:3f:31:c5:af:bb:b1:1e:53:d1:a7:13: + 55:e3:25:f6:67:95:a1:75:e9:b8:a1:81:eb:d0:de:8a:a3:af: + 78:dc:d0:39:d0:e7:d6:61:9e:39:7b:8b:f9:ee:44:48:78:92: + e7:22:fa:9c:a4:d0:6b:2b:89:0a:fa:78:3d:7a:af:44:91:e5: + 8a:40:2f:10 +-----BEGIN CERTIFICATE----- +MIIEAjCCAuqgAwIBAgIJAJ7313kcBoPVMA0GCSqGSIb3DQEBCwUAMG0xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMSUwIwYDVQQDDBxJTlRFUl9DQV9TSEExLVJPT1RfQ0Ff +U0hBMjU2MB4XDTE3MDMzMDA0NTEwNVoXDTI3MDMyODA0NTEwNVowgYQxCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMTwwOgYDVQQDDDNFTkRfRU5USVRZX1NIQTI1Ni1JTlRF +Ul9DQV9TSEExLVJPT1RfQ0FfU0hBMjU2LVBSSVYwggEiMA0GCSqGSIb3DQEBAQUA +A4IBDwAwggEKAoIBAQDaCsiXcNnu7WpVt+FarvFhtaRr4RMQbKGhiIHi4aV0vqWm +pX/eFde01eQZTZcPGJzEnjJrkyFo3Wbd31bjBLpt40kkI7kbODHrA2L+vY/hoCQe +XK8+BrGioX9qHOpD7OLI3Esm1+KDiPPKw6qr9O9nS/fOID3zly92r+obY2ZuW6jQ +C0Yah3K9INrSIjH+rHXsmj2U5dCnktfiLzRcocvqtQHASYXFXEhWr1TCMnSz7h+l +07O5YgYpmhwkRIPCkcdP+9wGhO2eOJYUkfaBteodDh7vHj2F+A6Lheosa4mi/nys +yhQJl8uBFw97dqab9ul5Tb03iHmaY/q0xJKcEohnAgMBAAGjgYwwgYkweQYDVR0j +BHIwcKFjpGEwXzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARD +aXR5MQwwCgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFzAVBgNVBAMMDlJPT1Rf +Q0FfU0hBMjU2ggkAhKFwHQqS080wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsF +AAOCAQEAiYTObYCD5xmAIaXTeazEL1xfR/Ec50AqV+x2AakQtqIrGwKs90axZ7M2 +D/rwo0DCWjgAZ6md6Fm+L1vQxmwgkMA7a691jJOsWh6LZix5C22dDdNotbbf1gRr +JPdaufAYCIGxUBysG3q3uNiObxV4fiNfQVzfdgkaZzYVNWp3NgkZUBJtYCDBejbL +TO6o17fHKSYxBApESCW+3QCS6owA7rTrUkraR5fXQt/dfRfe46EUSTstqqzngw/A +LT8xxa+7sR5T0acTVeMl9meVoXXpuKGB69DeiqOveNzQOdDn1mGeOXuL+e5ESHiS +5yL6nKTQayuJCvp4PXqvRJHlikAvEA== +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key new file mode 100644 index 00000000000..8584f50ec7e --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHC0ieOFNTJjP+ +HMlFQ/w50Hx/+FYh9z9w3i08dVvi8oEhGUop7fvsqEyuAj3U/BYG87Wsv27wfa9l +qSJRSgqUT3yI4jsMY/ozUInuKpp/yL97abyZVDUZc3diDZqryA/Qur8HNVLyA2hD +DA9x8Ioeu5EDFl7AeqV3jx+A8fbulwVeCa29GByVkWRUEVF/48a1jpazBf2YQvrm +5ElWoG8fuMrz6vgj+gYZYb1GPXmJQrtAIRp4Z1/AquPS4A/O21DnPLEM8WSw+rSC +KGGKMqefJw74zeVyPlOiOmjFTeNfeVDViQrDgU++CTDjFa8XhweU6v+MtY5Mmzmf +2AETGyd9AgMBAAECggEANCdMu8hebOcRsH+ybSfHKw7p0E4to3C5esV8bN8DWI/a +LeYGfL4SyIvAq8eClBAJZYDuFXmDhBgqoSSUDWCtLPc21lcQycpYgKGVwoX/PYRI +R/oIpNRfpW+P1G1kHaaqHjMQYr8iIK+r3gWG9n/kcPEMqhZudVitiopB4vODlDgf +OI0goNWwYOPzoBkJSBbgfYC7vSz0dg+j9ooYPDnyUnHjykhu95mkmBHYc/MVMP8s +ntFB5pgtWuLQATZImW4A1dtZiqCsF6APvJIQASxVq+wv3dwhejF9xMZR96QchVZJ +QvPOcH76njIH4fThb0e46Dn54+KBpCnveSnDtAz5sQKBgQD2u6gWOK/Z4VqGlff1 +diLqzesdalCJhydKzOGRzRiJeW4E4MhEpUjIo44zPGkQ64zq6nefqIltdiaE7T9C +Fnyu/+vd0zE1v3Ipgv0wD3NgTj3gGrBwl2gkY5sfSbCR+8vS/DhRU+s3KN45m3s4 +XfM27Uw/Zh/DFIe7jmGezfe/3wKBgQDOhRjDfxDDLCEXw4QFQb7Sp/43EGfoTd8h +m700T/QXUTGx6qRhzHF9mUVea7FT+3I6CEqYNnZtFlYsJlq1g457rnvUJnTjJZb7 +wFl1h+u4u3IKo/lUUh2vD89PPOkMUF/uamJLh5jK7KNkOjwEDN2yPkRgaedY++nv +NBcUPpGUIwKBgEkFmOWauVC+hVA3qj8XS5Y6g08dW+CYA2T75faEwLJPIeSHsj2+ +vR/EaB15z46WaApOgkDaXHHs+dF1dbdVeGlCjMgF7RZ/JoZqogxLRlZGUcG1pGpu +JQBACnTkFkHeR6CVzQUk1QRqL/rUrU8tXwHukRZiXxwZQ2Ka7QFW6+/5AoGAHGem +Dk2NyqppKtGTeP2f921vw7cX85WyWPcIwQc2NXbPdP8m+OSbv4CzT9dUHo75GQ5G +5ESpaTunQo9L7qdXk59eHMHlVdC3wYylQUsemtv9RYVkJ7rbplZwVx+zliP/7dTo +DCdsVozRtFlmI9B5Najm0rP+Q/jyJhpuCjTI5S0CgYEAsYcmFZZotwOyT4oJ/1Fu +BtSOsoxnCa1vPJTVXEoX3F28ZUP4X0iWgGDO1e3aoWWYxWusf1fUj9BWbVnbtJfb +gJ5JtQTAuMvmjCwFRWcBUytdxTUsWFbuDc5fw7DMW7YqjkCCISkd6Q8JyaFsJPy1 +7uFzumBnFtZGUIo2w4l8yrQ= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1.cer new file mode 100644 index 00000000000..8b9f080920e --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1.cer @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 9e:b3:99:30:15:24:2c:69 + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA1 + Validity + Not Before: Mar 30 04:51:06 2017 GMT + Not After : Mar 28 04:51:06 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:c7:0b:48:9e:38:53:53:26:33:fe:1c:c9:45:43: + fc:39:d0:7c:7f:f8:56:21:f7:3f:70:de:2d:3c:75: + 5b:e2:f2:81:21:19:4a:29:ed:fb:ec:a8:4c:ae:02: + 3d:d4:fc:16:06:f3:b5:ac:bf:6e:f0:7d:af:65:a9: + 22:51:4a:0a:94:4f:7c:88:e2:3b:0c:63:fa:33:50: + 89:ee:2a:9a:7f:c8:bf:7b:69:bc:99:54:35:19:73: + 77:62:0d:9a:ab:c8:0f:d0:ba:bf:07:35:52:f2:03: + 68:43:0c:0f:71:f0:8a:1e:bb:91:03:16:5e:c0:7a: + a5:77:8f:1f:80:f1:f6:ee:97:05:5e:09:ad:bd:18: + 1c:95:91:64:54:11:51:7f:e3:c6:b5:8e:96:b3:05: + fd:98:42:fa:e6:e4:49:56:a0:6f:1f:b8:ca:f3:ea: + f8:23:fa:06:19:61:bd:46:3d:79:89:42:bb:40:21: + 1a:78:67:5f:c0:aa:e3:d2:e0:0f:ce:db:50:e7:3c: + b1:0c:f1:64:b0:fa:b4:82:28:61:8a:32:a7:9f:27: + 0e:f8:cd:e5:72:3e:53:a2:3a:68:c5:4d:e3:5f:79: + 50:d5:89:0a:c3:81:4f:be:09:30:e3:15:af:17:87: + 07:94:ea:ff:8c:b5:8e:4c:9b:39:9f:d8:01:13:1b: + 27:7d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1 + serial:8D:A0:D2:8A:EE:0B:CF:64 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 2b:43:e4:c1:37:36:00:a3:ed:25:15:c7:9f:6b:25:0e:24:cd: + 1c:e8:d2:8c:a6:11:05:a9:2b:b5:dc:7b:fd:55:8e:be:1d:15: + d7:8b:a8:a6:44:cf:03:ba:ba:78:74:26:b9:19:11:c0:03:9b: + 4d:2f:f9:f7:ea:da:a3:2f:82:f9:9e:d0:77:d6:bf:eb:fd:57: + c8:eb:03:54:0a:0c:2b:36:0c:e5:99:b7:93:4d:a9:9d:e9:50: + 80:66:4e:73:c1:bd:83:13:09:ee:b9:01:62:ed:90:0e:4f:ff: + 9d:92:f3:cd:db:1f:ba:da:fc:67:9d:cb:a0:09:99:8b:3e:ea: + 9d:61:55:ac:6f:fb:11:5c:c0:fe:fb:ff:5b:15:7d:a7:c1:aa: + 3a:cd:30:43:35:ea:44:8a:21:ae:9f:af:bc:5c:ae:3a:01:2c: + 3b:eb:b6:8c:6a:e1:1c:4e:55:0a:84:5b:f8:68:71:aa:97:02: + 9b:5d:c4:c9:42:df:19:91:28:4a:12:35:8d:2e:3d:10:ec:35: + 8a:b1:d7:e0:e2:a6:f9:f6:47:4b:17:75:84:8e:2d:66:e8:74: + be:d6:27:6b:a2:28:23:26:41:70:92:c2:7c:50:e2:81:c9:e0: + 10:84:5d:87:4f:db:93:ce:dd:09:d2:48:63:3d:53:66:31:64: + 5a:13:b5:a6 +-----BEGIN CERTIFICATE----- +MIID+jCCAuKgAwIBAgIJAJ6zmTAVJCxpMA0GCSqGSIb3DQEBCwUAMG0xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMSUwIwYDVQQDDBxJTlRFUl9DQV9TSEEyNTYtUk9PVF9D +QV9TSEExMB4XDTE3MDMzMDA0NTEwNloXDTI3MDMyODA0NTEwNlowfzELMAkGA1UE +BhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MQwwCgYDVQQKDANPcmcx +DTALBgNVBAsMBEphdmExNzA1BgNVBAMMLkVORF9FTlRJVFlfU0hBMjU2LUlOVEVS +X0NBX1NIQTI1Ni1ST09UX0NBX1NIQTEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDHC0ieOFNTJjP+HMlFQ/w50Hx/+FYh9z9w3i08dVvi8oEhGUop7fvs +qEyuAj3U/BYG87Wsv27wfa9lqSJRSgqUT3yI4jsMY/ozUInuKpp/yL97abyZVDUZ +c3diDZqryA/Qur8HNVLyA2hDDA9x8Ioeu5EDFl7AeqV3jx+A8fbulwVeCa29GByV +kWRUEVF/48a1jpazBf2YQvrm5ElWoG8fuMrz6vgj+gYZYb1GPXmJQrtAIRp4Z1/A +quPS4A/O21DnPLEM8WSw+rSCKGGKMqefJw74zeVyPlOiOmjFTeNfeVDViQrDgU++ +CTDjFa8XhweU6v+MtY5Mmzmf2AETGyd9AgMBAAGjgYowgYcwdwYDVR0jBHAwbqFh +pF8wXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MQww +CgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFTATBgNVBAMMDFJPT1RfQ0FfU0hB +MYIJAI2g0oruC89kMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBACtD +5ME3NgCj7SUVx59rJQ4kzRzo0oymEQWpK7Xce/1Vjr4dFdeLqKZEzwO6unh0JrkZ +EcADm00v+ffq2qMvgvme0HfWv+v9V8jrA1QKDCs2DOWZt5NNqZ3pUIBmTnPBvYMT +Ce65AWLtkA5P/52S883bH7ra/Gedy6AJmYs+6p1hVaxv+xFcwP77/1sVfafBqjrN +MEM16kSKIa6fr7xcrjoBLDvrtoxq4RxOVQqEW/hocaqXAptdxMlC3xmRKEoSNY0u +PRDsNYqx1+Dipvn2R0sXdYSOLWbodL7WJ2uiKCMmQXCSwnxQ4oHJ4BCEXYdP25PO +3QnSSGM9U2YxZFoTtaY= +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key new file mode 100644 index 00000000000..7fa63685714 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDuH2+6I/ytoLeW +AG3J0xMQafYmxYDZNaDjiWBl7TGpL4TjRY84FuHI/G8ib0VY9DKtyUixm7qZev+b +ExrfQGk9ZV7Dn41uBvmGcUMSqwb0QV/5/hneP7/3EXhoWjsCFUe0r0zOgCM7O9+F +jUlSuxEHyaFE09PxWGVZpU4Yu71PeoI/JJGITV81o2Fst7Urz65NE5OWrvbO+pfD +EiRvjLv/uil7znYV28lCbH7U1K8q5nGVtnpgTguhGL6/N3lIgvxoBtoXEQwdMV59 +APsH8anA19rHn5h/ZmknryxAs0c6Rg9Plo30MonIU/eAVZwNw8TczD276Rc02xnW +RmbmxToRAgMBAAECggEAbK3OWV9JWJlMkNqbQQzj247w+FsV5ozSZGbzpzFtg/Eb +Lns11XykCg4kTswIE4RIiQaf9efEb34yoL1Ee3YzUgEtEg2FCB2IzvJskV2ba+lW +e4uclNH1tDa2BLKB0f6SXoXPgUP8UHGQH60PNQIJ0MsWnoorZjBY+WQ305QD3/yB +fMonkjpWN+ZNTY8Y3vA2SsS4EoY0Ndy2FpmWPwKKMCcqXw6xzVjKvq+jpFfsGpcj +i3MlKsCG5koreWrXdyt28CVOc6eMW5rsJfAHRw+OSn7PdLaGyZCUUsFXCjG0Vq2G +YwuMfTJprrZk+lbi3XUXWk7XUEURB7Q4lIBxAcskAQKBgQD8pVj0OIsVHAGjQQ7C +ZAnxFlON7XX3fgPdLtil9c+a1GlcPA2K52fBp8YlKlAS4bmZIQHbbkEBjh8KfG1P +x7zBHoUXV8ruo/axzRPoeBVQat5NQKcKnlITrqdf8J3a+8iMxpMpd53h97HGiayq +W04ZQNf7wjXvR+pJVluTEaoVUQKBgQDxSLruMmCsYvD+sipaQ3rBEMIAI3kc7ctl +fEnipEk5wtPkKKldw+rvbh/AwY2i2JMUDcW92hkB5vCvbcKmCEkEO3FbawNkJnJi +qfwbvHP/fGThMV3gbWWF3GZvBKY2+toSa2rwoR5kYTT1e4+byk38NAp/HAItFHIT +DgAgMy6owQKBgQCjd8jKnBtBmVFl9B48oMXd+/gsCM0fSaXuYvVCzH17TJyvVRve +GEQGBSwrt+j/jpWsArNU602cV/y1qDSCPlZfDgRHSkK/jc9805hh/fCsi7kyevaZ +5D5vBb6+UM2Sdv8YNxPY7NB2+PFJ6KKTx2gM5uvYtZx4KivpL7souXE3QQKBgDxg +FZ5q7rPUIjepP13MyteqqNC+D51Eh4PCgP58W3JfpQPPhOnYj14QMVPbWuSnys3W +0Gc8PsuyDQHoti8znYm4khntAjE6SZ8Up+gM1P3WE6wh3Tq+RQwk5WDcSfcx+AVp +6Z2Cw4ccp9LRc1LpYXA9WW8LBCRhnFXWSAPGquNBAoGAdCsvFzSipQ5qxWPlClRM +lKqDdQheRl9IKCuImXZAvdX952VhmP7QV5PUwLV/CkVquvSdRSshrMO/fqFjfkjr +puajXghFXa+YppQW42tPYBmKDnNVgxW5d5sC62AYaykh2iNw3v4BJyN+MMmkSf0M +4/mKvs5m8N2OkOpY6r2wCp8= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256.cer new file mode 100644 index 00000000000..c503f92fb12 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256.cer @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + e8:33:78:c7:69:9c:28:c1 + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA256 + Validity + Not Before: Mar 30 04:51:04 2017 GMT + Not After : Mar 28 04:51:04 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=END_ENTITY_SHA256-INTER_CA_SHA256-ROOT_CA_SHA256 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:ee:1f:6f:ba:23:fc:ad:a0:b7:96:00:6d:c9:d3: + 13:10:69:f6:26:c5:80:d9:35:a0:e3:89:60:65:ed: + 31:a9:2f:84:e3:45:8f:38:16:e1:c8:fc:6f:22:6f: + 45:58:f4:32:ad:c9:48:b1:9b:ba:99:7a:ff:9b:13: + 1a:df:40:69:3d:65:5e:c3:9f:8d:6e:06:f9:86:71: + 43:12:ab:06:f4:41:5f:f9:fe:19:de:3f:bf:f7:11: + 78:68:5a:3b:02:15:47:b4:af:4c:ce:80:23:3b:3b: + df:85:8d:49:52:bb:11:07:c9:a1:44:d3:d3:f1:58: + 65:59:a5:4e:18:bb:bd:4f:7a:82:3f:24:91:88:4d: + 5f:35:a3:61:6c:b7:b5:2b:cf:ae:4d:13:93:96:ae: + f6:ce:fa:97:c3:12:24:6f:8c:bb:ff:ba:29:7b:ce: + 76:15:db:c9:42:6c:7e:d4:d4:af:2a:e6:71:95:b6: + 7a:60:4e:0b:a1:18:be:bf:37:79:48:82:fc:68:06: + da:17:11:0c:1d:31:5e:7d:00:fb:07:f1:a9:c0:d7: + da:c7:9f:98:7f:66:69:27:af:2c:40:b3:47:3a:46: + 0f:4f:96:8d:f4:32:89:c8:53:f7:80:55:9c:0d:c3: + c4:dc:cc:3d:bb:e9:17:34:db:19:d6:46:66:e6:c5: + 3a:11 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256 + serial:84:A1:70:1D:0A:92:D3:CC + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 1d:1a:87:7d:11:0e:cc:cd:7f:6c:ed:21:1a:2c:35:de:09:b8: + c4:cf:0c:31:00:3d:f5:bd:d4:6e:f0:4f:7e:c2:8d:d6:c5:28: + ed:38:9d:d7:52:32:e2:8d:7b:64:c8:1d:4e:69:7e:49:5f:e1: + 5e:04:c7:d3:96:d2:63:ef:2c:35:4f:eb:08:2b:9d:b0:15:df: + 33:d8:1c:59:8e:bb:f1:28:4f:f0:85:bb:3c:56:e1:86:a4:75: + 2b:44:8a:1c:98:ae:94:f3:b6:76:a9:a3:e7:d6:bc:58:ef:fe: + 32:11:6f:76:5b:85:f8:14:91:83:2c:b6:20:a5:48:48:8b:6e: + ee:a8:6c:2b:12:18:94:3e:59:5e:a6:66:53:dc:40:b2:da:fd: + a4:5f:16:35:b6:20:2b:31:86:9b:91:55:b2:35:63:d2:47:bd: + 91:7e:43:bc:d6:0e:dc:95:1a:f0:8d:08:e5:66:cd:d1:0b:32: + d6:92:26:3e:78:e8:70:74:e1:14:64:b0:39:5d:7c:d0:28:23: + c7:83:53:02:90:fe:fc:9e:aa:9a:fb:c4:ef:9d:d5:22:f6:c1: + fd:e4:07:04:25:4f:8f:b2:13:6f:0d:51:cc:54:b4:38:d3:ac: + 31:aa:94:c5:d0:c8:5a:58:35:13:87:3e:f6:74:26:8c:2b:7d: + 6c:8e:36:a5 +-----BEGIN CERTIFICATE----- +MIIEATCCAumgAwIBAgIJAOgzeMdpnCjBMA0GCSqGSIb3DQEBCwUAMG8xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMScwJQYDVQQDDB5JTlRFUl9DQV9TSEEyNTYtUk9PVF9D +QV9TSEEyNTYwHhcNMTcwMzMwMDQ1MTA0WhcNMjcwMzI4MDQ1MTA0WjCBgTELMAkG +A1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MQwwCgYDVQQKDANP +cmcxDTALBgNVBAsMBEphdmExOTA3BgNVBAMMMEVORF9FTlRJVFlfU0hBMjU2LUlO +VEVSX0NBX1NIQTI1Ni1ST09UX0NBX1NIQTI1NjCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAO4fb7oj/K2gt5YAbcnTExBp9ibFgNk1oOOJYGXtMakvhONF +jzgW4cj8byJvRVj0Mq3JSLGbupl6/5sTGt9AaT1lXsOfjW4G+YZxQxKrBvRBX/n+ +Gd4/v/cReGhaOwIVR7SvTM6AIzs734WNSVK7EQfJoUTT0/FYZVmlThi7vU96gj8k +kYhNXzWjYWy3tSvPrk0Tk5au9s76l8MSJG+Mu/+6KXvOdhXbyUJsftTUryrmcZW2 +emBOC6EYvr83eUiC/GgG2hcRDB0xXn0A+wfxqcDX2sefmH9maSevLECzRzpGD0+W +jfQyichT94BVnA3DxNzMPbvpFzTbGdZGZubFOhECAwEAAaOBjDCBiTB5BgNVHSME +cjBwoWOkYTBfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENp +dHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEXMBUGA1UEAwwOUk9PVF9D +QV9TSEEyNTaCCQCEoXAdCpLTzDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUA +A4IBAQAdGod9EQ7MzX9s7SEaLDXeCbjEzwwxAD31vdRu8E9+wo3WxSjtOJ3XUjLi +jXtkyB1OaX5JX+FeBMfTltJj7yw1T+sIK52wFd8z2BxZjrvxKE/whbs8VuGGpHUr +RIocmK6U87Z2qaPn1rxY7/4yEW92W4X4FJGDLLYgpUhIi27uqGwrEhiUPllepmZT +3ECy2v2kXxY1tiArMYabkVWyNWPSR72RfkO81g7clRrwjQjlZs3RCzLWkiY+eOhw +dOEUZLA5XXzQKCPHg1MCkP78nqqa+8TvndUi9sH95AcEJU+PshNvDVHMVLQ406wx +qpTF0MhaWDUThz72dCaMK31sjjal +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key new file mode 100644 index 00000000000..cb077627f1e --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1-PRIV.key @@ -0,0 +1,26 @@ +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDX1pPNXGpnPQNc +x9ReXrjbcHkIoyXcdXbhO0TnUBV5aGJTEn5/meDsK76Y2KDVyU/EO2jXpaQ5QiGn +UzY6vKIn6boqTov4NLYwBsVPdAG/xZyr5q7p6bnJ8WRj40A2JeOeZ3FMglRtBCNg +rYeEC4MDp2F41OVxsJZ4huodq94arqhD/hjE40g06UNa0I+/2dIpI2cSamIC5b3L +/DK3ol+gIw/OOxMCgzAUSjeH6nTrrW1hUeSKx0NPGWRLWzLQ2yxhYcXlsedNuKHo +ux/p3EkGXoGPajK7s7IlKj9CPQYwlQez37jCLJGovArqTr/8hxfrKMdZOl5bp+6H +6uWh6af7AgMBAAECggEAXrUsM79qfRR7pjmVCTe9G6T1pwGXum3clSYhrPIqChTw +mA0Ubr9Bv7/OKVlc8ZIdKzj6Xy2yquFGzRopQIrHCIZ5htjieC4BB3/hEmUP42s9 +vPxDIibJvD/s0hvEcD4d68LuJylFDHT1ZRWf0iQPAApxLckVSNa4n/hrQEvK8J+G +HIH8VATq9iHp/GQmmFB8b3ubqn46zDGqly14+TGP2KtVJlY9FuCpvmtZZZjJ+K09 +vYM+BATwje6N6PqX5a3Z+NFC1NK9CmC+U6ECJ27uhySn8kvlU/i/SOAnrPftByO7 +g7K8p2Qzq1LlVIUU/JTidNZGXTaTMOVg8eHLmyt92QKBgQD9a94rLqk9BUtVsTYa +AImt+KbUMB+Zi83cYDiCfNBkfIYw4dVUFJecmqZwg7IeqNwuSmXP41fASOvDel/L +8bOj/rPccVSG9pmU0ir5WK9n8zobogfAzvaFr8cmo+TVv0FOZZA8e/+UfVsiKAsW +3nwhwxN8ieILU1dtaNV1IfnAPwKBgQDaCM9URf+DFILI2WpuzKpk1loF6HrlklIn ++N0IFFcalqUpC8GhXTw7suypRBCZ+cp32h7WEcN9aHLMrnkDQP3bGTv53pJT5N9k +7nk9Bfrk0CJCxeMRKwtuMhLkOmT0eh2aB1lWR0owA5b1Gjtiz5kTW7NN2+paJCDz +SiDLVoFpRQKBgQCHvt0N4nuy/QACkd86BGm7b8LlTDXRCMsnrb73XqY9/VngG0gr +NrCTqV9YS6MAu1Dd1uo8djnN/QGU/xsLYpfoU4nCnk450SQpTH7Ke8/Rbb8FiECA +7hutNqAFuardOApiVRLy4zTfNFq5rBtsj5aMezMX9b/Ic0cUiyA0ExP1/wKBgQCp +SDvI34wRdqRQUtWa7xbAsdg1TBnXEjLtTAA4nKpAP4Q+CR2uLlhstW+fv/PvyIwV +X+mfJS2VubmgBzp3d0dhjAcP6mnL7yAvGiRRZ8ozSxG+rCuvEa+PQBuAzYHCeulu +xJPtM+56tt7GsDY5cpsT95eQNNWQZQqcOgqaNTDGzQKBgCmMwRP1HN0qUSSVO1d8 +8N17OoZe5yntppEjesYQrLf4AEgPS3Qj8dv0qfe3z1B0gAKlG9+OR8cUBCMGVyum +b51SiSi3LSm1VeuMfT7JDMSxTkbaI5CY7v+/5yCRFqikgBtCkHM9m4K95d3dVDO8 +JGrlKiKVIbu5LnQZMkPHRIEX diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1.cer new file mode 100644 index 00000000000..58a4043c636 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA1.cer @@ -0,0 +1,80 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 8d:a0:d2:8a:ee:0b:cf:65 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1 + Validity + Not Before: Mar 30 04:51:04 2017 GMT + Not After : Mar 28 04:51:04 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:d7:d6:93:cd:5c:6a:67:3d:03:5c:c7:d4:5e:5e: + b8:db:70:79:08:a3:25:dc:75:76:e1:3b:44:e7:50: + 15:79:68:62:53:12:7e:7f:99:e0:ec:2b:be:98:d8: + a0:d5:c9:4f:c4:3b:68:d7:a5:a4:39:42:21:a7:53: + 36:3a:bc:a2:27:e9:ba:2a:4e:8b:f8:34:b6:30:06: + c5:4f:74:01:bf:c5:9c:ab:e6:ae:e9:e9:b9:c9:f1: + 64:63:e3:40:36:25:e3:9e:67:71:4c:82:54:6d:04: + 23:60:ad:87:84:0b:83:03:a7:61:78:d4:e5:71:b0: + 96:78:86:ea:1d:ab:de:1a:ae:a8:43:fe:18:c4:e3: + 48:34:e9:43:5a:d0:8f:bf:d9:d2:29:23:67:12:6a: + 62:02:e5:bd:cb:fc:32:b7:a2:5f:a0:23:0f:ce:3b: + 13:02:83:30:14:4a:37:87:ea:74:eb:ad:6d:61:51: + e4:8a:c7:43:4f:19:64:4b:5b:32:d0:db:2c:61:61: + c5:e5:b1:e7:4d:b8:a1:e8:bb:1f:e9:dc:49:06:5e: + 81:8f:6a:32:bb:b3:b2:25:2a:3f:42:3d:06:30:95: + 07:b3:df:b8:c2:2c:91:a8:bc:0a:ea:4e:bf:fc:87: + 17:eb:28:c7:59:3a:5e:5b:a7:ee:87:ea:e5:a1:e9: + a7:fb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1 + serial:F1:3B:B7:FB:28:3F:52:09 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + d3:ce:da:23:e1:7c:73:fb:7f:26:d7:a4:3c:7b:17:01:75:ce: + a5:bd:75:f1:65:1b:56:27:ae:f8:97:a6:c4:ca:94:93:c9:12: + bb:c7:ec:2b:d5:38:d5:43:3a:6c:c2:51:3a:79:2f:d7:4e:da: + 2d:12:1f:b8:c2:4f:c8:ba:33:d3:f5:0c:78:cc:26:69:24:47: + 3f:ed:17:a0:7f:d0:20:fe:11:ca:75:50:1a:61:e1:91:b5:fa: + 91:04:e9:14:59:77:d4:29:0f:43:19:e0:dc:dd:a6:18:14:f4: + 33:3e:f0:cb:36:7b:18:04:03:dd:be:35:41:c4:3e:65:d2:67: + 44:73:ab:7f:d1:b9:26:7e:b3:1e:d0:e4:a4:52:83:60:a9:e6: + e1:bf:62:bb:9b:16:0c:97:ad:11:1a:2f:eb:92:ca:7e:98:15: + 46:23:59:5d:26:d9:ec:57:85:51:5b:09:f1:9b:1b:d3:5d:53: + 02:67:1a:e4:24:49:67:87:04:75:66:13:56:1b:8b:a1:08:de: + c8:4b:f8:87:73:6e:c2:31:ee:f6:32:14:45:32:a3:3f:e4:b1: + 0f:23:28:29:b4:a3:86:65:4f:2e:57:ad:8f:44:77:f8:4b:ea: + 7b:9d:8e:dc:cb:07:ee:b4:78:46:db:cd:12:eb:ad:ef:9b:8f: + 22:ba:83:7b +-----BEGIN CERTIFICATE----- +MIID1jCCAr6gAwIBAgIJAI2g0oruC89lMA0GCSqGSIb3DQEBBQUAMF0xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTEwHhcNMTcwMzMw +MDQ1MTA0WhcNMjcwMzI4MDQ1MTA0WjBrMQswCQYDVQQGEwJVUzELMAkGA1UECAwC +Q0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEj +MCEGA1UEAwwaSU5URVJfQ0FfU0hBMS1ST09UX0NBX1NIQTEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDX1pPNXGpnPQNcx9ReXrjbcHkIoyXcdXbhO0Tn +UBV5aGJTEn5/meDsK76Y2KDVyU/EO2jXpaQ5QiGnUzY6vKIn6boqTov4NLYwBsVP +dAG/xZyr5q7p6bnJ8WRj40A2JeOeZ3FMglRtBCNgrYeEC4MDp2F41OVxsJZ4huod +q94arqhD/hjE40g06UNa0I+/2dIpI2cSamIC5b3L/DK3ol+gIw/OOxMCgzAUSjeH +6nTrrW1hUeSKx0NPGWRLWzLQ2yxhYcXlsedNuKHoux/p3EkGXoGPajK7s7IlKj9C +PQYwlQez37jCLJGovArqTr/8hxfrKMdZOl5bp+6H6uWh6af7AgMBAAGjgYowgYcw +dwYDVR0jBHAwbqFhpF8wXTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYD +VQQHDARDaXR5MQwwCgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFTATBgNVBAMM +DFJPT1RfQ0FfU0hBMYIJAPE7t/soP1IJMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN +AQEFBQADggEBANPO2iPhfHP7fybXpDx7FwF1zqW9dfFlG1YnrviXpsTKlJPJErvH +7CvVONVDOmzCUTp5L9dO2i0SH7jCT8i6M9P1DHjMJmkkRz/tF6B/0CD+Ecp1UBph +4ZG1+pEE6RRZd9QpD0MZ4NzdphgU9DM+8Ms2exgEA92+NUHEPmXSZ0Rzq3/RuSZ+ +sx7Q5KRSg2Cp5uG/YrubFgyXrREaL+uSyn6YFUYjWV0m2exXhVFbCfGbG9NdUwJn +GuQkSWeHBHVmE1Ybi6EI3shL+IdzbsIx7vYyFEUyoz/ksQ8jKCm0o4ZlTy5XrY9E +d/hL6nudjtzLB+60eEbbzRLrre+bjyK6g3s= +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key new file mode 100644 index 00000000000..8997b5f69e0 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256-PRIV.key @@ -0,0 +1,26 @@ +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDWN68vV57EPqPZ +Dtvi2+NI4tfxUgkaWJXbqrLKuAJC8bff9edZpMXGAyqMpDDr7MAjs/3TDYpVaWYN +Id5iwqamImbBLYf/K0LOkaX6+TyogaqwwdNVryR5eYcGXEiJY1MJ2mgzCNeGJ091 +4qwll3xkjAFolB6o9QoIbLB3cctl0vw6oAoi3TKWQxJ+UI6/uBotX5eQ9z1b/MDs +6PNXHB22jYAj4tOePMZxq7AVCwTFpWbHK8j5ftXxpVoU5ECNHfIAHLprJqc/lKdf +7rMyflbsjD8nV7TwY+FW7WfOQgiJhk0OK3VaBeSsovpOOwjS4Lpsazh3eUXeZJUk +lrYrMfI3AgMBAAECggEAEpXmNx9NAQ3GPXDSlw4o3AwCXEeXzpdc+SAIPxpT5+b8 +4wt8tQRcvF9N88HTFMUHrpFRNlx4Ygyw8/a6SqtEtilJ7Py8TeE8/JsaYXn6T0xg +uNE4OrjlWzy2AFFFYdYiQDqYy8S6nkMO29V8xg4slrSm8qHXPyVzZ2O2s8ZFtWG+ +ItAMb+Gv7FU2M4te/TwRnadljFAoyWry0XCXle1fN1Y3QJXtu3VDdmLmU0t+VGfa +wuZ5k0FIb9TFIQuxtgUNXJZmIjZw4Ych3luUc1bMSn9FPHeOzk8J3yo1tGqQu15M +KMLHxASTgt6opfhDbYIpD0fJJqCPdiJlMrqXHBPYwQKBgQDy8lrmsjBE97H0U2sS +tqlJq+7VOe2ien+z6seXFxd6XHBI8D/wTi2Q/7BpIGbpek3xc0ujxaFbcqo/RJZA +TUzYmc5leQLTwy4a54Neo33+sOuYPg8fQIMPT1OGa3DXv3EPSC8FdQrweNjn/bDX +YXbXJ2nKc3RgdTVehuMh6mw25wKBgQDhuitrTL3dlyHMGhO+djxW3cgjsUbJXQsK +1GnkGw5mzzL67M6ixw4WNxNJjuXEUI5Vat8iJzhZOA+Ae84DDbeN2FCM7UBpUsyB +9T9aApBYLLMflZhl4PXK/zkh1J9vA5NqqJbAcw6a5uH0kjtuJOSvP5CVQc2xsX9i +U9+eZesQMQKBgHo4Znasqg/oNIRf+vvdHOlNL8fhbqVQzzHqKSLfoRYTrwFirCfu +jInnuA4LGPrYZqHTiPgJEpX456EQli4fNUu6hNUTvdJe3LD4S2SvB1G8G6npfp4Q +TF7FX5W+M3S2gOBZRh6OtUQo56Y+QFr6U1kGIPiSgLeN/51gap/DWVF9AoGBAMmL +hMEloFF+Y/rtPbvNrkqRc+YKn32jyfw9dN7rGYzKbGaHkmjc+sLzIhGHubfzhWLX +Law9AJ8I4y6BXIx1bvMDtche/igMefV/mLUxnNhd8QG+fHhayJwcDlMamdBxjOqq +5Q+oq927UP0ipFXQMzAWvW3Hd3W1WlvdL8kqjxvBAoGBAMaZ9JZO48Zn17IUweZC +oVfM99YaHa+dm3L47PdQN6Ag6UjQ+sZ/6SLGIIg67SDhUQ+nuPCL8PH3Rf7PCuqW +oHW3F+44SIrVdLlMkWb444dxdP6Xvb9aOMpvopBDuvzYPR3xzZ202DZbZ0sIEVu8 +8a+09JbRmEI2/Ee+em6a/Y4T diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256.cer new file mode 100644 index 00000000000..440b9c35c57 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA1-ROOT_CA_SHA256.cer @@ -0,0 +1,80 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 84:a1:70:1d:0a:92:d3:cd + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256 + Validity + Not Before: Mar 30 04:51:03 2017 GMT + Not After : Mar 28 04:51:03 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA1-ROOT_CA_SHA256 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:d6:37:af:2f:57:9e:c4:3e:a3:d9:0e:db:e2:db: + e3:48:e2:d7:f1:52:09:1a:58:95:db:aa:b2:ca:b8: + 02:42:f1:b7:df:f5:e7:59:a4:c5:c6:03:2a:8c:a4: + 30:eb:ec:c0:23:b3:fd:d3:0d:8a:55:69:66:0d:21: + de:62:c2:a6:a6:22:66:c1:2d:87:ff:2b:42:ce:91: + a5:fa:f9:3c:a8:81:aa:b0:c1:d3:55:af:24:79:79: + 87:06:5c:48:89:63:53:09:da:68:33:08:d7:86:27: + 4f:75:e2:ac:25:97:7c:64:8c:01:68:94:1e:a8:f5: + 0a:08:6c:b0:77:71:cb:65:d2:fc:3a:a0:0a:22:dd: + 32:96:43:12:7e:50:8e:bf:b8:1a:2d:5f:97:90:f7: + 3d:5b:fc:c0:ec:e8:f3:57:1c:1d:b6:8d:80:23:e2: + d3:9e:3c:c6:71:ab:b0:15:0b:04:c5:a5:66:c7:2b: + c8:f9:7e:d5:f1:a5:5a:14:e4:40:8d:1d:f2:00:1c: + ba:6b:26:a7:3f:94:a7:5f:ee:b3:32:7e:56:ec:8c: + 3f:27:57:b4:f0:63:e1:56:ed:67:ce:42:08:89:86: + 4d:0e:2b:75:5a:05:e4:ac:a2:fa:4e:3b:08:d2:e0: + ba:6c:6b:38:77:79:45:de:64:95:24:96:b6:2b:31: + f2:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256 + serial:A3:52:9D:82:6F:DD:C6:1D + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 56:fb:b0:ab:a6:bb:3a:55:04:ed:5c:3b:ae:0c:0d:32:8f:aa: + ec:b7:24:2c:d5:37:b9:1f:91:64:21:c2:c0:6d:bc:d4:d4:5e: + e2:f1:12:ad:34:02:93:65:10:6c:93:93:2c:23:53:e8:ed:96: + c7:3b:6b:44:df:ff:24:8b:c1:cc:26:b2:1e:8f:26:66:34:3a: + bb:7d:ef:4e:a6:7e:b2:c8:93:c9:f7:46:5a:de:40:88:70:28: + c7:d1:fd:27:c3:99:fd:6a:a1:a5:e1:6d:c3:5a:bc:99:28:95: + e9:17:ed:a4:56:a5:04:ad:fb:74:a2:01:26:2a:5a:45:bc:7b: + 0d:df:0c:41:79:8b:b4:15:50:cd:88:ce:f5:a7:ee:cb:d2:5b: + 76:81:4c:1b:09:92:0e:e9:c6:42:df:b7:81:9e:89:3d:49:ed: + 17:fa:d2:2f:bd:8b:74:d5:cb:ce:af:46:6a:74:b3:34:a0:c5: + a0:64:66:7a:80:59:15:1e:de:16:df:11:3d:1e:96:e2:e5:2d: + f1:4d:20:f3:f6:f1:19:aa:ac:f8:b4:6e:76:a0:26:6c:cd:90: + f2:23:35:a0:8b:c8:e8:5d:27:5d:34:d3:69:74:61:c5:ac:6a: + 54:e9:86:8d:ca:ca:16:03:48:7f:cd:23:43:41:e2:77:3a:5d: + f2:3e:de:fa +-----BEGIN CERTIFICATE----- +MIID3DCCAsSgAwIBAgIJAIShcB0KktPNMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjAeFw0xNzAz +MzAwNDUxMDNaFw0yNzAzMjgwNDUxMDNaMG0xCzAJBgNVBAYTAlVTMQswCQYDVQQI +DAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZh +MSUwIwYDVQQDDBxJTlRFUl9DQV9TSEExLVJPT1RfQ0FfU0hBMjU2MIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1jevL1eexD6j2Q7b4tvjSOLX8VIJGliV +26qyyrgCQvG33/XnWaTFxgMqjKQw6+zAI7P90w2KVWlmDSHeYsKmpiJmwS2H/ytC +zpGl+vk8qIGqsMHTVa8keXmHBlxIiWNTCdpoMwjXhidPdeKsJZd8ZIwBaJQeqPUK +CGywd3HLZdL8OqAKIt0ylkMSflCOv7gaLV+XkPc9W/zA7OjzVxwdto2AI+LTnjzG +cauwFQsExaVmxyvI+X7V8aVaFORAjR3yABy6ayanP5SnX+6zMn5W7Iw/J1e08GPh +Vu1nzkIIiYZNDit1WgXkrKL6TjsI0uC6bGs4d3lF3mSVJJa2KzHyNwIDAQABo4GM +MIGJMHkGA1UdIwRyMHChY6RhMF8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEN +MAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZhMRcwFQYD +VQQDDA5ST09UX0NBX1NIQTI1NoIJAKNSnYJv3cYdMAwGA1UdEwQFMAMBAf8wDQYJ +KoZIhvcNAQEFBQADggEBAFb7sKumuzpVBO1cO64MDTKPquy3JCzVN7kfkWQhwsBt +vNTUXuLxEq00ApNlEGyTkywjU+jtlsc7a0Tf/ySLwcwmsh6PJmY0Ort9706mfrLI +k8n3RlreQIhwKMfR/SfDmf1qoaXhbcNavJkolekX7aRWpQSt+3SiASYqWkW8ew3f +DEF5i7QVUM2IzvWn7svSW3aBTBsJkg7pxkLft4GeiT1J7Rf60i+9i3TVy86vRmp0 +szSgxaBkZnqAWRUe3hbfET0eluLlLfFNIPP28RmqrPi0bnagJmzNkPIjNaCLyOhd +J10002l0YcWsalTpho3KyhYDSH/NI0NB4nc6XfI+3vo= +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key new file mode 100644 index 00000000000..e1388a10251 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDh12cWta4H1sY6 +KHyfvxSJk1JIUAe08JFmHwvO0Eb6LRmKrqwbXEyGs0CPGhMlnmxjvrfXbKkUjodY +9ByxSBa7zYaVdPDGKDQ3HvPxyjZ0npPrHDII2wR+0UOD0ftkDbPHWQFBsl0OY/sI +pRzihYRh8MwCrADdza3vHPrNBz2umuM5jnN20FVIGKhGMGbg5eackBmgvcaWT6BW +B67iYRWVRwLywdSE+imOIS4P7ivndBe1DlB+z4oBmbBwYkM+5WyR3yT4+stdByyn +naL+kExsC/TWDw+sE9TQUo2zqRbNI1j8UhBaQZz1pbX5YeGPTq/Z2J8EGvPxz6VY +PmkDyMl3AgMBAAECggEAKrlDKUqpZ5Y73di26smNKxGRqVhqfNJdz0HkS/We18kc +Yd31dR+a4oial/fI038K5ju4L6rAucDU3gEgRHFsy45v/Won+nS0nBDg+UbV0m4F +cZ7d4Er+qLcR3KgmtKDa98VgtXr2m7hSTypdMoUrrBOPpJnBeDRmyStkTtEl3Bfa +Fh72SZXNauGvB5+qrbPhls1HoWVbzZ3i6oUCBDrfmLD6G0ipGM+AQICmXjYX8OxT +Ye5u/6DU4TkWu5A6/1m0Q4clGZXSeMx2d4PkZ0jZKOXdhwvzAaGh7I0AkuA4ZlCj +slXENyAzQhm4EHHWxvld11e8oEh4DUfWtUXeLttawQKBgQDybE5gjAZdv+5BJXWV +l2G+zb5tKHWd0XQQ2epktX+i+iA5lA0bLkAA4rrmZVsDEc4D2yjINsopBHTjwvtV +F/LBBWIynm6MkIyjY6+0fBfoikz9ebKikuf1YRoRC5Dl0pd2Wa/ps2wowDbQnj3o +4e6x+z0WviyL+uRr1JyotR2J5wKBgQDufVw64Z6AdWThlnP8qXqW12QQBd5qChPr +fHJEkx0ViBoM97yalVzDssXn4X2ESVDqtsxH21SzKzDGzLoCG3PwCPgp9zWk9GS/ +HfhXFzI3qHIlI+s6481vjqDnXtvJ7oHutxYkkYQXSMgC69jeRY0nW78Bz03BAYjQ +boRmeK1x8QKBgQDw9VBOTMADLUPvQwGGKAsC8VQHAgEuVcONAF0nrvPoFcA0GwGP +87+wYayuVy5IdckVMiBuKW91p7VbsjHJGd2zl9tMPwfY9dCkkvBRcEr/W4A9Llqt +l2GyF8smCB4FIfZkr67Xlvy54Jxbbf5RXUi5ZeUJlwuGM2IaACGa2zM6HwKBgEmW +iOTqRTwh/RTWlcd6jAcLQybmiLBzl53r8l5SfoDsVA14S8vvFoaUHRjlrRMqhDtI +WFQ7yzDVvOE6vpJz4hxIyDo6u2TAvG10U/Kbh7VA1qe7I5QyQmuPuPprfKocXB9K +gxyZggalQIIWP/6lu15PoupuCvHpBUw7LcNorSwhAoGAXXBcp4U369B3ld+M+hC9 +G+2VttaC2917iqoM8R7WOiwez+10s+fNv89B6DjZxeX5haa7bbB+RvfqN8OysIRK +m0Bh4w6q/JuRydj9T5sJLk9oUrEFLncqihlNT+1WEwR5x50OODYjpHz1YORo5HzL +cnXKk8xTZFE7mXD1ZJoRLxc= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1.cer new file mode 100644 index 00000000000..3756ab2aeeb --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA1.cer @@ -0,0 +1,80 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 8d:a0:d2:8a:ee:0b:cf:64 + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1 + Validity + Not Before: Mar 30 04:51:03 2017 GMT + Not After : Mar 28 04:51:03 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:e1:d7:67:16:b5:ae:07:d6:c6:3a:28:7c:9f:bf: + 14:89:93:52:48:50:07:b4:f0:91:66:1f:0b:ce:d0: + 46:fa:2d:19:8a:ae:ac:1b:5c:4c:86:b3:40:8f:1a: + 13:25:9e:6c:63:be:b7:d7:6c:a9:14:8e:87:58:f4: + 1c:b1:48:16:bb:cd:86:95:74:f0:c6:28:34:37:1e: + f3:f1:ca:36:74:9e:93:eb:1c:32:08:db:04:7e:d1: + 43:83:d1:fb:64:0d:b3:c7:59:01:41:b2:5d:0e:63: + fb:08:a5:1c:e2:85:84:61:f0:cc:02:ac:00:dd:cd: + ad:ef:1c:fa:cd:07:3d:ae:9a:e3:39:8e:73:76:d0: + 55:48:18:a8:46:30:66:e0:e5:e6:9c:90:19:a0:bd: + c6:96:4f:a0:56:07:ae:e2:61:15:95:47:02:f2:c1: + d4:84:fa:29:8e:21:2e:0f:ee:2b:e7:74:17:b5:0e: + 50:7e:cf:8a:01:99:b0:70:62:43:3e:e5:6c:91:df: + 24:f8:fa:cb:5d:07:2c:a7:9d:a2:fe:90:4c:6c:0b: + f4:d6:0f:0f:ac:13:d4:d0:52:8d:b3:a9:16:cd:23: + 58:fc:52:10:5a:41:9c:f5:a5:b5:f9:61:e1:8f:4e: + af:d9:d8:9f:04:1a:f3:f1:cf:a5:58:3e:69:03:c8: + c9:77 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1 + serial:F1:3B:B7:FB:28:3F:52:09 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 24:74:94:0a:7d:81:62:16:ed:4e:0f:e2:19:06:bd:8b:7a:e4: + 35:63:4c:73:ec:3a:45:d7:2a:8c:80:e6:6b:d9:26:7d:78:9f: + 6b:36:f9:fd:94:f7:ac:86:3c:0e:95:66:80:f3:0b:93:0f:44: + 0a:05:76:d9:1d:c6:37:6f:ea:02:b9:29:e9:96:11:d1:e6:1e: + 70:95:31:77:22:ed:3c:96:ad:9f:74:8c:41:f5:44:47:a2:4e: + d4:58:86:92:31:36:94:90:05:9d:94:16:8c:f8:c8:18:7b:45: + dc:49:45:53:63:06:bb:c6:a9:33:72:fe:48:7b:0e:21:89:e2: + 6c:44:29:3c:10:65:c6:7d:8e:6c:cb:95:ea:a1:ae:3b:c1:12: + 98:ce:b9:c8:98:12:0d:ac:a7:bd:31:cc:aa:ac:51:b4:a7:33: + 5b:60:0d:d6:ed:e0:29:5a:29:f5:fc:e0:27:db:77:88:fd:59: + 0c:02:70:d8:f4:1d:89:88:13:94:55:5b:77:a3:a6:8e:18:9a: + b8:82:5b:64:27:8c:ef:10:6a:df:ed:fd:a4:b5:2b:44:0f:5f: + 89:08:15:48:df:b0:13:08:7c:08:cc:07:ea:b8:a6:17:ab:35: + 65:07:2c:b9:ec:9a:d0:1f:e7:b9:a7:36:9e:24:f7:73:10:e0: + 70:6c:78:6e +-----BEGIN CERTIFICATE----- +MIID2DCCAsCgAwIBAgIJAI2g0oruC89kMA0GCSqGSIb3DQEBCwUAMF0xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTEwHhcNMTcwMzMw +MDQ1MTAzWhcNMjcwMzI4MDQ1MTAzWjBtMQswCQYDVQQGEwJVUzELMAkGA1UECAwC +Q0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEl +MCMGA1UEAwwcSU5URVJfQ0FfU0hBMjU2LVJPT1RfQ0FfU0hBMTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAOHXZxa1rgfWxjoofJ+/FImTUkhQB7TwkWYf +C87QRvotGYqurBtcTIazQI8aEyWebGO+t9dsqRSOh1j0HLFIFrvNhpV08MYoNDce +8/HKNnSek+scMgjbBH7RQ4PR+2QNs8dZAUGyXQ5j+wilHOKFhGHwzAKsAN3Nre8c ++s0HPa6a4zmOc3bQVUgYqEYwZuDl5pyQGaC9xpZPoFYHruJhFZVHAvLB1IT6KY4h +Lg/uK+d0F7UOUH7PigGZsHBiQz7lbJHfJPj6y10HLKedov6QTGwL9NYPD6wT1NBS +jbOpFs0jWPxSEFpBnPWltflh4Y9Or9nYnwQa8/HPpVg+aQPIyXcCAwEAAaOBijCB +hzB3BgNVHSMEcDBuoWGkXzBdMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTAL +BgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEVMBMGA1UE +AwwMUk9PVF9DQV9TSEExggkA8Tu3+yg/UgkwDAYDVR0TBAUwAwEB/zANBgkqhkiG +9w0BAQsFAAOCAQEAJHSUCn2BYhbtTg/iGQa9i3rkNWNMc+w6RdcqjIDma9kmfXif +azb5/ZT3rIY8DpVmgPMLkw9ECgV22R3GN2/qArkp6ZYR0eYecJUxdyLtPJatn3SM +QfVER6JO1FiGkjE2lJAFnZQWjPjIGHtF3ElFU2MGu8apM3L+SHsOIYnibEQpPBBl +xn2ObMuV6qGuO8ESmM65yJgSDaynvTHMqqxRtKczW2AN1u3gKVop9fzgJ9t3iP1Z +DAJw2PQdiYgTlFVbd6OmjhiauIJbZCeM7xBq3+39pLUrRA9fiQgVSN+wEwh8CMwH +6rimF6s1ZQcsueya0B/nuac2niT3cxDgcGx4bg== +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key new file mode 100644 index 00000000000..e01b5aed2cd --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256-PRIV.key @@ -0,0 +1,26 @@ +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDbXbqJwTisc3wF +Z6MYWonNxMsWBfNfwFB/KLQfEfZ+phvReORvJZ5lVT/1gTVs5/QhREU0qW48OxyM +NXKgkcBZGLkRvVlDaOEcbTIDa4PYf7rnsTtU8DWYuyqqmeBnJ2ViKJ3ZGA750ctm +ZsDZlWdwE5iCqX3hA/pfHGu+CNiW2jWSulookdIPqdJeLiwgnntm5tZFxoZ9hD1h +J88iRqmqpS4joYXPxUNxfJ49Nx4iRfrx7HpyUVg3i5Q2q/AVuVSwbbPfNaQrG71V +EbK0K7EjtL8Gw8DCS8Gvr0ApIpabA644BueWA9skjns9lvfSuH76Y5e2nHGJiOz7 +LWMFV24LAgMBAAECggEAD546u7gQCucl+1SHniJEEWxjcSv3SeftU0BYoqWqwRWe +gWl0Ch3Jizlollger6RME1pC+x7dBFjJDYp4oMn/wdgqxQKQKmZ7MITtvKSY/H8L +lZdevAtmJXud7AuMmIuLglOV+XDnEA5Jxv6l2Ff0x1v9zb+3gJ/B4aeqXBtRIFxD +CfCcvcN1Bl+jj2fvS8iRrqofGa6DGXZVZvtIVjIvJnR1YBVMVYBNs6kcscM5Nblr +PJFDDsg+Ph7hq5gpwj7pyb4e54sn06pdfBLgGkHJ82tCNkc+f4Ee2M7MoS//m4IC +ajV+xht4REHuB7h5GM50TF5Gziianyc3g8//M7sC8QKBgQD7tvSzJK1N0w9NPK1e +Q5zfEWxU1c7dJ/hr81OpvEzUut1vZeKT1mydtA0YJftDTFTXe5fsPKNTIrL4BWUw +PLa3jWQNNDSLDNhdoqKrno+017pD7+p8G8x3AfyHxn6x2Shoz0jHTnGf+Q0vnvdT +ZTFpWU+3J8Wp4+1Nx2lwGGEJXwKBgQDfGcnk/fTSs/QQNgzkC1HaQ35b66eEBwK3 +yi8KNsNxDByvdYGxaK/tLRiZIsKMxAV+3jebfA4WSgDkenmzGLn4gYUr5gkkmEW5 +irETT+HDK8LeM2iIbCROactwu3ytJrgpaoDXxRbDsGCUf98hjz1JDCR94wjGH78H +K3Pmbm6e1QKBgEIuTVIYj5RJrNlC3dZN8p3Xx+LaQER3cOJ5HIMhJhY8d2IFqLf0 +BaTFJTg3LEP6esgZD82l988w7Vs2l+9B10yVWTv7gOEaZHzh+OEklGYY3jlkiANP +j8eudwX/02nRTcWY0mrMniVQZv4hTqfXkFFBkSr3wwmzCr6LcpZtYn4DAoGBAIEm +2bTBu1/aoxhbYd0GHI1g8x5dbm1E7bLdzZt5Fm00GMsOGFVOiEGiEJJeCAgbVh8a +n1BYYYNPtfKOYDNoxgfxWtmN4o8Xw41kl5vZa5VjmPyu//2xtNbb8dTCBKvsNUJs +kEfYpZQFX/O3jsFLvauy5tElhCfFqv2IjyC/nzQ9AoGBAJLCz62crl/AXqArSnAH +efX9ozrNMJMQDMDtw5xB/EqRMazmTlqkYr0H4iTS69QNAPr8czdmpY6uO6BRE9+/ +f/tWZXQj7eT8pd1Dp2Ed1vHsOfiAUha0cYUMrqshsqKNXrCxl7144iRGZY7OjFI1 +USqVVNaci2IrtW5+NGV62BYP diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256.cer new file mode 100644 index 00000000000..8c7e21cc629 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/INTER_CA_SHA256-ROOT_CA_SHA256.cer @@ -0,0 +1,80 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 84:a1:70:1d:0a:92:d3:cc + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256 + Validity + Not Before: Mar 30 04:51:02 2017 GMT + Not After : Mar 28 04:51:02 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=INTER_CA_SHA256-ROOT_CA_SHA256 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:db:5d:ba:89:c1:38:ac:73:7c:05:67:a3:18:5a: + 89:cd:c4:cb:16:05:f3:5f:c0:50:7f:28:b4:1f:11: + f6:7e:a6:1b:d1:78:e4:6f:25:9e:65:55:3f:f5:81: + 35:6c:e7:f4:21:44:45:34:a9:6e:3c:3b:1c:8c:35: + 72:a0:91:c0:59:18:b9:11:bd:59:43:68:e1:1c:6d: + 32:03:6b:83:d8:7f:ba:e7:b1:3b:54:f0:35:98:bb: + 2a:aa:99:e0:67:27:65:62:28:9d:d9:18:0e:f9:d1: + cb:66:66:c0:d9:95:67:70:13:98:82:a9:7d:e1:03: + fa:5f:1c:6b:be:08:d8:96:da:35:92:ba:5a:28:91: + d2:0f:a9:d2:5e:2e:2c:20:9e:7b:66:e6:d6:45:c6: + 86:7d:84:3d:61:27:cf:22:46:a9:aa:a5:2e:23:a1: + 85:cf:c5:43:71:7c:9e:3d:37:1e:22:45:fa:f1:ec: + 7a:72:51:58:37:8b:94:36:ab:f0:15:b9:54:b0:6d: + b3:df:35:a4:2b:1b:bd:55:11:b2:b4:2b:b1:23:b4: + bf:06:c3:c0:c2:4b:c1:af:af:40:29:22:96:9b:03: + ae:38:06:e7:96:03:db:24:8e:7b:3d:96:f7:d2:b8: + 7e:fa:63:97:b6:9c:71:89:88:ec:fb:2d:63:05:57: + 6e:0b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256 + serial:A3:52:9D:82:6F:DD:C6:1D + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 3f:f2:91:96:59:da:c1:8a:8c:4d:eb:25:1f:74:87:6f:fc:2e: + 92:7e:44:ff:a7:0b:78:aa:6d:2b:fe:b8:0a:b9:e9:bc:19:87: + 44:15:e1:3a:e4:54:e6:4b:54:3c:75:d9:f8:c9:07:83:74:f4: + 4c:ab:e4:6b:19:64:b6:4b:69:44:6e:74:f6:66:cf:16:43:8f: + 9c:cb:20:e4:7a:5e:78:13:00:6f:28:78:8d:c5:05:46:a9:92: + 0f:d0:38:c3:8b:0e:39:d4:87:e9:ee:35:07:78:dd:1a:1a:8c: + 3a:36:56:4e:3b:96:7a:d1:2c:29:95:06:29:ac:b2:f7:5c:fc: + 09:1c:72:24:e2:9e:72:bf:60:3a:7a:9b:59:35:48:6a:d2:3e: + 76:7f:ad:41:45:a5:6f:93:96:10:c4:4c:cf:3f:f1:1d:00:5f: + d1:60:f1:88:86:d8:ef:ff:72:63:8f:4c:df:9e:35:cb:17:2c: + 16:7b:d4:6c:0e:67:b6:ee:bc:68:07:b0:99:df:c5:f3:88:28: + a1:46:bb:6d:f5:2c:45:6b:e9:90:c0:78:35:20:73:14:5a:d0: + a5:56:cb:04:f4:43:a7:cf:28:f5:a3:5b:ac:f2:a3:4c:f6:39: + 3c:ef:f4:b1:42:20:8e:2a:14:0d:a1:b4:38:b2:f2:6c:14:33: + 05:04:bb:a7 +-----BEGIN CERTIFICATE----- +MIID3jCCAsagAwIBAgIJAIShcB0KktPMMA0GCSqGSIb3DQEBCwUAMF8xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjAeFw0xNzAz +MzAwNDUxMDJaFw0yNzAzMjgwNDUxMDJaMG8xCzAJBgNVBAYTAlVTMQswCQYDVQQI +DAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZh +MScwJQYDVQQDDB5JTlRFUl9DQV9TSEEyNTYtUk9PVF9DQV9TSEEyNTYwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDbXbqJwTisc3wFZ6MYWonNxMsWBfNf +wFB/KLQfEfZ+phvReORvJZ5lVT/1gTVs5/QhREU0qW48OxyMNXKgkcBZGLkRvVlD +aOEcbTIDa4PYf7rnsTtU8DWYuyqqmeBnJ2ViKJ3ZGA750ctmZsDZlWdwE5iCqX3h +A/pfHGu+CNiW2jWSulookdIPqdJeLiwgnntm5tZFxoZ9hD1hJ88iRqmqpS4joYXP +xUNxfJ49Nx4iRfrx7HpyUVg3i5Q2q/AVuVSwbbPfNaQrG71VEbK0K7EjtL8Gw8DC +S8Gvr0ApIpabA644BueWA9skjns9lvfSuH76Y5e2nHGJiOz7LWMFV24LAgMBAAGj +gYwwgYkweQYDVR0jBHIwcKFjpGEwXzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNB +MQ0wCwYDVQQHDARDaXR5MQwwCgYDVQQKDANPcmcxDTALBgNVBAsMBEphdmExFzAV +BgNVBAMMDlJPT1RfQ0FfU0hBMjU2ggkAo1Kdgm/dxh0wDAYDVR0TBAUwAwEB/zAN +BgkqhkiG9w0BAQsFAAOCAQEAP/KRllnawYqMTeslH3SHb/wukn5E/6cLeKptK/64 +CrnpvBmHRBXhOuRU5ktUPHXZ+MkHg3T0TKvkaxlktktpRG509mbPFkOPnMsg5Hpe +eBMAbyh4jcUFRqmSD9A4w4sOOdSH6e41B3jdGhqMOjZWTjuWetEsKZUGKayy91z8 +CRxyJOKecr9gOnqbWTVIatI+dn+tQUWlb5OWEMRMzz/xHQBf0WDxiIbY7/9yY49M +3541yxcsFnvUbA5ntu68aAewmd/F84gooUa7bfUsRWvpkMB4NSBzFFrQpVbLBPRD +p88o9aNbrPKjTPY5PO/0sUIgjioUDaG0OLLybBQzBQS7pw== +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1-PRIV.key new file mode 100644 index 00000000000..c56e9f1bdae --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1-PRIV.key @@ -0,0 +1,26 @@ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDhROyqYZ5UdQJ0 +xJdG4B+aXPHbIKV0w5AvJ7r4SuvIJ/4pEmV6fIU3+4CvN2sXKzW+0DppOBz99Oe6 +19jfMAx5t0pKHkwh5J0bduLf1k83lm8CvoX1a9lYY6ER4Y8wWtTcHG016onl8Lxq +QVqlqbk9zsbNipvWxipIQOgzq7DmTXQ2Hrx0tg4DROlgwuarPBWcZjq6dG09nI0E +zSY/Wis619L/6sdCxGFhvnJ0YbULvIqdR2J638KEO+rx1RXD66Jqc0KhnGZLf7NT +YfTlY0zIMHE8oMkJPdH9tPKbyXMXhiG/u5x81RcJxT4gLi5fq2yrvMsaUC13bnJJ +npFNy6XTAgMBAAECggEAPS4h9Jg0jw2EUEBAMaCXFK5fhTrVlOO0Ggp5TgvTA3ZR +Ich8RQrih3TH2056yD0VCLC23HK/9Pz5npYWsW70RG5SP9UAqkfTn2znaxFiTF+P +4Lfr296hlc7hJOEUqXZRz0HtKzJ6pzd9hIIhY1K4G6A4AATAFFGXlC4Eolvj3Hf0 +NgVFDYaFDEpEiin+fAsM5c1ZE0pxRZSVE5Emr9XvkvxLm5dK9lKOyyOQ+5RHhxQ6 +J4n+6Ct0O+FkeP9u3jTMtew9gxTwvHSgkf05hSRoqgMKcusKpqhHp6E4mT7sus7q +AYzdv5sNIcx7PpojuHjploMH7ghhYxCmVOOFxXJ4CQKBgQD2naA8zZnh5BfbVC8p +C9A6HfwnZ7cCjGtL30y8fh8OAMHbdGE4JXlhifPgW7PDxZ0Yho4rYd9MxLVcGl+p +YPOKKcaKbzwdUJwZ4Zs1dJC+LTRqku6O3qlEofeojHN5IctLoLqDsiZBD7aT4l+O +wmAWqwLZZQtiFpA/jbCb/Qw7tQKBgQDp11rFSHLKuVdMuSnUon3WN6lj9WNM3KFy +C8R4EN/DTnuHrVL0MCff9eddBYvpQe0z/LA74oAD9fSjmtYe/24qIm2lAWVkwxBm +yyspUmOybU8Q3GN8xw1Vrwg8JR5JVAOwKHwCGmybT7Zs+9eJRONnnZ6nUbTQ94cP +sJVkyGUgZwKBgQCd/0CAk+xpl1tdbiLEtkfSZBF/IWhTXqkDM+2SuW6l5wBL29TJ +RuDsB5jR/Y4+96T86H++9XY9Va0nc9IjzvRYaQlE+ZzW3yUTQ8HPTn3JCWcSfE4Q +BEEHsojbWBhG28rGChRUeVceybVcK2SzLn6nJyqtIppXXkNOJDWoykcDHQKBgHzY +27+k1JTjq3ZtDaZXMvQiN7AEnYW17gRjv/uSlsVBq7ZelYGGDGQIeAQ0J+Tbq/cr +nDP80/hJYtnOmy9llL2uL/f+7NGFS8Z2Bo9DS7NBpQsNf5ho9fefQbhK4Qapcmak +1sCQtxec0XsSYpsJSphRkRkoCG/hGB0KXFi4nTVVAoGAJrrh1rG1UMXmFUpraXIy +Mc58lEYB87EkMOthyK8XklxLoYKPZlVS7AZZDtQMpRC6YnweiX6LmO4AamtlT71x +BzQgmwHn4wOaysDPHFuf5hNCobXJREoiNzHb4AcqiZ7SNAW5Jd+0/PSY47hrDnRy +wNFyg3O0k3kaXz5h3lVhxo4= diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1.cer new file mode 100644 index 00000000000..490d03b0a78 --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA1.cer @@ -0,0 +1,80 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + f1:3b:b7:fb:28:3f:52:09 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1 + Validity + Not Before: Mar 30 04:51:01 2017 GMT + Not After : Mar 28 04:51:01 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:e1:44:ec:aa:61:9e:54:75:02:74:c4:97:46:e0: + 1f:9a:5c:f1:db:20:a5:74:c3:90:2f:27:ba:f8:4a: + eb:c8:27:fe:29:12:65:7a:7c:85:37:fb:80:af:37: + 6b:17:2b:35:be:d0:3a:69:38:1c:fd:f4:e7:ba:d7: + d8:df:30:0c:79:b7:4a:4a:1e:4c:21:e4:9d:1b:76: + e2:df:d6:4f:37:96:6f:02:be:85:f5:6b:d9:58:63: + a1:11:e1:8f:30:5a:d4:dc:1c:6d:35:ea:89:e5:f0: + bc:6a:41:5a:a5:a9:b9:3d:ce:c6:cd:8a:9b:d6:c6: + 2a:48:40:e8:33:ab:b0:e6:4d:74:36:1e:bc:74:b6: + 0e:03:44:e9:60:c2:e6:ab:3c:15:9c:66:3a:ba:74: + 6d:3d:9c:8d:04:cd:26:3f:5a:2b:3a:d7:d2:ff:ea: + c7:42:c4:61:61:be:72:74:61:b5:0b:bc:8a:9d:47: + 62:7a:df:c2:84:3b:ea:f1:d5:15:c3:eb:a2:6a:73: + 42:a1:9c:66:4b:7f:b3:53:61:f4:e5:63:4c:c8:30: + 71:3c:a0:c9:09:3d:d1:fd:b4:f2:9b:c9:73:17:86: + 21:bf:bb:9c:7c:d5:17:09:c5:3e:20:2e:2e:5f:ab: + 6c:ab:bc:cb:1a:50:2d:77:6e:72:49:9e:91:4d:cb: + a5:d3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA1 + serial:F1:3B:B7:FB:28:3F:52:09 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 0b:be:7b:c7:53:14:87:37:02:66:37:f5:6f:38:3c:75:b3:72: + f6:f8:9c:77:4d:9a:e4:5c:23:3a:4a:5f:aa:6e:90:23:e9:b8: + 48:fd:6d:e1:88:b5:a2:a5:0a:30:c0:7d:33:a8:6f:79:42:52: + 80:f8:87:4b:2a:15:0a:ff:14:88:97:21:12:89:1c:d3:33:bf: + fa:4f:5e:68:9a:c6:69:2f:aa:1d:31:aa:80:f5:b0:d3:72:c9: + fa:ce:3b:5f:15:a6:61:e0:f1:d1:ab:e7:40:48:c1:d4:30:bd: + 0a:13:37:0d:ea:ac:38:b2:af:1b:78:3a:29:53:ee:90:71:3b: + 2b:a4:8b:16:e9:da:94:59:44:3d:7f:34:fb:0a:d1:6b:db:3d: + 66:01:a6:0f:98:b5:cc:57:39:b9:09:f2:01:cc:e5:89:86:7d: + f2:9a:b2:ad:08:3d:da:05:f9:24:1e:30:98:cc:92:a9:4c:4a: + cf:a3:53:6e:7f:5e:db:aa:43:9c:ac:b1:b5:80:ab:7e:a3:89: + 71:37:c2:4a:c1:16:9d:26:d5:70:89:8a:8e:a8:cb:40:3b:b8: + f0:d2:31:54:c2:1f:fc:24:5e:29:c1:5e:86:48:1e:83:4e:44: + 30:ff:8d:46:47:b6:0e:9c:77:bf:ba:08:8b:bd:eb:b7:ca:45: + 0a:e3:0c:ec +-----BEGIN CERTIFICATE----- +MIIDyDCCArCgAwIBAgIJAPE7t/soP1IJMA0GCSqGSIb3DQEBBQUAMF0xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTEwHhcNMTcwMzMw +MDQ1MTAxWhcNMjcwMzI4MDQ1MTAxWjBdMQswCQYDVQQGEwJVUzELMAkGA1UECAwC +Q0ExDTALBgNVBAcMBENpdHkxDDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEV +MBMGA1UEAwwMUk9PVF9DQV9TSEExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEA4UTsqmGeVHUCdMSXRuAfmlzx2yCldMOQLye6+ErryCf+KRJlenyFN/uA +rzdrFys1vtA6aTgc/fTnutfY3zAMebdKSh5MIeSdG3bi39ZPN5ZvAr6F9WvZWGOh +EeGPMFrU3BxtNeqJ5fC8akFapam5Pc7GzYqb1sYqSEDoM6uw5k10Nh68dLYOA0Tp +YMLmqzwVnGY6unRtPZyNBM0mP1orOtfS/+rHQsRhYb5ydGG1C7yKnUdiet/ChDvq +8dUVw+uianNCoZxmS3+zU2H05WNMyDBxPKDJCT3R/bTym8lzF4Yhv7ucfNUXCcU+ +IC4uX6tsq7zLGlAtd25ySZ6RTcul0wIDAQABo4GKMIGHMHcGA1UdIwRwMG6hYaRf +MF0xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoG +A1UECgwDT3JnMQ0wCwYDVQQLDARKYXZhMRUwEwYDVQQDDAxST09UX0NBX1NIQTGC +CQDxO7f7KD9SCTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQALvnvH +UxSHNwJmN/VvODx1s3L2+Jx3TZrkXCM6Sl+qbpAj6bhI/W3hiLWipQowwH0zqG95 +QlKA+IdLKhUK/xSIlyESiRzTM7/6T15omsZpL6odMaqA9bDTcsn6zjtfFaZh4PHR +q+dASMHUML0KEzcN6qw4sq8beDopU+6QcTsrpIsW6dqUWUQ9fzT7CtFr2z1mAaYP +mLXMVzm5CfIBzOWJhn3ymrKtCD3aBfkkHjCYzJKpTErPo1Nuf17bqkOcrLG1gKt+ +o4lxN8JKwRadJtVwiYqOqMtAO7jw0jFUwh/8JF4pwV6GSB6DTkQw/41GR7YOnHe/ +ugiLveu3ykUK4wzs +-----END CERTIFICATE----- diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256-PRIV.key b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256-PRIV.key new file mode 100644 index 00000000000..4c53e23e8ab --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256-PRIV.key @@ -0,0 +1,26 @@ +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2DzrIXts3huIs +dtX+ZbY6RR5/S4yXUs3jJXc4mbITLn7PO1QVBT528NZVOu6jUxXsPTpTg1jgresh +6Pcv1LNj7bP30uPXhmyawgQVUgLTGyU0+JWLJrpU7cEOTK4f/j58A+UHL255fM7T +B3EvIj2Ad1MAYwIvVZnAXPSFt72YGz15doYiewp8dTXcX4TsFisCbypFikWxpXIF +qjVqbAUx8fYgQxfPWFw4HbVvo3Nu1LqypswAfsmHd2v5nMv8wkAcPG5dIYHACN9r +kPLMoUNUcBLn6QdIUrhk7dldRlR0TWT+VtRLKVWlGkMk9rRK+RnskNSuPg8fjb/Y +gM0m5p0JAgMBAAECggEAPVk8cbClJjzpkhopWiRkF5abBEItCgD5KAXD+uqvuw77 +5FEVsE+oEORvFSFasOaaiJTJRsMH/A4fIbojMZb3LEE5V9VUuZeumSevwI92LDUF +gKgTnGRcfanwWCU2t8kwvRGC57zv+Tg5aZskZMGg/901tvemENVDjjLEoxqbZNmX +WZnhB8XiPxl9K32K0l+qNW3HvKJ8lkaW0L6/4HWWU4rYwbc9TZpzHDOXhAICQB76 +fCw4hcy1K6KjfGjfE/6afqMa76KSxxeCvUYorZlm2gk1WcEafkg9Jwzz2SWtsa8W +L+YzbTd1GE8Z9bDA88Dw3vgdC1Pt0ywX/fJ/GCDHUQKBgQDjNaW/enKYXGTsM5C1 +I94OgSmgnjnjPZIBY0u89iCAf07ueqrNaLJgOEkGpCrLEa4tC2qc57ge1DO2rxTa +6RowUzqG3Oqdsq21QaQZAmjjDC5mXlYPRpWvWVjBRaIDKw9zAUg9qEy24e/pRjdP +cugR30d1OaxExdgoAt8iOqZ67wKBgQDNIPqF/+npd1UAqgdC9lOxnPQly1zjz/zY +jbeJeww9Ut9aCXj0+we4gKhD37d178y1H2QBod+IPpqQ/uZmbNmN5JP+MIk2kZKB +4jquQLa5jEc+y57h8UrWJBY+Ls7xiu/cw3aCAk0JaZRSrH/KzWE91x3s7o2yV43d +dMkRmTTHhwKBgQCHaq4C1WP/UvIDpSgWDe6HDoxU4nj16vheQ2Qcl0T/0OCmWg36 +pu/JUUKU5rtqlHsO9cLxCVo/ZZH8y5TOdCfbrX8wafKbUqcdZKX9EeaZi+ULtiXs +rNEB1WqEpo/M+5kVnioENY6jYT2v9t14SK/wFvdr8pet1YzjK/L5X6NhmQKBgFK4 +0u7I9k61Ve0vpEAH0FaXIgo/yZUBYkj+VZ62pYfxbKsFmObKeSGZmMHObVC9RMNi +BlV2LwvlmzWP5eA2U0GahWgDsMH10KxaTCnLZSTMgkq7mLYrNW/IG8Q14jScQAC6 +PodNYD3EexEgCWUCkA19O885oKDkGAzPtOpI63TvAoGBAJvbKiJSFJNd3CIQlrOM +wNw+Sww+c2Qw4PZZvIJNzjWumjesfUsuAyySrO2nXPzzSOrh7dRW98suaFi1Mih6 +ZwBpIll5VQsd2dwEa6vp6RFGWFNKPvDILEVgcCEOmckKRWDo+fb5bx2VHj1v4kfG +MHDqy8Y2ercsU0Z5mEN8bUD7 diff --git a/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256.cer b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256.cer new file mode 100644 index 00000000000..09d0dbd7f5c --- /dev/null +++ b/jdk/test/sun/security/ssl/CertPathRestrictions/certs/ROOT_CA_SHA256.cer @@ -0,0 +1,80 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + a3:52:9d:82:6f:dd:c6:1d + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256 + Validity + Not Before: Mar 30 04:51:01 2017 GMT + Not After : Mar 28 04:51:01 2027 GMT + Subject: C=US, ST=CA, L=City, O=Org, OU=Java, CN=ROOT_CA_SHA256 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:b6:0f:3a:c8:5e:db:37:86:e2:2c:76:d5:fe:65: + b6:3a:45:1e:7f:4b:8c:97:52:cd:e3:25:77:38:99: + b2:13:2e:7e:cf:3b:54:15:05:3e:76:f0:d6:55:3a: + ee:a3:53:15:ec:3d:3a:53:83:58:e0:ad:eb:21:e8: + f7:2f:d4:b3:63:ed:b3:f7:d2:e3:d7:86:6c:9a:c2: + 04:15:52:02:d3:1b:25:34:f8:95:8b:26:ba:54:ed: + c1:0e:4c:ae:1f:fe:3e:7c:03:e5:07:2f:6e:79:7c: + ce:d3:07:71:2f:22:3d:80:77:53:00:63:02:2f:55: + 99:c0:5c:f4:85:b7:bd:98:1b:3d:79:76:86:22:7b: + 0a:7c:75:35:dc:5f:84:ec:16:2b:02:6f:2a:45:8a: + 45:b1:a5:72:05:aa:35:6a:6c:05:31:f1:f6:20:43: + 17:cf:58:5c:38:1d:b5:6f:a3:73:6e:d4:ba:b2:a6: + cc:00:7e:c9:87:77:6b:f9:9c:cb:fc:c2:40:1c:3c: + 6e:5d:21:81:c0:08:df:6b:90:f2:cc:a1:43:54:70: + 12:e7:e9:07:48:52:b8:64:ed:d9:5d:46:54:74:4d: + 64:fe:56:d4:4b:29:55:a5:1a:43:24:f6:b4:4a:f9: + 19:ec:90:d4:ae:3e:0f:1f:8d:bf:d8:80:cd:26:e6: + 9d:09 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Authority Key Identifier: + DirName:/C=US/ST=CA/L=City/O=Org/OU=Java/CN=ROOT_CA_SHA256 + serial:A3:52:9D:82:6F:DD:C6:1D + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha256WithRSAEncryption + 6f:2f:a4:56:d5:58:6d:20:74:6b:66:b7:41:eb:c2:8c:56:2e: + 1b:51:79:b0:07:a6:63:28:8b:20:40:b9:72:4b:f5:e0:6b:18: + 39:5b:b4:ae:50:58:25:81:86:e3:19:ec:b1:dd:fb:5c:f5:d4: + a8:7d:a0:50:46:ac:1e:80:dc:cc:aa:0c:61:f8:a3:41:af:03: + 35:a4:02:4f:23:c7:5c:36:26:90:fe:51:07:58:0f:e7:14:26: + 34:c2:a7:bd:f2:34:33:cf:67:e4:2d:82:b6:e8:94:85:d6:8b: + 01:6f:ba:3d:78:f6:db:3d:dc:ba:6e:6d:83:fa:ea:d0:60:ab: + 1b:ad:9b:e2:ba:e3:e3:9f:26:5b:9a:c7:fb:9f:c1:7d:cc:0b: + cf:23:e0:ac:e1:e4:09:08:84:98:d4:6e:16:34:a5:5e:74:d5: + a8:61:e1:65:f7:9a:51:9f:f0:9f:86:65:ce:4f:b8:b6:64:7d: + 86:62:21:ec:71:50:70:ca:6b:2e:74:12:51:b1:68:b0:4a:66: + 19:60:e9:f8:b0:bf:6e:d8:ad:75:29:c3:31:13:73:01:3d:d5: + d4:5b:c2:60:bb:c4:c8:e6:29:cf:a3:49:65:8d:c2:1d:7d:c9: + 75:33:9b:97:73:38:99:5c:7d:b3:9f:b0:be:0d:f4:6a:c6:19: + 8d:98:a1:ca +-----BEGIN CERTIFICATE----- +MIIDzjCCAragAwIBAgIJAKNSnYJv3cYdMA0GCSqGSIb3DQEBCwUAMF8xCzAJBgNV +BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3Jn +MQ0wCwYDVQQLDARKYXZhMRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjAeFw0xNzAz +MzAwNDUxMDFaFw0yNzAzMjgwNDUxMDFaMF8xCzAJBgNVBAYTAlVTMQswCQYDVQQI +DAJDQTENMAsGA1UEBwwEQ2l0eTEMMAoGA1UECgwDT3JnMQ0wCwYDVQQLDARKYXZh +MRcwFQYDVQQDDA5ST09UX0NBX1NIQTI1NjCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBALYPOshe2zeG4ix21f5ltjpFHn9LjJdSzeMldziZshMufs87VBUF +Pnbw1lU67qNTFew9OlODWOCt6yHo9y/Us2Pts/fS49eGbJrCBBVSAtMbJTT4lYsm +ulTtwQ5Mrh/+PnwD5Qcvbnl8ztMHcS8iPYB3UwBjAi9VmcBc9IW3vZgbPXl2hiJ7 +Cnx1NdxfhOwWKwJvKkWKRbGlcgWqNWpsBTHx9iBDF89YXDgdtW+jc27UurKmzAB+ +yYd3a/mcy/zCQBw8bl0hgcAI32uQ8syhQ1RwEufpB0hSuGTt2V1GVHRNZP5W1Esp +VaUaQyT2tEr5GeyQ1K4+Dx+Nv9iAzSbmnQkCAwEAAaOBjDCBiTB5BgNVHSMEcjBw +oWOkYTBfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDTALBgNVBAcMBENpdHkx +DDAKBgNVBAoMA09yZzENMAsGA1UECwwESmF2YTEXMBUGA1UEAwwOUk9PVF9DQV9T +SEEyNTaCCQCjUp2Cb93GHTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IB +AQBvL6RW1VhtIHRrZrdB68KMVi4bUXmwB6ZjKIsgQLlyS/Xgaxg5W7SuUFglgYbj +Geyx3ftc9dSofaBQRqwegNzMqgxh+KNBrwM1pAJPI8dcNiaQ/lEHWA/nFCY0wqe9 +8jQzz2fkLYK26JSF1osBb7o9ePbbPdy6bm2D+urQYKsbrZviuuPjnyZbmsf7n8F9 +zAvPI+Cs4eQJCISY1G4WNKVedNWoYeFl95pRn/CfhmXOT7i2ZH2GYiHscVBwymsu +dBJRsWiwSmYZYOn4sL9u2K11KcMxE3MBPdXUW8Jgu8TI5inPo0lljcIdfcl1M5uX +cziZXH2zn7C+DfRqxhmNmKHK +-----END CERTIFICATE----- From 25dbddc731f544c3563113b56cc936ae53e26c37 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Tue, 4 Apr 2017 23:04:39 -0700 Subject: [PATCH 14/75] 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation 8178078: jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java failed due to some subtests failed 8178079: jdk/javadoc/doclet/testModules/TestModules.java failed due to some subtests failed Reviewed-by: jjg, ksrini --- .../formats/html/TagletWriterImpl.java | 2 +- .../formats/html/markup/HtmlStyle.java | 1 + .../doclets/formats/html/markup/HtmlTree.java | 17 +++++++++++- .../doclets/toolkit/resources/stylesheet.css | 11 ++++---- .../TestDeprecatedDocs.java | 26 +++++++++---------- .../doclet/testModules/TestModules.java | 16 ++++++------ .../javadoc/doclet/testSearch/TestSearch.java | 6 ++--- .../doclet/testStylesheet/TestStylesheet.java | 11 ++++++++ 8 files changed, 58 insertions(+), 32 deletions(-) diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java index 32f3871286e..2892801a090 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java @@ -106,7 +106,7 @@ public class TagletWriterImpl extends TagletWriter { String desc = ch.getText(itt.getDescription()); String anchorName = htmlWriter.getName(tagText); - Content result = HtmlTree.A_ID(anchorName, new StringContent(tagText)); + Content result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText)); if (configuration.createindex && !tagText.isEmpty()) { SearchIndexItem si = new SearchIndexItem(); si.setLabel(tagText); diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java index 941538e83d3..ad6c183448e 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java @@ -99,6 +99,7 @@ public enum HtmlStyle { rightIframe, rowColor, searchTagLink, + searchTagResult, seeLabel, serializedFormContainer, simpleTagLabel, diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java index b3ab27dadd3..46001936673 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -264,6 +264,21 @@ public class HtmlTree extends Content { return htmltree; } + /** + * Generates an HTML anchor tag with a style class, id attribute and a body. + * + * @param styleClass stylesheet class for the tag + * @param id id for the anchor tag + * @param body body for the anchor tag + * @return an HtmlTree object + */ + public static HtmlTree A_ID(HtmlStyle styleClass, String id, Content body) { + HtmlTree htmltree = A_ID(id, body); + if (styleClass != null) + htmltree.addStyle(styleClass); + return htmltree; + } + /** * Generates a CAPTION tag with some content. * diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css index c0eeeb42590..25b7cf34ef9 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css @@ -42,15 +42,14 @@ a[name]:hover { text-decoration:none; color:#353833; } -a[name]:before, a[name]:target { +a[name]:before, a[name]:target, a[id]:before, a[id]:target { content:""; - display:block; - height:120px; - margin:-120px 0 0; -} -a[id]:before, a[id]:target { + display:inline-block; + position:relative; padding-top:129px; margin-top:-129px; +} +.searchTagResult:before, .searchTagResult:target { color:red; } pre { diff --git a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java index 0fe649e029a..a801c887055 100644 --- a/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java +++ b/langtools/test/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4927552 8026567 8071982 8162674 8175200 + * @bug 4927552 8026567 8071982 8162674 8175200 8175218 * @summary * @author jamieh * @library ../lib @@ -81,16 +81,16 @@ public class TestDeprecatedDocs extends JavadocTester { + "extends java.lang.Object", "
        @Deprecated(forRemoval=true)\n"
                         + "public int field
        \n" - + "
        Deprecated, for removal: This API element is subject to removal in a future version.  
        ", + + "
        Deprecated, for removal: This API element is subject to removal in a future version. 
        ", "
        @Deprecated(forRemoval=true)\n"
                         + "public DeprecatedClassByAnnotation​()
        \n" - + "
        Deprecated, for removal: This API element is subject to removal in a future version.  
        ", + + "
        Deprecated, for removal: This API element is subject to removal in a future version. 
        ", "
        @Deprecated\n"
                         + "public void method​()
        \n" + "
        Deprecated. 
        "); checkOutput("pkg/TestAnnotationType.html", true, - "
        Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
        Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
        annotation_test1 passes.
        \n" + "
        \n" + "
        \n" @@ -100,16 +100,16 @@ public class TestDeprecatedDocs extends JavadocTester { "
        @Deprecated(forRemoval=true)\n"
                         + "static final int field
        \n" + "
        Deprecated, for removal: This " - + "API element is subject to removal in a future version.  annotation_test4 passes.
        ", + + "API element is subject to removal in a future version. annotation_test4 passes.
        ", "
        @Deprecated(forRemoval=true)\n"
                         + "int required
        \n" - + "
        Deprecated, for removal: This API element is subject to removal in a future version.  " + + "
        Deprecated, for removal: This API element is subject to removal in a future version. " + "annotation_test3 passes.
        ", "
        java.lang.String optional
        \n" + "
        Deprecated. annotation_test2 passes.
        "); checkOutput("pkg/TestClass.html", true, - "
        Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
        Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
        class_test1 passes.
        \n" + "
        \n" + "
        \n" @@ -118,11 +118,11 @@ public class TestDeprecatedDocs extends JavadocTester { + "extends java.lang.Object", "
        @Deprecated(forRemoval=true)\n"
                         + "public TestClass​()
        \n" - + "
        Deprecated, for removal: This API element is subject to removal in a future version.  " + + "
        Deprecated, for removal: This API element is subject to removal in a future version. " + "class_test3 passes.
        "); checkOutput("pkg/TestEnum.html", true, - "
        Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
        Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
        enum_test1 passes.
        \n" + "
        \n" + "
        \n" @@ -131,11 +131,11 @@ public class TestDeprecatedDocs extends JavadocTester { + "extends java.lang.Enum<TestEnum>", "
        @Deprecated(forRemoval=true)\n"
                         + "public static final TestEnum FOR_REMOVAL
        \n" - + "
        Deprecated, for removal: This API element is subject to removal in a future version.  " + + "
        Deprecated, for removal: This API element is subject to removal in a future version. " + "enum_test3 passes.
        "); checkOutput("pkg/TestError.html", true, - "
        Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
        Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
        error_test1 passes.
        \n" + "
        \n" + "
        \n" @@ -144,7 +144,7 @@ public class TestDeprecatedDocs extends JavadocTester { + "extends java.lang.Error"); checkOutput("pkg/TestException.html", true, - "
        Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
        Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
        exception_test1 passes.
        \n" + "
        \n" + "
        \n" @@ -153,7 +153,7 @@ public class TestDeprecatedDocs extends JavadocTester { + "extends java.lang.Exception"); checkOutput("pkg/TestInterface.html", true, - "
        Deprecated, for removal: This API element is subject to removal in a future version.  \n" + "
        Deprecated, for removal: This API element is subject to removal in a future version. \n" + "
        interface_test1 passes.
        \n" + "
        \n" + "
        \n" diff --git a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java index 4a148756b37..5c026ea57ea 100644 --- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java +++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java @@ -24,7 +24,7 @@ /* * @test * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 - * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 + * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -277,14 +277,14 @@ public class TestModules extends JavadocTester { + "\n" + "\n" + "
        This is a test description for the moduleA module. Search " - + "phrase search phrase.
        "); + + "phrase search phrase.
        "); checkOutput("moduleB-summary.html", found, "\n" + "\n" + "\n" + "\n" + "
        This is a test description for the moduleB module. Search " - + "word search_word with no description.
        "); + + "word search_word with no description.
        "); checkOutput("overview-summary.html", found, "\n" + "
        \n" @@ -325,7 +325,7 @@ public class TestModules extends JavadocTester { checkOutput("moduleA-summary.html", found, "
        \n" + "
        Deprecated, for removal:" - + " This API element is subject to removal in a future version. \n" + + " This API element is subject to removal in a future version.\n" + "
        This module is deprecated.
        \n" + "
        \n" + "\n" @@ -333,7 +333,7 @@ public class TestModules extends JavadocTester { + "\n" + "\n" + "
        This is a test description for the moduleA module. Search " - + "phrase search phrase.
        "); + + "phrase search phrase.
        "); checkOutput("moduleB-summary.html", found, "
        \n" + "\n" @@ -341,7 +341,7 @@ public class TestModules extends JavadocTester { + "\n" + "\n" + "
        This is a test description for the moduleB module. Search " - + "word search_word with no description.
        "); + + "word search_word with no description.
        "); checkOutput("overview-summary.html", found, "\n" + "\n" @@ -618,7 +618,7 @@ public class TestModules extends JavadocTester { + "

        Module moduleT

        \n" + "
        ", "
        This is a test description for the moduleT module. " - + "Search phrase search phrase. " + + "Search phrase search phrase. " + "Make sure there are no exported packages.
        ", "
        \n" + "\n" @@ -867,7 +867,7 @@ public class TestModules extends JavadocTester { void checkModuleDeprecation(boolean found) { checkOutput("moduleA-summary.html", found, "
        Deprecated, for removal:" - + " This API element is subject to removal in a future version. \n" + + " This API element is subject to removal in a future version.\n" + "
        This module is deprecated.
        \n" + "
        "); checkOutput("deprecated-list.html", found, diff --git a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java index ccda7324d47..5be26d2e972 100644 --- a/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 + * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 * @summary Test the search feature of javadoc. * @author bpatel * @library ../lib @@ -321,9 +321,9 @@ public class TestSearch extends JavadocTester { + "pkg2.TestEnum"); checkOutput("index-all.html", true, "
        class_test1 passes. Search tag" - + " SearchTagDeprecatedClass
        ", + + " SearchTagDeprecatedClass", "
        error_test3 passes. Search tag for\n" - + " method SearchTagDeprecatedMethod
        "); + + " method SearchTagDeprecatedMethod"); } void checkSplitIndex() { diff --git a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java index b5b9c373f02..f649f3b4f15 100644 --- a/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java +++ b/langtools/test/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java @@ -24,6 +24,7 @@ /* * @test * @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549 8072461 8154261 8162363 8160196 8151743 8177417 + * 8175218 * @summary Run tests on doclet stylesheet. * @author jamieh * @library ../lib @@ -162,6 +163,16 @@ public class TestStylesheet extends JavadocTester { "@import url('resources/fonts/dejavu.css');", ".navPadding {\n" + " padding-top: 107px;\n" + + "}", + "a[name]:before, a[name]:target, a[id]:before, a[id]:target {\n" + + " content:\"\";\n" + + " display:inline-block;\n" + + " position:relative;\n" + + " padding-top:129px;\n" + + " margin-top:-129px;\n" + + "}\n" + + ".searchTagResult:before, .searchTagResult:target {\n" + + " color:red;\n" + "}"); // Test whether a link to the stylesheet file is inserted properly From 06143df6a2a32985cd59baf569121cc4eec9a8d8 Mon Sep 17 00:00:00 2001 From: Srikanth Adayapalam Date: Wed, 5 Apr 2017 14:34:15 +0530 Subject: [PATCH 15/75] 8176572: Javac does not enforce module name restrictions Reviewed-by: jlahoda --- .../com/sun/tools/javac/comp/Check.java | 30 ++++++++++++++++--- .../tools/javac/resources/compiler.properties | 2 +- .../modules/PoorChoiceForModuleNameTest.java | 25 ++++++++++++++-- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 117da713ead..f8b9ee6761e 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -2107,10 +2107,32 @@ public class Check { Name moduleName = tree.sym.name; Assert.checkNonNull(moduleName); if (lint.isEnabled(LintCategory.MODULE)) { - String moduleNameString = moduleName.toString(); - int nameLength = moduleNameString.length(); - if (nameLength > 0 && Character.isDigit(moduleNameString.charAt(nameLength - 1))) { - log.warning(Lint.LintCategory.MODULE, tree.qualId.pos(), Warnings.PoorChoiceForModuleName(moduleName)); + JCExpression qualId = tree.qualId; + while (qualId != null) { + Name componentName; + DiagnosticPosition pos; + switch (qualId.getTag()) { + case SELECT: + JCFieldAccess selectNode = ((JCFieldAccess) qualId); + componentName = selectNode.name; + pos = selectNode.pos(); + qualId = selectNode.selected; + break; + case IDENT: + componentName = ((JCIdent) qualId).name; + pos = qualId.pos(); + qualId = null; + break; + default: + throw new AssertionError("Unexpected qualified identifier: " + qualId.toString()); + } + if (componentName != null) { + String moduleNameComponentString = componentName.toString(); + int nameLength = moduleNameComponentString.length(); + if (nameLength > 0 && Character.isDigit(moduleNameComponentString.charAt(nameLength - 1))) { + log.warning(Lint.LintCategory.MODULE, pos, Warnings.PoorChoiceForModuleName(componentName)); + } + } } } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index 3a93a8ad874..f72baf51d57 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -1537,7 +1537,7 @@ compiler.warn.finally.cannot.complete=\ # 0: name compiler.warn.poor.choice.for.module.name=\ - module name {0} should avoid terminal digits + module name component {0} should avoid terminal digits # 0: string compiler.warn.incubating.modules=\ diff --git a/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java b/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java index 9bb8f15fa0c..cf9480c43d5 100644 --- a/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java +++ b/langtools/test/tools/javac/modules/PoorChoiceForModuleNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8160181 + * @bug 8160181 8176572 * @summary Add lint warning for digits in module names * @library /tools/lib * @modules @@ -63,6 +63,22 @@ public class PoorChoiceForModuleNameTest extends ModuleTestBase { Path src_m3 = src.resolve("mango100"); tb.writeJavaFiles(src_m3, "@SuppressWarnings(\"module\") module mango100 { }"); + // Check that there is no warning at use site. + Path src_m4 = src.resolve("mangouser"); + tb.writeJavaFiles(src_m4, "module mangouser { requires mango19; }"); + + // Check that we warn about component names ending in digit also + Path src_m5 = src.resolve("mango1000.mangofruit.mangomodule"); + tb.writeJavaFiles(src_m5, "module mango1000.mangofruit.mangomodule { }"); + + // Check that we warn about component names ending in digit also + Path src_m6 = src.resolve("mangofruit.mango1000.mangomodule"); + tb.writeJavaFiles(src_m6, "module mangofruit.mango1000.mangomodule { }"); + + // Check that we warn about component names ending in digit also + Path src_m7 = src.resolve("mangomodule.mangofruit.mango1000"); + tb.writeJavaFiles(src_m7, "module mangomodule.mangofruit.mango1000 { }"); + Path classes = base.resolve("classes"); tb.createDirectories(classes); @@ -78,9 +94,12 @@ public class PoorChoiceForModuleNameTest extends ModuleTestBase { .getOutput(Task.OutputKind.DIRECT); if (!log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango19") || + !log.contains("module-info.java:1:8: compiler.warn.poor.choice.for.module.name: mango1000") || + !log.contains("module-info.java:1:18: compiler.warn.poor.choice.for.module.name: mango1000") || + !log.contains("module-info.java:1:30: compiler.warn.poor.choice.for.module.name: mango1000") || !log.contains("- compiler.err.warnings.and.werror") || !log.contains("1 error") || - !log.contains("1 warning")) + !log.contains("4 warning")) throw new Exception("expected output not found: " + log); } } From 0ba8b7a529ebb0113db5a882bb096324ced13290 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Wed, 5 Apr 2017 09:57:32 -0400 Subject: [PATCH 16/75] 8165641: Deprecate Object.finalize Reviewed-by: mchung, smarks --- .../com/sun/crypto/provider/DESKey.java | 3 +- .../com/sun/crypto/provider/DESedeKey.java | 3 +- .../com/sun/crypto/provider/PBEKey.java | 3 +- .../sun/crypto/provider/PBKDF2KeyImpl.java | 3 +- .../classes/java/io/FileInputStream.java | 12 ++++- .../classes/java/io/FileOutputStream.java | 11 ++++- .../share/classes/java/lang/ClassLoader.java | 1 + .../share/classes/java/lang/Enum.java | 3 +- .../share/classes/java/lang/Object.java | 45 ++++++++++++++++++- .../share/classes/java/lang/System.java | 1 + .../net/AbstractPlainDatagramSocketImpl.java | 3 +- .../java/net/AbstractPlainSocketImpl.java | 3 +- .../classes/java/net/SocketInputStream.java | 3 +- .../classes/java/net/SocketOutputStream.java | 3 +- .../share/classes/java/util/Timer.java | 3 +- .../java/util/concurrent/Executors.java | 1 + .../util/concurrent/ThreadPoolExecutor.java | 10 +++++ .../share/classes/java/util/zip/Deflater.java | 12 ++++- .../share/classes/java/util/zip/Inflater.java | 12 ++++- .../share/classes/java/util/zip/ZipFile.java | 11 +++++ .../jdk/internal/jrtfs/JrtFileSystem.java | 3 +- .../classes/sun/net/www/MeteredStream.java | 3 +- .../https/DelegateHttpsURLConnection.java | 3 +- .../https/HttpsURLConnectionImpl.java | 3 +- .../sun/nio/ch/DatagramChannelImpl.java | 3 +- .../sun/security/provider/KeyProtector.java | 3 +- .../sun/security/ssl/BaseSSLSocketImpl.java | 3 +- .../classes/sun/security/ssl/SunJSSE.java | 3 +- .../classes/apple/laf/JRSUIControl.java | 3 +- .../classes/sun/awt/CGraphicsEnvironment.java | 1 + .../macosx/classes/sun/font/CFont.java | 1 + .../macosx/classes/sun/font/CStrike.java | 3 +- .../sun/lwawt/macosx/CFRetainedResource.java | 3 +- .../classes/sun/lwawt/macosx/CPrinterJob.java | 3 +- .../plugins/common/SubImageInputStream.java | 3 +- .../imageio/plugins/png/PNGImageWriter.java | 4 +- .../plugins/tiff/TIFFBaseJPEGCompressor.java | 3 +- .../plugins/tiff/TIFFJPEGDecompressor.java | 3 +- .../plugins/tiff/TIFFOldJPEGDecompressor.java | 3 +- .../sun/imageio/stream/StreamFinalizer.java | 3 +- .../sun/media/sound/AbstractMidiDevice.java | 3 +- .../share/classes/java/awt/Graphics.java | 12 ++++- .../share/classes/java/awt/PrintJob.java | 12 ++++- .../classes/java/awt/color/ICC_Profile.java | 12 ++++- .../classes/java/awt/image/ColorModel.java | 12 ++++- .../java/awt/image/IndexColorModel.java | 12 ++++- .../javax/imageio/spi/ServiceRegistry.java | 13 +++++- .../stream/FileCacheImageInputStream.java | 12 ++++- .../imageio/stream/FileImageInputStream.java | 12 ++++- .../imageio/stream/FileImageOutputStream.java | 12 ++++- .../imageio/stream/ImageInputStreamImpl.java | 12 ++++- .../stream/MemoryCacheImageInputStream.java | 12 ++++- .../javax/swing/text/StringContent.java | 3 +- .../sun/awt/image/BufImgSurfaceData.java | 3 +- .../classes/sun/java2d/SunGraphics2D.java | 3 +- .../java2d/pipe/RegionClipSpanIterator.java | 3 +- .../share/classes/sun/print/PeekGraphics.java | 3 +- .../share/classes/sun/print/PrintJob2D.java | 3 +- .../classes/sun/print/ProxyGraphics.java | 3 +- .../classes/sun/print/ProxyGraphics2D.java | 3 +- .../unix/classes/sun/awt/X11InputMethod.java | 3 +- .../classes/sun/awt/windows/WInputMethod.java | 3 +- .../ldap/AbstractLdapNamingEnumeration.java | 3 +- .../classes/com/sun/jndi/ldap/LdapClient.java | 3 +- .../classes/com/sun/jndi/ldap/LdapCtx.java | 3 +- .../ldap/sasl/DefaultCallbackHandler.java | 3 +- .../classes/sun/rmi/log/LogInputStream.java | 3 +- .../transport/tcp/ConnectionMultiplexer.java | 3 +- .../security/jgss/wrapper/GSSCredElement.java | 3 +- .../security/jgss/wrapper/GSSNameElement.java | 3 +- .../jgss/wrapper/NativeGSSContext.java | 3 +- .../com/sun/security/sasl/CramMD5Base.java | 3 +- .../com/sun/security/sasl/PlainClient.java | 3 +- .../sun/security/smartcardio/CardImpl.java | 3 +- .../sun/security/pkcs11/P11KeyStore.java | 3 +- .../sun/security/pkcs11/wrapper/PKCS11.java | 3 +- .../classes/sun/security/mscapi/Key.java | 3 +- .../internal/jline/console/ConsoleReader.java | 1 + .../classes/com/sun/jndi/dns/DnsClient.java | 3 +- .../jndi/rmi/registry/RegistryContext.java | 5 ++- .../security/sasl/gsskerb/GssKrb5Base.java | 3 +- .../classes/jdk/nio/zipfs/ZipFileSystem.java | 1 + 82 files changed, 354 insertions(+), 73 deletions(-) diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java index d4493808167..d3f1c99df2a 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESKey.java @@ -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 @@ -149,6 +149,7 @@ final class DESKey implements SecretKey { * Ensures that the bytes of this key are * set to zero when there are no more references to it. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { if (this.key != null) { diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java index a0de5dc059c..9695ba39e6f 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java @@ -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 @@ -150,6 +150,7 @@ final class DESedeKey implements SecretKey { * Ensures that the bytes of this key are * set to zero when there are no more references to it. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { if (this.key != null) { diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java index 3331f787429..72e7452ace0 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java @@ -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 @@ -145,6 +145,7 @@ final class PBEKey implements SecretKey { * Ensures that the password bytes of this key are * set to zero when there are no more references to it. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { if (this.key != null) { diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java index 9d82ebb6ff2..1bf51566165 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -267,6 +267,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey { * Ensures that the password bytes of this key are * erased when there are no more references to it. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { if (this.passwd != null) { diff --git a/jdk/src/java.base/share/classes/java/io/FileInputStream.java b/jdk/src/java.base/share/classes/java/io/FileInputStream.java index a321c61ae41..0d8401128ff 100644 --- a/jdk/src/java.base/share/classes/java/io/FileInputStream.java +++ b/jdk/src/java.base/share/classes/java/io/FileInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -413,9 +413,19 @@ class FileInputStream extends InputStream * Ensures that the close method of this file input stream is * called when there are no more references to it. * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. + * * @exception IOException if an I/O error occurs. * @see java.io.FileInputStream#close() */ + @Deprecated(since="9") protected void finalize() throws IOException { if ((fd != null) && (fd != FileDescriptor.in)) { /* if fd is shared, the references in FileDescriptor diff --git a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java index f6bdb1f3b5f..634ca1ed481 100644 --- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java +++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -427,9 +427,18 @@ class FileOutputStream extends OutputStream * close method of this file output stream is * called when there are no more references to this stream. * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. * @exception IOException if an I/O error occurs. * @see java.io.FileInputStream#close() */ + @Deprecated(since="9") protected void finalize() throws IOException { if (fd != null) { if (fd == FileDescriptor.out || fd == FileDescriptor.err) { diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java index a6817746cdc..6bcd5520812 100644 --- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java @@ -2348,6 +2348,7 @@ public abstract class ClassLoader { this.isBuiltin = isBuiltin; } + @SuppressWarnings("deprecation") protected void finalize() { synchronized (loadedLibraryNames) { if (fromClass.getClassLoader() != null && loaded) { diff --git a/jdk/src/java.base/share/classes/java/lang/Enum.java b/jdk/src/java.base/share/classes/java/lang/Enum.java index 9a98f30bbbd..ac912f5ca65 100644 --- a/jdk/src/java.base/share/classes/java/lang/Enum.java +++ b/jdk/src/java.base/share/classes/java/lang/Enum.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -243,6 +243,7 @@ public abstract class Enum> /** * enum classes cannot have finalize methods. */ + @SuppressWarnings("deprecation") protected final void finalize() { } /** diff --git a/jdk/src/java.base/share/classes/java/lang/Object.java b/jdk/src/java.base/share/classes/java/lang/Object.java index 0677aa5d234..989ae4f7dae 100644 --- a/jdk/src/java.base/share/classes/java/lang/Object.java +++ b/jdk/src/java.base/share/classes/java/lang/Object.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -561,10 +561,53 @@ public class Object { * the finalization of this object to be halted, but is otherwise * ignored. * + * @apiNote + * Classes that embed non-heap resources have many options + * for cleanup of those resources. The class must ensure that the + * lifetime of each instance is longer than that of any resource it embeds. + * {@link java.lang.ref.Reference#reachabilityFence} can be used to ensure that + * objects remain reachable while resources embedded in the object are in use. + *

        + * A subclass should avoid overriding the {@code finalize} method + * unless the subclass embeds non-heap resources that must be cleaned up + * before the instance is collected. + * Finalizer invocations are not automatically chained, unlike constructors. + * If a subclass overrides {@code finalize} it must invoke the superclass + * finalizer explicitly. + * To guard against exceptions prematurely terminating the finalize chain, + * the subclass should use a {@code try-finally} block to ensure + * {@code super.finalize()} is always invoked. For example, + *

        {@code      @Override
        +     *     protected void finalize() throws Throwable {
        +     *         try {
        +     *             ... // cleanup subclass state
        +     *         } finally {
        +     *             super.finalize();
        +     *         }
        +     *     }
        +     * }
        + * + * @deprecated The finalization mechanism is inherently problematic. + * Finalization can lead to performance issues, deadlocks, and hangs. + * Errors in finalizers can lead to resource leaks; there is no way to cancel + * finalization if it is no longer necessary; and no ordering is specified + * among calls to {@code finalize} methods of different objects. + * Furthermore, there are no guarantees regarding the timing of finalization. + * The {@code finalize} method might be called on an finalizable object + * only after an indefinite delay, if at all. + * + * Classes whose instances hold non-heap resources should provide a method + * to enable explicit release of those resources, and they should also + * implement {@link AutoCloseable} if appropriate. + * The {@link java.lang.ref.Cleaner} and {@link java.lang.ref.PhantomReference} + * provide more flexible and efficient ways to release resources when an object + * becomes unreachable. + * * @throws Throwable the {@code Exception} raised by this method * @see java.lang.ref.WeakReference * @see java.lang.ref.PhantomReference * @jls 12.6 Finalization of Class Instances */ + @Deprecated(since="9") protected void finalize() throws Throwable { } } diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index 661c0f5a34c..0ad2031eccb 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -2097,6 +2097,7 @@ public final class System { public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) { return new Thread(target, acc); } + @SuppressWarnings("deprecation") public void invokeFinalize(Object o) throws Throwable { o.finalize(); } diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java index 4945713e228..d4414560fe6 100644 --- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java +++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -275,6 +275,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl return (fd == null) ? true : false; } + @SuppressWarnings("deprecation") protected void finalize() { close(); } diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java index 465ec01cc37..e66bbdc61aa 100644 --- a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java +++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -646,6 +646,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl /** * Cleans up if the user forgets to close it. */ + @SuppressWarnings("deprecation") protected void finalize() throws IOException { close(); } diff --git a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java index 2f54d344659..04ee3378eaa 100644 --- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java +++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -283,6 +283,7 @@ class SocketInputStream extends FileInputStream /** * Overrides finalize, the fd is closed by the Socket. */ + @SuppressWarnings("deprecation") protected void finalize() {} /** diff --git a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java index 9cbe056066f..0ba877bf56e 100644 --- a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java +++ b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -175,6 +175,7 @@ class SocketOutputStream extends FileOutputStream /** * Overrides finalize, the fd is closed by the Socket. */ + @SuppressWarnings("deprecation") protected void finalize() {} /** diff --git a/jdk/src/java.base/share/classes/java/util/Timer.java b/jdk/src/java.base/share/classes/java/util/Timer.java index 770d9f9df8b..7c47d0c7135 100644 --- a/jdk/src/java.base/share/classes/java/util/Timer.java +++ b/jdk/src/java.base/share/classes/java/util/Timer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,6 +108,7 @@ public class Timer { * finalizer forgetting to call it. */ private final Object threadReaper = new Object() { + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { synchronized(queue) { thread.newTasksMayBeScheduled = false; diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java b/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java index a31e3a1ebac..00fdf25772c 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/Executors.java @@ -713,6 +713,7 @@ public class Executors { FinalizableDelegatedExecutorService(ExecutorService executor) { super(executor); } + @SuppressWarnings("deprecation") protected void finalize() { super.shutdown(); } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java index 0016bfffe87..ceb9bf2022f 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java @@ -1490,7 +1490,17 @@ public class ThreadPoolExecutor extends AbstractExecutorService { /** * Invokes {@code shutdown} when this executor is no longer * referenced and it has no threads. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() { shutdown(); } diff --git a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java index bf70f4dd8a1..6eb5065040e 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java +++ b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -551,7 +551,17 @@ class Deflater { /** * Closes the compressor when garbage is collected. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() { end(); } diff --git a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java index 94c05e1d315..2aab545f2a1 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java +++ b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -378,7 +378,17 @@ class Inflater { /** * Closes the decompressor when garbage is collected. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() { end(); } diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java index ecd002bc340..83ce2441eeb 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -420,6 +420,7 @@ class ZipFile implements ZipConstants, Closeable { Integer.MAX_VALUE : (int) avail); } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { close(); } @@ -641,9 +642,18 @@ class ZipFile implements ZipConstants, Closeable { * This will prevent holding up system resources for an undetermined * length of time. * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. * @throws IOException if an I/O error has occurred * @see java.util.zip.ZipFile#close() */ + @Deprecated(since="9") protected void finalize() throws IOException { close(); } @@ -813,6 +823,7 @@ class ZipFile implements ZipConstants, Closeable { } } + @SuppressWarnings("deprecation") protected void finalize() { close(); } diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java index 49285b31dfb..d544e4c0deb 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java +++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java @@ -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 @@ -106,6 +106,7 @@ class JrtFileSystem extends FileSystem { } @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { cleanup(); diff --git a/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java b/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java index 29b998a5e70..08ff179457a 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java +++ b/jdk/src/java.base/share/classes/sun/net/www/MeteredStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -203,6 +203,7 @@ public class MeteredStream extends FilterInputStream { return super.markSupported(); } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { close(); diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java index b6ff7b417ac..2b5e5115cf3 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java +++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DelegateHttpsURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2005, 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 @@ -77,6 +77,7 @@ public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnecti * Called by layered delegator's finalize() method to handle closing * the underlying object. */ + @SuppressWarnings("deprecation") protected void dispose() throws Throwable { super.finalize(); } diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java index 1b2a584a79b..792af78675c 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java +++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java @@ -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 @@ -478,6 +478,7 @@ public class HttpsURLConnectionImpl * sun.net.www.protocol.http.HttpURLConnection's finalize() * would have to be made public. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { delegate.dispose(); } diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java index 7f63ec88264..c4d508070d4 100644 --- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java +++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java @@ -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 @@ -1034,6 +1034,7 @@ class DatagramChannelImpl } } + @SuppressWarnings("deprecation") protected void finalize() throws IOException { // fd is null if constructor threw exception if (fd != null) diff --git a/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java b/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java index ef7a1f43ffb..bffa1f5b283 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/KeyProtector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -147,6 +147,7 @@ final class KeyProtector { * Ensures that the password bytes of this key protector are * set to zero when there are no more references to it. */ + @SuppressWarnings("deprecation") protected void finalize() { if (passwdBytes != null) { Arrays.fill(passwdBytes, (byte)0x00); diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java index a09932d94e5..51560f5872d 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -265,6 +265,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { * the penalty of prematurly killing SSL sessions. */ @Override + @SuppressWarnings("deprecation") protected final void finalize() throws Throwable { try { close(); diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java b/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java index 3ef37b798a1..0bb89fbc3ca 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -247,6 +247,7 @@ public abstract class SunJSSE extends java.security.Provider { } @Override + @SuppressWarnings("deprecation") protected final void finalize() throws Throwable { // empty super.finalize(); diff --git a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java index 115002b5825..e3579449b75 100644 --- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java +++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,6 +114,7 @@ public final class JRSUIControl { changes.putAll(other.changes); } + @SuppressWarnings("deprecation") protected synchronized void finalize() throws Throwable { if (cfDictionaryPtr == 0) return; disposeCFDictionary(cfDictionaryPtr); diff --git a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java index f0db13f9567..ce5ed8b141e 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java +++ b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java @@ -124,6 +124,7 @@ public final class CGraphicsEnvironment extends SunGraphicsEnvironment { } @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { super.finalize(); diff --git a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java index c8c3f5b1fae..15abdda711d 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java +++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java @@ -250,6 +250,7 @@ public final class CFont extends PhysicalFont implements FontSubstitution { return compFont; } + @SuppressWarnings("deprecation") protected synchronized void finalize() { if (nativeFontPtr != 0) { disposeNativeFont(nativeFontPtr); diff --git a/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java b/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java index ed3838886c9..7eba9678020 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java +++ b/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -127,6 +127,7 @@ public final class CStrike extends PhysicalStrike { return nativeStrikePtr; } + @SuppressWarnings("deprecation") protected synchronized void finalize() throws Throwable { if (nativeStrikePtr != 0) { disposeNativeStrikePtr(nativeStrikePtr); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java index f69ad201ef8..e53f23a304b 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -135,6 +135,7 @@ public class CFRetainedResource { } @Override + @SuppressWarnings("deprecation") protected final void finalize() throws Throwable { dispose(); } diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java index 2d54d62b799..e54e1532666 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -556,6 +556,7 @@ public final class CPrinterJob extends RasterPrinterJob { // The following methods are CPrinterJob specific. @Override + @SuppressWarnings("deprecation") protected void finalize() { synchronized (fNSPrintInfoLock) { if (fNSPrintInfo != -1) { diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java index cdcb68dd90d..8ddffc522f1 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SubImageInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,6 +72,7 @@ public final class SubImageInputStream extends ImageInputStreamImpl { streamPos = pos; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { // Empty finalizer (for improved performance; no need to call // super.finalize() in this case) diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java index f1660f8a159..3fbc55c82b9 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,6 +143,7 @@ final class ChunkStream extends ImageOutputStreamImpl { } @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { // Empty finalizer (for improved performance; no need to call // super.finalize() in this case) @@ -279,6 +280,7 @@ final class IDATOutputStream extends ImageOutputStreamImpl { } @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { // Empty finalizer (for improved performance; no need to call // super.finalize() in this case) diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java index 46185618913..2adc479411c 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -435,6 +435,7 @@ public abstract class TIFFBaseJPEGCompressor extends TIFFCompressor { return compDataLength; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); if(JPEGWriter != null) { diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java index 966ca9575d9..384687f8344 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGDecompressor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,6 +139,7 @@ public class TIFFJPEGDecompressor extends TIFFDecompressor { JPEGReader.read(0, JPEGParam); } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); JPEGReader.dispose(); diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java index 2837754ddb2..67dd60f8a79 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -610,6 +610,7 @@ public class TIFFOldJPEGDecompressor extends TIFFJPEGDecompressor { JPEGReader.read(0, JPEGParam); } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); JPEGReader.dispose(); diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java index 36954988f1b..be1e659ee6e 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamFinalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,6 +60,7 @@ public class StreamFinalizer { this.stream = stream; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { stream.close(); diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java index 672b76f926b..bea9f5daf24 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -444,6 +444,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice * close this device if discarded by the garbage collector. */ @Override + @SuppressWarnings("deprecation") protected final void finalize() { close(); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/Graphics.java b/jdk/src/java.desktop/share/classes/java/awt/Graphics.java index 932a89d5ade..317a93fad22 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Graphics.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Graphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1159,8 +1159,18 @@ public abstract class Graphics { /** * Disposes of this graphics context once it is no longer referenced. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. * @see #dispose */ + @Deprecated(since="9") public void finalize() { dispose(); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java b/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java index fcc6afebf2a..9012608584f 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java +++ b/jdk/src/java.desktop/share/classes/java/awt/PrintJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,8 +79,18 @@ public abstract class PrintJob { /** * Ends this print job once it is no longer referenced. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. * @see #end */ + @Deprecated(since="9") public void finalize() { end(); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java index 3adc80fa59f..625664f41d0 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java +++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java @@ -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 @@ -751,7 +751,17 @@ public class ICC_Profile implements Serializable { /** * Frees the resources associated with an ICC_Profile object. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize () { if (cmmProfile != null) { CMSManager.getModule().freeProfile(cmmProfile); diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java index 07e823ce6aa..2be7f7e844f 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java @@ -1620,7 +1620,17 @@ public abstract class ColorModel implements Transparency{ * Disposes of system resources associated with this * {@code ColorModel} once this {@code ColorModel} is no * longer referenced. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") public void finalize() { } @@ -1952,4 +1962,4 @@ public abstract class ColorModel implements Transparency{ return lg16Toog16LUT; } -} \ No newline at end of file +} diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java index 3a172c142e2..81aab994178 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/IndexColorModel.java @@ -1514,7 +1514,17 @@ public class IndexColorModel extends ColorModel { * Disposes of system resources associated with this * {@code ColorModel} once this {@code ColorModel} is no * longer referenced. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") public void finalize() { } @@ -1630,4 +1640,4 @@ public class IndexColorModel extends ColorModel { } return result; } -} \ No newline at end of file +} diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java index 465f155374e..2df6e1ba03b 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -706,7 +706,17 @@ public class ServiceRegistry { * * @exception Throwable if an error occurs during superclass * finalization. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") public void finalize() throws Throwable { deregisterAll(); super.finalize(); @@ -846,6 +856,7 @@ class SubRegistry { poset.clear(); } + @SuppressWarnings("deprecation") public synchronized void finalize() { clear(); } diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java index f354f7a113a..e5974900161 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -260,7 +260,17 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { /** * {@inheritDoc} + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() throws Throwable { // Empty finalizer: for performance reasons we instead use the // Disposer mechanism for ensuring that the underlying diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java index b7129085317..7ecc28767a0 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,7 +155,17 @@ public class FileImageInputStream extends ImageInputStreamImpl { /** * {@inheritDoc} + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() throws Throwable { // Empty finalizer: for performance reasons we instead use the // Disposer mechanism for ensuring that the underlying diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java index c76d09f4b71..e75c40396d8 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -163,7 +163,17 @@ public class FileImageOutputStream extends ImageOutputStreamImpl { /** * {@inheritDoc} + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() throws Throwable { // Empty finalizer: for performance reasons we instead use the // Disposer mechanism for ensuring that the underlying diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java index 3d17e278e99..c7cdc47cdaf 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -867,7 +867,17 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { * * @exception Throwable if an error occurs during superclass * finalization. + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() throws Throwable { if (!isClosed) { try { diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java index 87774c1d94f..4fcb0f40b81 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCacheImageInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -178,7 +178,17 @@ public class MemoryCacheImageInputStream extends ImageInputStreamImpl { /** * {@inheritDoc} + * + * @deprecated The {@code finalize} method has been deprecated. + * Subclasses that override {@code finalize} in order to perform cleanup + * should be modified to use alternative cleanup mechanisms and + * to remove the overriding {@code finalize} method. + * When overriding the {@code finalize} method, its implementation must explicitly + * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. + * See the specification for {@link Object#finalize()} for further + * information about migration options. */ + @Deprecated(since="9") protected void finalize() throws Throwable { // Empty finalizer: for performance reasons we instead use the // Disposer mechanism for ensuring that the underlying diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java index d6b897fd93f..4f26f54d8b8 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java @@ -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 @@ -351,6 +351,7 @@ public final class StringContent implements AbstractDocument.Content, Serializab return rec.offset; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { // schedule the record to be removed later // on another thread. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java b/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java index 8d37a2d6a1d..ac42b424152 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -472,6 +472,7 @@ public class BufImgSurfaceData extends SurfaceData { this.pData = pData; } + @SuppressWarnings("deprecation") public void finalize() { if (pData != 0L) { BufImgSurfaceData.freeNativeICMData(pData); diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java index 4c0abc9eec8..d2ae86ef3b4 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3633,6 +3633,7 @@ public final class SunGraphics2D * enough to know that if our override is empty then it should not * mark us as finalizeable. */ + @SuppressWarnings("deprecation") public void finalize() { // DO NOT REMOVE THIS METHOD } diff --git a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java index 69bba24c2a6..cf8193f0c42 100644 --- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java +++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RegionClipSpanIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -383,6 +383,7 @@ public class RegionClipSpanIterator implements SpanIterator { */ //public native void dispose(); + @SuppressWarnings("deprecation") protected void finalize() { //dispose(); } diff --git a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java index b76321d84a3..c273ca1d071 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PeekGraphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1336,6 +1336,7 @@ public class PeekGraphics extends Graphics2D /** * Empty finalizer as no clean up needed here. */ + @SuppressWarnings("deprecation") public void finalize() { } diff --git a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java index b62c4eb1298..9d9b2009af3 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -942,6 +942,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable { * Ends this print job once it is no longer referenced. * @see #end */ + @SuppressWarnings("deprecation") public void finalize() { end(); } diff --git a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java index eefb49ee75a..5d50ab8ba9d 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java +++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1099,6 +1099,7 @@ public class ProxyGraphics extends Graphics { /** * Empty finalizer as no clean up needed here. */ + @SuppressWarnings("deprecation") public void finalize() { } diff --git a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java index 6ded8e98eab..2fc626721e2 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java +++ b/jdk/src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1264,6 +1264,7 @@ public class ProxyGraphics2D extends Graphics2D implements PrinterGraphics { /** * Empty finalizer as no clean up needed here. */ + @SuppressWarnings("deprecation") public void finalize() { } diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java index 0ac2a16243a..2e570129f84 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java @@ -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 @@ -181,6 +181,7 @@ public abstract class X11InputMethod extends InputMethodAdapter { } } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { dispose(); super.finalize(); diff --git a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java index 4bd8f7b5e98..1d3a176388c 100644 --- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java +++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java @@ -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 @@ -132,6 +132,7 @@ final class WInputMethod extends InputMethodAdapter } @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { // Release the resources used by the native input context. diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java index 8bef0da95ca..31b9c5c87d0 100644 --- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java +++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -382,6 +382,7 @@ abstract class AbstractLdapNamingEnumeration listArg = ne.listArg; } + @SuppressWarnings("deprecation") protected final void finalize() { cleanup(); } diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java index f6b42d341fb..c6159711d13 100644 --- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java +++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -474,6 +474,7 @@ public final class LdapClient implements PooledConnection { } } + @SuppressWarnings("deprecation") protected void finalize() { if (debug > 0) System.err.println("LdapClient: finalize " + this); forceClose(pooled); diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java index 5308478c9f9..6484c3945ab 100644 --- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java +++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2609,6 +2609,7 @@ final public class LdapCtx extends ComponentDirContext // ----------------- Connection --------------------- + @SuppressWarnings("deprecation") protected void finalize() { try { close(); diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java index a1d53b277f2..e5e04a12ee2 100644 --- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java +++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -129,6 +129,7 @@ final class DefaultCallbackHandler implements CallbackHandler { } } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { clearPassword(); } diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java b/jdk/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java index 319e9741155..649fa22516d 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -128,6 +128,7 @@ class LogInputStream extends InputStream { /** * Closes the stream when garbage is collected. */ + @SuppressWarnings("deprecation") protected void finalize() throws IOException { close(); } diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java b/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java index fae0e36570b..42857ec967c 100644 --- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java +++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -440,6 +440,7 @@ final class ConnectionMultiplexer { /** * Shut down connection upon finalization. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java index 3b06c7a0da9..019fa6f8052 100644 --- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java +++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -130,6 +130,7 @@ public class GSSCredElement implements GSSCredentialSpi { return "N/A"; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { dispose(); } diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java index 3463fd69dfa..88274c1601b 100644 --- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java +++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSNameElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -289,6 +289,7 @@ public class GSSNameElement implements GSSNameSpi { } } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { dispose(); } diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java index 271fcfb896b..d2d5367f1b8 100644 --- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java +++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -618,6 +618,7 @@ class NativeGSSContext implements GSSContextSpi { return isInitiator; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { dispose(); } diff --git a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java index 88ddb7fb42c..0d521bf5a00 100644 --- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java +++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -136,6 +136,7 @@ abstract class CramMD5Base { } } + @SuppressWarnings("deprecation") protected void finalize() { clearPassword(); } diff --git a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java index ce92c2939a1..7d561542d8f 100644 --- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java +++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/PlainClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,6 +199,7 @@ final class PlainClient implements SaslClient { } } + @SuppressWarnings("deprecation") protected void finalize() { clearPassword(); } diff --git a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java index f3a01511a29..d7e8f49fa83 100644 --- a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java +++ b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -274,6 +274,7 @@ final class CardImpl extends Card { + ", protocol " + getProtocol() + ", state " + state; } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { if (state == State.OK) { diff --git a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java index c630598f199..43ebbec7436 100644 --- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java +++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java @@ -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 @@ -241,6 +241,7 @@ final class P11KeyStore extends KeyStoreSpi { pc.setPassword(password); // this clones the password if not null } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { if (password != null) { Arrays.fill(password, ' '); diff --git a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java index 0b3c7a089d6..554f4d5bb6e 100644 --- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java +++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/PKCS11.java @@ -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. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -1531,6 +1531,7 @@ public class PKCS11 { * * @exception Throwable If finalization fails. */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { disconnect(); } diff --git a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java index 8154c489a95..a36656f4521 100644 --- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java +++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,6 +52,7 @@ abstract class Key implements java.security.Key, Length /** * Finalization method */ + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { diff --git a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java index a7f26871f28..6a9fb3b9db9 100644 --- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java +++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java @@ -306,6 +306,7 @@ public class ConsoleReader * Shuts down the ConsoleReader if the JVM attempts to clean it up. */ @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { try { shutdown(); diff --git a/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java b/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java index 6820eee580b..90ed8ef965c 100644 --- a/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java +++ b/jdk/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -142,6 +142,7 @@ public class DnsClient { resps = Collections.synchronizedMap(new HashMap()); } + @SuppressWarnings("deprecation") protected void finalize() { close(); } diff --git a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java index 874d6872af5..81a348f013f 100644 --- a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java +++ b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,6 +119,7 @@ public class RegistryContext implements Context, Referenceable { reference = ctx.reference; } + @SuppressWarnings("deprecation") protected void finalize() { close(); } @@ -593,6 +594,7 @@ class BindingEnumeration implements NamingEnumeration { nextName = 0; } + @SuppressWarnings("deprecation") protected void finalize() { ctx.close(); } @@ -633,6 +635,7 @@ class BindingEnumeration implements NamingEnumeration { } } + @SuppressWarnings("deprecation") public void close () { finalize(); } diff --git a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java index 7a7dc52a26c..bb7a4e4ad41 100644 --- a/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java +++ b/jdk/src/jdk.security.jgss/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java @@ -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 @@ -158,6 +158,7 @@ abstract class GssKrb5Base extends AbstractSaslImpl { } } + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { dispose(); } diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java index 498a93dc902..2b9891b8e15 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java @@ -936,6 +936,7 @@ class ZipFileSystem extends FileSystem { return zc.toString(name); } + @SuppressWarnings("deprecation") protected void finalize() throws IOException { close(); } From c7743f769842d7f9152df19901a5452593df921b Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Wed, 5 Apr 2017 10:55:31 -0700 Subject: [PATCH 17/75] 8177980: ResourceBundle.getBundle throws NoClassDefFoundError when fails to define a class Reviewed-by: naoto, lancea --- .../classes/java/util/ResourceBundle.java | 2 +- .../CaseInsensitiveNameClash.java | 72 +++++++++++++++++++ .../src/resbundle/jdk/test/Main.java | 35 +++++++++ .../src/resbundle/jdk/test/main.properties | 1 + .../src/resbundle/module-info.java | 25 +++++++ 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java create mode 100644 jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/Main.java create mode 100644 jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/main.properties create mode 100644 jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/module-info.java diff --git a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java index b587da9b9e3..07a71db5ba7 100644 --- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java @@ -1836,7 +1836,7 @@ public abstract class ResourceBundle { cacheKey.setFormat(format); break; } - } catch (Exception e) { + } catch (LinkageError|Exception e) { cacheKey.setCause(e); } } diff --git a/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java b/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java new file mode 100644 index 00000000000..b3eef5d3d6c --- /dev/null +++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8177980 + * @library /lib/testlibrary + * @modules jdk.compiler + * @build CompilerUtils jdk.testlibrary.ProcessTools CaseInsensitiveNameClash + * @run testng CaseInsensitiveNameClash + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import jdk.testlibrary.ProcessTools; + +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +public class CaseInsensitiveNameClash { + + private static final String TEST_SRC = System.getProperty("test.src"); + + private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); + private static final Path MODS_DIR = Paths.get("mods"); + + private static final String MODULE = "resbundle"; + private static final String MAIN_CLASS = MODULE + "/jdk.test.Main"; + + /** + * Compiles the module used by the test + */ + @BeforeTest + public void compileAll() throws Exception { + Path msrc = SRC_DIR.resolve(MODULE); + assertTrue(CompilerUtils.compile(msrc, MODS_DIR, + "--module-source-path", SRC_DIR.toString())); + Path propsFile = Paths.get("jdk", "test", "main.properties"); + Files.copy(msrc.resolve(propsFile), MODS_DIR.resolve(MODULE).resolve(propsFile)); + } + + @Test + public void test() throws Exception { + assertTrue(ProcessTools.executeTestJava("--module-path", MODS_DIR.toString(), + "-m", MAIN_CLASS) + .outputTo(System.out) + .errorTo(System.out) + .getExitValue() == 0); + } +} diff --git a/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/Main.java b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/Main.java new file mode 100644 index 00000000000..73ff726bd3c --- /dev/null +++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/Main.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test; + +import java.util.ResourceBundle; + +public class Main { + public static void main(String[] args) throws Exception { + ResourceBundle bundle = ResourceBundle.getBundle("jdk.test.main"); + if (!bundle.getString("key").equals("value")) { + throw new RuntimeException("Expected: value but get " + bundle.getString("key")); + } + } +} diff --git a/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/main.properties b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/main.properties new file mode 100644 index 00000000000..7b89edbafe4 --- /dev/null +++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/jdk/test/main.properties @@ -0,0 +1 @@ +key=value diff --git a/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/module-info.java b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/module-info.java new file mode 100644 index 00000000000..fdb2838915d --- /dev/null +++ b/jdk/test/java/util/ResourceBundle/modules/casesensitive/src/resbundle/module-info.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module resbundle { +} From 779aa6fe364d242551769edb71db07d2d5365bf6 Mon Sep 17 00:00:00 2001 From: Amy Lu Date: Thu, 6 Apr 2017 09:33:47 +0800 Subject: [PATCH 18/75] 8177640: jdk/internal/util/jar/TestVersionedStream.java fails on Windows Reviewed-by: psandoz --- jdk/test/ProblemList.txt | 2 -- .../util/jar/TestVersionedStream.java | 30 ++++++++----------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 95ad6434a0c..8ec40b35d3b 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -284,8 +284,6 @@ com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows- java/util/BitSet/BitSetStreamTest.java 8079538 generic-all -jdk/internal/util/jar/TestVersionedStream.java 8177640 windows-all - ############################################################################ # jdk_instrument diff --git a/jdk/test/jdk/internal/util/jar/TestVersionedStream.java b/jdk/test/jdk/internal/util/jar/TestVersionedStream.java index 5dbef938752..1f043b2bc33 100644 --- a/jdk/test/jdk/internal/util/jar/TestVersionedStream.java +++ b/jdk/test/jdk/internal/util/jar/TestVersionedStream.java @@ -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 @@ -40,7 +40,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; -import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -168,23 +167,23 @@ public class TestVersionedStream { // verify the contents Map contents = new HashMap<>(); - contents.put("p/Bar.class", "base/p/Bar.class\n"); - contents.put("p/Main.class", "base/p/Main.class\n"); + contents.put("p/Bar.class", "base/p/Bar.class"); + contents.put("p/Main.class", "base/p/Main.class"); switch (version.major()) { case 8: - contents.put("p/Foo.class", "base/p/Foo.class\n"); + contents.put("p/Foo.class", "base/p/Foo.class"); break; case 9: - contents.put("p/Foo.class", "v9/p/Foo.class\n"); + contents.put("p/Foo.class", "v9/p/Foo.class"); break; case 10: - contents.put("p/Foo.class", "v10/p/Foo.class\n"); - contents.put("q/Bar.class", "v10/q/Bar.class\n"); + contents.put("p/Foo.class", "v10/p/Foo.class"); + contents.put("q/Bar.class", "v10/q/Bar.class"); break; case 11: - contents.put("p/Bar.class", "v11/p/Bar.class\n"); - contents.put("p/Foo.class", "v11/p/Foo.class\n"); - contents.put("q/Bar.class", "v10/q/Bar.class\n"); + contents.put("p/Bar.class", "v11/p/Bar.class"); + contents.put("p/Foo.class", "v11/p/Foo.class"); + contents.put("q/Bar.class", "v10/q/Bar.class"); break; default: Assert.fail("Test out of date, please add more cases"); @@ -196,7 +195,7 @@ public class TestVersionedStream { Assert.assertTrue(i != -1, name + " not in enames"); JarEntry je = versionedEntries.get(i); try (InputStream is = jf.getInputStream(je)) { - String s = new String(is.readAllBytes()); + String s = new String(is.readAllBytes()).replaceAll(System.lineSeparator(), ""); Assert.assertTrue(s.endsWith(e.getValue()), s); } catch (IOException x) { throw new UncheckedIOException(x); @@ -208,16 +207,13 @@ public class TestVersionedStream { private void createFiles(String... files) { ArrayList list = new ArrayList(); Arrays.stream(files) - .map(f -> "file:///" + userdir + "/" + f) - .map(f -> URI.create(f)) - .filter(u -> u != null) - .map(u -> Paths.get(u)) + .map(f -> Paths.get(userdir.toAbsolutePath().toString(), f)) .forEach(p -> { try { Files.createDirectories(p.getParent()); Files.createFile(p); list.clear(); - list.add(p.toString()); + list.add(p.toString().replace(File.separatorChar, '/')); Files.write(p, list); } catch (IOException x) { throw new UncheckedIOException(x); From 04f675702768994493e56b7bdc05ac3ddf49480c Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Thu, 6 Apr 2017 09:00:47 +0100 Subject: [PATCH 19/75] 8178101: Migrate the thread deprecation technote to javadoc doc-files Reviewed-by: dholmes --- .../share/classes/java/lang/Thread.java | 10 +- .../doc-files/threadPrimitiveDeprecation.html | 364 ++++++++++++++++++ 2 files changed, 369 insertions(+), 5 deletions(-) create mode 100644 jdk/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java index a7fc391d540..8ecc90dd964 100644 --- a/jdk/src/java.base/share/classes/java/lang/Thread.java +++ b/jdk/src/java.base/share/classes/java/lang/Thread.java @@ -927,7 +927,7 @@ class Thread implements Runnable { * for example), the interrupt method should be used to * interrupt the wait. * For more information, see - * Why + * Why * are Thread.stop, Thread.suspend and Thread.resume Deprecated?. */ @Deprecated(since="1.2") @@ -960,7 +960,7 @@ class Thread implements Runnable { * could be used to generate exceptions that the target thread was * not prepared to handle. * For more information, see - * Why + * Why * are Thread.stop, Thread.suspend and Thread.resume Deprecated?. * This method is subject to removal in a future version of Java SE. */ @@ -1082,7 +1082,7 @@ class Thread implements Runnable { * If another thread ever attempted to lock this resource, deadlock * would result. Such deadlocks typically manifest themselves as * "frozen" processes. For more information, see - * + * * Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?. * This method is subject to removal in a future version of Java SE. * @throws NoSuchMethodError always @@ -1122,7 +1122,7 @@ class Thread implements Runnable { * monitor prior to calling resume, deadlock results. Such * deadlocks typically manifest themselves as "frozen" processes. * For more information, see - * Why + * Why * are Thread.stop, Thread.suspend and Thread.resume Deprecated?. */ @Deprecated(since="1.2") @@ -1148,7 +1148,7 @@ class Thread implements Runnable { * @deprecated This method exists solely for use with {@link #suspend}, * which has been deprecated because it is deadlock-prone. * For more information, see - * Why + * Why * are Thread.stop, Thread.suspend and Thread.resume Deprecated?. */ @Deprecated(since="1.2") diff --git a/jdk/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html b/jdk/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html new file mode 100644 index 00000000000..aa6ba4981f4 --- /dev/null +++ b/jdk/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html @@ -0,0 +1,364 @@ + + + + + Java Thread Primitive Deprecation + + + +

        Java Thread Primitive Deprecation

        +
        +

        Why is Thread.stop deprecated?

        +

        Because it is inherently unsafe. Stopping a thread causes it to +unlock all the monitors that it has locked. (The monitors are +unlocked as the ThreadDeath exception propagates up +the stack.) If any of the objects previously protected by these +monitors were in an inconsistent state, other threads may now view +these objects in an inconsistent state. Such objects are said to be +damaged. When threads operate on damaged objects, arbitrary +behavior can result. This behavior may be subtle and difficult to +detect, or it may be pronounced. Unlike other unchecked exceptions, +ThreadDeath kills threads silently; thus, the user has +no warning that his program may be corrupted. The corruption can +manifest itself at any time after the actual damage occurs, even +hours or days in the future.

        +
        +

        Couldn't I just catch the ThreadDeath exception +and fix the damaged object?

        +

        In theory, perhaps, but it would vastly complicate the +task of writing correct multithreaded code. The task would be +nearly insurmountable for two reasons:

        +
          +
        1. A thread can throw a ThreadDeath exception +almost anywhere. All synchronized methods and blocks would +have to be studied in great detail, with this in mind.
        2. +
        3. A thread can throw a second ThreadDeath exception +while cleaning up from the first (in the catch or +finally clause). Cleanup would have to be repeated till +it succeeded. The code to ensure this would be quite complex.
        4. +
        +In sum, it just isn't practical. +
        +

        What about Thread.stop(Throwable)?

        +

        In addition to all of the problems noted above, this method may +be used to generate exceptions that its target thread is unprepared +to handle (including checked exceptions that the thread could not +possibly throw, were it not for this method). For example, the +following method is behaviorally identical to Java's +throw operation, but circumvents the compiler's +attempts to guarantee that the calling method has declared all of +the checked exceptions that it may throw:

        +
        +    static void sneakyThrow(Throwable t) {
        +        Thread.currentThread().stop(t);
        +    }
        +
        +
        +

        What should I use instead of Thread.stop?

        +

        Most uses of stop should be replaced by code that +simply modifies some variable to indicate that the target thread +should stop running. The target thread should check this variable +regularly, and return from its run method in an orderly fashion if +the variable indicates that it is to stop running. To ensure prompt +communication of the stop-request, the variable must be +volatile (or access to the variable must be +synchronized).

        +

        For example, suppose your applet contains the following +start, stop and run +methods:

        +
        +    private Thread blinker;
        +
        +    public void start() {
        +        blinker = new Thread(this);
        +        blinker.start();
        +    }
        +
        +    public void stop() {
        +        blinker.stop();  // UNSAFE!
        +    }
        +
        +    public void run() {
        +        while (true) {
        +            try {
        +                Thread.sleep(interval);
        +            } catch (InterruptedException e){
        +            }
        +            repaint();
        +        }
        +    }
        +
        +You can avoid the use of Thread.stop by replacing the +applet's stop and run methods with: +
        +    private volatile Thread blinker;
        +
        +    public void stop() {
        +        blinker = null;
        +    }
        +
        +    public void run() {
        +        Thread thisThread = Thread.currentThread();
        +        while (blinker == thisThread) {
        +            try {
        +                Thread.sleep(interval);
        +            } catch (InterruptedException e){
        +            }
        +            repaint();
        +        }
        +    }
        +
        +
        +

        How do I stop a thread that waits for long periods (e.g., for +input)?

        +

        That's what the Thread.interrupt method is for. The +same "state based" signaling mechanism shown above can be used, but +the state change (blinker = null, in the previous +example) can be followed by a call to +Thread.interrupt, to interrupt the wait:

        +
        +    public void stop() {
        +        Thread moribund = waiter;
        +        waiter = null;
        +        moribund.interrupt();
        +    }
        +
        +For this technique to work, it's critical that any method that +catches an interrupt exception and is not prepared to deal with it +immediately reasserts the exception. We say reasserts +rather than rethrows, because it is not always possible to +rethrow the exception. If the method that catches the +InterruptedException is not declared to throw this +(checked) exception, then it should "reinterrupt itself" with the +following incantation: +
        +    Thread.currentThread().interrupt();
        +
        +This ensures that the Thread will reraise the +InterruptedException as soon as it is able. +
        +

        What if a thread doesn't respond to +Thread.interrupt?

        +

        In some cases, you can use application specific tricks. For +example, if a thread is waiting on a known socket, you can close +the socket to cause the thread to return immediately. +Unfortunately, there really isn't any technique that works in +general. It should be noted that in all situations where a +waiting thread doesn't respond to Thread.interrupt, it +wouldn't respond to Thread.stop either. Such +cases include deliberate denial-of-service attacks, and I/O +operations for which thread.stop and thread.interrupt do not work +properly.

        +
        +

        Why are Thread.suspend and +Thread.resume deprecated?

        +

        Thread.suspend is inherently deadlock-prone. If the +target thread holds a lock on the monitor protecting a critical +system resource when it is suspended, no thread can access this +resource until the target thread is resumed. If the thread that +would resume the target thread attempts to lock this monitor prior +to calling resume, deadlock results. Such deadlocks +typically manifest themselves as "frozen" processes.

        +
        +

        What should I use instead of Thread.suspend and +Thread.resume?

        +

        As with Thread.stop, the prudent approach is to +have the "target thread" poll a variable indicating the desired +state of the thread (active or suspended). When the desired state +is suspended, the thread waits using Object.wait. When +the thread is resumed, the target thread is notified using +Object.notify.

        +

        For example, suppose your applet contains the following +mousePressed event handler, which toggles the state of a thread +called blinker:

        +
        +    private boolean threadSuspended;
        +
        +    Public void mousePressed(MouseEvent e) {
        +        e.consume();
        +
        +        if (threadSuspended)
        +            blinker.resume();
        +        else
        +            blinker.suspend();  // DEADLOCK-PRONE!
        +
        +        threadSuspended = !threadSuspended;
        +    }
        +
        +You can avoid the use of Thread.suspend and +Thread.resume by replacing the event handler above +with: +
        +    public synchronized void mousePressed(MouseEvent e) {
        +        e.consume();
        +
        +        threadSuspended = !threadSuspended;
        +
        +        if (!threadSuspended)
        +            notify();
        +    }
        +
        +and adding the following code to the "run loop": +
        +                synchronized(this) {
        +                    while (threadSuspended)
        +                        wait();
        +                }
        +
        +The wait method throws the +InterruptedException, so it must be inside a try +... catch clause. It's fine to put it in the same clause as +the sleep. The check should follow (rather than +precede) the sleep so the window is immediately +repainted when the thread is "resumed." The resulting +run method follows: +
        +    public void run() {
        +        while (true) {
        +            try {
        +                Thread.sleep(interval);
        +
        +                synchronized(this) {
        +                    while (threadSuspended)
        +                        wait();
        +                }
        +            } catch (InterruptedException e){
        +            }
        +            repaint();
        +        }
        +    }
        +
        +Note that the notify in the mousePressed +method and the wait in the run method are +inside synchronized blocks. This is required by the +language, and ensures that wait and +notify are properly serialized. In practical terms, +this eliminates race conditions that could cause the "suspended" +thread to miss a notify and remain suspended +indefinitely. +

        While the cost of synchronization in Java is decreasing as the +platform matures, it will never be free. A simple trick can be used +to remove the synchronization that we've added to each iteration of +the "run loop." The synchronized block that was added is replaced +by a slightly more complex piece of code that enters a synchronized +block only if the thread has actually been suspended:

        +
        +                if (threadSuspended) {
        +                    synchronized(this) {
        +                        while (threadSuspended)
        +                            wait();
        +                    }
        +                }
        +
        +

        In the absence of explicit synchronization, +threadSuspended must be made volatile to ensure +prompt communication of the suspend-request.

        +The resulting run method is: +
        +    private volatile boolean threadSuspended;
        +
        +    public void run() {
        +        while (true) {
        +            try {
        +                Thread.sleep(interval);
        +
        +                if (threadSuspended) {
        +                    synchronized(this) {
        +                        while (threadSuspended)
        +                            wait();
        +                    }
        +                }
        +            } catch (InterruptedException e){
        +            }
        +            repaint();
        +        }
        +    }
        +
        +
        +

        Can I combine the two techniques to produce a thread that may +be safely "stopped" or "suspended"?

        +Yes, it's reasonably straightforward. The one subtlety is that the +target thread may already be suspended at the time that another +thread tries to stop it. If the stop method merely sets +the state variable (blinker) to null, the target thread +will remain suspended (waiting on the monitor), rather than exiting +gracefully as it should. If the applet is restarted, multiple +threads could end up waiting on the monitor at the same time, +resulting in erratic behavior. +

        To rectify this situation, the stop method must ensure +that the target thread resumes immediately if it is suspended. Once +the target thread resumes, it must recognize immediately that it +has been stopped, and exit gracefully. Here's how the resulting +run and stop methods look:

        +
        +    public void run() {
        +        Thread thisThread = Thread.currentThread();
        +        while (blinker == thisThread) {
        +            try {
        +                Thread.sleep(interval);
        +
        +                synchronized(this) {
        +                    while (threadSuspended && blinker==thisThread)
        +                        wait();
        +                }
        +            } catch (InterruptedException e){
        +            }
        +            repaint();
        +        }
        +    }
        +
        +    public synchronized void stop() {
        +        blinker = null;
        +        notify();
        +    }
        +
        +If the stop method calls Thread.interrupt, as +described above, it needn't call notify as well, but it +still must be synchronized. This ensures that the target thread +won't miss an interrupt due to a race condition. +
        +

        What about Thread.destroy?

        +Thread.destroy was never implemented and has been +deprecated. If it were implemented, it would be deadlock-prone in +the manner of Thread.suspend. (In fact, it is roughly +equivalent to Thread.suspend without the possibility +of a subsequent Thread.resume.) +
        +

        Why is Runtime.runFinalizersOnExit +deprecated?

        +Because it is inherently unsafe. It may result in finalizers being +called on live objects while other threads are concurrently +manipulating those objects, resulting in erratic behavior or +deadlock. While this problem could be prevented if the class whose +objects are being finalized were coded to "defend against" this +call, most programmers do not defend against it. They assume +that an object is dead at the time that its finalizer is called. +

        Further, the call is not "thread-safe" in the sense that it sets +a VM-global flag. This forces every class with a finalizer +to defend against the finalization of live objects!

        +

        + + From c8873016c3d2822fc4f726f92d294c763ffdfc15 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Thu, 6 Apr 2017 14:38:15 +0100 Subject: [PATCH 20/75] 8178139: Minor typo in API documentation of java.util.logging.Logger Reviewed-by: lancea --- .../java.logging/share/classes/java/util/logging/Logger.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java index 1cfd6f98659..d99b13907e5 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java @@ -664,7 +664,7 @@ public class Logger { * a new logger is created. *

        * If a new logger is created its log level will be configured - * based on the LogManager configuration and it will configured + * based on the LogManager configuration and it will be configured * to also send logging output to its parent's Handlers. It will * be registered in the LogManager global namespace. *

        @@ -726,7 +726,7 @@ public class Logger { * *

        * If a new logger is created its log level will be configured - * based on the LogManager and it will configured to also send logging + * based on the LogManager and it will be configured to also send logging * output to its parent's Handlers. It will be registered in * the LogManager global namespace. *

        From 8286fe95ee508f9a151e5fd5b27a31cc32bd7344 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 6 Apr 2017 16:17:03 +0200 Subject: [PATCH 21/75] 8178077: jshell tool: crash on ctrl-up or ctrl-down When looking up a private method, using the ConsoleReader.class, instead of getClass(), which may return a subclass. Reviewed-by: rfield --- .../classes/jdk/internal/jline/extra/EditingHistory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java index 394d0eb4096..fcccd9d2523 100644 --- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java +++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java @@ -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 @@ -74,7 +74,7 @@ public abstract class EditingHistory implements History { //in.resetPromptLine(in.getPrompt(), in.getHistory().current().toString(), -1); //but that would mean more re-writing on the screen, (and prints an additional //empty line), so using setBuffer directly: - Method setBuffer = in.getClass().getDeclaredMethod("setBuffer", String.class); + Method setBuffer = ConsoleReader.class.getDeclaredMethod("setBuffer", String.class); setBuffer.setAccessible(true); setBuffer.invoke(in, in.getHistory().current().toString()); From 0f883182133a6616311ad52c9db6bc8c2b9dda8f Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Thu, 6 Apr 2017 10:41:31 -0400 Subject: [PATCH 22/75] 8178154: Typo in Object.finalize deprecation javadoc Reviewed-by: mchung --- jdk/src/java.base/share/classes/java/lang/Object.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Object.java b/jdk/src/java.base/share/classes/java/lang/Object.java index 989ae4f7dae..e1cb6e0246d 100644 --- a/jdk/src/java.base/share/classes/java/lang/Object.java +++ b/jdk/src/java.base/share/classes/java/lang/Object.java @@ -593,7 +593,7 @@ public class Object { * finalization if it is no longer necessary; and no ordering is specified * among calls to {@code finalize} methods of different objects. * Furthermore, there are no guarantees regarding the timing of finalization. - * The {@code finalize} method might be called on an finalizable object + * The {@code finalize} method might be called on a finalizable object * only after an indefinite delay, if at all. * * Classes whose instances hold non-heap resources should provide a method From af1c347cbdfe03a556aed6ab5ad98522fece14a9 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Wed, 5 Apr 2017 14:05:00 -0700 Subject: [PATCH 23/75] 8065825: Make the java -help consistent with the man page Reviewed-by: alanb --- .../classes/sun/launcher/resources/launcher.properties | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties index e65926dc2a4..7816cc058cc 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -39,7 +39,8 @@ java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp \n\ +java.launcher.opt.footer = \ +\ -cp \n\ \ -classpath \n\ \ --class-path \n\ \ A {0} separated list of directories, JAR archives,\n\ @@ -101,8 +102,11 @@ java.launcher.opt.footer =\ -cp read options from the specified file\n\n\ +\ See the SplashScreen API documentation for more information\n\ +\ @argument files\n\ +\ one or more argument files containing options\n\ +\ -disable-@files\n\ +\ prevent further argument file expansion\n\ \To specify an argument for a long option, you can use --= or\n\ \-- .\n From a8a97e6625f97b1ab3bca1b8f8ae00ccd5a3154c Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 6 Apr 2017 08:19:42 +0200 Subject: [PATCH 24/75] 8178033: C1 crashes with -XX:UseAVX = 3: "not a mov [reg+offs], reg instruction" Skip the EVEX prefix such that the instruction address points to the prefixed opcode. Reviewed-by: kvn, mcberg --- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 2 +- hotspot/src/cpu/x86/vm/nativeInst_x86.cpp | 4 ++++ hotspot/src/cpu/x86/vm/nativeInst_x86.hpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index c819ffe9462..3c6d7b5cdd6 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -917,7 +917,7 @@ address Assembler::locate_operand(address inst, WhichOperand which) { break; case 0x62: // EVEX_4bytes - assert((UseAVX > 0), "shouldn't have EVEX prefix"); + assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix"); assert(ip == inst+1, "no prefixes allowed"); // no EVEX collisions, all instructions that have 0x62 opcodes // have EVEX versions and are subopcodes of 0x66 diff --git a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp index cb8c08f4652..fc7fcba2fc7 100644 --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp @@ -365,6 +365,10 @@ int NativeMovRegMem::instruction_start() const { NOT_LP64(assert((0xC0 & ubyte_at(1)) == 0xC0, "shouldn't have LDS and LES instructions")); return 3; } + if (instr_0 == instruction_EVEX_prefix_4bytes) { + assert(VM_Version::supports_evex(), "shouldn't have EVEX prefix"); + return 4; + } // First check to see if we have a (prefixed or not) xor if (instr_0 >= instruction_prefix_wide_lo && // 0x40 diff --git a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp index 7db3ccb9d3c..ef87c17807c 100644 --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp @@ -356,6 +356,7 @@ class NativeMovRegMem: public NativeInstruction { instruction_VEX_prefix_2bytes = Assembler::VEX_2bytes, instruction_VEX_prefix_3bytes = Assembler::VEX_3bytes, + instruction_EVEX_prefix_4bytes = Assembler::EVEX_4bytes, instruction_size = 4, instruction_offset = 0, From 64d37b0a69b5739b198a69b97cc7c26d55a1edb2 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 6 Apr 2017 11:55:58 +0200 Subject: [PATCH 25/75] 8178013: Finetuning of merged tab and shift tab completion Fixing mistakes in localization bundle, fixing completion after /help set. Reviewed-by: rfield --- .../classes/jdk/internal/jshell/tool/JShellTool.java | 4 ++-- .../jdk/internal/jshell/tool/resources/l10n.properties | 8 ++++---- langtools/test/jdk/jshell/CommandCompletionTest.java | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java index 6d6e3855d3c..1c4283d600b 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1440,7 +1440,7 @@ public class JShellTool implements MessageHandler { : c.command) + " ") .toArray(String[]::new)) .completionSuggestions(code, cursor, anchor); - } else if (code.startsWith("/se")) { + } else if (code.startsWith("/se") || code.startsWith("se")) { result = new FixedCompletionProvider(SET_SUBCOMMANDS) .completionSuggestions(code.substring(pastSpace), cursor - pastSpace, anchor); } else { diff --git a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties index 76a309539df..734b2805fd3 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties @@ -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 @@ -500,11 +500,11 @@ Supported shortcuts include:\n\ Shift- v\n\t\t\ After a complete expression, hold down while pressing ,\n\t\t\ then release and press "v", the expression will be converted to\n\t\t\ - a variable declaration whose type is based on the type of the expression.\n\t\t\ + a variable declaration whose type is based on the type of the expression.\n\n\ Shift- i\n\t\t\ After an unresolvable identifier, hold down while pressing ,\n\t\t\ then release and press "i", and jshell will propose possible imports\n\t\t\ - which will resolve the identifier based on the content of the specified classpath.\n\t\t\ + which will resolve the identifier based on the content of the specified classpath. help.context.summary = the evaluation context options for /env /reload and /reset help.context =\ @@ -928,5 +928,5 @@ startup.feedback = \ /set format silent display '' \n jshell.fix.wrong.shortcut =\ -Invalid character. Use "i" for auto-import or "v" for variable creation. For more information see:\n\ +Unexpected character after Shift-Tab. Use "i" for auto-import or "v" for variable creation. For more information see:\n\ /help shortcuts diff --git a/langtools/test/jdk/jshell/CommandCompletionTest.java b/langtools/test/jdk/jshell/CommandCompletionTest.java index 83e0f78a63e..4424604fc23 100644 --- a/langtools/test/jdk/jshell/CommandCompletionTest.java +++ b/langtools/test/jdk/jshell/CommandCompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8144095 8164825 8169818 8153402 8165405 8177079 + * @bug 8144095 8164825 8169818 8153402 8165405 8177079 8178013 * @summary Test Command Completion * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -173,6 +173,8 @@ public class CommandCompletionTest extends ReplToolTesting { "/save ", "/set "), a -> assertCompletion(a, "/help /set |", false, "editor", "feedback", "format", "mode", "prompt", "start", "truncation"), + a -> assertCompletion(a, "/help set |", false, + "editor", "feedback", "format", "mode", "prompt", "start", "truncation"), a -> assertCompletion(a, "/help /edit |", false), a -> assertCompletion(a, "/help dr|", false, "drop ") From 9bb53e41931b2f3f58a75030a2265ec83bcd9e49 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 6 Apr 2017 16:19:33 +0200 Subject: [PATCH 26/75] 8178077: jshell tool: crash on ctrl-up or ctrl-down Adding a test for EditingHistory. Reviewed-by: rfield --- langtools/test/jdk/jshell/HistoryUITest.java | 83 ++++++ .../jdk/jshell/MergedTabShiftTabTest.java | 224 +-------------- langtools/test/jdk/jshell/UITesting.java | 272 ++++++++++++++++++ 3 files changed, 357 insertions(+), 222 deletions(-) create mode 100644 langtools/test/jdk/jshell/HistoryUITest.java create mode 100644 langtools/test/jdk/jshell/UITesting.java diff --git a/langtools/test/jdk/jshell/HistoryUITest.java b/langtools/test/jdk/jshell/HistoryUITest.java new file mode 100644 index 00000000000..3e6f52a0abd --- /dev/null +++ b/langtools/test/jdk/jshell/HistoryUITest.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8178077 + * @summary Check the UI behavior of editing history. + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.jshell/jdk.jshell:open + * @library /tools/lib + * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask + * @build Compiler UITesting + * @build HistoryUITest + * @run testng HistoryUITest + */ + +import org.testng.annotations.Test; + +@Test +public class HistoryUITest extends UITesting { + + public void testPrevNextSnippet() throws Exception { + doRunTest((inputSink, out) -> { + inputSink.write("void test1() {\nSystem.err.println(1);\n}\n"); + waitOutput(out, "\u0005"); + inputSink.write("void test2() {\nSystem.err.println(2);\n}\n"); + waitOutput(out, "\u0005"); + inputSink.write(CTRL_UP); + waitOutput(out, "^void test2\\(\\) \\{"); + inputSink.write(CTRL_UP); + waitOutput(out, "^" + clearOut("2() {") + "1\\(\\) \\{"); + inputSink.write(CTRL_DOWN); + waitOutput(out, "^" + clearOut("1() {") + "2\\(\\) \\{"); + inputSink.write(ENTER); + waitOutput(out, "^\n\u0006"); + inputSink.write(UP); + waitOutput(out, "^}"); + inputSink.write(UP); + waitOutput(out, "^" + clearOut("}") + "System.err.println\\(2\\);"); + inputSink.write(UP); + waitOutput(out, "^" + clearOut("System.err.println(2);") + "void test2\\(\\) \\{"); + inputSink.write(UP); + waitOutput(out, "^\u0007"); + inputSink.write(DOWN); + waitOutput(out, "^" + clearOut("void test2() {") + "System.err.println\\(2\\);"); + inputSink.write(DOWN); + waitOutput(out, "^" + clearOut("System.err.println(2);") + "}"); + inputSink.write(DOWN); + waitOutput(out, "^" + clearOut("}")); + inputSink.write(DOWN); + waitOutput(out, "^\u0007"); + }); + } + //where: + private static final String CTRL_UP = "\033[1;5A"; + private static final String CTRL_DOWN = "\033[1;5B"; + private static final String UP = "\033[A"; + private static final String DOWN = "\033[B"; + private static final String ENTER = "\n"; + +} diff --git a/langtools/test/jdk/jshell/MergedTabShiftTabTest.java b/langtools/test/jdk/jshell/MergedTabShiftTabTest.java index 73305051869..0ff1aea6633 100644 --- a/langtools/test/jdk/jshell/MergedTabShiftTabTest.java +++ b/langtools/test/jdk/jshell/MergedTabShiftTabTest.java @@ -31,37 +31,29 @@ * jdk.jshell/jdk.jshell:open * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask - * @build Compiler + * @build Compiler UITesting * @build MergedTabShiftTabTest * @run testng MergedTabShiftTabTest */ import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.Writer; import java.lang.reflect.Field; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.text.MessageFormat; import java.util.Arrays; -import java.util.HashMap; import java.util.Locale; import java.util.ResourceBundle; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; -import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.jshell.JShell; -import jdk.jshell.tool.JavaShellToolBuilder; import org.testng.annotations.Test; @Test -public class MergedTabShiftTabTest { +public class MergedTabShiftTabTest extends UITesting { public void testCommand() throws Exception { doRunTest((inputSink, out) -> { @@ -281,60 +273,6 @@ public class MergedTabShiftTabTest { }); } - private void doRunTest(Test test) throws Exception { - PipeInputStream input = new PipeInputStream(); - StringBuilder out = new StringBuilder(); - PrintStream outS = new PrintStream(new OutputStream() { - @Override public void write(int b) throws IOException { - synchronized (out) { - System.out.print((char) b); - out.append((char) b); - out.notifyAll(); - } - } - }); - Thread runner = new Thread(() -> { - try { - JavaShellToolBuilder.builder() - .in(input, input) - .out(outS) - .err(outS) - .promptCapture(true) - .persistence(new HashMap<>()) - .locale(Locale.US) - .run("--no-startup"); - } catch (Exception ex) { - throw new IllegalStateException(ex); - } - }); - - Writer inputSink = new OutputStreamWriter(input.createOutput()) { - @Override - public void write(String str) throws IOException { - super.write(str); - flush(); - } - }; - - runner.start(); - - try { - waitOutput(out, "\u0005"); - test.test(inputSink, out); - } finally { - inputSink.write("\003\003/exit"); - - runner.join(1000); - if (runner.isAlive()) { - runner.stop(); - } - } - } - - interface Test { - public void test(Writer inputSink, StringBuilder out) throws Exception; - } - private Path prepareZip() { String clazz1 = "package jshelltest;\n" + @@ -404,162 +342,4 @@ public class MergedTabShiftTabTest { return MessageFormat.format(resources.getString(key), args); } - private static final long TIMEOUT; - - static { - long factor; - - try { - factor = (long) Double.parseDouble(System.getProperty("test.timeout.factor", "1")); - } catch (NumberFormatException ex) { - factor = 1; - } - TIMEOUT = 60_000 * factor; - } - - private void waitOutput(StringBuilder out, String expected) { - expected = expected.replaceAll("\n", System.getProperty("line.separator")); - Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL); - synchronized (out) { - long s = System.currentTimeMillis(); - - while (true) { - Matcher m = expectedPattern.matcher(out); - if (m.find()) { - out.delete(0, m.end() + 1); - return ; - } - long e = System.currentTimeMillis(); - if ((e - s) > TIMEOUT) { - throw new IllegalStateException("Timeout waiting for: " + quote(expected) + ", actual output so far: " + quote(out.toString())); - } - try { - out.wait(TIMEOUT); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } - } - } - - private String quote(String original) { - StringBuilder output = new StringBuilder(); - - for (char c : original.toCharArray()) { - if (c < 32) { - output.append(String.format("\\u%04X", (int) c)); - } else { - output.append(c); - } - } - - return output.toString(); - } - - private static class PipeInputStream extends InputStream { - - private static final int INITIAL_SIZE = 128; - private int[] buffer = new int[INITIAL_SIZE]; - private int start; - private int end; - private boolean closed; - - @Override - public synchronized int read() throws IOException { - if (start == end && !closed) { - inputNeeded(); - } - while (start == end) { - if (closed) { - return -1; - } - try { - wait(); - } catch (InterruptedException ex) { - //ignore - } - } - try { - return buffer[start]; - } finally { - start = (start + 1) % buffer.length; - } - } - - @Override - public synchronized int read(byte[] b, int off, int len) throws IOException { - if (b == null) { - throw new NullPointerException(); - } else if (off < 0 || len < 0 || len > b.length - off) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return 0; - } - - int c = read(); - if (c == -1) { - return -1; - } - b[off] = (byte)c; - - int totalRead = 1; - while (totalRead < len && start != end) { - int r = read(); - if (r == (-1)) - break; - b[off + totalRead++] = (byte) r; - } - return totalRead; - } - - protected void inputNeeded() throws IOException {} - - private synchronized void write(int b) { - if (closed) { - throw new IllegalStateException("Already closed."); - } - int newEnd = (end + 1) % buffer.length; - if (newEnd == start) { - //overflow: - int[] newBuffer = new int[buffer.length * 2]; - int rightPart = (end > start ? end : buffer.length) - start; - int leftPart = end > start ? 0 : start - 1; - System.arraycopy(buffer, start, newBuffer, 0, rightPart); - System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart); - buffer = newBuffer; - start = 0; - end = rightPart + leftPart; - newEnd = end + 1; - } - buffer[end] = b; - end = newEnd; - notifyAll(); - } - - @Override - public synchronized void close() { - closed = true; - notifyAll(); - } - - public OutputStream createOutput() { - return new OutputStream() { - @Override public void write(int b) throws IOException { - PipeInputStream.this.write(b); - } - @Override - public void write(byte[] b, int off, int len) throws IOException { - for (int i = 0 ; i < len ; i++) { - write(Byte.toUnsignedInt(b[off + i])); - } - } - @Override - public void close() throws IOException { - PipeInputStream.this.close(); - } - }; - } - - } - } diff --git a/langtools/test/jdk/jshell/UITesting.java b/langtools/test/jdk/jshell/UITesting.java new file mode 100644 index 00000000000..fffd54dfc37 --- /dev/null +++ b/langtools/test/jdk/jshell/UITesting.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintStream; +import java.io.Writer; +import java.util.HashMap; +import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import jdk.jshell.tool.JavaShellToolBuilder; + +public class UITesting { + + protected void doRunTest(Test test) throws Exception { + PipeInputStream input = new PipeInputStream(); + StringBuilder out = new StringBuilder(); + PrintStream outS = new PrintStream(new OutputStream() { + @Override public void write(int b) throws IOException { + synchronized (out) { + System.out.print((char) b); + out.append((char) b); + out.notifyAll(); + } + } + }); + Thread runner = new Thread(() -> { + try { + JavaShellToolBuilder.builder() + .in(input, input) + .out(outS) + .err(outS) + .promptCapture(true) + .persistence(new HashMap<>()) + .locale(Locale.US) + .run("--no-startup"); + } catch (Exception ex) { + throw new IllegalStateException(ex); + } + }); + + Writer inputSink = new OutputStreamWriter(input.createOutput()) { + @Override + public void write(String str) throws IOException { + super.write(str); + flush(); + } + }; + + runner.start(); + + try { + waitOutput(out, "\u0005"); + test.test(inputSink, out); + } finally { + inputSink.write("\003\003/exit"); + + runner.join(1000); + if (runner.isAlive()) { + runner.stop(); + } + } + } + + protected interface Test { + public void test(Writer inputSink, StringBuilder out) throws Exception; + } + + private static final long TIMEOUT; + + static { + long factor; + + try { + factor = (long) Double.parseDouble(System.getProperty("test.timeout.factor", "1")); + } catch (NumberFormatException ex) { + factor = 1; + } + TIMEOUT = 60_000 * factor; + } + + protected void waitOutput(StringBuilder out, String expected) { + expected = expected.replaceAll("\n", System.getProperty("line.separator")); + Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL); + synchronized (out) { + long s = System.currentTimeMillis(); + + while (true) { + Matcher m = expectedPattern.matcher(out); + if (m.find()) { + out.delete(0, m.end() + 1); + return ; + } + long e = System.currentTimeMillis(); + if ((e - s) > TIMEOUT) { + throw new IllegalStateException("Timeout waiting for: " + quote(expected) + ", actual output so far: " + quote(out.toString())); + } + try { + out.wait(TIMEOUT); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + } + } + + private String quote(String original) { + StringBuilder output = new StringBuilder(); + + for (char c : original.toCharArray()) { + if (c < 32) { + output.append(String.format("\\u%04X", (int) c)); + } else { + output.append(c); + } + } + + return output.toString(); + } + + protected String clearOut(String what) { + return backspace(what.length()) + space(what.length()) + backspace(what.length()); + } + + protected String backspace(int n) { + return fill(n, '\010'); + } + + protected String space(int n) { + return fill(n, ' '); + } + + private String fill(int n, char c) { + StringBuilder result = new StringBuilder(n); + + while (n-- > 0) + result.append(c); + + return result.toString(); + } + + private static class PipeInputStream extends InputStream { + + private static final int INITIAL_SIZE = 128; + private int[] buffer = new int[INITIAL_SIZE]; + private int start; + private int end; + private boolean closed; + + @Override + public synchronized int read() throws IOException { + if (start == end && !closed) { + inputNeeded(); + } + while (start == end) { + if (closed) { + return -1; + } + try { + wait(); + } catch (InterruptedException ex) { + //ignore + } + } + try { + return buffer[start]; + } finally { + start = (start + 1) % buffer.length; + } + } + + @Override + public synchronized int read(byte[] b, int off, int len) throws IOException { + if (b == null) { + throw new NullPointerException(); + } else if (off < 0 || len < 0 || len > b.length - off) { + throw new IndexOutOfBoundsException(); + } else if (len == 0) { + return 0; + } + + int c = read(); + if (c == -1) { + return -1; + } + b[off] = (byte)c; + + int totalRead = 1; + while (totalRead < len && start != end) { + int r = read(); + if (r == (-1)) + break; + b[off + totalRead++] = (byte) r; + } + return totalRead; + } + + protected void inputNeeded() throws IOException {} + + private synchronized void write(int b) { + if (closed) { + throw new IllegalStateException("Already closed."); + } + int newEnd = (end + 1) % buffer.length; + if (newEnd == start) { + //overflow: + int[] newBuffer = new int[buffer.length * 2]; + int rightPart = (end > start ? end : buffer.length) - start; + int leftPart = end > start ? 0 : start - 1; + System.arraycopy(buffer, start, newBuffer, 0, rightPart); + System.arraycopy(buffer, 0, newBuffer, rightPart, leftPart); + buffer = newBuffer; + start = 0; + end = rightPart + leftPart; + newEnd = end + 1; + } + buffer[end] = b; + end = newEnd; + notifyAll(); + } + + @Override + public synchronized void close() { + closed = true; + notifyAll(); + } + + public OutputStream createOutput() { + return new OutputStream() { + @Override public void write(int b) throws IOException { + PipeInputStream.this.write(b); + } + @Override + public void write(byte[] b, int off, int len) throws IOException { + for (int i = 0 ; i < len ; i++) { + write(Byte.toUnsignedInt(b[off + i])); + } + } + @Override + public void close() throws IOException { + PipeInputStream.this.close(); + } + }; + } + + } + +} From 999a830a40287c74c2f1d3d656955261617d1ade Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 6 Apr 2017 17:27:52 +0100 Subject: [PATCH 27/75] 8177933: Stackoverflow during compilation, starting jdk-9+163 Avoid extra method call in Attr.attribTree Reviewed-by: vromero --- .../sun/tools/javac/comp/ArgumentAttr.java | 11 +-- .../com/sun/tools/javac/comp/Attr.java | 19 ++-- .../javac/lambda/speculative/T8177933.java | 89 +++++++++++++++++++ 3 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 langtools/test/tools/javac/lambda/speculative/T8177933.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java index d99bc73567a..eb8311d7f2c 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java @@ -105,7 +105,7 @@ public class ArgumentAttr extends JCTree.Visitor { private Env env; /** Result of method attribution. */ - private Type result; + Type result; /** Cache for argument types; behavior is influences by the currrently selected cache policy. */ Map> argumentTypeCache = new LinkedHashMap<>(); @@ -215,13 +215,8 @@ public class ArgumentAttr extends JCTree.Visitor { processArg(that, () -> { T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() { @Override - protected void attr(JCTree tree, Env env) { - //avoid speculative attribution loops - if (!new UniquePos(tree).equals(pos)) { - super.attr(tree, env); - } else { - visitTree(tree); - } + protected boolean needsArgumentAttr(JCTree tree) { + return !new UniquePos(tree).equals(pos); } }); return argumentTypeFactory.apply(speculativeTree); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 4f47a589113..9ff0df058fd 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -505,9 +505,12 @@ public class Attr extends JCTree.Visitor { this.checkMode = checkMode; } - protected void attr(JCTree tree, Env env) { - tree.accept(Attr.this); - } + /** + * Should {@link Attr#attribTree} use the {@ArgumentAttr} visitor instead of this one? + * @param tree The tree to be type-checked. + * @return true if {@ArgumentAttr} should be used. + */ + protected boolean needsArgumentAttr(JCTree tree) { return false; } protected Type check(final DiagnosticPosition pos, final Type found) { return chk.checkType(pos, found, pt, checkContext); @@ -553,8 +556,8 @@ public class Attr extends JCTree.Visitor { } @Override - protected void attr(JCTree tree, Env env) { - result = argumentAttr.attribArg(tree, env); + protected boolean needsArgumentAttr(JCTree tree) { + return true; } protected ResultInfo dup(Type newPt) { @@ -644,7 +647,11 @@ public class Attr extends JCTree.Visitor { try { this.env = env; this.resultInfo = resultInfo; - resultInfo.attr(tree, env); + if (resultInfo.needsArgumentAttr(tree)) { + result = argumentAttr.attribArg(tree, env); + } else { + tree.accept(this); + } if (tree == breakTree && resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) { throw new BreakAttr(copyEnv(env)); diff --git a/langtools/test/tools/javac/lambda/speculative/T8177933.java b/langtools/test/tools/javac/lambda/speculative/T8177933.java new file mode 100644 index 00000000000..2487f7bb1c4 --- /dev/null +++ b/langtools/test/tools/javac/lambda/speculative/T8177933.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8177933 + * @summary Stackoverflow during compilation, starting jdk-9+163 + * + * @library /tools/javac/lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.comp + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.tree + * jdk.compiler/com.sun.tools.javac.util + * @build combo.ComboTestHelper + + * @run main/othervm -Xss512K T8177933 + */ + +import combo.ComboInstance; +import combo.ComboParameter; +import combo.ComboTask.Result; +import combo.ComboTestHelper; + +import javax.lang.model.element.Element; + +public class T8177933 extends ComboInstance { + + static final int MAX_DEPTH = 350; + + static class CallExpr implements ComboParameter { + @Override + public String expand(String optParameter) { + Integer n = Integer.parseInt(optParameter); + if (n == MAX_DEPTH) { + return "m()"; + } else { + return "m().#{CALL." + (n + 1) + "}"; + } + } + } + + static final String sourceTemplate = + "class Test {\n" + + " Test m() { return null; }\n" + + " void test() {\n" + + " #{CALL.0};\n" + + "} }\n"; + + public static void main(String[] args) { + new ComboTestHelper() + .withDimension("CALL", new CallExpr()) + .run(T8177933::new); + } + + @Override + protected void doWork() throws Throwable { + Result> result = newCompilationTask() + .withOption("-XDdev") + .withSourceFromTemplate(sourceTemplate) + .analyze(); + if (!result.get().iterator().hasNext()) { + fail("Exception occurred when compiling combo. " + result.compilationInfo()); + } + } +} From 504ceb85890358bfffc5dddb107b57b5c0fea494 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 6 Apr 2017 18:00:47 -0700 Subject: [PATCH 28/75] 8178286: Missing @moduleGraph in javadoc Reviewed-by: lancea --- jdk/src/jdk.accessibility/share/classes/module-info.java | 1 + jdk/src/jdk.editpad/share/classes/module-info.java | 1 + jdk/src/jdk.incubator.httpclient/share/classes/module-info.java | 1 + 3 files changed, 3 insertions(+) diff --git a/jdk/src/jdk.accessibility/share/classes/module-info.java b/jdk/src/jdk.accessibility/share/classes/module-info.java index 97834b9460c..4df2da0bf5e 100644 --- a/jdk/src/jdk.accessibility/share/classes/module-info.java +++ b/jdk/src/jdk.accessibility/share/classes/module-info.java @@ -26,6 +26,7 @@ /** * Defines JDK utility classes used by implementors of Assistive Technologies. * + * @moduleGraph * @since 9 */ module jdk.accessibility { diff --git a/jdk/src/jdk.editpad/share/classes/module-info.java b/jdk/src/jdk.editpad/share/classes/module-info.java index 0d674bbae56..57077ed9008 100644 --- a/jdk/src/jdk.editpad/share/classes/module-info.java +++ b/jdk/src/jdk.editpad/share/classes/module-info.java @@ -26,6 +26,7 @@ /** * Implementation of the edit pad service. * + * @moduleGraph * @since 9 */ module jdk.editpad { diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java b/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java index a9a16dfe3d1..a3fb16abbd4 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/module-info.java @@ -27,6 +27,7 @@ * Defines the high-level HTTP and WebSocket API. * {@Incubating} * + * @moduleGraph * @since 9 */ module jdk.incubator.httpclient { From 3ff43d350b7cf594cfcb5f0344bec823907b18e4 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 6 Apr 2017 18:00:57 -0700 Subject: [PATCH 29/75] 8178286: Missing @moduleGraph in javadoc Reviewed-by: lancea --- nashorn/src/jdk.dynalink/share/classes/module-info.java | 1 + nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java | 1 + 2 files changed, 2 insertions(+) diff --git a/nashorn/src/jdk.dynalink/share/classes/module-info.java b/nashorn/src/jdk.dynalink/share/classes/module-info.java index 963a1d43141..3faffbd7f7a 100644 --- a/nashorn/src/jdk.dynalink/share/classes/module-info.java +++ b/nashorn/src/jdk.dynalink/share/classes/module-info.java @@ -217,6 +217,7 @@ * from B will get a chance to link the call site in A when it encounters the * object from B. * + * @moduleGraph * @since 9 */ module jdk.dynalink { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java b/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java index 2e19def917d..00aeab11923 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/module-info.java @@ -90,6 +90,7 @@ arrays and back, and so on. In addition to {@code Java}, Nashorn also exposes some other non-standard built-in objects: {@code JSAdapter}, {@code JavaImporter}, {@code Packages} +@moduleGraph @since 9 */ module jdk.scripting.nashorn { From f492e7d8220d5c515c36146e0b873f86ac299a5f Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:04:38 +0000 Subject: [PATCH 30/75] 8177530: Module system implementation refresh (4/2017) Reviewed-by: mchung --- common/conf/jib-profiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js index c0273cda4f0..871068d8a6a 100644 --- a/common/conf/jib-profiles.js +++ b/common/conf/jib-profiles.js @@ -882,7 +882,7 @@ var getJibProfilesDependencies = function (input, common) { jtreg: { server: "javare", revision: "4.2", - build_number: "b05", + build_number: "b07", checksum_file: "MD5_VALUES", file: "jtreg_bin-4.2.zip", environment_name: "JT_HOME", From a3ab143c64ee904542d84fb556d23d7fa5cd9cc1 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:04:46 +0000 Subject: [PATCH 31/75] 8177530: Module system implementation refresh (4/2017) Co-authored-by: Harold Seigel Co-authored-by: Mandy Chung Reviewed-by: lfoltan, sspitsyn --- .../src/jdk/vm/ci/services/Services.java | 3 +- .../compiler/core/common/util/ModuleAPI.java | 10 +-- .../compiler/test/ExportingClassLoader.java | 4 +- .../test/{JLRModule.java => JLModule.java} | 29 ++++---- .../share/vm/classfile/classFileParser.cpp | 2 +- .../src/share/vm/classfile/javaClasses.cpp | 46 ++++++------ .../src/share/vm/classfile/javaClasses.hpp | 4 +- .../share/vm/classfile/javaClasses.inline.hpp | 6 +- .../src/share/vm/classfile/moduleEntry.cpp | 26 +++---- .../src/share/vm/classfile/moduleEntry.hpp | 4 +- hotspot/src/share/vm/classfile/modules.cpp | 42 +++++------ hotspot/src/share/vm/classfile/modules.hpp | 12 ++-- .../share/vm/classfile/systemDictionary.hpp | 4 +- hotspot/src/share/vm/classfile/vmSymbols.hpp | 20 +++--- hotspot/src/share/vm/oops/klass.cpp | 4 +- hotspot/src/share/vm/prims/jvmti.xml | 70 +++++++++++++++++-- hotspot/src/share/vm/prims/jvmtiEnv.cpp | 32 ++++++--- hotspot/src/share/vm/runtime/reflection.cpp | 12 ++-- hotspot/src/share/vm/runtime/thread.cpp | 2 +- hotspot/test/TEST.ROOT | 4 +- .../compiler/jvmci/common/CTVMUtilities.java | 3 +- .../fakeMethodAccessor.jasm | 9 ++- .../runtime/getSysPackage/GetSysPkgTest.java | 4 +- .../test/runtime/modules/AccModuleTest.java | 2 - .../AccessCheck/AccessExportTwice.java | 10 ++- .../modules/AccessCheck/AccessReadTwice.java | 10 ++- .../modules/AccessCheck/CheckRead.java | 9 ++- .../modules/AccessCheck/DiffCL_CheckRead.java | 9 ++- .../AccessCheck/DiffCL_ExpQualOther.java | 9 ++- .../AccessCheck/DiffCL_ExpQualToM1.java | 9 ++- .../modules/AccessCheck/DiffCL_ExpUnqual.java | 9 ++- .../modules/AccessCheck/DiffCL_PkgNotExp.java | 9 ++- .../modules/AccessCheck/DiffCL_Umod.java | 22 +++--- .../modules/AccessCheck/DiffCL_UmodUpkg.java | 15 ++-- .../modules/AccessCheck/ExpQualOther.java | 9 ++- .../modules/AccessCheck/ExpQualToM1.java | 9 ++- .../modules/AccessCheck/ExpUnqual.java | 9 ++- .../modules/AccessCheck/ExportAllUnnamed.java | 10 ++- .../modules/AccessCheck/PkgNotExp.java | 9 ++- .../runtime/modules/AccessCheck/Umod.java | 22 +++--- .../AccessCheck/UmodDiffCL_ExpQualOther.java | 9 ++- .../AccessCheck/UmodDiffCL_ExpUnqual.java | 9 ++- .../AccessCheck/UmodDiffCL_PkgNotExp.java | 9 ++- .../runtime/modules/AccessCheck/UmodUPkg.java | 16 ++--- .../UmodUpkgDiffCL_ExpQualOther.java | 9 ++- .../AccessCheck/UmodUpkgDiffCL_NotExp.java | 9 ++- .../AccessCheck/UmodUpkg_ExpQualOther.java | 11 ++- .../modules/AccessCheck/UmodUpkg_NotExp.java | 9 ++- .../AccessCheck/Umod_ExpQualOther.java | 11 ++- .../modules/AccessCheck/Umod_ExpUnqual.java | 9 ++- .../modules/AccessCheck/Umod_PkgNotExp.java | 9 ++- .../modules/AccessCheck/p1/c1ReadEdge.java | 1 - .../AccessCheck/p1/c1ReadEdgeDiffLoader.java | 1 - .../modules/AccessCheck/p3/c3ReadEdge.jcod | 7 +- .../AccessCheck/p3/c3ReadEdgeDiffLoader.jcod | 7 +- .../runtime/modules/AccessCheck/p4/c4.java | 2 - .../modules/AccessCheckAllUnnamed.java | 13 ++-- .../test/runtime/modules/AccessCheckExp.java | 13 ++-- .../runtime/modules/AccessCheckJavaBase.java | 3 +- .../test/runtime/modules/AccessCheckRead.java | 13 ++-- .../runtime/modules/AccessCheckSuper.java | 3 +- .../runtime/modules/AccessCheckUnnamed.java | 11 ++- .../runtime/modules/AccessCheckWorks.java | 13 ++-- .../test/runtime/modules/CCE_module_msg.java | 17 +++-- hotspot/test/runtime/modules/ExportTwice.java | 15 ++-- .../JVMAddModuleExportToAllUnnamed.java | 11 ++- .../runtime/modules/JVMAddModuleExports.java | 5 +- .../modules/JVMAddModuleExportsToAll.java | 15 ++-- .../runtime/modules/JVMAddModulePackage.java | 2 +- .../runtime/modules/JVMAddReadsModule.java | 2 +- .../test/runtime/modules/JVMDefineModule.java | 4 +- .../modules/JVMGetModuleByPkgName.java | 3 +- .../modules/LoadUnloadModuleStress.java | 2 +- .../test/runtime/modules/ModuleHelper.java | 15 ++-- .../ModuleStress/ModuleNonBuiltinCLMain.java | 9 ++- .../ModuleStress/ModuleSameCLMain.java | 9 ++- .../ModuleStress/src/jdk.test/test/Main.java | 8 +-- .../src/jdk.test/test/MainGC.java | 8 +-- .../modules/getModuleJNI/GetModule.java | 3 +- .../java/lang/{reflect => }/ModuleHelper.java | 14 ++-- .../jdwp/AllModulesCommandTestDebuggee.java | 8 +-- .../AddModuleExportsAndOpensTest.java | 3 +- .../libAddModuleExportsAndOpensTest.c | 12 ++-- .../MyPackage/AddModuleReadsTest.java | 3 +- .../AddModuleReads/libAddModuleReadsTest.c | 10 +-- .../AddModuleUsesAndProvidesTest.java | 3 +- .../libAddModuleUsesAndProvidesTest.c | 8 +-- .../JvmtiGetAllModulesTest.java | 10 ++- .../libJvmtiGetAllModulesTest.c | 4 +- .../GetNamedModule/libGetNamedModuleTest.c | 8 +-- 90 files changed, 477 insertions(+), 464 deletions(-) rename hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/{JLRModule.java => JLModule.java} (80%) rename hotspot/test/runtime/modules/java.base/java/lang/{reflect => }/ModuleHelper.java (86%) diff --git a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java index dbeb7fbf6b0..851fd3060fe 100644 --- a/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java +++ b/hotspot/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/Services.java @@ -28,6 +28,7 @@ import java.util.Formatter; import java.util.Iterator; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; +import java.util.Set; /** * A mechanism for accessing service providers via JVMCI. @@ -108,7 +109,7 @@ public final class Services { Object jvmci = invoke(getModule, Services.class); Object requestorModule = invoke(getModule, requestor); if (jvmci != requestorModule) { - String[] packages = invoke(getPackages, jvmci); + Set packages = invoke(getPackages, jvmci); for (String pkg : packages) { // Export all JVMCI packages dynamically instead // of requiring a long list of --add-exports diff --git a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java index 240fdc07fb6..8facd197165 100644 --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/ModuleAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,22 +58,22 @@ public final class ModuleAPI { public static final ModuleAPI addExports; /** - * {@code java.lang.reflect.Module.getResourceAsStream(String)}. + * {@code java.lang.Module.getResourceAsStream(String)}. */ public static final ModuleAPI getResourceAsStream; /** - * {@code java.lang.reflect.Module.canRead(Module)}. + * {@code java.lang.Module.canRead(Module)}. */ public static final ModuleAPI canRead; /** - * {@code java.lang.reflect.Module.isExported(String)}. + * {@code java.lang.Module.isExported(String)}. */ public static final ModuleAPI isExported; /** - * {@code java.lang.reflect.Module.isExported(String, Module)}. + * {@code java.lang.Module.isExported(String, Module)}. */ public static final ModuleAPI isExportedTo; diff --git a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java index e139b19c971..1c08964c696 100644 --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/ExportingClassLoader.java @@ -29,14 +29,14 @@ package org.graalvm.compiler.test; public class ExportingClassLoader extends ClassLoader { public ExportingClassLoader() { if (!GraalTest.Java8OrEarlier) { - JLRModule.fromClass(getClass()).exportAllPackagesTo(JLRModule.getUnnamedModuleFor(this)); + JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this)); } } public ExportingClassLoader(ClassLoader parent) { super(parent); if (!GraalTest.Java8OrEarlier) { - JLRModule.fromClass(getClass()).exportAllPackagesTo(JLRModule.getUnnamedModuleFor(this)); + JLModule.fromClass(getClass()).exportAllPackagesTo(JLModule.getUnnamedModuleFor(this)); } } } diff --git a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLRModule.java b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java similarity index 80% rename from hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLRModule.java rename to hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java index caa32231bd6..9fe1c139863 100644 --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLRModule.java +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java @@ -23,22 +23,23 @@ package org.graalvm.compiler.test; import java.lang.reflect.Method; +import java.util.Set; /** - * Facade for the {@code java.lang.reflect.Module} class introduced in JDK9 that allows tests to be + * Facade for the {@code java.lang.Module} class introduced in JDK9 that allows tests to be * developed against JDK8 but use module logic if deployed on JDK9. */ -public class JLRModule { +public class JLModule { static { if (GraalTest.Java8OrEarlier) { - throw new AssertionError("Use of " + JLRModule.class + " only allowed if " + GraalTest.class.getName() + ".JDK8OrEarlier is false"); + throw new AssertionError("Use of " + JLModule.class + " only allowed if " + GraalTest.class.getName() + ".JDK8OrEarlier is false"); } } private final Object realModule; - public JLRModule(Object module) { + public JLModule(Object module) { this.realModule = module; } @@ -51,7 +52,7 @@ public class JLRModule { private static final Method addExportsMethod; static { try { - moduleClass = Class.forName("java.lang.reflect.Module"); + moduleClass = Class.forName("java.lang.Module"); getModuleMethod = Class.class.getMethod("getModule"); getUnnamedModuleMethod = ClassLoader.class.getMethod("getUnnamedModule"); getPackagesMethod = moduleClass.getMethod("getPackages"); @@ -63,17 +64,17 @@ public class JLRModule { } } - public static JLRModule fromClass(Class cls) { + public static JLModule fromClass(Class cls) { try { - return new JLRModule(getModuleMethod.invoke(cls)); + return new JLModule(getModuleMethod.invoke(cls)); } catch (Exception e) { throw new AssertionError(e); } } - public static JLRModule getUnnamedModuleFor(ClassLoader cl) { + public static JLModule getUnnamedModuleFor(ClassLoader cl) { try { - return new JLRModule(getUnnamedModuleMethod.invoke(cl)); + return new JLModule(getUnnamedModuleMethod.invoke(cl)); } catch (Exception e) { throw new AssertionError(e); } @@ -82,7 +83,7 @@ public class JLRModule { /** * Exports all packages in this module to a given module. */ - public void exportAllPackagesTo(JLRModule module) { + public void exportAllPackagesTo(JLModule module) { if (this != module) { for (String pkg : getPackages()) { // Export all JVMCI packages dynamically instead @@ -95,9 +96,9 @@ public class JLRModule { } } - public String[] getPackages() { + public Set getPackages() { try { - return (String[]) getPackagesMethod.invoke(realModule); + return (Set) getPackagesMethod.invoke(realModule); } catch (Exception e) { throw new AssertionError(e); } @@ -111,7 +112,7 @@ public class JLRModule { } } - public boolean isExported(String pn, JLRModule other) { + public boolean isExported(String pn, JLModule other) { try { return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule); } catch (Exception e) { @@ -119,7 +120,7 @@ public class JLRModule { } } - public void addExports(String pn, JLRModule other) { + public void addExports(String pn, JLModule other) { try { addExportsMethod.invoke(realModule, pn, other.realModule); } catch (Exception e) { diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 8d5742c94da..db813adf834 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -5406,7 +5406,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa ModuleEntry* module_entry = ik->module(); assert(module_entry != NULL, "module_entry should always be set"); - // Obtain java.lang.reflect.Module + // Obtain java.lang.Module Handle module_handle(THREAD, JNIHandles::resolve(module_entry->module())); // Allocate mirror and initialize static fields diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 62f27770365..22c1e6cc34e 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -773,13 +773,13 @@ void java_lang_Class::initialize_mirror_fields(KlassHandle k, InstanceKlass::cast(k())->do_local_static_fields(&initialize_static_field, mirror, CHECK); } -// Set the java.lang.reflect.Module module field in the java_lang_Class mirror +// Set the java.lang.Module module field in the java_lang_Class mirror void java_lang_Class::set_mirror_module_field(KlassHandle k, Handle mirror, Handle module, TRAPS) { if (module.is_null()) { // During startup, the module may be NULL only if java.base has not been defined yet. - // Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module + // Put the class on the fixup_module_list to patch later when the java.lang.Module // for java.base is known. - assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization"); + assert(!Universe::is_module_initialized(), "Incorrect java.lang.Module pre module system initialization"); bool javabase_was_defined = false; { @@ -810,7 +810,7 @@ void java_lang_Class::set_mirror_module_field(KlassHandle k, Handle mirror, Hand assert(Universe::is_module_initialized() || (ModuleEntryTable::javabase_defined() && (module() == JNIHandles::resolve(ModuleEntryTable::javabase_moduleEntry()->module()))), - "Incorrect java.lang.reflect.Module specification while creating mirror"); + "Incorrect java.lang.Module specification while creating mirror"); set_module(mirror(), module()); } } @@ -2804,28 +2804,28 @@ void java_lang_reflect_Parameter::set_executable(oop param, oop value) { } -int java_lang_reflect_Module::loader_offset; -int java_lang_reflect_Module::name_offset; -int java_lang_reflect_Module::_module_entry_offset = -1; +int java_lang_Module::loader_offset; +int java_lang_Module::name_offset; +int java_lang_Module::_module_entry_offset = -1; -Handle java_lang_reflect_Module::create(Handle loader, Handle module_name, TRAPS) { +Handle java_lang_Module::create(Handle loader, Handle module_name, TRAPS) { assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); - Symbol* name = vmSymbols::java_lang_reflect_Module(); + Symbol* name = vmSymbols::java_lang_Module(); Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH); instanceKlassHandle klass (THREAD, k); - Handle jlrmh = klass->allocate_instance_handle(CHECK_NH); + Handle jlmh = klass->allocate_instance_handle(CHECK_NH); JavaValue result(T_VOID); - JavaCalls::call_special(&result, jlrmh, KlassHandle(THREAD, klass()), + JavaCalls::call_special(&result, jlmh, KlassHandle(THREAD, klass()), vmSymbols::object_initializer_name(), - vmSymbols::java_lang_reflect_module_init_signature(), + vmSymbols::java_lang_module_init_signature(), loader, module_name, CHECK_NH); - return jlrmh; + return jlmh; } -void java_lang_reflect_Module::compute_offsets() { - Klass* k = SystemDictionary::reflect_Module_klass(); +void java_lang_Module::compute_offsets() { + Klass* k = SystemDictionary::Module_klass(); if(NULL != k) { compute_offset(loader_offset, k, vmSymbols::loader_name(), vmSymbols::classloader_signature()); compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); @@ -2834,27 +2834,27 @@ void java_lang_reflect_Module::compute_offsets() { } -oop java_lang_reflect_Module::loader(oop module) { +oop java_lang_Module::loader(oop module) { assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); return module->obj_field(loader_offset); } -void java_lang_reflect_Module::set_loader(oop module, oop value) { +void java_lang_Module::set_loader(oop module, oop value) { assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); module->obj_field_put(loader_offset, value); } -oop java_lang_reflect_Module::name(oop module) { +oop java_lang_Module::name(oop module) { assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); return module->obj_field(name_offset); } -void java_lang_reflect_Module::set_name(oop module, oop value) { +void java_lang_Module::set_name(oop module, oop value) { assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); module->obj_field_put(name_offset, value); } -ModuleEntry* java_lang_reflect_Module::module_entry(oop module, TRAPS) { +ModuleEntry* java_lang_Module::module_entry(oop module, TRAPS) { assert(_module_entry_offset != -1, "Uninitialized module_entry_offset"); assert(module != NULL, "module can't be null"); assert(module->is_oop(), "module must be oop"); @@ -2863,7 +2863,7 @@ ModuleEntry* java_lang_reflect_Module::module_entry(oop module, TRAPS) { if (module_entry == NULL) { // If the inject field containing the ModuleEntry* is null then return the // class loader's unnamed module. - oop loader = java_lang_reflect_Module::loader(module); + oop loader = java_lang_Module::loader(module); Handle h_loader = Handle(THREAD, loader); ClassLoaderData* loader_cld = SystemDictionary::register_loader(h_loader, CHECK_NULL); return loader_cld->modules()->unnamed_module(); @@ -2871,7 +2871,7 @@ ModuleEntry* java_lang_reflect_Module::module_entry(oop module, TRAPS) { return module_entry; } -void java_lang_reflect_Module::set_module_entry(oop module, ModuleEntry* module_entry) { +void java_lang_Module::set_module_entry(oop module, ModuleEntry* module_entry) { assert(_module_entry_offset != -1, "Uninitialized module_entry_offset"); assert(module != NULL, "module can't be null"); assert(module->is_oop(), "module must be oop"); @@ -3877,7 +3877,7 @@ void JavaClasses::compute_offsets() { reflect_ConstantPool::compute_offsets(); reflect_UnsafeStaticFieldAccessorImpl::compute_offsets(); java_lang_reflect_Parameter::compute_offsets(); - java_lang_reflect_Module::compute_offsets(); + java_lang_Module::compute_offsets(); java_lang_StackFrameInfo::compute_offsets(); java_lang_LiveStackFrameInfo::compute_offsets(); diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp index fc934b89791..da5d4a67f2c 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp @@ -755,9 +755,9 @@ class java_lang_reflect_Parameter { }; #define MODULE_INJECTED_FIELDS(macro) \ - macro(java_lang_reflect_Module, module_entry, intptr_signature, false) + macro(java_lang_Module, module_entry, intptr_signature, false) -class java_lang_reflect_Module { +class java_lang_Module { private: static int loader_offset; static int name_offset; diff --git a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp index b388bb157d3..a50113d1c61 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.inline.hpp +++ b/hotspot/src/share/vm/classfile/javaClasses.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -162,8 +162,8 @@ inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) { return obj != NULL && is_subclass(obj->klass()); } -inline bool java_lang_reflect_Module::is_instance(oop obj) { - return obj != NULL && obj->klass() == SystemDictionary::reflect_Module_klass(); +inline bool java_lang_Module::is_instance(oop obj) { + return obj != NULL && obj->klass() == SystemDictionary::Module_klass(); } inline int Backtrace::merge_bci_and_version(int bci, int version) { diff --git a/hotspot/src/share/vm/classfile/moduleEntry.cpp b/hotspot/src/share/vm/classfile/moduleEntry.cpp index 42384cbacd2..2f07b10da3e 100644 --- a/hotspot/src/share/vm/classfile/moduleEntry.cpp +++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp @@ -266,19 +266,19 @@ void ModuleEntryTable::create_unnamed_module(ClassLoaderData* loader_data) { // Each ModuleEntryTable has exactly one unnamed module if (loader_data->is_the_null_class_loader_data()) { - // For the boot loader, the java.lang.reflect.Module for the unnamed module + // For the boot loader, the java.lang.Module for the unnamed module // is not known until a call to JVM_SetBootLoaderUnnamedModule is made. At // this point initially create the ModuleEntry for the unnamed module. _unnamed_module = new_entry(0, Handle(NULL), NULL, NULL, NULL, loader_data); } else { - // For all other class loaders the java.lang.reflect.Module for their + // For all other class loaders the java.lang.Module for their // corresponding unnamed module can be found in the java.lang.ClassLoader object. oop module = java_lang_ClassLoader::unnamedModule(loader_data->class_loader()); _unnamed_module = new_entry(0, Handle(module), NULL, NULL, NULL, loader_data); - // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module + // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module // object. - java_lang_reflect_Module::set_module_entry(module, _unnamed_module); + java_lang_Module::set_module_entry(module, _unnamed_module); } // Add to bucket 0, no name to hash on @@ -388,27 +388,27 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version, fatal("Unable to finalize module definition for " JAVA_BASE_NAME); } - // Set java.lang.reflect.Module, version and location for java.base + // Set java.lang.Module, version and location for java.base ModuleEntry* jb_module = javabase_moduleEntry(); assert(jb_module != NULL, JAVA_BASE_NAME " ModuleEntry not defined"); jb_module->set_version(version); jb_module->set_location(location); // Once java.base's ModuleEntry _module field is set with the known - // java.lang.reflect.Module, java.base is considered "defined" to the VM. + // java.lang.Module, java.base is considered "defined" to the VM. jb_module->set_module(boot_loader_data->add_handle(module_handle)); - // Store pointer to the ModuleEntry for java.base in the java.lang.reflect.Module object. - java_lang_reflect_Module::set_module_entry(module_handle(), jb_module); + // Store pointer to the ModuleEntry for java.base in the java.lang.Module object. + java_lang_Module::set_module_entry(module_handle(), jb_module); } -// Within java.lang.Class instances there is a java.lang.reflect.Module field -// that must be set with the defining module. During startup, prior to java.base's -// definition, classes needing their module field set are added to the fixup_module_list. -// Their module field is set once java.base's java.lang.reflect.Module is known to the VM. +// Within java.lang.Class instances there is a java.lang.Module field that must +// be set with the defining module. During startup, prior to java.base's definition, +// classes needing their module field set are added to the fixup_module_list. +// Their module field is set once java.base's java.lang.Module is known to the VM. void ModuleEntryTable::patch_javabase_entries(Handle module_handle) { if (module_handle.is_null()) { fatal("Unable to patch the module field of classes loaded prior to " - JAVA_BASE_NAME "'s definition, invalid java.lang.reflect.Module"); + JAVA_BASE_NAME "'s definition, invalid java.lang.Module"); } // Do the fixups for the basic primitive types diff --git a/hotspot/src/share/vm/classfile/moduleEntry.hpp b/hotspot/src/share/vm/classfile/moduleEntry.hpp index ac35010b04c..c50441a1739 100644 --- a/hotspot/src/share/vm/classfile/moduleEntry.hpp +++ b/hotspot/src/share/vm/classfile/moduleEntry.hpp @@ -45,7 +45,7 @@ class ModuleClosure; // A ModuleEntry describes a module that has been defined by a call to JVM_DefineModule. // It contains: // - Symbol* containing the module's name. -// - pointer to the java.lang.reflect.Module for this module. +// - pointer to the java.lang.Module for this module. // - pointer to the java.security.ProtectionDomain shared by classes defined to this module. // - ClassLoaderData*, class loader of this module. // - a growable array containg other module entries that this module can read. @@ -55,7 +55,7 @@ class ModuleClosure; // data structure. class ModuleEntry : public HashtableEntry { private: - jobject _module; // java.lang.reflect.Module + jobject _module; // java.lang.Module jobject _pd; // java.security.ProtectionDomain, cached // for shared classes from this module ClassLoaderData* _loader_data; diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp index 39ab9649516..39928498910 100644 --- a/hotspot/src/share/vm/classfile/modules.cpp +++ b/hotspot/src/share/vm/classfile/modules.cpp @@ -62,7 +62,7 @@ bool Modules::verify_package_name(const char* package_name) { } static char* get_module_name(oop module, TRAPS) { - oop name_oop = java_lang_reflect_Module::name(module); + oop name_oop = java_lang_Module::name(module); if (name_oop == NULL) { THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Null module name"); } @@ -98,11 +98,11 @@ static PackageEntryTable* get_package_entry_table(Handle h_loader, TRAPS) { static ModuleEntry* get_module_entry(jobject module, TRAPS) { Handle module_h(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(module_h())) { + if (!java_lang_Module::is_instance(module_h())) { THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), - "module is not an instance of type java.lang.reflect.Module"); + "module is not an instance of type java.lang.Module"); } - return java_lang_reflect_Module::module_entry(module_h(), CHECK_NULL); + return java_lang_Module::module_entry(module_h(), CHECK_NULL); } static PackageEntry* get_package_entry(ModuleEntry* module_entry, const char* package_name, TRAPS) { @@ -181,7 +181,7 @@ static void define_javabase_module(jobject module, jstring version, } // Validate java_base's loader is the boot loader. - oop loader = java_lang_reflect_Module::loader(module_handle()); + oop loader = java_lang_Module::loader(module_handle()); if (loader != NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Class loader must be the boot class loader"); @@ -234,7 +234,7 @@ static void define_javabase_module(jobject module, jstring version, // Only the thread that actually defined the base module will get here, // so no locking is needed. - // Patch any previously loaded class's module field with java.base's java.lang.reflect.Module. + // Patch any previously loaded class's module field with java.base's java.lang.Module. ModuleEntryTable::patch_javabase_entries(module_handle); log_debug(modules)("define_javabase_module(): Definition of module: " @@ -284,9 +284,9 @@ void Modules::define_module(jobject module, jstring version, } Handle module_handle(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(module_handle())) { + if (!java_lang_Module::is_instance(module_handle())) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "module is not an instance of type java.lang.reflect.Module"); + "module is not an instance of type java.lang.Module"); } char* module_name = get_module_name(module_handle(), CHECK); @@ -303,7 +303,7 @@ void Modules::define_module(jobject module, jstring version, const char* module_version = get_module_version(version); - oop loader = java_lang_reflect_Module::loader(module_handle()); + oop loader = java_lang_Module::loader(module_handle()); // Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader. if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), @@ -424,8 +424,8 @@ void Modules::define_module(jobject module, jstring version, pkg_list->at(y)->decrement_refcount(); } - // Store pointer to ModuleEntry record in java.lang.reflect.Module object. - java_lang_reflect_Module::set_module_entry(module_handle(), module_entry); + // Store pointer to ModuleEntry record in java.lang.Module object. + java_lang_Module::set_module_entry(module_handle(), module_entry); } } } // Release the lock @@ -467,20 +467,20 @@ void Modules::set_bootloader_unnamed_module(jobject module, TRAPS) { THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object"); } Handle module_handle(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(module_handle())) { + if (!java_lang_Module::is_instance(module_handle())) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "module is not an instance of type java.lang.reflect.Module"); + "module is not an instance of type java.lang.Module"); } // Ensure that this is an unnamed module - oop name = java_lang_reflect_Module::name(module_handle()); + oop name = java_lang_Module::name(module_handle()); if (name != NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - "boot loader's unnamed module's java.lang.reflect.Module has a name"); + "boot loader's unnamed module's java.lang.Module has a name"); } // Validate java_base's loader is the boot loader. - oop loader = java_lang_reflect_Module::loader(module_handle()); + oop loader = java_lang_Module::loader(module_handle()); if (loader != NULL) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Class loader must be the boot class loader"); @@ -492,12 +492,12 @@ void Modules::set_bootloader_unnamed_module(jobject module, TRAPS) { // Ensure the boot loader's PackageEntryTable has been created ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK); - // Set java.lang.reflect.Module for the boot loader's unnamed module + // Set java.lang.Module for the boot loader's unnamed module ModuleEntry* unnamed_module = module_table->unnamed_module(); assert(unnamed_module != NULL, "boot loader's unnamed ModuleEntry not defined"); unnamed_module->set_module(ClassLoaderData::the_null_class_loader_data()->add_handle(module_handle)); - // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module object. - java_lang_reflect_Module::set_module_entry(module_handle(), unnamed_module); + // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module object. + java_lang_Module::set_module_entry(module_handle(), unnamed_module); } void Modules::add_module_exports(jobject from_module, const char* package_name, jobject to_module, TRAPS) { @@ -627,13 +627,13 @@ jobject Modules::get_module(jclass clazz, TRAPS) { oop module = java_lang_Class::module(mirror); assert(module != NULL, "java.lang.Class module field not set"); - assert(java_lang_reflect_Module::is_instance(module), "module is not an instance of type java.lang.reflect.Module"); + assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module"); if (log_is_enabled(Debug, modules)) { ResourceMark rm(THREAD); outputStream* logst = Log(modules)::debug_stream(); Klass* klass = java_lang_Class::as_Klass(mirror); - oop module_name = java_lang_reflect_Module::name(module); + oop module_name = java_lang_Module::name(module); if (module_name != NULL) { logst->print("get_module(): module "); java_lang_String::print(module_name, tty); diff --git a/hotspot/src/share/vm/classfile/modules.hpp b/hotspot/src/share/vm/classfile/modules.hpp index 4f5e089a065..4dc752c95a4 100644 --- a/hotspot/src/share/vm/classfile/modules.hpp +++ b/hotspot/src/share/vm/classfile/modules.hpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,12 +55,12 @@ public: jstring location, const char* const* packages, jsize num_packages, TRAPS); - // Provides the java.lang.reflect.Module for the unnamed module defined + // Provides the java.lang.Module for the unnamed module defined // to the boot loader. // // IllegalArgumentExceptions are thrown for the following : // * Module has a name - // * Module is not a subclass of java.lang.reflect.Module + // * Module is not a subclass of java.lang.Module // * Module's class loader is not the boot loader // NullPointerExceptions are thrown if module is null. static void set_bootloader_unnamed_module(jobject module, TRAPS); @@ -96,10 +96,10 @@ public: // module does not exist. static void add_reads_module(jobject from_module, jobject to_module, TRAPS); - // Return the java.lang.reflect.Module object for this class object. + // Return the java.lang.Module object for this class object. static jobject get_module(jclass clazz, TRAPS); - // Return the java.lang.reflect.Module object for this class loader and package. + // Return the java.lang.Module object for this class loader and package. // Returns NULL if the class loader has not loaded any classes in the package. // The package should contain /'s, not .'s, as in java/lang, not java.lang. // NullPointerException is thrown if package is null. @@ -109,7 +109,7 @@ public: static jobject get_named_module(Handle h_loader, const char* package, TRAPS); // If package is defined by loader, return the - // java.lang.reflect.Module object for the module in which the package is defined. + // java.lang.Module object for the module in which the package is defined. // Returns NULL if package is invalid or not defined by loader. static jobject get_module(Symbol* package_name, Handle h_loader, TRAPS); diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp index 4cd5e40ffa8..f6ad7a4b347 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -133,9 +133,9 @@ class SymbolPropertyTable; do_klass(Thread_klass, java_lang_Thread, Pre ) \ do_klass(ThreadGroup_klass, java_lang_ThreadGroup, Pre ) \ do_klass(Properties_klass, java_util_Properties, Pre ) \ + do_klass(Module_klass, java_lang_Module, Pre ) \ do_klass(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject, Pre ) \ do_klass(reflect_Field_klass, java_lang_reflect_Field, Pre ) \ - do_klass(reflect_Module_klass, java_lang_reflect_Module, Pre ) \ do_klass(reflect_Parameter_klass, java_lang_reflect_Parameter, Opt ) \ do_klass(reflect_Method_klass, java_lang_reflect_Method, Pre ) \ do_klass(reflect_Constructor_klass, java_lang_reflect_Constructor, Pre ) \ diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 1a9db44ddcd..633bb8fd98a 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -56,6 +56,7 @@ template(java_lang_Object, "java/lang/Object") \ template(java_lang_Class, "java/lang/Class") \ template(java_lang_Package, "java/lang/Package") \ + template(java_lang_Module, "java/lang/Module") \ template(java_lang_String, "java/lang/String") \ template(java_lang_StringLatin1, "java/lang/StringLatin1") \ template(java_lang_StringUTF16, "java/lang/StringUTF16") \ @@ -90,7 +91,6 @@ template(java_lang_reflect_Method, "java/lang/reflect/Method") \ template(java_lang_reflect_Constructor, "java/lang/reflect/Constructor") \ template(java_lang_reflect_Field, "java/lang/reflect/Field") \ - template(java_lang_reflect_Module, "java/lang/reflect/Module") \ template(java_lang_reflect_Parameter, "java/lang/reflect/Parameter") \ template(java_lang_reflect_Array, "java/lang/reflect/Array") \ template(java_lang_StringBuffer, "java/lang/StringBuffer") \ @@ -136,7 +136,7 @@ template(initPhase1_name, "initPhase1") \ template(initPhase2_name, "initPhase2") \ template(initPhase3_name, "initPhase3") \ - template(java_lang_reflect_module_init_signature, "(Ljava/lang/ClassLoader;Ljava/lang/String;)V") \ + template(java_lang_module_init_signature, "(Ljava/lang/ClassLoader;Ljava/lang/String;)V") \ \ /* class file format tags */ \ template(tag_source_file, "SourceFile") \ @@ -450,7 +450,7 @@ template(getModule_name, "getModule") \ template(input_stream_void_signature, "(Ljava/io/InputStream;)V") \ template(definePackage_name, "definePackage") \ - template(definePackage_signature, "(Ljava/lang/String;Ljava/lang/reflect/Module;)Ljava/lang/Package;") \ + template(definePackage_signature, "(Ljava/lang/String;Ljava/lang/Module;)Ljava/lang/Package;") \ template(defineOrCheckPackage_name, "defineOrCheckPackage") \ template(defineOrCheckPackage_signature, "(Ljava/lang/String;Ljava/util/jar/Manifest;Ljava/net/URL;)Ljava/lang/Package;") \ template(fileToEncodedURL_name, "fileToEncodedURL") \ @@ -532,7 +532,7 @@ template(void_class_signature, "()Ljava/lang/Class;") \ template(void_class_array_signature, "()[Ljava/lang/Class;") \ template(void_string_signature, "()Ljava/lang/String;") \ - template(void_module_signature, "()Ljava/lang/reflect/Module;") \ + template(void_module_signature, "()Ljava/lang/Module;") \ template(object_array_object_signature, "([Ljava/lang/Object;)Ljava/lang/Object;") \ template(object_object_array_object_signature, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;")\ template(exception_void_signature, "(Ljava/lang/Exception;)V") \ @@ -552,7 +552,7 @@ template(reference_signature, "Ljava/lang/ref/Reference;") \ template(sun_misc_Cleaner_signature, "Lsun/misc/Cleaner;") \ template(executable_signature, "Ljava/lang/reflect/Executable;") \ - template(module_signature, "Ljava/lang/reflect/Module;") \ + template(module_signature, "Ljava/lang/Module;") \ template(concurrenthashmap_signature, "Ljava/util/concurrent/ConcurrentHashMap;") \ template(String_StringBuilder_signature, "(Ljava/lang/String;)Ljava/lang/StringBuilder;") \ template(int_StringBuilder_signature, "(I)Ljava/lang/StringBuilder;") \ @@ -642,16 +642,16 @@ template(jdk_internal_module_Modules, "jdk/internal/module/Modules") \ template(jdk_internal_vm_VMSupport, "jdk/internal/vm/VMSupport") \ template(addReads_name, "addReads") \ - template(addReads_signature, "(Ljava/lang/reflect/Module;Ljava/lang/reflect/Module;)V") \ + template(addReads_signature, "(Ljava/lang/Module;Ljava/lang/Module;)V") \ template(addExports_name, "addExports") \ template(addOpens_name, "addOpens") \ - template(addExports_signature, "(Ljava/lang/reflect/Module;Ljava/lang/String;Ljava/lang/reflect/Module;)V") \ + template(addExports_signature, "(Ljava/lang/Module;Ljava/lang/String;Ljava/lang/Module;)V") \ template(addUses_name, "addUses") \ - template(addUses_signature, "(Ljava/lang/reflect/Module;Ljava/lang/Class;)V") \ + template(addUses_signature, "(Ljava/lang/Module;Ljava/lang/Class;)V") \ template(addProvides_name, "addProvides") \ - template(addProvides_signature, "(Ljava/lang/reflect/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \ + template(addProvides_signature, "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \ template(transformedByAgent_name, "transformedByAgent") \ - template(transformedByAgent_signature, "(Ljava/lang/reflect/Module;)V") \ + template(transformedByAgent_signature, "(Ljava/lang/Module;)V") \ template(appendToClassPathForInstrumentation_name, "appendToClassPathForInstrumentation") \ do_alias(appendToClassPathForInstrumentation_signature, string_void_signature) \ template(serializePropertiesToByteArray_name, "serializePropertiesToByteArray") \ diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index ebc59953842..d8ec1ba8875 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -532,7 +532,7 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec } else { module_entry = ModuleEntryTable::javabase_moduleEntry(); } - // Obtain java.lang.reflect.Module, if available + // Obtain java.lang.Module, if available Handle module_handle(THREAD, ((module_entry != NULL) ? JNIHandles::resolve(module_entry->module()) : (oop)NULL)); java_lang_Class::create_mirror(this, loader, module_handle, protection_domain, CHECK); } diff --git a/hotspot/src/share/vm/prims/jvmti.xml b/hotspot/src/share/vm/prims/jvmti.xml index d01db3240fc..e7d02cc6dd0 100644 --- a/hotspot/src/share/vm/prims/jvmti.xml +++ b/hotspot/src/share/vm/prims/jvmti.xml @@ -6516,7 +6516,7 @@ class C2 extends C1 implements I2 { Get Named Module - Return the java.lang.reflect.Module object for a named + Return the java.lang.Module object for a named module defined to a class loader that contains a given package. The module is returned via module_ptr.

        @@ -6554,7 +6554,7 @@ class C2 extends C1 implements I2 { - On return, points to a java.lang.reflect.Module object + On return, points to a java.lang.Module object or points to NULL. @@ -6599,6 +6599,10 @@ class C2 extends C1 implements I2 { If is not a module object. + + if the module cannot be modified. + See . + @@ -6633,7 +6637,7 @@ class C2 extends C1 implements I2 { The module the package is exported to. If the to_module is not a subclass of - java.lang.reflect.Module this function returns + java.lang.Module this function returns . @@ -6649,6 +6653,10 @@ class C2 extends C1 implements I2 { If the package does not belong to the module. + + if the module cannot be modified. + See . + @@ -6684,7 +6692,7 @@ class C2 extends C1 implements I2 { The module with the package to open. If the to_module is not a subclass of - java.lang.reflect.Module this function returns + java.lang.Module this function returns . @@ -6700,6 +6708,10 @@ class C2 extends C1 implements I2 { If the package does not belong to the module. + + if the module cannot be modified. + See . + @@ -6737,6 +6749,10 @@ class C2 extends C1 implements I2 { If is not a class object. + + if the module cannot be modified. + See . + @@ -6783,6 +6799,44 @@ class C2 extends C1 implements I2 { If is not a class object. + + if the module cannot be modified. + See . + + + + + + Is Modifiable Module + + Determines whether a module is modifiable. + If a module is modifiable then this module can be updated with + , , + , , + and . If a module is not modifiable + then the module can not be updated with these functions. + + new + + + + + + + The module to query. + + + + + + On return, points to the boolean result of this function. + + + + + + If is not a module object. + @@ -7803,6 +7857,10 @@ class C2 extends C1 implements I2 { A method in the new class version has different modifiers than its counterpart in the old class version. + + A module cannot be modified. + See . + @@ -11567,6 +11625,9 @@ myInit() { The class cannot be modified. + + The module cannot be modified. + The functionality is not available in this virtual machine. @@ -14736,6 +14797,7 @@ typedef void (JNICALL *jvmtiEventVMInit) - Add new functions: - GetAllModules - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides + - IsModifiableModule Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to disallow some implementation defined classes. diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp index 57292a2c8bc..491eeddd1d5 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp @@ -235,12 +235,12 @@ JvmtiEnv::AddModuleReads(jobject module, jobject to_module) { // check module Handle h_module(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(h_module())) { + if (!java_lang_Module::is_instance(h_module())) { return JVMTI_ERROR_INVALID_MODULE; } // check to_module Handle h_to_module(THREAD, JNIHandles::resolve(to_module)); - if (!java_lang_reflect_Module::is_instance(h_to_module())) { + if (!java_lang_Module::is_instance(h_to_module())) { return JVMTI_ERROR_INVALID_MODULE; } return JvmtiExport::add_module_reads(h_module, h_to_module, THREAD); @@ -257,12 +257,12 @@ JvmtiEnv::AddModuleExports(jobject module, const char* pkg_name, jobject to_modu // check module Handle h_module(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(h_module())) { + if (!java_lang_Module::is_instance(h_module())) { return JVMTI_ERROR_INVALID_MODULE; } // check to_module Handle h_to_module(THREAD, JNIHandles::resolve(to_module)); - if (!java_lang_reflect_Module::is_instance(h_to_module())) { + if (!java_lang_Module::is_instance(h_to_module())) { return JVMTI_ERROR_INVALID_MODULE; } return JvmtiExport::add_module_exports(h_module, h_pkg, h_to_module, THREAD); @@ -279,12 +279,12 @@ JvmtiEnv::AddModuleOpens(jobject module, const char* pkg_name, jobject to_module // check module Handle h_module(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(h_module())) { + if (!java_lang_Module::is_instance(h_module())) { return JVMTI_ERROR_INVALID_MODULE; } // check to_module Handle h_to_module(THREAD, JNIHandles::resolve(to_module)); - if (!java_lang_reflect_Module::is_instance(h_to_module())) { + if (!java_lang_Module::is_instance(h_to_module())) { return JVMTI_ERROR_INVALID_MODULE; } return JvmtiExport::add_module_opens(h_module, h_pkg, h_to_module, THREAD); @@ -299,7 +299,7 @@ JvmtiEnv::AddModuleUses(jobject module, jclass service) { // check module Handle h_module(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(h_module())) { + if (!java_lang_Module::is_instance(h_module())) { return JVMTI_ERROR_INVALID_MODULE; } // check service @@ -321,7 +321,7 @@ JvmtiEnv::AddModuleProvides(jobject module, jclass service, jclass impl_class) { // check module Handle h_module(THREAD, JNIHandles::resolve(module)); - if (!java_lang_reflect_Module::is_instance(h_module())) { + if (!java_lang_Module::is_instance(h_module())) { return JVMTI_ERROR_INVALID_MODULE; } // check service @@ -339,6 +339,22 @@ JvmtiEnv::AddModuleProvides(jobject module, jclass service, jclass impl_class) { return JvmtiExport::add_module_provides(h_module, h_service, h_impl_class, THREAD); } /* end AddModuleProvides */ +// module - pre-checked for NULL +// is_modifiable_class_ptr - pre-checked for NULL +jvmtiError +JvmtiEnv::IsModifiableModule(jobject module, jboolean* is_modifiable_module_ptr) { + JavaThread* THREAD = JavaThread::current(); + + // check module + Handle h_module(THREAD, JNIHandles::resolve(module)); + if (!java_lang_Module::is_instance(h_module())) { + return JVMTI_ERROR_INVALID_MODULE; + } + + *is_modifiable_module_ptr = JNI_TRUE; + return JVMTI_ERROR_NONE; +} /* end IsModifiableModule */ + // // Class functions diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index fb4b2ee63cc..68b895c5f05 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -594,9 +594,9 @@ char* Reflection::verify_class_access_msg(const Klass* current_class, current_class_name, module_from_name, new_class_name, module_to_name, module_from_name, module_to_name); } else { - jobject jlrm = module_to->module(); - assert(jlrm != NULL, "Null jlrm in module_to ModuleEntry"); - intptr_t identity_hash = JNIHandles::resolve(jlrm)->identity_hash(); + jobject jlm = module_to->module(); + assert(jlm != NULL, "Null jlm in module_to ModuleEntry"); + intptr_t identity_hash = JNIHandles::resolve(jlm)->identity_hash(); size_t len = 160 + strlen(current_class_name) + 2*strlen(module_from_name) + strlen(new_class_name) + 2*sizeof(uintx); msg = NEW_RESOURCE_ARRAY(char, len); @@ -621,9 +621,9 @@ char* Reflection::verify_class_access_msg(const Klass* current_class, current_class_name, module_from_name, new_class_name, module_to_name, module_to_name, package_name, module_from_name); } else { - jobject jlrm = module_from->module(); - assert(jlrm != NULL, "Null jlrm in module_from ModuleEntry"); - intptr_t identity_hash = JNIHandles::resolve(jlrm)->identity_hash(); + jobject jlm = module_from->module(); + assert(jlm != NULL, "Null jlm in module_from ModuleEntry"); + intptr_t identity_hash = JNIHandles::resolve(jlm)->identity_hash(); size_t len = 170 + strlen(current_class_name) + strlen(new_class_name) + 2*strlen(module_to_name) + strlen(package_name) + 2*sizeof(uintx); msg = NEW_RESOURCE_ARRAY(char, len); diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index b4fe087a960..c5bf44f76ec 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -3465,7 +3465,7 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) { java_lang_Thread::RUNNABLE); // The VM creates objects of this class. - initialize_class(vmSymbols::java_lang_reflect_Module(), CHECK); + initialize_class(vmSymbols::java_lang_Module(), CHECK); // The VM preresolves methods to these classes. Make sure that they get initialized initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK); diff --git a/hotspot/test/TEST.ROOT b/hotspot/test/TEST.ROOT index 54b61ac1406..0bb7896cc79 100644 --- a/hotspot/test/TEST.ROOT +++ b/hotspot/test/TEST.ROOT @@ -50,8 +50,8 @@ requires.properties= \ vm.cpu.features \ vm.debug -# Tests using jtreg 4.2 b04 features -requiredVersion=4.2 b04 +# Tests using jtreg 4.2 b07 features +requiredVersion=4.2 b07 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java index 7ba6d00debf..7f32d95855d 100644 --- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java +++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,6 @@ import java.lang.reflect.Executable; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.lang.reflect.Parameter; import java.util.HashMap; import java.util.Map; diff --git a/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm b/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm index 36cebcb5049..207438a59a7 100644 --- a/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm +++ b/hotspot/test/runtime/classFileParserBug/fakeMethodAccessor.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ // to create a sub-type of jdk.internal.reflect.MethodAccessorImpl in order // to bypass Reflection.getCallerClass. That should fail with an IAE. // - import java.lang.reflect.Module; class fakeMethodAccessor extends jdk.internal.reflect.MethodAccessorImpl { public static void main(String[] a) throws Exception { fakeMethodAccessor f = new fakeMethodAccessor(); @@ -60,11 +59,11 @@ public static Method main:"([Ljava/lang/String;)V" astore_1; getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; ldc class java/lang/String; - invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/reflect/Module;"; + invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/Module;"; ldc String "jdk.internal.misc"; ldc class FakeMethodAccessor; - invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/reflect/Module;"; - invokevirtual Method java/lang/reflect/Module.isExported:"(Ljava/lang/String;Ljava/lang/reflect/Module;)Z"; + invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/Module;"; + invokevirtual Method java/lang/Module.isExported:"(Ljava/lang/String;Ljava/lang/Module;)Z"; invokevirtual Method java/io/PrintStream.println:"(Z)V"; return; } diff --git a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java index d3f3ca700d6..6847f26c8f1 100644 --- a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java +++ b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ public class GetSysPkgTest { return m; } } - throw new RuntimeException("Failed to find method " + name + " in java.lang.reflect.Module"); + throw new RuntimeException("Failed to find method " + name + " in java.lang.Module"); } // Throw RuntimeException if getSystemPackageLocation() does not return diff --git a/hotspot/test/runtime/modules/AccModuleTest.java b/hotspot/test/runtime/modules/AccModuleTest.java index 8deac7f327e..84e2de3552f 100644 --- a/hotspot/test/runtime/modules/AccModuleTest.java +++ b/hotspot/test/runtime/modules/AccModuleTest.java @@ -28,8 +28,6 @@ * @run main AccModuleTest */ -import java.io.File; - public class AccModuleTest { public static void main(String args[]) throws Throwable { diff --git a/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java b/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java index 5f9d716892f..465c709fd86 100644 --- a/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java +++ b/hotspot/test/runtime/modules/AccessCheck/AccessExportTwice.java @@ -39,8 +39,6 @@ import static jdk.test.lib.Asserts.*; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -58,7 +56,7 @@ import myloaders.MySameClassLoader; public class AccessExportTwice { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publicly defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -87,7 +85,7 @@ public class AccessExportTwice { ModuleFinder finder = ModuleLibrary.of(descriptor_first_mod, descriptor_second_mod); // Resolves "first_mod" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("first_mod")); @@ -96,8 +94,8 @@ public class AccessExportTwice { map.put("first_mod", MySameClassLoader.loader1); map.put("second_mod", MySameClassLoader.loader1); - // Create Layer that contains first_mod & second_mod - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains first_mod & second_mod + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("first_mod") == MySameClassLoader.loader1); assertTrue(layer.findLoader("second_mod") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java b/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java index 5e21a9335fc..74752d3d136 100644 --- a/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java +++ b/hotspot/test/runtime/modules/AccessCheck/AccessReadTwice.java @@ -39,8 +39,6 @@ import static jdk.test.lib.Asserts.*; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -56,7 +54,7 @@ import java.util.Set; public class AccessReadTwice { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publicly defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -85,7 +83,7 @@ public class AccessReadTwice { ModuleFinder finder = ModuleLibrary.of(descriptor_first_mod, descriptor_second_mod); // Resolves "first_mod" and "second_mod" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod")); @@ -95,8 +93,8 @@ public class AccessReadTwice { map.put("first_mod", loader); map.put("second_mod", loader); - // Create Layer that contains first_mod & second_mod - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains first_mod & second_mod + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("first_mod") == loader); assertTrue(layer.findLoader("second_mod") == loader); diff --git a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java index 0d507cb7f16..bc8aaeed8bd 100644 --- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,7 +58,7 @@ import myloaders.MySameClassLoader; // public class CheckRead { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publicly defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -100,7 +99,7 @@ public class CheckRead { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -110,8 +109,8 @@ public class CheckRead { map.put("m2x", MySameClassLoader.loader1); map.put("m3x", MySameClassLoader.loader1); - // Create Layer that contains m1x, m2x and m3x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x, m2x and m3x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java index d02959fd06f..732c326ccc1 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,7 +58,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_CheckRead { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publicly defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -100,7 +99,7 @@ public class DiffCL_CheckRead { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -110,8 +109,8 @@ public class DiffCL_CheckRead { map.put("m2x", MyDiffClassLoader.loader2); map.put("m3x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x, m2x and m3x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x, m2x and m3x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java index 3ffb591ff57..66062c4a2d9 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java @@ -38,7 +38,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -60,7 +59,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_ExpQualOther { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -102,7 +101,7 @@ public class DiffCL_ExpQualOther { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -112,8 +111,8 @@ public class DiffCL_ExpQualOther { map.put("m2x", MyDiffClassLoader.loader2); map.put("m3x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java index 1a86434be85..3088a972803 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -58,7 +57,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_ExpQualToM1 { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -88,7 +87,7 @@ public class DiffCL_ExpQualToM1 { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class DiffCL_ExpQualToM1 { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java index cb8c3f2b682..6cb7ea9bdcb 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,7 +58,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_ExpUnqual { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -89,7 +88,7 @@ public class DiffCL_ExpUnqual { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -98,8 +97,8 @@ public class DiffCL_ExpUnqual { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java index 5b18038a16d..e235d895751 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -58,7 +57,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_PkgNotExp { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -88,7 +87,7 @@ public class DiffCL_PkgNotExp { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class DiffCL_PkgNotExp { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java index 8b3d098e815..fafd41af3fa 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java @@ -42,8 +42,6 @@ import static jdk.test.lib.Asserts.*; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -68,7 +66,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_Umod { - // Create Layers over the boot layer to test different + // Create layers over the boot layer to test different // accessing scenarios of a named module to an unnamed module. // Module m1x is a strict module and has not established @@ -89,7 +87,7 @@ public class DiffCL_Umod { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -102,8 +100,8 @@ public class DiffCL_Umod { Map map = new HashMap<>(); map.put("m1x", MyDiffClassLoader.loader1); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("java.base") == null); @@ -138,7 +136,7 @@ public class DiffCL_Umod { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -151,8 +149,8 @@ public class DiffCL_Umod { Map map = new HashMap<>(); map.put("m1x", MyDiffClassLoader.loader1); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("java.base") == null); @@ -187,7 +185,7 @@ public class DiffCL_Umod { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -200,8 +198,8 @@ public class DiffCL_Umod { Map map = new HashMap<>(); map.put("m1x", MyDiffClassLoader.loader1); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("java.base") == null); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java index 8b3c600ca0a..8a0d6a35af9 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java @@ -38,7 +38,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -63,7 +62,7 @@ import myloaders.MyDiffClassLoader; // public class DiffCL_UmodUpkg { - // Create Layers over the boot layer to test different + // Create layers over the boot layer to test different // accessing scenarios of a named module to an unnamed module. // Module m1x is a strict module and has not established @@ -84,7 +83,7 @@ public class DiffCL_UmodUpkg { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class DiffCL_UmodUpkg { Map map = new HashMap<>(); map.put("m1x", MyDiffClassLoader.loader1); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("java.base") == null); @@ -133,7 +132,7 @@ public class DiffCL_UmodUpkg { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -146,8 +145,8 @@ public class DiffCL_UmodUpkg { Map map = new HashMap<>(); map.put("m1x", MyDiffClassLoader.loader1); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("java.base") == null); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java index 14da2aac213..d3d8395b13a 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java @@ -38,7 +38,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -60,7 +59,7 @@ import myloaders.MySameClassLoader; // public class ExpQualOther { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -102,7 +101,7 @@ public class ExpQualOther { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -112,8 +111,8 @@ public class ExpQualOther { map.put("m2x", MySameClassLoader.loader1); map.put("m3x", MySameClassLoader.loader1); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java index ede47809f7a..1545bcb50e5 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -48,7 +47,7 @@ import myloaders.MySameClassLoader; public class ExpQualToM1 { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -78,7 +77,7 @@ public class ExpQualToM1 { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -87,8 +86,8 @@ public class ExpQualToM1 { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java index 0ded845e90d..0daba28d73e 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -48,7 +47,7 @@ import myloaders.MySameClassLoader; public class ExpUnqual { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -78,7 +77,7 @@ public class ExpUnqual { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -87,8 +86,8 @@ public class ExpUnqual { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java index 35857f695cc..69f2ca14869 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java @@ -41,8 +41,6 @@ import static jdk.test.lib.Asserts.*; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -61,7 +59,7 @@ import myloaders.MySameClassLoader; public class ExportAllUnnamed { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -90,7 +88,7 @@ public class ExportAllUnnamed { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -99,8 +97,8 @@ public class ExportAllUnnamed { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java index 990d08cc8b8..baabe54cd85 100644 --- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -58,7 +57,7 @@ import myloaders.MySameClassLoader; // public class PkgNotExp { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -88,7 +87,7 @@ public class PkgNotExp { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class PkgNotExp { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x and m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x and m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod.java b/hotspot/test/runtime/modules/AccessCheck/Umod.java index edce6ac4a3f..20b97edd11e 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java @@ -39,11 +39,9 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -68,7 +66,7 @@ import myloaders.MySameClassLoader; // public class Umod { - // Create Layers over the boot layer to test different + // Create layers over the boot layer to test different // accessing scenarios of a named module to an unnamed module. // Module m1x is a strict module and has not established @@ -89,7 +87,7 @@ public class Umod { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -99,8 +97,8 @@ public class Umod { Map map = new HashMap<>(); map.put("m1x", loader); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == loader); assertTrue(layer.findLoader("java.base") == null); @@ -135,7 +133,7 @@ public class Umod { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -145,8 +143,8 @@ public class Umod { Map map = new HashMap<>(); map.put("m1x", loader); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == loader); assertTrue(layer.findLoader("java.base") == null); @@ -181,7 +179,7 @@ public class Umod { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -191,8 +189,8 @@ public class Umod { Map map = new HashMap<>(); map.put("m1x", loader); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == loader); assertTrue(layer.findLoader("java.base") == null); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java index ecdda73f41c..a017c9f74b6 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java @@ -38,7 +38,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -60,7 +59,7 @@ import myloaders.MyDiffClassLoader; // public class UmodDiffCL_ExpQualOther { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -89,7 +88,7 @@ public class UmodDiffCL_ExpQualOther { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -98,8 +97,8 @@ public class UmodDiffCL_ExpQualOther { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java index c05fccc1a1c..724a92d7748 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java @@ -38,7 +38,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -60,7 +59,7 @@ import myloaders.MyDiffClassLoader; // public class UmodDiffCL_ExpUnqual { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -89,7 +88,7 @@ public class UmodDiffCL_ExpUnqual { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -98,8 +97,8 @@ public class UmodDiffCL_ExpUnqual { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java index 67732ac89bc..c95ab7fb031 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,7 +58,7 @@ import myloaders.MyDiffClassLoader; // public class UmodDiffCL_PkgNotExp { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -88,7 +87,7 @@ public class UmodDiffCL_PkgNotExp { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class UmodDiffCL_PkgNotExp { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java index fed0ad4382c..f84425ba4a6 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java @@ -40,8 +40,6 @@ import static jdk.test.lib.Asserts.*; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -63,7 +61,7 @@ import myloaders.MySameClassLoader; // public class UmodUPkg { - // Create Layers over the boot layer to test different + // Create layers over the boot layer to test different // accessing scenarios of a named module to an unnamed module. // Module m1x is a strict module and has not established @@ -84,7 +82,7 @@ public class UmodUPkg { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -94,8 +92,8 @@ public class UmodUPkg { Map map = new HashMap<>(); map.put("m1x", loader); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == loader); assertTrue(layer.findLoader("java.base") == null); @@ -130,7 +128,7 @@ public class UmodUPkg { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -140,8 +138,8 @@ public class UmodUPkg { Map map = new HashMap<>(); map.put("m1x", loader); - // Create Layer that contains m1x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == loader); assertTrue(layer.findLoader("java.base") == null); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java index b8c48da4b4a..85ecface508 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java @@ -38,7 +38,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -60,7 +59,7 @@ import myloaders.MyDiffClassLoader; // public class UmodUpkgDiffCL_ExpQualOther { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -89,7 +88,7 @@ public class UmodUpkgDiffCL_ExpQualOther { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -98,8 +97,8 @@ public class UmodUpkgDiffCL_ExpQualOther { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java index 134a9d64e91..b55a19ea1b5 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,7 +58,7 @@ import myloaders.MyDiffClassLoader; // public class UmodUpkgDiffCL_NotExp { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -88,7 +87,7 @@ public class UmodUpkgDiffCL_NotExp { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class UmodUpkgDiffCL_NotExp { map.put("m1x", MyDiffClassLoader.loader1); map.put("m2x", MyDiffClassLoader.loader2); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java index c6f2dd8be4a..081dc0a2ba2 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,12 +58,12 @@ import myloaders.MySameClassLoader; // public class UmodUpkg_ExpQualOther { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { - // Define module: m1x (need to define m1x to establish the Layer successfully) + // Define module: m1x (need to define m1x to establish the layer successfully) // Can read: java.base, m2x, m3x // Packages: none // Packages exported: none @@ -98,7 +97,7 @@ public class UmodUpkg_ExpQualOther { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -108,8 +107,8 @@ public class UmodUpkg_ExpQualOther { map.put("m2x", MySameClassLoader.loader1); map.put("m3x", MySameClassLoader.loader1); - // Create Layer that contains m1x, m2x and m3x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x, m2x and m3x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java index 69a768a8a07..d7e3287ac9d 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -57,7 +56,7 @@ import myloaders.MySameClassLoader; // public class UmodUpkg_NotExp { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -86,7 +85,7 @@ public class UmodUpkg_NotExp { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -95,8 +94,8 @@ public class UmodUpkg_NotExp { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x and m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x and m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java index 4ca29861c69..1032eecb27f 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,12 +58,12 @@ import myloaders.MySameClassLoader; // public class Umod_ExpQualOther { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { - // Define module: m1x (need to define m1x to establish the Layer successfully) + // Define module: m1x (need to define m1x to establish the layer successfully) // Can read: java.base, m2x, m3x // Packages: none // Packages exported: none @@ -98,7 +97,7 @@ public class Umod_ExpQualOther { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -108,8 +107,8 @@ public class Umod_ExpQualOther { map.put("m2x", MySameClassLoader.loader1); map.put("m3x", MySameClassLoader.loader1); - // Create Layer that contains m1x, m2x and m3x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x, m2x and m3x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java index 4430341308f..05971cec727 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -59,7 +58,7 @@ import myloaders.MySameClassLoader; public class Umod_ExpUnqual { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -88,7 +87,7 @@ public class Umod_ExpUnqual { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -97,8 +96,8 @@ public class Umod_ExpUnqual { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java index 4990a379bb4..46e692934c6 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java @@ -37,7 +37,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -57,7 +56,7 @@ import myloaders.MySameClassLoader; // public class Umod_PkgNotExp { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -86,7 +85,7 @@ public class Umod_PkgNotExp { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -95,8 +94,8 @@ public class Umod_PkgNotExp { map.put("m1x", MySameClassLoader.loader1); map.put("m2x", MySameClassLoader.loader1); - // Create Layer that contains m1x and m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x and m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1); assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1); diff --git a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java index fdceb569684..40b31cc49f6 100644 --- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java +++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdge.java @@ -22,7 +22,6 @@ */ package p1; -import java.lang.reflect.*; import p2.c2; public class c1ReadEdge { diff --git a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java index 03c444172b6..51b8955673e 100644 --- a/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java +++ b/hotspot/test/runtime/modules/AccessCheck/p1/c1ReadEdgeDiffLoader.java @@ -22,7 +22,6 @@ */ package p1; -import java.lang.reflect.*; import myloaders.MyDiffClassLoader; import p2.c2; diff --git a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod index 466d675f220..cc529395226 100644 --- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod +++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdge.jcod @@ -23,7 +23,6 @@ /* * package p3; - * import java.lang.reflect.*; * public class c3ReadEdge { * public c3ReadEdge() { * // Establish read edge from module m1x, where c3ReadEdge is defined, @@ -75,14 +74,14 @@ class p3/c3ReadEdge { Utf8 "java/lang/Object"; // #28 at 0xBC Utf8 "java/lang/Class"; // #29 at 0xCF Utf8 "getModule"; // #30 at 0xE1 - Utf8 "()Ljava/lang/reflect/Module;"; // #31 at 0xED + Utf8 "()Ljava/lang/Module;"; // #31 at 0xED Utf8 "getClassLoader"; // #32 at 0x010C Utf8 "()Ljava/lang/ClassLoader;"; // #33 at 0x011D Utf8 "java/lang/ClassLoader"; // #34 at 0x0139 Utf8 "getUnnamedModule"; // #35 at 0x0151 - Utf8 "java/lang/reflect/Module"; // #36 at 0x0164 + Utf8 "java/lang/Module"; // #36 at 0x0164 Utf8 "addReads"; // #37 at 0x017F - Utf8 "(Ljava/lang/reflect/Module;)Ljava/lang/reflect/Module;"; // #38 at 0x018A + Utf8 "(Ljava/lang/Module;)Ljava/lang/Module;"; // #38 at 0x018A Utf8 "method4"; // #39 at 0x01C3 } // Constant Pool diff --git a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod index 3229c7a2054..e1602cdf9fb 100644 --- a/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod +++ b/hotspot/test/runtime/modules/AccessCheck/p3/c3ReadEdgeDiffLoader.jcod @@ -23,7 +23,6 @@ /* * package p3; - * import java.lang.reflect.*; * import myloaders.MyDiffClassLoader; * * public class c3ReadEdgeDiffLoader { @@ -100,14 +99,14 @@ class p3/c3ReadEdgeDiffLoader { Utf8 "java/lang/Object"; // #31 at 0xDD Utf8 "java/lang/Class"; // #32 at 0xF0 Utf8 "getModule"; // #33 at 0x0102 - Utf8 "()Ljava/lang/reflect/Module;"; // #34 at 0x010E + Utf8 "()Ljava/lang/Module;"; // #34 at 0x010E Utf8 "java/lang/ClassLoader"; // #35 at 0x012D Utf8 "getSystemClassLoader"; // #36 at 0x0145 Utf8 "()Ljava/lang/ClassLoader;"; // #37 at 0x015C Utf8 "getUnnamedModule"; // #38 at 0x0178 - Utf8 "java/lang/reflect/Module"; // #39 at 0x018B + Utf8 "java/lang/Module"; // #39 at 0x018B Utf8 "addReads"; // #40 at 0x01A6 - Utf8 "(Ljava/lang/reflect/Module;)Ljava/lang/reflect/Module;"; // #41 at 0x01B1 + Utf8 "(Ljava/lang/Module;)Ljava/lang/Module;"; // #41 at 0x01B1 Utf8 "myloaders/MyDiffClassLoader"; // #42 at 0x01EA Utf8 "loader2"; // #43 at 0x0208 Utf8 "Lmyloaders/MyDiffClassLoader;"; // #44 at 0x0212 diff --git a/hotspot/test/runtime/modules/AccessCheck/p4/c4.java b/hotspot/test/runtime/modules/AccessCheck/p4/c4.java index d0098674672..8df98a646f8 100644 --- a/hotspot/test/runtime/modules/AccessCheck/p4/c4.java +++ b/hotspot/test/runtime/modules/AccessCheck/p4/c4.java @@ -25,8 +25,6 @@ package p4; -import java.lang.reflect.Module; - public class c4 { // Add a read edge from c4's module to given module m public void addReads(Module m) { diff --git a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java index 1ce5fdcc4db..69ee6d6cf31 100644 --- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java @@ -21,7 +21,6 @@ * questions. */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; /* @@ -31,7 +30,7 @@ import static jdk.test.lib.Asserts.*; * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckAllUnnamed @@ -45,10 +44,10 @@ public class AccessCheckAllUnnamed { public static void main(String args[]) throws Throwable { Object m1x, m2x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlM = jlObject.getModule(); + assertNotNull(jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for AccessCheckWorks and assume it's also used to // load class p2.c2. @@ -58,13 +57,13 @@ public class AccessCheckAllUnnamed { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlM); // Define a module for p2. m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlM); try { ModuleHelper.AddModuleExportsToAllUnnamed((Module)null, "p2"); diff --git a/hotspot/test/runtime/modules/AccessCheckExp.java b/hotspot/test/runtime/modules/AccessCheckExp.java index 6c3cb07fff8..18c02937a82 100644 --- a/hotspot/test/runtime/modules/AccessCheckExp.java +++ b/hotspot/test/runtime/modules/AccessCheckExp.java @@ -28,13 +28,12 @@ * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckExp */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class AccessCheckExp { @@ -44,10 +43,10 @@ public class AccessCheckExp { public static void main(String args[]) throws Throwable { Object m1x, m2x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for AccessCheckExp and assume it's also used to // load classes p1.c1 and p2.c2. @@ -57,13 +56,13 @@ public class AccessCheckExp { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlObject_jlM); // Define a module for p2. m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); // Make package p1 in m1x visible to everyone. ModuleHelper.AddModuleExportsToAll(m1x, "p1"); diff --git a/hotspot/test/runtime/modules/AccessCheckJavaBase.java b/hotspot/test/runtime/modules/AccessCheckJavaBase.java index aea13270267..0402f129658 100644 --- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java +++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java @@ -27,13 +27,12 @@ * @library /test/lib .. * @compile p2/c2.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckJavaBase */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class AccessCheckJavaBase { diff --git a/hotspot/test/runtime/modules/AccessCheckRead.java b/hotspot/test/runtime/modules/AccessCheckRead.java index 193388dbade..c25c33a61da 100644 --- a/hotspot/test/runtime/modules/AccessCheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheckRead.java @@ -28,13 +28,12 @@ * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckRead */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class AccessCheckRead { @@ -44,10 +43,10 @@ public class AccessCheckRead { public static void main(String args[]) throws Throwable { Object m1x, m2x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for AccessCheckRead and assume it's also used to // load classes p1.c1 and p2.c2. @@ -57,13 +56,13 @@ public class AccessCheckRead { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlObject_jlM); // Define a module for p2. m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); // Make package p1 in m1x visible to everyone. ModuleHelper.AddModuleExportsToAll(m1x, "p1"); diff --git a/hotspot/test/runtime/modules/AccessCheckSuper.java b/hotspot/test/runtime/modules/AccessCheckSuper.java index 240d79c0ab9..c227db254a1 100644 --- a/hotspot/test/runtime/modules/AccessCheckSuper.java +++ b/hotspot/test/runtime/modules/AccessCheckSuper.java @@ -28,13 +28,12 @@ * @compile p2/c2.java * @compile p3/c3.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckSuper */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class AccessCheckSuper { diff --git a/hotspot/test/runtime/modules/AccessCheckUnnamed.java b/hotspot/test/runtime/modules/AccessCheckUnnamed.java index 79a685d4c43..14b48b107b6 100644 --- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java @@ -21,7 +21,6 @@ * questions. */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; /* @@ -31,7 +30,7 @@ import static jdk.test.lib.Asserts.*; * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckUnnamed @@ -44,10 +43,10 @@ public class AccessCheckUnnamed { public static void main(String args[]) throws Throwable { Object m1x, m2x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for AccessCheckWorks and assume it's also used to // load class p2.c2. @@ -57,7 +56,7 @@ public class AccessCheckUnnamed { m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); // p1.c1's ctor tries to call a method in p2.c2. This should fail because // p1 is in the unnamed module and p2.c2 is not unqualifiedly exported. diff --git a/hotspot/test/runtime/modules/AccessCheckWorks.java b/hotspot/test/runtime/modules/AccessCheckWorks.java index 0cc9cb981e0..9cb638ade3a 100644 --- a/hotspot/test/runtime/modules/AccessCheckWorks.java +++ b/hotspot/test/runtime/modules/AccessCheckWorks.java @@ -28,13 +28,12 @@ * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckWorks */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class AccessCheckWorks { @@ -45,10 +44,10 @@ public class AccessCheckWorks { public static void main(String args[]) throws Throwable { Object m1x, m2x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for AccessCheckWorks and assume it's also used to // load classes p1.c1 and p2.c2. @@ -58,13 +57,13 @@ public class AccessCheckWorks { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlObject_jlM); // Define a module for p2. m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); // Make package p1 in m1x visible to everyone. ModuleHelper.AddModuleExportsToAll(m1x, "p1"); diff --git a/hotspot/test/runtime/modules/CCE_module_msg.java b/hotspot/test/runtime/modules/CCE_module_msg.java index 0cca61bef86..7e593dfcee9 100644 --- a/hotspot/test/runtime/modules/CCE_module_msg.java +++ b/hotspot/test/runtime/modules/CCE_module_msg.java @@ -28,14 +28,13 @@ * @compile p2/c2.java * @compile p4/c4.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI CCE_module_msg */ import java.io.*; -import java.lang.reflect.Module; import java.net.URL; import java.net.URLClassLoader; import java.nio.file.Path; @@ -73,10 +72,10 @@ public class CCE_module_msg { } public static void invalidClassToString() throws Throwable { - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for CCE_module_msg and assume it's also used to // load classes p1.c1 and p2.c2. @@ -86,7 +85,7 @@ public class CCE_module_msg { Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); try { ModuleHelper.AddModuleExportsToAll(m2x, "p2"); @@ -105,10 +104,10 @@ public class CCE_module_msg { } public static void invalidClassToStringCustomLoader() throws Throwable { - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Create a customer class loader to load class p4/c4. URL[] urls = new URL[] { CLASSES_DIR.toUri().toURL() }; diff --git a/hotspot/test/runtime/modules/ExportTwice.java b/hotspot/test/runtime/modules/ExportTwice.java index 82cefa939e2..abdad3a7822 100644 --- a/hotspot/test/runtime/modules/ExportTwice.java +++ b/hotspot/test/runtime/modules/ExportTwice.java @@ -28,13 +28,12 @@ * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ExportTwice */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class ExportTwice { @@ -46,10 +45,10 @@ public class ExportTwice { public static void main(String args[]) throws Throwable { Object m1x, m2x, m3x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for ExportTwice and assume it's also used to // load classes p1.c1 and p2.c2. @@ -59,19 +58,19 @@ public class ExportTwice { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlObject_jlM); // Define a module for p2. m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); // Define a module for p3. m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" }); assertNotNull(m3x, "Module should not be null"); ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" }); - ModuleHelper.AddReadsModule(m3x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m3x, jlObject_jlM); // Make package p1 in m1x visible to everyone. ModuleHelper.AddModuleExportsToAll(m1x, "p1"); diff --git a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java index 99f47ad4227..71fba9816f2 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java @@ -30,11 +30,10 @@ * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExportToAllUnnamed */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class JVMAddModuleExportToAllUnnamed { @@ -44,10 +43,10 @@ public class JVMAddModuleExportToAllUnnamed { public static void main(String args[]) throws Throwable { Object m1x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for JVMAddModuleExportToAllUnnamed and assume it's also used to // load class p1.c1. @@ -57,7 +56,7 @@ public class JVMAddModuleExportToAllUnnamed { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlObject_jlM); // Make package p1 in m1x visible to everyone. ModuleHelper.AddModuleExportsToAll(m1x, "p1"); diff --git a/hotspot/test/runtime/modules/JVMAddModuleExports.java b/hotspot/test/runtime/modules/JVMAddModuleExports.java index 689523639f4..01d441c7879 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExports.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,13 +26,12 @@ * @modules java.base/jdk.internal.misc * @library /test/lib .. * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExports */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; public class JVMAddModuleExports { diff --git a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java index ec4672327c3..f6499644b48 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java @@ -21,7 +21,6 @@ * questions. */ -import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; /* @@ -31,7 +30,7 @@ import static jdk.test.lib.Asserts.*; * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModuleExportsToAll @@ -45,10 +44,10 @@ public class JVMAddModuleExportsToAll { public static void main(String args[]) throws Throwable { Object m1x, m2x, m3x; - // Get the java.lang.reflect.Module object for module java.base. + // Get the java.lang.Module object for module java.base. Class jlObject = Class.forName("java.lang.Object"); - Object jlObject_jlrM = jlObject.getModule(); - assertNotNull(jlObject_jlrM, "jlrModule object of java.lang.Object should not be null"); + Object jlObject_jlM = jlObject.getModule(); + assertNotNull(jlObject_jlM, "jlModule object of java.lang.Object should not be null"); // Get the class loader for JVMAddModuleExportsToAll and assume it's also used to // load class p2.c2. @@ -58,13 +57,13 @@ public class JVMAddModuleExportsToAll { m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" }); assertNotNull(m1x, "Module should not be null"); ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" }); - ModuleHelper.AddReadsModule(m1x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m1x, jlObject_jlM); // Define a module for p2. m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" }); assertNotNull(m2x, "Module should not be null"); ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" }); - ModuleHelper.AddReadsModule(m2x, jlObject_jlrM); + ModuleHelper.AddReadsModule(m2x, jlObject_jlM); try { ModuleHelper.AddModuleExportsToAll((Module)null, "p2"); @@ -80,7 +79,7 @@ public class JVMAddModuleExportsToAll { // Expected } - try { // Expect IAE when passing a ClassLoader object instead of a java.lang.reflect.Module object. + try { // Expect IAE when passing a ClassLoader object instead of a java.lang.Module object. ModuleHelper.AddModuleExportsToAll(this_cldr, "p2"); throw new RuntimeException("Failed to get the expected IAE for bad module"); } catch(IllegalArgumentException e) { diff --git a/hotspot/test/runtime/modules/JVMAddModulePackage.java b/hotspot/test/runtime/modules/JVMAddModulePackage.java index e109e728607..eb2e32581c6 100644 --- a/hotspot/test/runtime/modules/JVMAddModulePackage.java +++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java @@ -26,7 +26,7 @@ * @modules java.base/jdk.internal.misc * @library /test/lib .. * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddModulePackage diff --git a/hotspot/test/runtime/modules/JVMAddReadsModule.java b/hotspot/test/runtime/modules/JVMAddReadsModule.java index a25bcfc64f6..bf0b838403e 100644 --- a/hotspot/test/runtime/modules/JVMAddReadsModule.java +++ b/hotspot/test/runtime/modules/JVMAddReadsModule.java @@ -26,7 +26,7 @@ * @modules java.base/jdk.internal.misc * @library /test/lib .. * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMAddReadsModule diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java index 5ef669ed93b..e3e263be291 100644 --- a/hotspot/test/runtime/modules/JVMDefineModule.java +++ b/hotspot/test/runtime/modules/JVMDefineModule.java @@ -26,7 +26,7 @@ * @modules java.base/jdk.internal.misc * @library /test/lib .. * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMDefineModule @@ -78,7 +78,7 @@ public class JVMDefineModule { ModuleHelper.DefineModule(new Object(), "9.0", "mymodule/here", new String[] { "mypackage1" }); throw new RuntimeException("Failed to get expected IAE or NPE for bad module"); } catch(IllegalArgumentException e) { - if (!e.getMessage().contains("module is not an instance of type java.lang.reflect.Module")) { + if (!e.getMessage().contains("module is not an instance of type java.lang.Module")) { throw new RuntimeException("Failed to get expected IAE message for bad module: " + e.getMessage()); } } diff --git a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java index ce94bb19536..da3224826eb 100644 --- a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java +++ b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java @@ -27,7 +27,7 @@ * @library /test/lib .. * @compile p2/c2.java * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMGetModuleByPkgName @@ -35,7 +35,6 @@ import static jdk.test.lib.Asserts.*; import java.lang.ClassLoader; -import java.lang.reflect.Module; public class JVMGetModuleByPkgName { diff --git a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java index 1f27ba9b432..20cde3a5f60 100644 --- a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java +++ b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java @@ -27,7 +27,7 @@ * @modules java.base/jdk.internal.misc * @library /test/lib .. * @build sun.hotspot.WhiteBox - * @compile/module=java.base java/lang/reflect/ModuleHelper.java + * @compile/module=java.base java/lang/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx64m -Xmx64m LoadUnloadModuleStress 15000 diff --git a/hotspot/test/runtime/modules/ModuleHelper.java b/hotspot/test/runtime/modules/ModuleHelper.java index 26febc2a75e..e4db0f53a18 100644 --- a/hotspot/test/runtime/modules/ModuleHelper.java +++ b/hotspot/test/runtime/modules/ModuleHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,6 @@ import java.net.URI; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Module; import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -41,19 +40,19 @@ public class ModuleHelper { public static void AddModuleExports(Object from, String pkg, Object to) throws Throwable { WhiteBox wb = WhiteBox.getWhiteBox(); wb.AddModuleExports(from, pkg, to); - java.lang.reflect.ModuleHelper.addExportsNoSync((Module)from, pkg, (Module)to); + java.lang.ModuleHelper.addExportsNoSync((Module)from, pkg, (Module)to); } public static void AddReadsModule(Object from, Object to) throws Throwable { WhiteBox wb = WhiteBox.getWhiteBox(); wb.AddReadsModule(from, to); - java.lang.reflect.ModuleHelper.addReadsNoSync((Module)from, (Module)to); + java.lang.ModuleHelper.addReadsNoSync((Module)from, (Module)to); } public static void AddModulePackage(Object m, String pkg) throws Throwable { WhiteBox wb = WhiteBox.getWhiteBox(); wb.AddModulePackage(m, pkg); - java.lang.reflect.ModuleHelper.addPackageNoSync((Module)m, pkg); + java.lang.ModuleHelper.addPackageNoSync((Module)m, pkg); } public static Module GetModuleByPackageName(Object ldr, String pkg) throws Throwable { @@ -64,13 +63,13 @@ public class ModuleHelper { public static void AddModuleExportsToAllUnnamed(Object m, String pkg) throws Throwable { WhiteBox wb = WhiteBox.getWhiteBox(); wb.AddModuleExportsToAllUnnamed(m, pkg); - //java.lang.reflect.ModuleHelper.addExportsToAllUnnamedNoSync((Module)m, pkg); + //java.lang.ModuleHelper.addExportsToAllUnnamedNoSync((Module)m, pkg); } public static void AddModuleExportsToAll(Object m, String pkg) throws Throwable { WhiteBox wb = WhiteBox.getWhiteBox(); wb.AddModuleExportsToAll(m, pkg); - java.lang.reflect.ModuleHelper.addExportsNoSync((Module)m, pkg, (Module)null); + java.lang.ModuleHelper.addExportsNoSync((Module)m, pkg, (Module)null); } public static Module ModuleObject(String name, ClassLoader loader, String[] pkgs) throws Throwable { @@ -87,7 +86,7 @@ public class ModuleHelper { ModuleDescriptor.newModule(name).packages(pkg_set).build(); URI uri = URI.create("module:/" + name); - return java.lang.reflect.ModuleHelper.newModule(loader, descriptor); + return java.lang.ModuleHelper.newModule(loader, descriptor); } } diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java b/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java index 6186727606f..772293f91a8 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleNonBuiltinCLMain.java @@ -25,7 +25,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -47,7 +46,7 @@ import java.util.Set; // public class ModuleNonBuiltinCLMain { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -90,7 +89,7 @@ public class ModuleNonBuiltinCLMain { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -103,8 +102,8 @@ public class ModuleNonBuiltinCLMain { map.put("m2x", cl2); map.put("m3x", cl3); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == cl1); assertTrue(layer.findLoader("m2x") == cl2); assertTrue(layer.findLoader("m3x") == cl3); diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java b/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java index c2f859e3817..1eab8308495 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleSameCLMain.java @@ -25,7 +25,6 @@ import static jdk.test.lib.Asserts.*; -import java.lang.reflect.Layer; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -45,7 +44,7 @@ import java.util.Set; // public class ModuleSameCLMain { - // Create a Layer over the boot layer. + // Create a layer over the boot layer. // Define modules within this layer to test access between // publically defined classes within packages of those modules. public void createLayerOnBoot() throws Throwable { @@ -75,7 +74,7 @@ public class ModuleSameCLMain { ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x); // Resolves "m1x" - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1x")); @@ -85,8 +84,8 @@ public class ModuleSameCLMain { map.put("m1x", cl1); map.put("m2x", cl1); - // Create Layer that contains m1x & m2x - Layer layer = Layer.boot().defineModules(cf, map::get); + // Create layer that contains m1x & m2x + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, map::get); assertTrue(layer.findLoader("m1x") == cl1); assertTrue(layer.findLoader("m2x") == cl1); assertTrue(layer.findLoader("java.base") == null); diff --git a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java index 6ce8823db25..3c6c84794ab 100644 --- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java +++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,7 @@ package test; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; @@ -44,7 +42,7 @@ public class Main { public static void main(String[] args) throws Exception { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Layer layerBoot = Layer.boot(); + ModuleLayer layerBoot = ModuleLayer.boot(); Configuration cf = layerBoot .configuration() @@ -58,7 +56,7 @@ public class Main { Callable task = new Callable() { @Override public Void call() throws Exception { - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); Module transletModule = layer.findModule(MODULE_NAME).get(); testModule.addExports("test", transletModule); Class c = layer.findLoader(MODULE_NAME).loadClass("translet.Main"); diff --git a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java index 45e592f9d62..ddc4bdc4792 100644 --- a/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java +++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/MainGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,7 @@ package test; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; @@ -44,7 +42,7 @@ public class MainGC { public static void main(String[] args) throws Exception { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Layer layerBoot = Layer.boot(); + ModuleLayer layerBoot = ModuleLayer.boot(); Configuration cf = layerBoot .configuration() @@ -59,7 +57,7 @@ public class MainGC { Callable task = new Callable() { @Override public Void call() throws Exception { - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); Module transletModule = layer.findModule(MODULE_NAME).get(); testModule.addExports("test", transletModule); testModule.addReads(transletModule); diff --git a/hotspot/test/runtime/modules/getModuleJNI/GetModule.java b/hotspot/test/runtime/modules/getModuleJNI/GetModule.java index 01d00648cd9..182632ac9e2 100644 --- a/hotspot/test/runtime/modules/getModuleJNI/GetModule.java +++ b/hotspot/test/runtime/modules/getModuleJNI/GetModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ * @run main/native GetModule */ -import java.lang.reflect.Module; import java.lang.management.LockInfo; public class GetModule { diff --git a/hotspot/test/runtime/modules/java.base/java/lang/reflect/ModuleHelper.java b/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java similarity index 86% rename from hotspot/test/runtime/modules/java.base/java/lang/reflect/ModuleHelper.java rename to hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java index 19bbff48a76..6aef814acf2 100644 --- a/hotspot/test/runtime/modules/java.base/java/lang/reflect/ModuleHelper.java +++ b/hotspot/test/runtime/modules/java.base/java/lang/ModuleHelper.java @@ -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 @@ -21,14 +21,14 @@ * questions. */ -package java.lang.reflect; +package java.lang; import java.lang.module.ModuleDescriptor; /** - * A helper class intended to be injected into java.lang.reflect using the + * A helper class intended to be injected into java.lang using the * java --patch-module option. The helper class provides access to package private - * methods in java.lang.reflect.Module. + * methods in java.lang.Module. */ public final class ModuleHelper { @@ -56,7 +56,11 @@ public final class ModuleHelper { * {@code null} then the package is exported unconditionally. */ public static void addExportsNoSync(Module from, String pkg, Module to) { - from.implAddExportsNoSync(pkg, to); + if (to == null) { + from.implAddExportsNoSync(pkg); + } else { + from.implAddExportsNoSync(pkg, to); + } } /** diff --git a/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java b/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java index 1b686ec9ae4..5c919f40c49 100644 --- a/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java +++ b/hotspot/test/serviceability/jdwp/AllModulesCommandTestDebuggee.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,6 @@ * questions. */ -import java.lang.reflect.Module; -import java.lang.reflect.Layer; import java.util.Set; import java.util.HashSet; @@ -35,10 +33,10 @@ public class AllModulesCommandTestDebuggee { public static void main(String[] args) throws InterruptedException { - int modCount = Layer.boot().modules().size(); + int modCount = ModuleLayer.boot().modules().size(); // Send all modules names via the process output - for (Module mod : Layer.boot().modules()) { + for (Module mod : ModuleLayer.boot().modules()) { String info = String.format("module %s", mod.getName()); write(info); } diff --git a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java index 04446a6c87d..94da0f081d4 100644 --- a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java +++ b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/MyPackage/AddModuleExportsAndOpensTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ package MyPackage; */ import java.io.PrintStream; -import java.lang.reflect.Module; public class AddModuleExportsAndOpensTest { diff --git a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c index e028ee50c9c..b5ccf258659 100644 --- a/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c +++ b/hotspot/test/serviceability/jvmti/AddModuleExportsAndOpens/libAddModuleExportsAndOpensTest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ extern "C" { #define FAILED 2 static const char *EXC_CNAME = "java/lang/Exception"; -static const char* MOD_CNAME = "Ljava/lang/reflect/Module;"; +static const char* MOD_CNAME = "Ljava/lang/Module;"; static jvmtiEnv *jvmti = NULL; static jint result = PASSED; @@ -97,7 +97,7 @@ void throw_exc(JNIEnv *env, char *msg) { } static -jclass jlrM(JNIEnv *env) { +jclass jlM(JNIEnv *env) { jclass cls = NULL; cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME)); @@ -127,7 +127,7 @@ jboolean is_exported(JNIEnv *env, jobject module, const char* pkg, jboolean open if (mIsExported == NULL) { const char* sign = "(Ljava/lang/String;)Z"; const char* name = open ? "isOpen" : "isExported"; - mIsExported = get_method(env, jlrM(env), name, sign); + mIsExported = get_method(env, jlM(env), name, sign); } jstr = JNI_ENV_PTR(env)->NewStringUTF(JNI_ENV_ARG(env, pkg)); res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module), @@ -143,9 +143,9 @@ jboolean is_exported_to(JNIEnv *env, jobject module, const char* pkg, jobject to jboolean res = JNI_FALSE; if (mIsExportedTo == NULL) { - const char* sign = "(Ljava/lang/String;Ljava/lang/reflect/Module;)Z"; + const char* sign = "(Ljava/lang/String;Ljava/lang/Module;)Z"; const char* name = open ? "isOpen" : "isExported"; - mIsExportedTo = get_method(env, jlrM(env), name, sign); + mIsExportedTo = get_method(env, jlM(env), name, sign); } jstr = JNI_ENV_PTR(env)->NewStringUTF(JNI_ENV_ARG(env, pkg)); res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module), diff --git a/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java b/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java index 940172af807..a3915f72920 100644 --- a/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java +++ b/hotspot/test/serviceability/jvmti/AddModuleReads/MyPackage/AddModuleReadsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ package MyPackage; import java.io.PrintStream; import java.lang.instrument.Instrumentation; -import java.lang.reflect.Module; public class AddModuleReadsTest { diff --git a/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c b/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c index 4863a4aa5c9..be259ff4821 100644 --- a/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c +++ b/hotspot/test/serviceability/jvmti/AddModuleReads/libAddModuleReadsTest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ extern "C" { #define FAILED 2 static const char *EXC_CNAME = "java/lang/Exception"; -static const char* MOD_CNAME = "Ljava/lang/reflect/Module;"; +static const char* MOD_CNAME = "Ljava/lang/Module;"; static jvmtiEnv *jvmti = NULL; static jint result = PASSED; @@ -96,7 +96,7 @@ void throw_exc(JNIEnv *env, char *msg) { } static -jclass jlrM(JNIEnv *env) { +jclass jlM(JNIEnv *env) { jclass cls = NULL; cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME)); @@ -123,8 +123,8 @@ jboolean can_module_read(JNIEnv *env, jobject module, jobject to_module) { jboolean res = JNI_FALSE; if (mCanRead == NULL) { - const char* sign = "(Ljava/lang/reflect/Module;)Z"; - mCanRead = get_method(env, jlrM(env), "canRead", sign); + const char* sign = "(Ljava/lang/Module;)Z"; + mCanRead = get_method(env, jlM(env), "canRead", sign); } res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module), mCanRead, to_module); diff --git a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java index e6d9d57c01d..634b2eaf57c 100644 --- a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java +++ b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/MyPackage/AddModuleUsesAndProvidesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,6 @@ package MyPackage; import java.io.PrintStream; import java.lang.TestProvider; -import java.lang.reflect.Module; public class AddModuleUsesAndProvidesTest { diff --git a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c index 5ce1bf46d4f..86f9993c703 100644 --- a/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c +++ b/hotspot/test/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ extern "C" { #define FAILED 2 static const char *EXC_CNAME = "java/lang/Exception"; -static const char* MOD_CNAME = "Ljava/lang/reflect/Module;"; +static const char* MOD_CNAME = "Ljava/lang/Module;"; static jvmtiEnv *jvmti = NULL; static jint result = PASSED; @@ -97,7 +97,7 @@ void throw_exc(JNIEnv *env, char *msg) { } static -jclass jlrM(JNIEnv *env) { +jclass jlM(JNIEnv *env) { jclass cls = NULL; cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME)); @@ -125,7 +125,7 @@ jboolean can_use_service(JNIEnv *env, jobject module, jclass service) { if (mCanUse == NULL) { const char* sign = "(Ljava/lang/Class;)Z"; - mCanUse = get_method(env, jlrM(env), "canUse", sign); + mCanUse = get_method(env, jlM(env), "canUse", sign); } res = JNI_ENV_PTR(env)->CallBooleanMethod(JNI_ENV_ARG(env, module), mCanUse, service); diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java index dd0105a135f..4b700ef0b09 100644 --- a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java +++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,6 @@ * @run main/othervm -agentlib:JvmtiGetAllModulesTest JvmtiGetAllModulesTest * */ -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.lang.module.ModuleReference; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReader; @@ -79,15 +77,15 @@ public class JvmtiGetAllModulesTest { final String MY_MODULE_NAME = "myModule"; // Verify that JVMTI reports exactly the same info as Java regarding the named modules - Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI()); + Asserts.assertEquals(ModuleLayer.boot().modules(), getModulesJVMTI()); // Load a new named module ModuleDescriptor descriptor = ModuleDescriptor.newModule(MY_MODULE_NAME).build(); ModuleFinder finder = finderOf(descriptor); ClassLoader loader = new ClassLoader() {}; - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME)); - Layer my = Layer.boot().defineModules(cf, m -> loader); + ModuleLayer my = ModuleLayer.boot().defineModules(cf, m -> loader); // Verify that the loaded module is indeed reported by JVMTI Set jvmtiModules = getModulesJVMTI(); diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c index ed83d19784c..fcabaa4bfb9 100644 --- a/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c +++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/libJvmtiGetAllModulesTest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ extern "C" { return NULL; } - array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/reflect/Module"), NULL); + array = (*env)->NewObjectArray(env, modules_count, (*env)->FindClass(env, "java/lang/Module"), NULL); for (i = 0; i < modules_count; ++i) { (*env)->SetObjectArrayElement(env, array, i, modules_ptr[i]); diff --git a/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c b/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c index 087f840216f..307fab0f2b0 100644 --- a/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c +++ b/hotspot/test/serviceability/jvmti/GetNamedModule/libGetNamedModuleTest.c @@ -47,7 +47,7 @@ extern "C" { #define FAILED 2 static const char *EXC_CNAME = "java/lang/Exception"; -static const char* MOD_CNAME = "Ljava/lang/reflect/Module;"; +static const char* MOD_CNAME = "Ljava/lang/Module;"; static jvmtiEnv *jvmti = NULL; static jint result = PASSED; @@ -115,7 +115,7 @@ jobject get_class_loader(jclass cls) { } static -jclass jlrM(JNIEnv *env) { +jclass jlM(JNIEnv *env) { jclass cls = NULL; cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, MOD_CNAME)); @@ -142,7 +142,7 @@ jobject get_module_loader(JNIEnv *env, jobject module) { jobject loader = NULL; if (cl_method == NULL) { - cl_method = get_method(env, jlrM(env), "getClassLoader", "()Ljava/lang/ClassLoader;"); + cl_method = get_method(env, jlM(env), "getClassLoader", "()Ljava/lang/ClassLoader;"); } loader = (jobject)JNI_ENV_PTR(env)->CallObjectMethod(JNI_ENV_ARG(env, module), cl_method); return loader; @@ -157,7 +157,7 @@ const char* get_module_name(JNIEnv *env, jobject module) { const char *nstr = NULL; if (method == NULL) { - method = get_method(env, jlrM(env), "getName", "()Ljava/lang/String;"); + method = get_method(env, jlM(env), "getName", "()Ljava/lang/String;"); } jstr = (jstring)JNI_ENV_PTR(env)->CallObjectMethod(JNI_ENV_ARG(env, module), method); if (jstr != NULL) { From 57509f3cd55efda52cd9f8cc027f4d9ab2ce6890 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:05:40 +0000 Subject: [PATCH 32/75] 8177530: Module system implementation refresh (4/2017) Reviewed-by: mchung --- .../internal/xsltc/compiler/Constants.java | 4 +-- .../internal/xsltc/trax/TemplatesImpl.java | 8 ++--- jaxp/test/TEST.ROOT | 2 +- .../DefaultFactoryWrapperTest.java | 4 +-- .../LayerModularXMLParserTest.java | 32 +++++++++---------- .../ServiceProviderTest/src/unnamed/Main.java | 6 ++-- 6 files changed, 24 insertions(+), 32 deletions(-) diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java index def384b8c48..22bc7616a2c 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/Constants.java @@ -99,7 +99,7 @@ public interface Constants extends InstructionConstants { = com.sun.org.apache.bcel.internal.Constants.ACC_STATIC; public static final String MODULE_SIG - = "Ljava/lang/reflect/Module;"; + = "Ljava/lang/Module;"; public static final String CLASS_SIG = "Ljava/lang/Class;"; public static final String STRING_SIG @@ -255,7 +255,7 @@ public interface Constants extends InstructionConstants { public static final String CLASS_CLASS = "java.lang.Class"; public static final String MODULE_CLASS - = "java.lang.reflect.Module"; + = "java.lang.Module"; public static final String STRING_CLASS = "java.lang.String"; public static final String OBJECT_CLASS diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java index 0724ce8da16..bdbdca9137e 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java @@ -43,8 +43,6 @@ import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; import java.lang.module.ModuleReader; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.CodeSigner; import java.security.CodeSource; @@ -435,13 +433,13 @@ public final class TemplatesImpl implements Templates, Serializable { } }; - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer.configuration() .resolve(finder, ModuleFinder.of(), Set.of(mn)); - PrivilegedAction pa = () -> bootLayer.defineModules(cf, name -> loader); - Layer layer = AccessController.doPrivileged(pa); + PrivilegedAction pa = () -> bootLayer.defineModules(cf, name -> loader); + ModuleLayer layer = AccessController.doPrivileged(pa); Module m = layer.findModule(mn).get(); assert m.getLayer() == layer; diff --git a/jaxp/test/TEST.ROOT b/jaxp/test/TEST.ROOT index 5f7295efea1..d0b691366eb 100644 --- a/jaxp/test/TEST.ROOT +++ b/jaxp/test/TEST.ROOT @@ -23,7 +23,7 @@ modules=java.xml groups=TEST.groups # Minimum jtreg version -requiredVersion=4.2 b04 +requiredVersion=4.2 b07 # Use new module options useNewOptions=true diff --git a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java index 0e16d9b5db3..18e4e76cee8 100644 --- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java +++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/DefaultFactoryWrapperTest.java @@ -27,8 +27,6 @@ import static org.testng.Assert.assertSame; import java.io.StringReader; import java.io.StringWriter; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import javax.xml.datatype.DatatypeFactory; import javax.xml.parsers.DocumentBuilderFactory; @@ -52,7 +50,7 @@ import org.testng.annotations.Test; * @summary test customized provider wraps the built-in system-default implementation of JAXP factories */ public class DefaultFactoryWrapperTest { - private static final Module XML_MODULE = Layer.boot().findModule("java.xml").get(); + private static final Module XML_MODULE = ModuleLayer.boot().findModule("java.xml").get(); private static final String PROVIDER_PACKAGE = "xwp"; diff --git a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java index fcfba1955ae..306b9ee973a 100644 --- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java +++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/LayerModularXMLParserTest.java @@ -29,9 +29,7 @@ import java.lang.String; import java.lang.System; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.nio.file.Paths; import java.nio.file.Path; import java.util.Collections; @@ -95,23 +93,23 @@ public class LayerModularXMLParserTest { */ public void testOneLayer() throws Exception { ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1); - Configuration cf1 = Layer.boot().configuration() + Configuration cf1 = ModuleLayer.boot().configuration() .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test")); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl); ClassLoader cl1 = layer1.findLoader("test"); Method m = cl1.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class); for (String service : services1) { Object o = m.invoke(null, service); - Layer providerLayer = o.getClass().getModule().getLayer(); + ModuleLayer providerLayer = o.getClass().getModule().getLayer(); assertSame(providerLayer, layer1); } for (String service : services2) { Object o = m.invoke(null, service); - Layer providerLayer = o.getClass().getModule().getLayer(); - assertSame(providerLayer, Layer.boot()); + ModuleLayer providerLayer = o.getClass().getModule().getLayer(); + assertSame(providerLayer, ModuleLayer.boot()); } } @@ -125,26 +123,26 @@ public class LayerModularXMLParserTest { */ public void testTwoLayer() throws Exception { ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1); - Configuration cf1 = Layer.boot().configuration() + Configuration cf1 = ModuleLayer.boot().configuration() .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test")); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl); ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2); Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test")); - Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test")); + ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test")); ClassLoader cl2 = layer2.findLoader("test"); Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class); for (String service : services1) { Object o = m.invoke(null, service); - Layer providerLayer = o.getClass().getModule().getLayer(); + ModuleLayer providerLayer = o.getClass().getModule().getLayer(); assertSame(providerLayer, layer1); } for (String service : services2) { Object o = m.invoke(null, service); - Layer providerLayer = o.getClass().getModule().getLayer(); + ModuleLayer providerLayer = o.getClass().getModule().getLayer(); assertSame(providerLayer, layer2); } @@ -159,26 +157,26 @@ public class LayerModularXMLParserTest { */ public void testTwoLayerWithDuplicate() throws Exception { ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1, MOD_DIR2); - Configuration cf1 = Layer.boot().configuration() + Configuration cf1 = ModuleLayer.boot().configuration() .resolveAndBind(finder1, ModuleFinder.of(), Set.of("test")); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, scl); ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2); Configuration cf2 = cf1.resolveAndBind(finder2, ModuleFinder.of(), Set.of("test")); - Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test")); + ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test")); ClassLoader cl2 = layer2.findLoader("test"); Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class); for (String service : services1) { Object o = m.invoke(null, service); - Layer providerLayer = o.getClass().getModule().getLayer(); + ModuleLayer providerLayer = o.getClass().getModule().getLayer(); assertSame(providerLayer, layer1); } for (String service : services2) { Object o = m.invoke(null, service); - Layer providerLayer = o.getClass().getModule().getLayer(); + ModuleLayer providerLayer = o.getClass().getModule().getLayer(); assertSame(providerLayer, layer2); } diff --git a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java index 35d210369b2..971b5f350bf 100644 --- a/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java +++ b/jaxp/test/javax/xml/jaxp/module/ServiceProviderTest/src/unnamed/Main.java @@ -24,8 +24,6 @@ import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; import java.lang.module.ModuleDescriptor.Provides; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -38,7 +36,7 @@ public class Main { * @param args, the names of provider modules, which have been loaded */ public static void main(String[] args) throws Exception { - Module xml = Layer.boot().findModule("java.xml").get(); + Module xml = ModuleLayer.boot().findModule("java.xml").get(); Set allServices = new HashSet<>(Arrays.asList(expectedAllServices)); if (!allServices.equals(xml.getDescriptor().uses())) @@ -46,7 +44,7 @@ public class Main { + xml.getDescriptor().uses()); long violationCount = Stream.of(args) - .map(xmlProviderName -> Layer.boot().findModule(xmlProviderName).get()) + .map(xmlProviderName -> ModuleLayer.boot().findModule(xmlProviderName).get()) .mapToLong( // services provided by the implementation in provider module provider -> provider.getDescriptor().provides().stream() From 574b2208ec2291d696844ae162829b1312d48881 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:05:45 +0000 Subject: [PATCH 33/75] 8177530: Module system implementation refresh (4/2017) Reviewed-by: mchung --- .../ws/addressing/EPRSDDocumentFilter.java | 1 + .../ws/api/server/SDDocumentSource.java | 10 ++++------ .../ws/util/HandlerAnnotationProcessor.java | 18 ++++++++---------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java index e1f39b91ea9..6321da30dcb 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/addressing/EPRSDDocumentFilter.java @@ -26,6 +26,7 @@ package com.sun.xml.internal.ws.addressing; import com.sun.xml.internal.ws.api.server.*; +import com.sun.xml.internal.ws.api.server.Module; import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; import com.sun.xml.internal.ws.api.addressing.AddressingVersion; import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory; diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java index 59a18fe7992..3ba900a13da 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java @@ -155,12 +155,10 @@ public abstract class SDDocumentSource { } private InputStream inputStream() throws IOException { - java.lang.reflect.Module module = resolvingClass.getModule(); - if (module != null) { - InputStream stream = module.getResourceAsStream(path); - if (stream != null) { - return stream; - } + java.lang.Module module = resolvingClass.getModule(); + InputStream stream = module.getResourceAsStream(path); + if (stream != null) { + return stream; } throw new ServerRtException("cannot.load.wsdl", path); } diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java index 42385239f3f..53d37f3dee8 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/HandlerAnnotationProcessor.java @@ -234,17 +234,15 @@ public class HandlerAnnotationProcessor { } private static InputStream moduleResource(Class resolvingClass, String name) { - java.lang.reflect.Module module = resolvingClass.getModule(); - if (module != null) { - try { - InputStream stream = module.getResourceAsStream(name); - if (stream != null) { - return stream; - } - } catch(IOException e) { - throw new UtilException("util.failed.to.find.handlerchain.file", - resolvingClass.getName(), name); + Module module = resolvingClass.getModule(); + try { + InputStream stream = module.getResourceAsStream(name); + if (stream != null) { + return stream; } + } catch(IOException e) { + throw new UtilException("util.failed.to.find.handlerchain.file", + resolvingClass.getName(), name); } return null; } From 02cfdc2061d5a0b43431fd4b32159ec034d87916 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:05:54 +0000 Subject: [PATCH 34/75] 8177530: Module system implementation refresh (4/2017) Co-authored-by: Mandy Chung Reviewed-by: mchung, alanb --- jdk/make/mapfiles/libjava/mapfile-vers | 12 +- .../classes/java/io/ObjectInputFilter.java | 2 +- .../share/classes/java/lang/Class.java | 72 +++-- .../share/classes/java/lang/ClassLoader.java | 5 +- .../LayerInstantiationException.java | 9 +- .../java/lang/{reflect => }/Module.java | 261 +++++++++--------- .../{reflect/Layer.java => ModuleLayer.java} | 155 +++++------ .../share/classes/java/lang/NamedPackage.java | 1 - .../share/classes/java/lang/Package.java | 1 - .../classes/java/lang/SecurityManager.java | 4 +- .../classes/java/lang/StackTraceElement.java | 8 +- .../share/classes/java/lang/System.java | 83 ++++-- .../java/lang/{reflect => }/WeakPairMap.java | 2 +- .../classes/java/lang/invoke/MemberName.java | 1 - .../java/lang/invoke/MethodHandles.java | 5 +- .../java/lang/module/Configuration.java | 12 +- .../java/lang/module/ModuleDescriptor.java | 10 +- .../java/lang/module/ModuleFinder.java | 34 +-- .../classes/java/lang/module/Resolver.java | 47 +++- .../java/lang/module/package-info.java | 10 +- .../classes/java/lang/reflect/Proxy.java | 8 +- .../java/lang/reflect/package-info.java | 11 +- .../classes/java/util/ResourceBundle.java | 1 - .../classes/java/util/ServiceLoader.java | 72 +++-- .../spi/AbstractResourceBundleProvider.java | 1 - .../javax/crypto/JceSecurityManager.java | 1 - .../jdk/internal/loader/BootLoader.java | 7 +- .../jdk/internal/loader/ClassLoaders.java | 1 - .../classes/jdk/internal/loader/Loader.java | 17 +- .../jdk/internal/loader/LoaderPool.java | 5 +- .../internal/logger/DefaultLoggerFinder.java | 1 - .../jdk/internal/logger/LazyLoggers.java | 5 +- .../jdk/internal/misc/JavaLangAccess.java | 82 +++++- .../misc/JavaLangReflectModuleAccess.java | 121 -------- .../misc/JavaUtilResourceBundleAccess.java | 1 - .../jdk/internal/misc/SharedSecrets.java | 11 - .../internal/module/IllegalAccessLogger.java | 1 - .../jdk/internal/module/ModuleBootstrap.java | 21 +- .../jdk/internal/module/ModulePatcher.java | 20 +- .../jdk/internal/module/ModulePath.java | 17 +- .../classes/jdk/internal/module/Modules.java | 49 +--- .../jdk/internal/module/ServicesCatalog.java | 1 - .../classes/sun/invoke/util/VerifyAccess.java | 1 - .../classes/sun/launcher/LauncherHelper.java | 157 ++++++----- .../classes/sun/reflect/misc/MethodUtil.java | 1 - .../java.base/share/native/libjava/Module.c | 22 +- .../javax/imageio/metadata/IIOMetadata.java | 1 - .../imageio/spi/ImageReaderWriterSpi.java | 1 - .../classes/javax/swing/text/PlainView.java | 1 - .../lang/instrument/ClassFileTransformer.java | 1 - .../java/lang/instrument/Instrumentation.java | 21 +- .../UnmodifiableModuleException.java | 56 ++++ .../sun/instrument/InstrumentationImpl.java | 15 +- .../sun/instrument/TransformerManager.java | 2 - .../share/native/libinstrument/JPLISAgent.h | 2 +- .../classes/java/util/logging/Level.java | 2 +- .../classes/java/util/logging/LogManager.java | 2 - .../classes/java/util/logging/Logger.java | 2 - .../logging/internal/LoggingProviderImpl.java | 1 - .../management/remote/rmi/RMIConnector.java | 1 - .../remote/JMXConnectorFactory.java | 1 - .../management/ManagementFactoryHelper.java | 4 +- .../sun/naming/internal/VersionHelper.java | 2 +- .../activation/ActivationInstantiator.java | 4 +- .../java/rmi/server/UnicastRemoteObject.java | 4 +- .../sun/security/pkcs11/P11KeyStore.java | 2 +- .../sun/security/pkcs11/SunPKCS11.java | 8 +- .../tools/common/ProcessArgumentMatcher.java | 1 - .../native/libjdwp/ModuleReferenceImpl.c | 8 +- .../jdk/tools/jlink/internal/Jlink.java | 7 +- .../jlink/internal/PluginRepository.java | 11 +- .../jdk/tools/jlink/internal/TaskHelper.java | 11 +- .../jdk/tools/jlink/internal/Utils.java | 1 - .../internal/plugins/ReleaseInfoPlugin.java | 35 ++- jdk/test/TEST.ROOT | 4 +- .../awt/TrayIcon/SystemTrayIconHelper.java | 4 +- .../java.desktop/java/awt/Helper.java | 1 - jdk/test/java/awt/regtesthelpers/Util.java | 2 +- jdk/test/java/lang/Class/GetModuleTest.java | 1 - .../lang/Class/forName/modules/TestLayer.java | 6 +- .../lang/Class/forName/modules/TestMain.java | 4 +- .../forName/modules/src/m2/p2/test/Main.java | 5 +- .../forName/modules/src/m3/p3/NoAccess.java | 6 +- .../src/m3/p3/NoGetClassLoaderAccess.java | 4 +- .../FieldSetAccessibleTest.java | 4 +- .../java/lang/Class/getResource/Main.java | 3 +- .../getResource/automaticmodules/Main.java | 3 +- .../ClassLoader/getResource/modules/Main.java | 3 +- .../Layer => ModuleLayer}/BasicLayerTest.java | 192 +++++++------ .../LayerAndLoadersTest.java | 81 +++--- .../LayerControllerTest.java | 28 +- .../Layer => ModuleLayer}/layertest/Test.java | 2 +- .../src/m1/module-info.java | 0 .../Layer => ModuleLayer}/src/m1/p/Main.java | 0 .../src/m1/p/Service.java | 0 .../src/m2/module-info.java | 0 .../Layer => ModuleLayer}/src/m2/q/Hello.java | 0 .../src/m3/module-info.java | 0 .../Layer => ModuleLayer}/src/m3/w/Hello.java | 0 .../src/m4/impl/ServiceImpl.java | 0 .../src/m4/module-info.java | 0 .../AddExportsTest.java | 4 +- .../AnnotationsTest.java | 8 +- .../BasicModuleTest.java | 27 +- .../WithSecurityManager.java | 12 +- .../access/AccessTest.java | 0 .../access/src/target/module-info.java | 0 .../access/src/target/p1/Helper.java | 2 - .../access/src/target/p1/Public.java | 0 .../access/src/target/p2/NonPublic.java | 0 .../access/src/target/q1/Public.java | 0 .../access/src/target/q2/NonPublic.java | 0 .../access/src/test/module-info.java | 0 .../access/src/test/test/Main.java | 4 +- .../Module => ModuleTests}/addXXX/Driver.java | 0 .../addXXX/m1/module-info.java | 0 .../addXXX/m1/p1/C.java | 0 .../addXXX/m2/module-info.java | 0 .../addXXX/m2/p2/C.java | 2 - .../addXXX/m2/p2/internal/C.java | 0 .../addXXX/m3/module-info.java | 0 .../addXXX/m3/p3/C.java | 0 .../addXXX/m4/module-info.java | 0 .../addXXX/m4/p4/C.java | 0 .../addXXX/test/module-info.java | 0 .../addXXX/test/test/C.java | 0 .../addXXX/test/test/Main.java | 1 - .../addXXX/test/test/Service.java | 0 .../Module => ModuleTests}/allow.policy | 0 .../annotation/Basic.java | 1 - .../annotation/src/m/module-info.java | 0 .../annotation/src/m/p/annotation/Bar.java | 0 .../annotation/src/m/p/annotation/Baz.java | 0 .../annotation/src/m/p/annotation/Foo.java | 0 .../SecurityManager/CheckPackageAccess.java | 3 +- .../CheckSecurityProvider.java | 3 +- .../lang/SecurityManager/modules/Test.java | 2 - .../StackTraceElement/PublicConstructor.java | 1 - .../lib/m1/com/app/Utils.java | 1 - .../Logger/custom/CustomLoggerTest.java | 1 - .../BaseLoggerFinder.java | 1 - .../TestLoggerFinder.java | 1 - .../LoggerFinderAPI/LoggerFinderAPI.java | 1 - .../BaseDefaultLoggerFinderTest.java | 1 - .../BaseLoggerBridgeTest.java | 1 - .../BasePlatformLoggerTest.java | 1 - .../BootstrapLoggerAPIsTest.java | 1 - .../BootstrapLogger/BootstrapLoggerTest.java | 1 - .../LoggerBridgeTest/LoggerBridgeTest.java | 1 - .../LoggerFinderLoaderTest.java | 1 - .../PlatformLoggerBridgeTest.java | 1 - .../SystemLoggerInPlatformLoader.java | 3 +- .../backend/LoggerFinderBackendTest.java | 1 - .../DefaultLoggerBridgeTest.java | 1 - .../{reflect => }/WeakPairMap/Driver.java | 4 +- .../java.base/java/lang}/WeakPairMapTest.java | 2 +- .../ATransformerManagementTestCase.java | 2 - .../instrument/BootstrapClassPathAgent.java | 1 - .../instrument/BootstrapClassPathTest.java | 1 - .../RedefineClassWithNativeMethodAgent.java | 1 - .../lang/instrument/RedefineModuleAgent.java | 7 +- .../lang/instrument/RedefineModuleTest.java | 29 +- .../lang/instrument/RetransformAgent.java | 1 - .../instrument/SimpleIdentityTransformer.java | 1 - .../test/p/PrivateLookupInTests.java | 1 - .../java/lang/invoke/modules/m1/p1/Main.java | 6 +- .../lang/module/AutomaticModulesTest.java | 255 ++++++++++++++--- .../java/lang/module/ConfigurationTest.java | 15 +- .../lang/module/ModuleDescriptorTest.java | 1 - .../java/lang/module/ModuleFinderTest.java | 24 ++ .../module/ModuleReader/ModuleReaderTest.java | 1 - .../ModuleSetAccessibleTest.java | 1 - .../reflect/Proxy/ProxyClassAccessTest.java | 5 +- .../reflect/Proxy/ProxyForMethodHandle.java | 1 - .../lang/reflect/Proxy/ProxyLayerTest.java | 15 +- .../reflect/Proxy/ProxyModuleMapping.java | 1 - .../reflect/Proxy/src/test/jdk/test/Main.java | 1 - .../Proxy/src/test/jdk/test/ProxyTest.java | 1 - .../Provider/DefaultProviderList.java | 1 - .../modules/cache/src/test/jdk/test/Main.java | 3 +- .../security/src/test/jdk/test/Main.java | 1 - .../jdk/embargo/TestWithNoModuleArg.java | 1 - .../jdk/embargo/TestWithUnnamedModuleArg.java | 1 - .../visibility/src/pkg/jdk/pkg/test/Main.java | 1 - .../test/jdk/test/TestWithNoModuleArg.java | 1 - .../jdk/test/TestWithUnnamedModuleArg.java | 1 - .../modules/BadProvidersTest.java | 5 +- .../util/ServiceLoader/modules/Basic.java | 26 +- .../java/util/logging/LocalizedLevelName.java | 1 - .../pkgs/p3/test/ResourceBundleTest.java | 1 - .../test/jdk/test/ResourceBundleDelegate.java | 1 - .../CheckEncodingPropertiesFile.java | 1 - .../jdk/internal/jimage/JImageOpenTest.java | 3 +- .../modules/etc/JdkQualifiedExportTest.java | 1 - .../modules/etc/VerifyModuleDelegation.java | 6 +- .../jdk/modules/incubator/DefaultImage.java | 41 ++- .../jdk/modules/incubator/ImageModules.java | 11 +- .../src/cp/listmods/ListModules.java | 4 +- .../src/cp/test/ConvertToLowerCase.java | 4 +- .../incubator/src/cp/test/WriteUpperCase.java | 4 +- jdk/test/jdk/modules/open/Basic.java | 1 - .../src/basictest/test/Main.java | 7 +- .../src/sptest/test/Main.java | 6 +- .../src/container/container/Main.java | 10 +- .../test/loggerfinder/TestLoggerFinder.java | 1 - .../sun/tools/jconsole/ResourceCheckTest.java | 1 - jdk/test/tools/jar/modularJar/Basic.java | 2 +- .../modularJar/src/bar/jdk/test/bar/Bar.java | 1 - jdk/test/tools/jlink/JLink2Test.java | 3 +- jdk/test/tools/jlink/JLinkTest.java | 3 +- .../jlink/basic/src/test/jdk/test/Test.java | 5 +- .../jlink/plugins/PluginsNegativeTest.java | 7 +- .../UserModuleTest.java | 1 - .../src/m1/p1/Main.java | 2 - .../src/m3/p3/Main.java | 1 - .../src/m4/p4/Main.java | 3 +- .../src/m5/p5/Main.java | 3 +- .../src/test/jdk/test/Main.java | 4 +- .../launcher/modules/dryrun/DryRunTest.java | 16 -- .../modules/listmods/ListModsTest.java | 2 +- .../patch/basic/src/test/jdk/test/Main.java | 2 - .../src/test/jdk/test/Main.java | 3 +- 222 files changed, 1364 insertions(+), 1233 deletions(-) rename jdk/src/java.base/share/classes/java/lang/{reflect => }/LayerInstantiationException.java (93%) rename jdk/src/java.base/share/classes/java/lang/{reflect => }/Module.java (89%) rename jdk/src/java.base/share/classes/java/lang/{reflect/Layer.java => ModuleLayer.java} (88%) rename jdk/src/java.base/share/classes/java/lang/{reflect => }/WeakPairMap.java (99%) delete mode 100644 jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java create mode 100644 jdk/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/BasicLayerTest.java (85%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/LayerAndLoadersTest.java (88%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/LayerControllerTest.java (88%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/layertest/Test.java (95%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m1/module-info.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m1/p/Main.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m1/p/Service.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m2/module-info.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m2/q/Hello.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m3/module-info.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m3/w/Hello.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m4/impl/ServiceImpl.java (100%) rename jdk/test/java/lang/{reflect/Layer => ModuleLayer}/src/m4/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/AddExportsTest.java (97%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/AnnotationsTest.java (95%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/BasicModuleTest.java (93%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/WithSecurityManager.java (92%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/AccessTest.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/p1/Helper.java (97%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/p1/Public.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/p2/NonPublic.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/q1/Public.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/target/q2/NonPublic.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/test/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/access/src/test/test/Main.java (99%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/Driver.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m1/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m1/p1/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m2/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m2/p2/C.java (97%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m2/p2/internal/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m3/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m3/p3/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m4/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/m4/p4/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/test/C.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/test/Main.java (99%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/addXXX/test/test/Service.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/allow.policy (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/Basic.java (98%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/module-info.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/p/annotation/Bar.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/p/annotation/Baz.java (100%) rename jdk/test/java/lang/{reflect/Module => ModuleTests}/annotation/src/m/p/annotation/Foo.java (100%) rename jdk/test/java/lang/{reflect => }/WeakPairMap/Driver.java (91%) rename jdk/test/java/lang/{reflect/WeakPairMap/java.base/java/lang/reflect => WeakPairMap/java.base/java/lang}/WeakPairMapTest.java (99%) diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers index b7773925154..31395f7ee23 100644 --- a/jdk/make/mapfiles/libjava/mapfile-vers +++ b/jdk/make/mapfiles/libjava/mapfile-vers @@ -273,12 +273,12 @@ SUNWprivate_1.1 { Java_jdk_internal_misc_VM_getRuntimeArguments; Java_jdk_internal_misc_VM_initialize; - Java_java_lang_reflect_Module_defineModule0; - Java_java_lang_reflect_Module_addReads0; - Java_java_lang_reflect_Module_addExports0; - Java_java_lang_reflect_Module_addExportsToAll0; - Java_java_lang_reflect_Module_addExportsToAllUnnamed0; - Java_java_lang_reflect_Module_addPackage0; + Java_java_lang_Module_defineModule0; + Java_java_lang_Module_addReads0; + Java_java_lang_Module_addExports0; + Java_java_lang_Module_addExportsToAll0; + Java_java_lang_Module_addExportsToAllUnnamed0; + Java_java_lang_Module_addPackage0; Java_jdk_internal_loader_BootLoader_getSystemPackageLocation; Java_jdk_internal_loader_BootLoader_getSystemPackageNames; diff --git a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java index f9bbf1178ec..534e1b2b8de 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectInputFilter.java @@ -322,7 +322,7 @@ public interface ObjectInputFilter { * Other patterns match or reject class or package name * as returned from {@link Class#getName() Class.getName()} and * if an optional module name is present - * {@link java.lang.reflect.Module#getName() class.getModule().getName()}. + * {@link Module#getName() class.getModule().getName()}. * Note that for arrays the element type is used in the pattern, * not the array type. *

          diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index 14026931c97..733c76a2a2c 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -43,7 +43,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.lang.reflect.Proxy; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; @@ -2561,21 +2560,16 @@ public final class Class implements java.io.Serializable, public InputStream getResourceAsStream(String name) { name = resolveName(name); - Module module = getModule(); - if (module.isNamed()) { - if (Resources.canEncapsulate(name)) { - Module caller = Reflection.getCallerClass().getModule(); - if (caller != module) { - Set packages = module.getDescriptor().packages(); - String pn = Resources.toPackageName(name); - if (packages.contains(pn) && !module.isOpen(pn, caller)) { - // resource is in package not open to caller - return null; - } - } + Module thisModule = getModule(); + if (thisModule.isNamed()) { + // check if resource can be located by caller + if (Resources.canEncapsulate(name) + && !isOpenToCaller(name, Reflection.getCallerClass())) { + return null; } - String mn = module.getName(); + // resource not encapsulated or in package open to caller + String mn = thisModule.getName(); ClassLoader cl = getClassLoader0(); try { @@ -2663,20 +2657,16 @@ public final class Class implements java.io.Serializable, public URL getResource(String name) { name = resolveName(name); - Module module = getModule(); - if (module.isNamed()) { - if (Resources.canEncapsulate(name)) { - Module caller = Reflection.getCallerClass().getModule(); - if (caller != module) { - Set packages = module.getDescriptor().packages(); - String pn = Resources.toPackageName(name); - if (packages.contains(pn) && !module.isOpen(pn, caller)) { - // resource is in package not open to caller - return null; - } - } + Module thisModule = getModule(); + if (thisModule.isNamed()) { + // check if resource can be located by caller + if (Resources.canEncapsulate(name) + && !isOpenToCaller(name, Reflection.getCallerClass())) { + return null; } - String mn = getModule().getName(); + + // resource not encapsulated or in package open to caller + String mn = thisModule.getName(); ClassLoader cl = getClassLoader0(); try { if (cl == null) { @@ -2698,10 +2688,36 @@ public final class Class implements java.io.Serializable, } } + /** + * Returns true if a resource with the given name can be located by the + * given caller. All resources in a module can be located by code in + * the module. For other callers, then the package needs to be open to + * the caller. + */ + private boolean isOpenToCaller(String name, Class caller) { + // assert getModule().isNamed(); + Module thisModule = getModule(); + Module callerModule = (caller != null) ? caller.getModule() : null; + if (callerModule != thisModule) { + String pn = Resources.toPackageName(name); + if (thisModule.getDescriptor().packages().contains(pn)) { + if (callerModule == null && !thisModule.isOpen(pn)) { + // no caller, package not open + return false; + } + if (!thisModule.isOpen(pn, callerModule)) { + // package not open to caller + return false; + } + } + } + return true; + } + + /** protection domain returned when the internal domain is null */ private static java.security.ProtectionDomain allPermDomain; - /** * Returns the {@code ProtectionDomain} of this class. If there is a * security manager installed, this method first calls the security diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java index a6817746cdc..f9d8ae36934 100644 --- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java @@ -31,7 +31,6 @@ import java.io.UncheckedIOException; import java.io.File; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.Module; import java.net.URL; import java.security.AccessController; import java.security.AccessControlContext; @@ -352,9 +351,7 @@ public abstract class ClassLoader { private ClassLoader(Void unused, String name, ClassLoader parent) { this.name = name; this.parent = parent; - this.unnamedModule - = SharedSecrets.getJavaLangReflectModuleAccess() - .defineUnnamedModule(this); + this.unnamedModule = new Module(this); if (ParallelLoaders.isRegistered(this.getClass())) { parallelLockMap = new ConcurrentHashMap<>(); package2certs = new ConcurrentHashMap<>(); diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/LayerInstantiationException.java b/jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java similarity index 93% rename from jdk/src/java.base/share/classes/java/lang/reflect/LayerInstantiationException.java rename to jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java index fbd0de0ac85..4c64fe071a8 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/LayerInstantiationException.java +++ b/jdk/src/java.base/share/classes/java/lang/LayerInstantiationException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,13 +23,12 @@ * questions. */ -package java.lang.reflect; +package java.lang; /** - * Thrown when creating a Layer fails. - * - * @see Layer + * Thrown when creating a {@linkplain ModuleLayer module layer} fails. * + * @see ModuleLayer * @since 9 * @spec JPMS */ diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java b/jdk/src/java.base/share/classes/java/lang/Module.java similarity index 89% rename from jdk/src/java.base/share/classes/java/lang/reflect/Module.java rename to jdk/src/java.base/share/classes/java/lang/Module.java index 23fddfaa557..26337d86beb 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java +++ b/jdk/src/java.base/share/classes/java/lang/Module.java @@ -23,7 +23,7 @@ * questions. */ -package java.lang.reflect; +package java.lang; import java.io.IOException; import java.io.InputStream; @@ -35,6 +35,7 @@ import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Opens; import java.lang.module.ModuleDescriptor.Version; import java.lang.module.ResolvedModule; +import java.lang.reflect.AnnotatedElement; import java.net.URI; import java.net.URL; import java.security.AccessController; @@ -49,12 +50,12 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.loader.BuiltinClassLoader; import jdk.internal.loader.BootLoader; import jdk.internal.misc.JavaLangAccess; -import jdk.internal.misc.JavaLangReflectModuleAccess; import jdk.internal.misc.SharedSecrets; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.Resources; @@ -73,7 +74,7 @@ import sun.security.util.SecurityConstants; * *

          Named modules have a {@link #getName() name} and are constructed by the * Java Virtual Machine when a graph of modules is defined to the Java virtual - * machine to create a module {@link Layer Layer}.

          + * machine to create a {@linkplain ModuleLayer module layer}.

          * *

          An unnamed module does not have a name. There is an unnamed module for * each {@link ClassLoader ClassLoader}, obtained by invoking its {@link @@ -92,13 +93,13 @@ import sun.security.util.SecurityConstants; * * @since 9 * @spec JPMS - * @see java.lang.Class#getModule + * @see Class#getModule() */ public final class Module implements AnnotatedElement { // the layer that contains this module, can be null - private final Layer layer; + private final ModuleLayer layer; // module name and loader, these fields are read by VM private final String name; @@ -113,10 +114,10 @@ public final class Module implements AnnotatedElement { * VM but will not read any other modules, will not have any exports setup * and will not be registered in the service catalog. */ - private Module(Layer layer, - ClassLoader loader, - ModuleDescriptor descriptor, - URI uri) + Module(ModuleLayer layer, + ClassLoader loader, + ModuleDescriptor descriptor, + URI uri) { this.layer = layer; this.name = descriptor.name(); @@ -139,7 +140,7 @@ public final class Module implements AnnotatedElement { * * @see ClassLoader#getUnnamedModule */ - private Module(ClassLoader loader) { + Module(ClassLoader loader) { this.layer = null; this.name = null; this.loader = loader; @@ -217,29 +218,28 @@ public final class Module implements AnnotatedElement { * Returns the layer that contains this module or {@code null} if this * module is not in a layer. * - * A module {@code Layer} contains named modules and therefore this - * method always returns {@code null} when invoked on an unnamed module. + * A module layer contains named modules and therefore this method always + * returns {@code null} when invoked on an unnamed module. * - *

          Dynamic modules are named - * modules that are generated at runtime. A dynamic module may or may - * not be in a module Layer.

          + *

          Dynamic modules are + * named modules that are generated at runtime. A dynamic module may or may + * not be in a module layer.

          * - * @return The layer that contains this module + * @return The module layer that contains this module * - * @see Proxy + * @see java.lang.reflect.Proxy */ - public Layer getLayer() { + public ModuleLayer getLayer() { if (isNamed()) { - Layer layer = this.layer; + ModuleLayer layer = this.layer; if (layer != null) return layer; - // special-case java.base as it is created before the boot Layer + // special-case java.base as it is created before the boot layer if (loader == null && name.equals("java.base")) { - return SharedSecrets.getJavaLangAccess().getBootLayer(); + return ModuleLayer.boot(); } } - return null; } @@ -338,7 +338,7 @@ public final class Module implements AnnotatedElement { public Module addReads(Module other) { Objects.requireNonNull(other); if (this.isNamed()) { - Module caller = Reflection.getCallerClass().getModule(); + Module caller = getCallerModule(Reflection.getCallerClass()); if (caller != this) { throw new IllegalCallerException(caller + " != " + this); } @@ -350,12 +350,21 @@ public final class Module implements AnnotatedElement { /** * Updates this module to read another module. * - * @apiNote This method is for Proxy use and white-box testing. + * @apiNote Used by the --add-reads command line option. */ void implAddReads(Module other) { implAddReads(other, true); } + /** + * Updates this module to read all unnamed modules. + * + * @apiNote Used by the --add-reads command line option. + */ + void implAddReadsAllUnnamed() { + implAddReads(Module.ALL_UNNAMED_MODULE, true); + } + /** * Updates this module to read another module without notifying the VM. * @@ -371,6 +380,7 @@ public final class Module implements AnnotatedElement { * If {@code syncVM} is {@code true} then the VM is notified. */ private void implAddReads(Module other, boolean syncVM) { + Objects.requireNonNull(other); if (!canRead(other)) { // update VM first, just in case it fails if (syncVM) { @@ -659,7 +669,7 @@ public final class Module implements AnnotatedElement { Objects.requireNonNull(other); if (isNamed()) { - Module caller = Reflection.getCallerClass().getModule(); + Module caller = getCallerModule(Reflection.getCallerClass()); if (caller != this) { throw new IllegalCallerException(caller + " != " + this); } @@ -706,8 +716,8 @@ public final class Module implements AnnotatedElement { Objects.requireNonNull(other); if (isNamed()) { - Module caller = Reflection.getCallerClass().getModule(); - if (caller != this && !isOpen(pn, caller)) + Module caller = getCallerModule(Reflection.getCallerClass()); + if (caller != this && (caller == null || !isOpen(pn, caller))) throw new IllegalCallerException(pn + " is not open to " + caller); implAddExportsOrOpens(pn, other, /*open*/true, /*syncVM*/true); } @@ -717,36 +727,80 @@ public final class Module implements AnnotatedElement { /** - * Updates the exports so that package {@code pn} is exported to module - * {@code other} but without notifying the VM. + * Updates this module to export a package unconditionally. * - * @apiNote This method is for VM white-box testing. + * @apiNote This method is for JDK tests only. */ - void implAddExportsNoSync(String pn, Module other) { - if (other == null) - other = EVERYONE_MODULE; - implAddExportsOrOpens(pn.replace('/', '.'), other, false, false); + void implAddExports(String pn) { + implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, false, true); } /** - * Updates the exports so that package {@code pn} is exported to module - * {@code other}. + * Updates this module to export a package to another module. * - * @apiNote This method is for white-box testing. + * @apiNote Used by Instrumentation::redefineModule and --add-exports */ void implAddExports(String pn, Module other) { implAddExportsOrOpens(pn, other, false, true); } /** - * Updates the module to open package {@code pn} to module {@code other}. + * Updates this module to export a package to all unnamed modules. * - * @apiNote This method is for white-box tests and jtreg + * @apiNote Used by the --add-exports command line option. + */ + void implAddExportsToAllUnnamed(String pn) { + implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, false, true); + } + + /** + * Updates this export to export a package unconditionally without + * notifying the VM. + * + * @apiNote This method is for VM white-box testing. + */ + void implAddExportsNoSync(String pn) { + implAddExportsOrOpens(pn.replace('/', '.'), Module.EVERYONE_MODULE, false, false); + } + + /** + * Updates a module to export a package to another module without + * notifying the VM. + * + * @apiNote This method is for VM white-box testing. + */ + void implAddExportsNoSync(String pn, Module other) { + implAddExportsOrOpens(pn.replace('/', '.'), other, false, false); + } + + /** + * Updates this module to open a package unconditionally. + * + * @apiNote This method is for JDK tests only. + */ + void implAddOpens(String pn) { + implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, true, true); + } + + /** + * Updates this module to open a package to another module. + * + * @apiNote Used by Instrumentation::redefineModule and --add-opens */ void implAddOpens(String pn, Module other) { implAddExportsOrOpens(pn, other, true, true); } + /** + * Updates this module to export a package to all unnamed modules. + * + * @apiNote Used by the --add-opens command line option. + */ + void implAddOpensToAllUnnamed(String pn) { + implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, true, true); + } + + /** * Updates a module to export or open a module to another module. * @@ -831,7 +885,7 @@ public final class Module implements AnnotatedElement { Objects.requireNonNull(service); if (isNamed() && !descriptor.isAutomatic()) { - Module caller = Reflection.getCallerClass().getModule(); + Module caller = getCallerModule(Reflection.getCallerClass()); if (caller != this) { throw new IllegalCallerException(caller + " != " + this); } @@ -899,33 +953,28 @@ public final class Module implements AnnotatedElement { /** - * Returns an array of the package names of the packages in this module. + * Returns the set of package names for the packages in this module. * - *

          For named modules, the returned array contains an element for each + *

          For named modules, the returned set contains an element for each * package in the module.

          * *

          For unnamed modules, this method is the equivalent to invoking the * {@link ClassLoader#getDefinedPackages() getDefinedPackages} method of - * this module's class loader and returning the array of package names.

          + * this module's class loader and returning the set of package names.

          * - *

          A package name appears at most once in the returned array.

          - * - * @apiNote This method returns an array rather than a {@code Set} for - * consistency with other {@code java.lang.reflect} types. - * - * @return an array of the package names of the packages in this module + * @return the set of the package names of the packages in this module */ - public String[] getPackages() { + public Set getPackages() { if (isNamed()) { Set packages = descriptor.packages(); Map extraPackages = this.extraPackages; if (extraPackages == null) { - return packages.toArray(new String[0]); + return packages; } else { return Stream.concat(packages.stream(), extraPackages.keySet().stream()) - .toArray(String[]::new); + .collect(Collectors.toSet()); } } else { @@ -936,7 +985,7 @@ public final class Module implements AnnotatedElement { } else { packages = SharedSecrets.getJavaLangAccess().packages(loader); } - return packages.map(Package::getName).toArray(String[]::new); + return packages.map(Package::getName).collect(Collectors.toSet()); } } @@ -1013,12 +1062,12 @@ public final class Module implements AnnotatedElement { */ static Map defineModules(Configuration cf, Function clf, - Layer layer) + ModuleLayer layer) { Map nameToModule = new HashMap<>(); Map moduleToLoader = new HashMap<>(); - boolean isBootLayer = (Layer.boot() == null); + boolean isBootLayer = (ModuleLayer.boot() == null); Set loaders = new HashSet<>(); // map each module to a class loader @@ -1074,7 +1123,7 @@ public final class Module implements AnnotatedElement { assert m2 != null; } else { // parent layer - for (Layer parent: layer.parents()) { + for (ModuleLayer parent: layer.parents()) { m2 = findModule(parent, other); if (m2 != null) break; @@ -1133,7 +1182,8 @@ public final class Module implements AnnotatedElement { * Find the runtime Module corresponding to the given ResolvedModule * in the given parent layer (or its parents). */ - private static Module findModule(Layer parent, ResolvedModule resolvedModule) { + private static Module findModule(ModuleLayer parent, + ResolvedModule resolvedModule) { Configuration cf = resolvedModule.configuration(); String dn = resolvedModule.name(); return parent.layers() @@ -1156,7 +1206,7 @@ public final class Module implements AnnotatedElement { private static void initExportsAndOpens(Module m, Map nameToSource, Map nameToModule, - List parents) { + List parents) { // The VM doesn't special case open or automatic modules so need to // export all packages ModuleDescriptor descriptor = m.getDescriptor(); @@ -1246,12 +1296,12 @@ public final class Module implements AnnotatedElement { private static Module findModule(String target, Map nameToSource, Map nameToModule, - List parents) { + List parents) { Module m = nameToSource.get(target); if (m == null) { m = nameToModule.get(target); if (m == null) { - for (Layer parent : parents) { + for (ModuleLayer parent : parents) { m = parent.findModule(target).orElse(null); if (m != null) break; } @@ -1445,14 +1495,18 @@ public final class Module implements AnnotatedElement { } if (isNamed() && Resources.canEncapsulate(name)) { - Module caller = Reflection.getCallerClass().getModule(); + Module caller = getCallerModule(Reflection.getCallerClass()); if (caller != this && caller != Object.class.getModule()) { - // ignore packages added for proxies via addPackage - Set packages = getDescriptor().packages(); String pn = Resources.toPackageName(name); - if (packages.contains(pn) && !isOpen(pn, caller)) { - // resource is in package not open to caller - return null; + if (getPackages().contains(pn)) { + if (caller == null && !isOpen(pn)) { + // no caller, package not open + return null; + } + if (!isOpen(pn, caller)) { + // package not open to caller + return null; + } } } } @@ -1497,6 +1551,14 @@ public final class Module implements AnnotatedElement { } } + /** + * Returns the module that a given caller class is a member of. Returns + * {@code null} if the caller is {@code null}. + */ + private Module getCallerModule(Class caller) { + return (caller != null) ? caller.getModule() : null; + } + // -- native methods -- @@ -1521,71 +1583,4 @@ public final class Module implements AnnotatedElement { // JVM_AddModulePackage private static native void addPackage0(Module m, String pn); - - /** - * Register shared secret to provide access to package-private methods - */ - static { - SharedSecrets.setJavaLangReflectModuleAccess( - new JavaLangReflectModuleAccess() { - @Override - public Module defineUnnamedModule(ClassLoader loader) { - return new Module(loader); - } - @Override - public Module defineModule(ClassLoader loader, - ModuleDescriptor descriptor, - URI uri) { - return new Module(null, loader, descriptor, uri); - } - @Override - public void addReads(Module m1, Module m2) { - m1.implAddReads(m2, true); - } - @Override - public void addReadsAllUnnamed(Module m) { - m.implAddReads(Module.ALL_UNNAMED_MODULE); - } - @Override - public void addExports(Module m, String pn) { - m.implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, false, true); - } - @Override - public void addExports(Module m, String pn, Module other) { - m.implAddExportsOrOpens(pn, other, false, true); - } - @Override - public void addExportsToAllUnnamed(Module m, String pn) { - m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, false, true); - } - @Override - public void addOpens(Module m, String pn) { - m.implAddExportsOrOpens(pn, Module.EVERYONE_MODULE, true, true); - } - @Override - public void addOpens(Module m, String pn, Module other) { - m.implAddExportsOrOpens(pn, other, true, true); - } - @Override - public void addOpensToAllUnnamed(Module m, String pn) { - m.implAddExportsOrOpens(pn, Module.ALL_UNNAMED_MODULE, true, true); - } - @Override - public void addUses(Module m, Class service) { - m.implAddUses(service); - } - @Override - public ServicesCatalog getServicesCatalog(Layer layer) { - return layer.getServicesCatalog(); - } - @Override - public Stream layers(Layer layer) { - return layer.layers(); - } - @Override - public Stream layers(ClassLoader loader) { - return Layer.layers(loader); - } - }); - } } diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java similarity index 88% rename from jdk/src/java.base/share/classes/java/lang/reflect/Layer.java rename to jdk/src/java.base/share/classes/java/lang/ModuleLayer.java index bd0036d7de3..549662ff9c0 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java +++ b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java @@ -23,7 +23,7 @@ * questions. */ -package java.lang.reflect; +package java.lang; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; @@ -47,8 +47,6 @@ import java.util.stream.Stream; import jdk.internal.loader.ClassLoaderValue; import jdk.internal.loader.Loader; import jdk.internal.loader.LoaderPool; -import jdk.internal.misc.SharedSecrets; -import jdk.internal.module.Modules; import jdk.internal.module.ServicesCatalog; import sun.security.util.SecurityConstants; @@ -70,15 +68,16 @@ import sun.security.util.SecurityConstants; * *

          The {@link #defineModulesWithOneLoader defineModulesWithOneLoader} and * {@link #defineModulesWithManyLoaders defineModulesWithManyLoaders} methods - * provide convenient ways to create a {@code Layer} where all modules are + * provide convenient ways to create a module layer where all modules are * mapped to a single class loader or where each module is mapped to its own * class loader. The {@link #defineModules defineModules} method is for more * advanced cases where modules are mapped to custom class loaders by means of * a function specified to the method. Each of these methods has an instance * and static variant. The instance methods create a layer with the receiver * as the parent layer. The static methods are for more advanced cases where - * there can be more than one parent layer or where a {@link Layer.Controller - * Controller} is needed to control modules in the layer.

          + * there can be more than one parent layer or where a {@link + * ModuleLayer.Controller Controller} is needed to control modules in the layer + *

          * *

          A Java virtual machine has at least one non-empty layer, the {@link * #boot() boot} layer, that is created when the Java virtual machine is @@ -131,13 +130,13 @@ import sun.security.util.SecurityConstants; *

          {@code
            *     ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
            *
          - *     Layer parent = Layer.boot();
          + *     ModuleLayer parent = ModuleLayer.boot();
            *
            *     Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
            *
            *     ClassLoader scl = ClassLoader.getSystemClassLoader();
            *
          - *     Layer layer = parent.defineModulesWithOneLoader(cf, scl);
          + *     ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
            *
            *     Class c = layer.findLoader("myapp").loadClass("app.Main");
            * }
          @@ -147,27 +146,27 @@ import sun.security.util.SecurityConstants; * @see Module#getLayer() */ -public final class Layer { +public final class ModuleLayer { - // the empty Layer - private static final Layer EMPTY_LAYER - = new Layer(Configuration.empty(), List.of(), null); + // the empty layer + private static final ModuleLayer EMPTY_LAYER + = new ModuleLayer(Configuration.empty(), List.of(), null); - // the configuration from which this Layer was created + // the configuration from which this ;ayer was created private final Configuration cf; // parent layers, empty in the case of the empty layer - private final List parents; + private final List parents; // maps module name to jlr.Module private final Map nameToModule; /** - * Creates a new Layer from the modules in the given configuration. + * Creates a new module layer from the modules in the given configuration. */ - private Layer(Configuration cf, - List parents, - Function clf) + private ModuleLayer(Configuration cf, + List parents, + Function clf) { this.cf = cf; this.parents = parents; // no need to do defensive copy @@ -182,9 +181,9 @@ public final class Layer { } /** - * Controls a layer. The static methods defined by {@link Layer} to create - * module layers return a {@code Controller} that can be used to control - * modules in the layer. + * Controls a module layer. The static methods defined by {@link ModuleLayer} + * to create module layers return a {@code Controller} that can be used to + * control modules in the layer. * *

          Unless otherwise specified, passing a {@code null} argument to a * method in this class causes a {@link NullPointerException @@ -197,18 +196,18 @@ public final class Layer { * @spec JPMS */ public static final class Controller { - private final Layer layer; + private final ModuleLayer layer; - Controller(Layer layer) { + Controller(ModuleLayer layer) { this.layer = layer; } /** * Returns the layer that this object controls. * - * @return the layer + * @return the module layer */ - public Layer layer() { + public ModuleLayer layer() { return layer; } @@ -235,14 +234,13 @@ public final class Layer { * @return This controller * * @throws IllegalArgumentException - * If {@code source} is not in the layer + * If {@code source} is not in the module layer * * @see Module#addReads */ public Controller addReads(Module source, Module target) { ensureInLayer(source); - Objects.requireNonNull(target); - Modules.addReads(source, target); + source.implAddReads(target); return this; } @@ -261,23 +259,21 @@ public final class Layer { * @return This controller * * @throws IllegalArgumentException - * If {@code source} is not in the layer or the package is not - * in the source module + * If {@code source} is not in the module layer or the package + * is not in the source module * * @see Module#addOpens */ public Controller addOpens(Module source, String pn, Module target) { ensureInLayer(source); - Objects.requireNonNull(pn); - Objects.requireNonNull(target); - Modules.addOpens(source, pn, target); + source.implAddOpens(pn, target); return this; } } /** - * Creates a new layer, with this layer as its parent, by defining the + * Creates a new module layer, with this layer as its parent, by defining the * modules in the given {@code Configuration} to the Java virtual machine. * This method creates one class loader and defines all modules to that * class loader. The {@link ClassLoader#getParent() parent} of each class @@ -288,7 +284,7 @@ public final class Layer { * parent. In other words, if this layer is {@code thisLayer} then this * method is equivalent to invoking: *

           {@code
          -     *     Layer.defineModulesWithOneLoader(cf, List.of(thisLayer), parentLoader).layer();
          +     *     ModuleLayer.defineModulesWithOneLoader(cf, List.of(thisLayer), parentLoader).layer();
                * }
          * * @param cf @@ -312,14 +308,14 @@ public final class Layer { * * @see #findLoader */ - public Layer defineModulesWithOneLoader(Configuration cf, - ClassLoader parentLoader) { + public ModuleLayer defineModulesWithOneLoader(Configuration cf, + ClassLoader parentLoader) { return defineModulesWithOneLoader(cf, List.of(this), parentLoader).layer(); } /** - * Creates a new layer, with this layer as its parent, by defining the + * Creates a new module layer, with this layer as its parent, by defining the * modules in the given {@code Configuration} to the Java virtual machine. * Each module is defined to its own {@link ClassLoader} created by this * method. The {@link ClassLoader#getParent() parent} of each class loader @@ -330,7 +326,7 @@ public final class Layer { * parent. In other words, if this layer is {@code thisLayer} then this * method is equivalent to invoking: *
           {@code
          -     *     Layer.defineModulesWithManyLoaders(cf, List.of(thisLayer), parentLoader).layer();
          +     *     ModuleLayer.defineModulesWithManyLoaders(cf, List.of(thisLayer), parentLoader).layer();
                * }
          * * @param cf @@ -354,14 +350,14 @@ public final class Layer { * * @see #findLoader */ - public Layer defineModulesWithManyLoaders(Configuration cf, - ClassLoader parentLoader) { + public ModuleLayer defineModulesWithManyLoaders(Configuration cf, + ClassLoader parentLoader) { return defineModulesWithManyLoaders(cf, List.of(this), parentLoader).layer(); } /** - * Creates a new layer, with this layer as its parent, by defining the + * Creates a new module layer, with this layer as its parent, by defining the * modules in the given {@code Configuration} to the Java virtual machine. * Each module is mapped, by name, to its class loader by means of the * given function. This method works exactly as specified by the static @@ -370,7 +366,7 @@ public final class Layer { * this layer is {@code thisLayer} then this method is equivalent to * invoking: *
           {@code
          -     *     Layer.defineModules(cf, List.of(thisLayer), clf).layer();
          +     *     ModuleLayer.defineModules(cf, List.of(thisLayer), clf).layer();
                * }
          * * @param cf @@ -390,13 +386,13 @@ public final class Layer { * If {@code RuntimePermission("getClassLoader")} is denied by * the security manager */ - public Layer defineModules(Configuration cf, - Function clf) { + public ModuleLayer defineModules(Configuration cf, + Function clf) { return defineModules(cf, List.of(this), clf).layer(); } /** - * Creates a new layer by defining the modules in the given {@code + * Creates a new module layer by defining the modules in the given {@code * Configuration} to the Java virtual machine. This method creates one * class loader and defines all modules to that class loader. * @@ -458,10 +454,10 @@ public final class Layer { * @see #findLoader */ public static Controller defineModulesWithOneLoader(Configuration cf, - List parentLayers, + List parentLayers, ClassLoader parentLoader) { - List parents = new ArrayList<>(parentLayers); + List parents = new ArrayList<>(parentLayers); checkConfiguration(cf, parents); checkCreateClassLoaderPermission(); @@ -470,7 +466,7 @@ public final class Layer { try { Loader loader = new Loader(cf.modules(), parentLoader); loader.initRemotePackageMap(cf, parents); - Layer layer = new Layer(cf, parents, mn -> loader); + ModuleLayer layer = new ModuleLayer(cf, parents, mn -> loader); return new Controller(layer); } catch (IllegalArgumentException | IllegalStateException e) { throw new LayerInstantiationException(e.getMessage()); @@ -478,7 +474,7 @@ public final class Layer { } /** - * Creates a new layer by defining the modules in the given {@code + * Creates a new module layer by defining the modules in the given {@code * Configuration} to the Java virtual machine. Each module is defined to * its own {@link ClassLoader} created by this method. The {@link * ClassLoader#getParent() parent} of each class loader is the given parent @@ -528,10 +524,10 @@ public final class Layer { * @see #findLoader */ public static Controller defineModulesWithManyLoaders(Configuration cf, - List parentLayers, + List parentLayers, ClassLoader parentLoader) { - List parents = new ArrayList<>(parentLayers); + List parents = new ArrayList<>(parentLayers); checkConfiguration(cf, parents); checkCreateClassLoaderPermission(); @@ -539,7 +535,7 @@ public final class Layer { LoaderPool pool = new LoaderPool(cf, parents, parentLoader); try { - Layer layer = new Layer(cf, parents, pool::loaderFor); + ModuleLayer layer = new ModuleLayer(cf, parents, pool::loaderFor); return new Controller(layer); } catch (IllegalArgumentException | IllegalStateException e) { throw new LayerInstantiationException(e.getMessage()); @@ -547,7 +543,7 @@ public final class Layer { } /** - * Creates a new layer by defining the modules in the given {@code + * Creates a new module layer by defining the modules in the given {@code * Configuration} to the Java virtual machine. The given function maps each * module in the configuration, by name, to a class loader. Creating the * layer informs the Java virtual machine about the classes that may be @@ -562,7 +558,7 @@ public final class Layer { * ready to load from these modules before there are any attempts to load * classes or resources.

          * - *

          Creating a {@code Layer} can fail for the following reasons:

          + *

          Creating a layer can fail for the following reasons:

          * *
            * @@ -589,7 +585,7 @@ public final class Layer { * or runtime exception then it is propagated to the caller of this method. *

            * - * @apiNote It is implementation specific as to whether creating a Layer + * @apiNote It is implementation specific as to whether creating a layer * with this method is an atomic operation or not. Consequentially it is * possible for this method to fail with some modules, but not all, defined * to the Java virtual machine. @@ -613,10 +609,10 @@ public final class Layer { * the security manager */ public static Controller defineModules(Configuration cf, - List parentLayers, + List parentLayers, Function clf) { - List parents = new ArrayList<>(parentLayers); + List parents = new ArrayList<>(parentLayers); checkConfiguration(cf, parents); Objects.requireNonNull(clf); @@ -628,7 +624,7 @@ public final class Layer { } try { - Layer layer = new Layer(cf, parents, clf); + ModuleLayer layer = new ModuleLayer(cf, parents, clf); return new Controller(layer); } catch (IllegalArgumentException | IllegalStateException e) { throw new LayerInstantiationException(e.getMessage()); @@ -641,7 +637,7 @@ public final class Layer { * the parent layers. */ private static void checkConfiguration(Configuration cf, - List parentLayers) + List parentLayers) { Objects.requireNonNull(cf); @@ -650,7 +646,7 @@ public final class Layer { throw new IllegalArgumentException("wrong number of parents"); int index = 0; - for (Layer parent : parentLayers) { + for (ModuleLayer parent : parentLayers) { if (parent.configuration() != parentConfigurations.get(index)) { throw new IllegalArgumentException( "Parent of configuration != configuration of this Layer"); @@ -727,7 +723,7 @@ public final class Layer { * * @return The list of this layer's parents */ - public List parents() { + public List parents() { return parents; } @@ -739,24 +735,24 @@ public final class Layer { * @implNote For now, the assumption is that the number of elements will * be very low and so this method does not use a specialized spliterator. */ - Stream layers() { - List allLayers = this.allLayers; + Stream layers() { + List allLayers = this.allLayers; if (allLayers != null) return allLayers.stream(); allLayers = new ArrayList<>(); - Set visited = new HashSet<>(); - Deque stack = new ArrayDeque<>(); + Set visited = new HashSet<>(); + Deque stack = new ArrayDeque<>(); visited.add(this); stack.push(this); while (!stack.isEmpty()) { - Layer layer = stack.pop(); + ModuleLayer layer = stack.pop(); allLayers.add(layer); // push in reverse order for (int i = layer.parents.size() - 1; i >= 0; i--) { - Layer parent = layer.parents.get(i); + ModuleLayer parent = layer.parents.get(i); if (!visited.contains(parent)) { visited.add(parent); stack.push(parent); @@ -768,7 +764,7 @@ public final class Layer { return allLayers.stream(); } - private volatile List allLayers; + private volatile List allLayers; /** * Returns the set of the modules in this layer. @@ -856,9 +852,9 @@ public final class Layer { } /** - * Returns a string describing this layer. + * Returns a string describing this module layer. * - * @return A possibly empty string describing this layer + * @return A possibly empty string describing this module layer */ @Override public String toString() { @@ -873,7 +869,7 @@ public final class Layer { * * @return The empty layer */ - public static Layer empty() { + public static ModuleLayer empty() { return EMPTY_LAYER; } @@ -887,11 +883,10 @@ public final class Layer { * * @return The boot layer */ - public static Layer boot() { - return SharedSecrets.getJavaLangAccess().getBootLayer(); + public static ModuleLayer boot() { + return System.bootLayer; } - /** * Returns the ServicesCatalog for this Layer, creating it if not * already created. @@ -922,10 +917,10 @@ public final class Layer { */ void bindToLoader(ClassLoader loader) { // CLV.computeIfAbsent(loader, (cl, clv) -> new CopyOnWriteArrayList<>()) - List list = CLV.get(loader); + List list = CLV.get(loader); if (list == null) { list = new CopyOnWriteArrayList<>(); - List previous = CLV.putIfAbsent(loader, list); + List previous = CLV.putIfAbsent(loader, list); if (previous != null) list = previous; } list.add(this); @@ -935,8 +930,8 @@ public final class Layer { * Returns a stream of the layers that have at least one module defined to * the given class loader. */ - static Stream layers(ClassLoader loader) { - List list = CLV.get(loader); + static Stream layers(ClassLoader loader) { + List list = CLV.get(loader); if (list != null) { return list.stream(); } else { @@ -945,5 +940,5 @@ public final class Layer { } // the list of layers with modules defined to a class loader - private static final ClassLoaderValue> CLV = new ClassLoaderValue<>(); + private static final ClassLoaderValue> CLV = new ClassLoaderValue<>(); } diff --git a/jdk/src/java.base/share/classes/java/lang/NamedPackage.java b/jdk/src/java.base/share/classes/java/lang/NamedPackage.java index 5d86cc7fd9c..6234b949e65 100644 --- a/jdk/src/java.base/share/classes/java/lang/NamedPackage.java +++ b/jdk/src/java.base/share/classes/java/lang/NamedPackage.java @@ -26,7 +26,6 @@ package java.lang; import java.lang.module.Configuration; import java.lang.module.ModuleReference; -import java.lang.reflect.Module; import java.net.URI; /** diff --git a/jdk/src/java.base/share/classes/java/lang/Package.java b/jdk/src/java.base/share/classes/java/lang/Package.java index 0dcc5e1c12c..25bf4a751fd 100644 --- a/jdk/src/java.base/share/classes/java/lang/Package.java +++ b/jdk/src/java.base/share/classes/java/lang/Package.java @@ -27,7 +27,6 @@ package java.lang; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Module; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; diff --git a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java index 084d4661700..098e8626525 100644 --- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java +++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java @@ -29,9 +29,7 @@ import java.lang.RuntimePermission; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Opens; -import java.lang.reflect.Layer; import java.lang.reflect.Member; -import java.lang.reflect.Module; import java.io.FileDescriptor; import java.io.File; import java.io.FilePermission; @@ -1441,7 +1439,7 @@ class SecurityManager { static { // Get the modules in the boot layer - Stream bootLayerModules = Layer.boot().modules().stream(); + Stream bootLayerModules = ModuleLayer.boot().modules().stream(); // Filter out the modules loaded by the boot or platform loader PrivilegedAction> pa = () -> diff --git a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java index 79b4c7299f6..b96fb363559 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java +++ b/jdk/src/java.base/share/classes/java/lang/StackTraceElement.java @@ -33,8 +33,6 @@ import jdk.internal.module.ModuleReferenceImpl; import java.lang.module.ModuleDescriptor.Version; import java.lang.module.ModuleReference; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.HashSet; import java.util.Objects; import java.util.Optional; @@ -191,7 +189,7 @@ public final class StackTraceElement implements java.io.Serializable { * if the module name is not available. * @since 9 * @spec JPMS - * @see java.lang.reflect.Module#getName() + * @see Module#getName() */ public String getModuleName() { return moduleName; @@ -480,7 +478,7 @@ public final class StackTraceElement implements java.io.Serializable { if (!VM.isModuleSystemInited()) return true; - return Layer.boot() == m.getLayer() && HashedModules.contains(m); + return ModuleLayer.boot() == m.getLayer() && HashedModules.contains(m); } /* @@ -492,7 +490,7 @@ public final class StackTraceElement implements java.io.Serializable { static Set hashedModules() { - Optional resolvedModule = Layer.boot() + Optional resolvedModule = ModuleLayer.boot() .configuration() .findModule("java.base"); assert resolvedModule.isPresent(); diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index 661c0f5a34c..a749255158d 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -35,33 +35,32 @@ import java.io.InputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.lang.annotation.Annotation; +import java.lang.module.ModuleDescriptor; import java.lang.reflect.Constructor; import java.lang.reflect.Executable; -import java.lang.reflect.Layer; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; +import java.net.URI; import java.net.URL; import java.security.AccessControlContext; import java.security.ProtectionDomain; -import java.util.Properties; -import java.util.PropertyPermission; -import java.util.Map; import java.security.AccessController; import java.security.PrivilegedAction; import java.nio.channels.Channel; import java.nio.channels.spi.SelectorProvider; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.PropertyPermission; +import java.util.ResourceBundle; +import java.util.function.Supplier; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; -import java.util.Objects; -import java.util.ResourceBundle; -import java.util.function.Supplier; -import sun.nio.ch.Interruptible; +import jdk.internal.module.ModuleBootstrap; +import jdk.internal.module.ServicesCatalog; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; -import sun.security.util.SecurityConstants; -import sun.reflect.annotation.AnnotationType; import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.misc.JavaLangAccess;; import jdk.internal.misc.SharedSecrets;; @@ -69,8 +68,9 @@ import jdk.internal.misc.VM; import jdk.internal.logger.LoggerFinderLoader; import jdk.internal.logger.LazyLoggers; import jdk.internal.logger.LocalizedLoggerWrapper; - -import jdk.internal.module.ModuleBootstrap; +import sun.reflect.annotation.AnnotationType; +import sun.nio.ch.Interruptible; +import sun.security.util.SecurityConstants; /** * The System class contains several useful class fields @@ -1160,7 +1160,7 @@ public final class System { * @param msg the string message (or a key in the message catalog, if * this logger is a {@link * LoggerFinder#getLocalizedLogger(java.lang.String, - * java.util.ResourceBundle, java.lang.reflect.Module) localized logger}); + * java.util.ResourceBundle, java.lang.Module) localized logger}); * can be {@code null}. * * @throws NullPointerException if {@code level} is {@code null}. @@ -1228,7 +1228,7 @@ public final class System { * @param msg the string message (or a key in the message catalog, if * this logger is a {@link * LoggerFinder#getLocalizedLogger(java.lang.String, - * java.util.ResourceBundle, java.lang.reflect.Module) localized logger}); + * java.util.ResourceBundle, java.lang.Module) localized logger}); * can be {@code null}. * @param thrown a {@code Throwable} associated with the log message; * can be {@code null}. @@ -1277,7 +1277,7 @@ public final class System { * java.text.MessageFormat} format, (or a key in the message * catalog, if this logger is a {@link * LoggerFinder#getLocalizedLogger(java.lang.String, - * java.util.ResourceBundle, java.lang.reflect.Module) localized logger}); + * java.util.ResourceBundle, java.lang.Module) localized logger}); * can be {@code null}. * @param params an optional list of parameters to the message (may be * none). @@ -1482,7 +1482,7 @@ public final class System { * message localization. * * @implSpec By default, this method calls {@link - * #getLogger(java.lang.String, java.lang.reflect.Module) + * #getLogger(java.lang.String, java.lang.Module) * this.getLogger(name, module)} to obtain a logger, then wraps that * logger in a {@link Logger} instance where all methods that do not * take a {@link ResourceBundle} as parameter are redirected to one @@ -1566,7 +1566,7 @@ public final class System { * @implSpec * Instances returned by this method route messages to loggers * obtained by calling {@link LoggerFinder#getLogger(java.lang.String, - * java.lang.reflect.Module) LoggerFinder.getLogger(name, module)}, where + * java.lang.Module) LoggerFinder.getLogger(name, module)}, where * {@code module} is the caller's module. * In cases where {@code System.getLogger} is called from a context where * there is no caller frame on the stack (e.g when called directly @@ -1579,7 +1579,7 @@ public final class System { * * @apiNote * This method may defer calling the {@link - * LoggerFinder#getLogger(java.lang.String, java.lang.reflect.Module) + * LoggerFinder#getLogger(java.lang.String, java.lang.Module) * LoggerFinder.getLogger} method to create an actual logger supplied by * the logging backend, for instance, to allow loggers to be obtained during * the system initialization time. @@ -1612,7 +1612,7 @@ public final class System { * @implSpec * The returned logger will perform message localization as specified * by {@link LoggerFinder#getLocalizedLogger(java.lang.String, - * java.util.ResourceBundle, java.lang.reflect.Module) + * java.util.ResourceBundle, java.lang.Module) * LoggerFinder.getLocalizedLogger(name, bundle, module)}, where * {@code module} is the caller's module. * In cases where {@code System.getLogger} is called from a context where @@ -1977,7 +1977,7 @@ public final class System { } // @see #initPhase2() - private static Layer bootLayer; + static ModuleLayer bootLayer; /* * Invoked by VM. Phase 2 module system initialization. @@ -2100,9 +2100,6 @@ public final class System { public void invokeFinalize(Object o) throws Throwable { o.finalize(); } - public Layer getBootLayer() { - return bootLayer; - } public ConcurrentHashMap createOrGetClassLoaderValueMap(ClassLoader cl) { return cl.createOrGetClassLoaderValueMap(); } @@ -2127,6 +2124,44 @@ public final class System { public void invalidatePackageAccessCache() { SecurityManager.invalidatePackageAccessCache(); } + public Module defineModule(ClassLoader loader, + ModuleDescriptor descriptor, + URI uri) { + return new Module(null, loader, descriptor, uri); + } + public Module defineUnnamedModule(ClassLoader loader) { + return new Module(loader); + } + public void addReads(Module m1, Module m2) { + m1.implAddReads(m2); + } + public void addReadsAllUnnamed(Module m) { + m.implAddReadsAllUnnamed(); + } + public void addExports(Module m, String pn, Module other) { + m.implAddExports(pn, other); + } + public void addExportsToAllUnnamed(Module m, String pn) { + m.implAddExportsToAllUnnamed(pn); + } + public void addOpens(Module m, String pn, Module other) { + m.implAddOpens(pn, other); + } + public void addOpensToAllUnnamed(Module m, String pn) { + m.implAddOpensToAllUnnamed(pn); + } + public void addUses(Module m, Class service) { + m.implAddUses(service); + } + public ServicesCatalog getServicesCatalog(ModuleLayer layer) { + return layer.getServicesCatalog(); + } + public Stream layers(ModuleLayer layer) { + return layer.layers(); + } + public Stream layers(ClassLoader loader) { + return ModuleLayer.layers(loader); + } }); } } diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java b/jdk/src/java.base/share/classes/java/lang/WeakPairMap.java similarity index 99% rename from jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java rename to jdk/src/java.base/share/classes/java/lang/WeakPairMap.java index 39a623a4704..1e4e12767b3 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/WeakPairMap.java +++ b/jdk/src/java.base/share/classes/java/lang/WeakPairMap.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package java.lang.reflect; +package java.lang; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java index 97efa4f1066..92ab77cedf4 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java @@ -33,7 +33,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index 8f7059ec47e..afd8d9b2819 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -43,7 +43,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.lang.reflect.ReflectPermission; import java.nio.ByteOrder; import java.security.AccessController; @@ -668,11 +667,11 @@ public class MethodHandles { * The value is {@code 0x20}, which does not correspond meaningfully to * any particular {@linkplain java.lang.reflect.Modifier modifier bit}. * A {@code Lookup} with this lookup mode assumes {@linkplain - * java.lang.reflect.Module#canRead(java.lang.reflect.Module) readability}. + * java.lang.Module#canRead(java.lang.Module) readability}. * In conjunction with the {@code PUBLIC} modifier bit, a {@code Lookup} * with this lookup mode can access all public members of public types * of all modules where the type is in a package that is {@link - * java.lang.reflect.Module#isExported(String) exported unconditionally}. + * java.lang.Module#isExported(String) exported unconditionally}. * @since 9 * @spec JPMS * @see #publicLookup() diff --git a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java index dfd5fe87b7e..d5fc16c1ef6 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java +++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java @@ -64,11 +64,11 @@ import java.util.stream.Stream; * with the receiver as the parent configuration. The static methods are for * more advanced cases where there can be more than one parent configuration.

            * - *

            Each {@link java.lang.reflect.Layer layer} of modules in the Java virtual + *

            Each {@link java.lang.ModuleLayer layer} of modules in the Java virtual * machine is created from a configuration. The configuration for the {@link - * java.lang.reflect.Layer#boot() boot} layer is obtained by invoking {@code - * Layer.boot().configuration()}. The configuration for the boot layer will - * often be the parent when creating new configurations.

            + * java.lang.ModuleLayer#boot() boot} layer is obtained by invoking {@code + * ModuleLayer.boot().configuration()}. The configuration for the boot layer + * will often be the parent when creating new configurations.

            * *

            Example

            * @@ -81,7 +81,7 @@ import java.util.stream.Stream; *
            {@code
              *    ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
              *
            - *    Configuration parent = Layer.boot().configuration();
            + *    Configuration parent = ModuleLayer.boot().configuration();
              *
              *    Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("myapp"));
              *    cf.modules().forEach(m -> {
            @@ -95,7 +95,7 @@ import java.util.stream.Stream;
              *
              * @since 9
              * @spec JPMS
            - * @see java.lang.reflect.Layer
            + * @see java.lang.ModuleLayer
              */
             public final class Configuration {
             
            diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
            index e2438d718df..01b4316fa20 100644
            --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
            +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
            @@ -60,7 +60,7 @@ import jdk.internal.module.ModuleInfo;
              * 

            A module descriptor describes a named module and defines methods to * obtain each of its components. The module descriptor for a named module * in the Java virtual machine is obtained by invoking the {@link - * java.lang.reflect.Module Module}'s {@link java.lang.reflect.Module#getDescriptor + * java.lang.Module Module}'s {@link java.lang.Module#getDescriptor * getDescriptor} method. Module descriptors can also be created using the * {@link ModuleDescriptor.Builder} class or by reading the binary form of a * module declaration ({@code module-info.class}) using the {@link @@ -85,7 +85,7 @@ import jdk.internal.module.ModuleInfo; *

            {@code ModuleDescriptor} objects are immutable and safe for use by * multiple concurrent threads.

            * - * @see java.lang.reflect.Module + * @see java.lang.Module * @since 9 * @spec JPMS */ @@ -2110,7 +2110,9 @@ public class ModuleDescriptor /** * Sets the module main class. The package for the main class is added - * to the module if not already added. + * to the module if not already added. In other words, this method is + * equivalent to first invoking this builder's {@link #packages(Set) + * packages} method to add the package name of the main class. * * @param mc * The module main class @@ -2134,8 +2136,8 @@ public class ModuleDescriptor throw new IllegalArgumentException(mc + ": unnamed package"); } } - mainClass = mc; packages.add(pn); + mainClass = mc; return this; } diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java index 97c74f64209..0be9d8d9eff 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java @@ -228,14 +228,14 @@ public interface ModuleFinder { * directory is treated as an exploded module rather than a directory of * modules.

            * - *

            The module finder returned by this method supports modules that are - * packaged as JAR files. A JAR file with a {@code module-info.class} in - * the top-level directory of the JAR file (or overridden by a versioned - * entry in a {@link java.util.jar.JarFile#isMultiRelease() multi-release} - * JAR file) is a modular JAR and is an explicit module. - * A JAR file that does not have a {@code module-info.class} in the - * top-level directory is created as an automatic module. The components - * for the automatic module are derived as follows: + *

            The module finder returned by this method + * supports modules packaged as JAR files. A JAR file with a {@code + * module-info.class} in its top-level directory, or in a versioned entry + * in a {@linkplain java.util.jar.JarFile#isMultiRelease() multi-release} + * JAR file, is a modular JAR file and thus defines an explicit + * module. A JAR file that does not have a {@code module-info.class} in its + * top-level directory defines an automatic module, as follows: + *

            * *
              * @@ -254,16 +254,16 @@ public interface ModuleFinder { * ModuleDescriptor.Version} and ignored if it cannot be parsed as * a {@code Version}.

              * - *
            • For the module name, then any trailing digits and dots - * are removed, all non-alphanumeric characters ({@code [^A-Za-z0-9]}) - * are replaced with a dot ({@code "."}), all repeating dots are - * replaced with one dot, and all leading and trailing dots are - * removed.

            • + *
            • All non-alphanumeric characters ({@code [^A-Za-z0-9]}) + * in the module name are replaced with a dot ({@code "."}), all + * repeating dots are replaced with one dot, and all leading and + * trailing dots are removed.

            • * *
            • As an example, a JAR file named {@code foo-bar.jar} will * derive a module name {@code foo.bar} and no version. A JAR file - * named {@code foo-1.2.3-SNAPSHOT.jar} will derive a module name - * {@code foo} and {@code 1.2.3-SNAPSHOT} as the version.

            • + * named {@code foo-bar-1.2.3-SNAPSHOT.jar} will derive a module + * name {@code foo.bar} and {@code 1.2.3-SNAPSHOT} as the version. + *

              * *
            * @@ -312,7 +312,9 @@ public interface ModuleFinder { * *

            As with automatic modules, the contents of a packaged or exploded * module may need to be scanned in order to determine the packages - * in the module. If a {@code .class} file (other than {@code + * in the module. Whether {@linkplain java.nio.file.Files#isHidden(Path) + * hidden files} are ignored or not is implementation specific and therefore + * not specified. If a {@code .class} file (other than {@code * module-info.class}) is found in the top-level directory then it is * assumed to be a class in the unnamed package and so {@code FindException} * is thrown.

            diff --git a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java index b585ac63165..6adf93f8317 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/Resolver.java +++ b/jdk/src/java.base/share/classes/java/lang/module/Resolver.java @@ -28,7 +28,6 @@ package java.lang.module; import java.io.PrintStream; import java.lang.module.ModuleDescriptor.Provides; import java.lang.module.ModuleDescriptor.Requires.Modifier; -import java.lang.reflect.Layer; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +66,9 @@ final class Resolver { // maps module name to module reference private final Map nameToReference = new HashMap<>(); + // true if all automatic modules have been found + private boolean haveAllAutomaticModules; + // module constraints on target platform private String osName; private String osArch; @@ -171,6 +173,21 @@ final class Resolver { ModuleDescriptor descriptor = q.poll(); assert nameToReference.containsKey(descriptor.name()); + // if the module is an automatic module then all automatic + // modules need to be resolved + if (descriptor.isAutomatic() && !haveAllAutomaticModules) { + addFoundAutomaticModules().forEach(mref -> { + ModuleDescriptor other = mref.descriptor(); + q.offer(other); + if (isTracing()) { + trace("Automatic module %s located, required by %s", + other.name(), descriptor.name()); + mref.location().ifPresent(uri -> trace(" (%s)", uri)); + } + }); + haveAllAutomaticModules = true; + } + // process dependences for (ModuleDescriptor.Requires requires : descriptor.requires()) { @@ -199,10 +216,15 @@ final class Resolver { if (!nameToReference.containsKey(dn)) { addFoundModule(mref); q.offer(mref.descriptor()); - resolved.add(mref.descriptor()); if (isTracing()) { - trace("Module %s located, required by %s", + String prefix; + if (mref.descriptor().isAutomatic()) { + prefix = "Automatic module"; + } else { + prefix = "Module"; + } + trace(prefix + " %s located, required by %s", dn, descriptor.name()); mref.location().ifPresent(uri -> trace(" (%s)", uri)); } @@ -250,7 +272,7 @@ final class Resolver { // the initial set of modules that may use services Set initialConsumers; - if (Layer.boot() == null) { + if (ModuleLayer.boot() == null) { initialConsumers = new HashSet<>(); } else { initialConsumers = parents.stream() @@ -301,6 +323,21 @@ final class Resolver { return this; } + /** + * Add all automatic modules that have not already been found to the + * nameToReference map. + */ + private Set addFoundAutomaticModules() { + Set result = new HashSet<>(); + findAll().forEach(mref -> { + String mn = mref.descriptor().name(); + if (mref.descriptor().isAutomatic() && !nameToReference.containsKey(mn)) { + addFoundModule(mref); + result.add(mref); + } + }); + return result; + } /** * Add the module to the nameToReference map. Also check any constraints on @@ -534,7 +571,7 @@ final class Resolver { // need "requires transitive" from the modules in parent configurations // as there may be selected modules that have a dependency on modules in // the parent configuration. - if (Layer.boot() == null) { + if (ModuleLayer.boot() == null) { g2 = new HashMap<>(capacity); } else { g2 = parents.stream() diff --git a/jdk/src/java.base/share/classes/java/lang/module/package-info.java b/jdk/src/java.base/share/classes/java/lang/module/package-info.java index 1d830079cab..b531f13748c 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/package-info.java +++ b/jdk/src/java.base/share/classes/java/lang/module/package-info.java @@ -70,7 +70,7 @@ * }
            * *

            If module {@code m1} is resolved with the configuration for the {@link - * java.lang.reflect.Layer#boot() boot} layer as the parent then the resulting + * java.lang.ModuleLayer#boot() boot} layer as the parent then the resulting * configuration contains two modules ({@code m1}, {@code m2}). The edges in * its readability graph are: *

             {@code
            @@ -92,10 +92,10 @@
              *
              * 

            {@link java.lang.module.ModuleDescriptor#isAutomatic() Automatic} modules * receive special treatment during resolution. Each automatic module is resolved - * so that it reads all other modules in the configuration and all parent - * configurations. Each automatic module is also resolved as if it - * "{@code requires transitive}" all other automatic modules in the configuration - * (and all automatic modules in parent configurations).

            + * as if it "{@code requires transitive}" all observable automatic modules and + * all automatic modules in the parent configurations. Each automatic module is + * resolved so that it reads all other modules in the resulting configuration and + * all modules in parent configurations.

            * *

            Service binding

            * diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java index b4b4a07c807..c47caad95a5 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java @@ -227,11 +227,11 @@ import static java.lang.module.ModuleDescriptor.Modifier.SYNTHETIC; * {@code Proxy.newProxyInstance} method should be used instead. * *

            - * A dynamic module can read the modules of all of the superinterfaces of a proxy class - * and the modules of the types referenced by all public method signatures + * A dynamic module can read the modules of all of the superinterfaces of a proxy + * class and the modules of the types referenced by all public method signatures * of a proxy class. If a superinterface or a referenced type, say {@code T}, - * is in a non-exported package, the {@linkplain java.lang.reflect.Module module} - * of {@code T} is updated to export the package of {@code T} to the dynamic module. + * is in a non-exported package, the {@linkplain Module module} of {@code T} is + * updated to export the package of {@code T} to the dynamic module. * *

            Methods Duplicated in Multiple Proxy Interfaces

            * diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/package-info.java b/jdk/src/java.base/share/classes/java/lang/reflect/package-info.java index 97800b1ce13..e771f31cea1 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/package-info.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,10 @@ /** * Provides classes and interfaces for obtaining reflective information about - * modules, classes and objects. Reflection allows programmatic access to - * information about modules and to the fields, methods and constructors of - * loaded classes, and the use of reflected fields, methods, and constructors - * to operate on their underlying counterparts, within encapsulation and - * security restrictions. + * classes and objects. Reflection allows programmatic access to information + * about the fields, methods and constructors of loaded classes, and the use + * of reflected fields, methods, and constructors to operate on their underlying + * counterparts, within encapsulation and security restrictions. * *

            {@code AccessibleObject} allows suppression of access checks if * the necessary {@code ReflectPermission} is available. diff --git a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java index b587da9b9e3..5bfa6976a81 100644 --- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java @@ -50,7 +50,6 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.net.JarURLConnection; import java.net.URL; import java.net.URLConnection; diff --git a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java index b84139ca307..db4ff4e78ec 100644 --- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java +++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java @@ -31,10 +31,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Layer; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.net.URL; import java.net.URLConnection; import java.security.AccessControlContext; @@ -50,7 +48,6 @@ import java.util.stream.StreamSupport; import jdk.internal.loader.BootLoader; import jdk.internal.loader.ClassLoaders; import jdk.internal.misc.JavaLangAccess; -import jdk.internal.misc.JavaLangReflectModuleAccess; import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.module.ServicesCatalog; @@ -160,7 +157,7 @@ import jdk.internal.reflect.Reflection; *

            Locating providers

            * *

            The {@code load} methods locate providers using a class loader or module - * {@link Layer layer}. When locating providers using a class loader then + * {@link ModuleLayer layer}. When locating providers using a class loader then * providers in both named and unnamed modules may be located. When locating * providers using a module layer then only providers in named modules in * the layer (or parent layers) are located. @@ -168,11 +165,11 @@ import jdk.internal.reflect.Reflection; *

            When locating providers using a class loader then any providers in named * modules defined to the class loader, or any class loader that is reachable * via parent delegation, are located. Additionally, providers in module layers - * other than the {@link Layer#boot() boot} layer, where the module layer + * other than the {@link ModuleLayer#boot() boot} layer, where the module layer * contains modules defined to the class loader, or any class loader reachable * via parent delegation, are also located. For example, suppose there is a * module layer where each module is defined to its own class loader (see {@link - * Layer#defineModulesWithManyLoaders defineModulesWithManyLoaders}). If the + * ModuleLayer#defineModulesWithManyLoaders defineModulesWithManyLoaders}). If the * {@code load} method is invoked to locate providers using any of these class * loaders for this layer then it will locate all of the providers in that * layer, irrespective of their defining class loader. @@ -198,7 +195,7 @@ import jdk.internal.reflect.Reflection; * will locate providers in modules defined to the class loader, then its * parent class loader, its parent parent, and so on to the bootstrap class * loader. If a {@code ClassLoader}, or any class loader in the parent - * delegation chain, defines modules in a custom module {@link Layer} then + * delegation chain, defines modules in a custom module {@link ModuleLayer} then * all providers in that layer are located, irrespective of their class * loader. The ordering of modules defined to the same class loader, or the * ordering of modules in a layer, is not defined. @@ -216,11 +213,11 @@ import jdk.internal.reflect.Reflection; * method finds the service configuration files. *

          * - *

          Service loaders created to locate providers in a module {@link Layer} - * will first locate providers in the layer, before locating providers in - * parent layers. Traversal of parent layers is depth-first with each layer - * visited at most once. For example, suppose L0 is the boot layer, L1 and - * L2 are custom layers with L0 as their parent. Now suppose that L3 is + *

          Service loaders created to locate providers in a {@linkplain ModuleLayer + * module layer} will first locate providers in the layer, before locating + * providers in parent layers. Traversal of parent layers is depth-first with + * each layer visited at most once. For example, suppose L0 is the boot layer, + * L1 and L2 are custom layers with L0 as their parent. Now suppose that L3 is * created with L1 and L2 as the parents (in that order). Using a service * loader to locate providers with L3 as the content will locate providers * in the following order: L3, L1, L0, L2. The ordering of modules in a layer @@ -352,12 +349,12 @@ public final class ServiceLoader // The class of the service type private final String serviceName; - // The module Layer used to locate providers; null when locating + // The module layer used to locate providers; null when locating // providers using a class loader - private final Layer layer; + private final ModuleLayer layer; // The class loader used to locate, load, and instantiate providers; - // null when locating provider using a module Layer + // null when locating provider using a module layer private final ClassLoader loader; // The access control context taken when the ServiceLoader is created @@ -376,10 +373,8 @@ public final class ServiceLoader private int reloadCount; private static JavaLangAccess LANG_ACCESS; - private static JavaLangReflectModuleAccess JLRM_ACCESS; static { LANG_ACCESS = SharedSecrets.getJavaLangAccess(); - JLRM_ACCESS = SharedSecrets.getJavaLangReflectModuleAccess(); } /** @@ -425,13 +420,13 @@ public final class ServiceLoader /** * Initializes a new instance of this class for locating service providers - * in a module Layer. + * in a module layer. * * @throws ServiceConfigurationError * If {@code svc} is not accessible to {@code caller} or the caller * module does not use the service type. */ - private ServiceLoader(Class caller, Layer layer, Class svc) { + private ServiceLoader(Class caller, ModuleLayer layer, Class svc) { Objects.requireNonNull(caller); Objects.requireNonNull(layer); Objects.requireNonNull(svc); @@ -512,12 +507,15 @@ public final class ServiceLoader /** * Checks that the given service type is accessible to types in the given - * module, and check that the module declare that it uses the service type. ?? + * module, and check that the module declares that it uses the service type. */ private static void checkCaller(Class caller, Class svc) { - Module callerModule = caller.getModule(); + if (caller == null) { + fail(svc, "no caller to check if it declares `uses`"); + } // Check access to the service type + Module callerModule = caller.getModule(); int mods = svc.getModifiers(); if (!Reflection.verifyMemberAccess(caller, svc, null, mods)) { fail(svc, "service type not accessible to " + callerModule); @@ -826,13 +824,13 @@ public final class ServiceLoader /** * Implements lazy service provider lookup of service providers that - * are provided by modules in a module Layer (or parent layers) + * are provided by modules in a module layer (or parent layers) */ private final class LayerLookupIterator implements Iterator> { - Deque stack = new ArrayDeque<>(); - Set visited = new HashSet<>(); + Deque stack = new ArrayDeque<>(); + Set visited = new HashSet<>(); Iterator iterator; ServiceProvider next; // next provider to load @@ -841,8 +839,8 @@ public final class ServiceLoader stack.push(layer); } - private Iterator providers(Layer layer) { - ServicesCatalog catalog = JLRM_ACCESS.getServicesCatalog(layer); + private Iterator providers(ModuleLayer layer) { + ServicesCatalog catalog = LANG_ACCESS.getServicesCatalog(layer); return catalog.findServices(serviceName).iterator(); } @@ -864,10 +862,10 @@ public final class ServiceLoader if (stack.isEmpty()) return false; - Layer layer = stack.pop(); - List parents = layer.parents(); + ModuleLayer layer = stack.pop(); + List parents = layer.parents(); for (int i = parents.size() - 1; i >= 0; i--) { - Layer parent = parents.get(i); + ModuleLayer parent = parents.get(i); if (!visited.contains(parent)) { visited.add(parent); stack.push(parent); @@ -915,8 +913,8 @@ public final class ServiceLoader * Returns iterator to iterate over the implementations of {@code * service} in the given layer. */ - private List providers(Layer layer) { - ServicesCatalog catalog = JLRM_ACCESS.getServicesCatalog(layer); + private List providers(ModuleLayer layer) { + ServicesCatalog catalog = LANG_ACCESS.getServicesCatalog(layer); return catalog.findServices(serviceName); } @@ -946,10 +944,10 @@ public final class ServiceLoader return providers.iterator(); } else { List allProviders = new ArrayList<>(providers); - Layer bootLayer = Layer.boot(); - Iterator iterator = JLRM_ACCESS.layers(loader).iterator(); + ModuleLayer bootLayer = ModuleLayer.boot(); + Iterator iterator = LANG_ACCESS.layers(loader).iterator(); while (iterator.hasNext()) { - Layer layer = iterator.next(); + ModuleLayer layer = iterator.next(); if (layer != bootLayer) { allProviders.addAll(providers(layer)); } @@ -1535,7 +1533,7 @@ public final class ServiceLoader /** * Creates a new service loader for the given service type that loads - * service providers from modules in the given {@code Layer} and its + * service providers from modules in the given {@code ModuleLayer} and its * ancestors. * * @apiNote Unlike the other load methods defined here, the service type @@ -1545,7 +1543,7 @@ public final class ServiceLoader * @param the class of the service type * * @param layer - * The module Layer + * The module layer * * @param service * The interface or abstract class representing the service @@ -1561,7 +1559,7 @@ public final class ServiceLoader * @spec JPMS */ @CallerSensitive - public static ServiceLoader load(Layer layer, Class service) { + public static ServiceLoader load(ModuleLayer layer, Class service) { return new ServiceLoader<>(Reflection.getCallerClass(), layer, service); } diff --git a/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java b/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java index b0cba4f4915..4a3ef27e13a 100644 --- a/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java +++ b/jdk/src/java.base/share/classes/java/util/spi/AbstractResourceBundleProvider.java @@ -31,7 +31,6 @@ import jdk.internal.misc.SharedSecrets; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Locale; diff --git a/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java b/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java index 60a1c9d3aa2..16b7903cd8e 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java +++ b/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java @@ -25,7 +25,6 @@ package javax.crypto; -import java.lang.reflect.Module; import java.security.*; import java.net.*; import java.util.*; diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/BootLoader.java b/jdk/src/java.base/share/classes/jdk/internal/loader/BootLoader.java index 72148adb5bd..07b5173e726 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/BootLoader.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BootLoader.java @@ -27,8 +27,6 @@ package jdk.internal.loader; import java.io.IOException; import java.io.InputStream; import java.lang.module.ModuleReference; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; @@ -62,8 +60,7 @@ public class BootLoader { private static final String JAVA_HOME = System.getProperty("java.home"); static { - UNNAMED_MODULE - = SharedSecrets.getJavaLangReflectModuleAccess().defineUnnamedModule(null); + UNNAMED_MODULE = SharedSecrets.getJavaLangAccess().defineUnnamedModule(null); setBootLoaderUnnamedModule0(UNNAMED_MODULE); } @@ -255,7 +252,7 @@ public class BootLoader { if (mn != null) { // named module from runtime image or exploded module - Optional om = Layer.boot().findModule(mn); + Optional om = ModuleLayer.boot().findModule(mn); if (!om.isPresent()) throw new InternalError(mn + " not in boot layer"); return om.get(); diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java index 64492508dc0..972902651fe 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java @@ -27,7 +27,6 @@ package jdk.internal.loader; import java.io.File; import java.io.IOException; -import java.lang.reflect.Module; import java.net.URL; import java.nio.file.InvalidPathException; import java.nio.file.Paths; diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java index ca90e80a1ea..0eb249de0d9 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java @@ -33,7 +33,6 @@ import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleReader; import java.lang.module.ModuleReference; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; @@ -80,8 +79,8 @@ import jdk.internal.module.Resources; * loader. This allows automatic modules (for example) to link to types in the * unnamed module of the parent class loader. * - * @see Layer#defineModulesWithOneLoader - * @see Layer#defineModulesWithManyLoaders + * @see ModuleModuleLayer#defineModulesWithOneLoader + * @see ModuleModuleLayer#defineModulesWithManyLoaders */ public final class Loader extends SecureClassLoader { @@ -207,10 +206,10 @@ public final class Loader extends SecureClassLoader { * @param cf the Configuration containing at least modules to be defined to * this class loader * - * @param parentLayers the parent Layers + * @param parentModuleLayers the parent ModuleLayers */ public Loader initRemotePackageMap(Configuration cf, - List parentLayers) + List parentModuleLayers) { for (String name : nameToModule.keySet()) { ResolvedModule resolvedModule = cf.findModule(name).get(); @@ -236,8 +235,8 @@ public final class Loader extends SecureClassLoader { } else { // find the layer for the target module - Layer layer = parentLayers.stream() - .map(parent -> findLayer(parent, other.configuration())) + ModuleLayer layer = parentModuleLayers.stream() + .map(parent -> findModuleLayer(parent, other.configuration())) .flatMap(Optional::stream) .findAny() .orElseThrow(() -> @@ -286,8 +285,8 @@ public final class Loader extends SecureClassLoader { * Find the layer corresponding to the given configuration in the tree * of layers rooted at the given parent. */ - private Optional findLayer(Layer parent, Configuration cf) { - return SharedSecrets.getJavaLangReflectModuleAccess().layers(parent) + private Optional findModuleLayer(ModuleLayer parent, Configuration cf) { + return SharedSecrets.getJavaLangAccess().layers(parent) .filter(l -> l.configuration() == cf) .findAny(); } diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java b/jdk/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java index 14b088c14a9..a16f2447947 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java @@ -27,7 +27,6 @@ package jdk.internal.loader; import java.lang.module.Configuration; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,7 +35,7 @@ import java.util.stream.Stream; /** * A pool of class loaders. * - * @see Layer#defineModulesWithManyLoaders + * @see ModuleLayer#defineModulesWithManyLoaders */ public final class LoaderPool { @@ -51,7 +50,7 @@ public final class LoaderPool { * created with the given parent class loader as its parent. */ public LoaderPool(Configuration cf, - List parentLayers, + List parentLayers, ClassLoader parentLoader) { Map loaders = new HashMap<>(); diff --git a/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java b/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java index 18ccc33442e..5ffd8fd7af4 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java +++ b/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java @@ -34,7 +34,6 @@ import java.util.Objects; import java.lang.System.LoggerFinder; import java.lang.System.Logger; import java.lang.ref.ReferenceQueue; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collection; diff --git a/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java index 6c65426ca8e..c266caac684 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java +++ b/jdk/src/java.base/share/classes/jdk/internal/logger/LazyLoggers.java @@ -31,7 +31,6 @@ import java.util.function.BiFunction; import java.lang.System.LoggerFinder; import java.lang.System.Logger; import java.lang.ref.WeakReference; -import java.lang.reflect.Module; import java.util.Objects; import jdk.internal.misc.VM; import sun.util.logging.PlatformLogger; @@ -402,10 +401,10 @@ public final class LazyLoggers { * @param module The module on behalf of which the logger is created. * If the module is not loaded from the Boot ClassLoader, * the LoggerFinder is accessed and the logger returned - * by {@link LoggerFinder#getLogger(java.lang.String, java.lang.reflect.Module)} + * by {@link LoggerFinder#getLogger(java.lang.String, java.lang.Module)} * is returned to the caller directly. * Otherwise, the logger returned by - * {@link #getLazyLogger(java.lang.String, java.lang.reflect.Module)} + * {@link #getLazyLogger(java.lang.String, java.lang.Module)} * is returned to the caller. * * @return a (possibly lazy) Logger instance. diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java index 5d5e27d3e2b..ece20d827a4 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java @@ -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 @@ -27,10 +27,10 @@ package jdk.internal.misc; import java.io.IOException; import java.lang.annotation.Annotation; +import java.lang.module.ModuleDescriptor; import java.lang.reflect.Executable; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; +import java.net.URI; import java.net.URL; import java.security.AccessControlContext; import java.security.ProtectionDomain; @@ -38,6 +38,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; +import jdk.internal.module.ServicesCatalog; import jdk.internal.reflect.ConstantPool; import sun.reflect.annotation.AnnotationType; import sun.nio.ch.Interruptible; @@ -139,11 +140,6 @@ public interface JavaLangAccess { */ void invokeFinalize(Object o) throws Throwable; - /** - * Returns the boot Layer - */ - Layer getBootLayer(); - /** * Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s) * associated with the given class loader, creating it if it doesn't already exist. @@ -185,4 +181,74 @@ public interface JavaLangAccess { * Invalidate package access cache */ void invalidatePackageAccessCache(); + + /** + * Defines a new module to the Java virtual machine. The module + * is defined to the given class loader. + * + * The URI is for information purposes only, it can be {@code null}. + */ + Module defineModule(ClassLoader loader, ModuleDescriptor descriptor, URI uri); + + /** + * Defines the unnamed module for the given class loader. + */ + Module defineUnnamedModule(ClassLoader loader); + + /** + * Updates the readability so that module m1 reads m2. The new read edge + * does not result in a strong reference to m2 (m2 can be GC'ed). + * + * This method is the same as m1.addReads(m2) but without a permission check. + */ + void addReads(Module m1, Module m2); + + /** + * Updates module m to read all unnamed modules. + */ + void addReadsAllUnnamed(Module m); + + /** + * Updates module m1 to export a package to module m2. The export does + * not result in a strong reference to m2 (m2 can be GC'ed). + */ + void addExports(Module m1, String pkg, Module m2); + + /** + * Updates a module m to export a package to all unnamed modules. + */ + void addExportsToAllUnnamed(Module m, String pkg); + + /** + * Updates module m1 to open a package to module m2. Opening the + * package does not result in a strong reference to m2 (m2 can be GC'ed). + */ + void addOpens(Module m1, String pkg, Module m2); + + /** + * Updates a module m to open a package to all unnamed modules. + */ + void addOpensToAllUnnamed(Module m, String pkg); + + /** + * Updates a module m to use a service. + */ + void addUses(Module m, Class service); + + /** + * Returns the ServicesCatalog for the given Layer. + */ + ServicesCatalog getServicesCatalog(ModuleLayer layer); + + /** + * Returns an ordered stream of layers. The first element is is the + * given layer, the remaining elements are its parents, in DFS order. + */ + Stream layers(ModuleLayer layer); + + /** + * Returns a stream of the layers that have modules defined to the + * given class loader. + */ + Stream layers(ClassLoader loader); } diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java deleted file mode 100644 index c8a2039d3ce..00000000000 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangReflectModuleAccess.java +++ /dev/null @@ -1,121 +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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.internal.misc; - -import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; -import java.net.URI; -import java.util.stream.Stream; - -import jdk.internal.module.ServicesCatalog; - -/** - * Provides access to non-public methods in java.lang.reflect.Module - */ - -public interface JavaLangReflectModuleAccess { - - /** - * Defines the unnamed module for the given class loader. - */ - Module defineUnnamedModule(ClassLoader loader); - - /** - * Defines a new module to the Java virtual machine. The module - * is defined to the given class loader. - * - * The URI is for information purposes only, it can be {@code null}. - */ - Module defineModule(ClassLoader loader, ModuleDescriptor descriptor, URI uri); - - /** - * Updates the readability so that module m1 reads m2. The new read edge - * does not result in a strong reference to m2 (m2 can be GC'ed). - * - * This method is the same as m1.addReads(m2) but without a permission check. - */ - void addReads(Module m1, Module m2); - - /** - * Updates module m to read all unnamed modules. - */ - void addReadsAllUnnamed(Module m); - - /** - * Update module m to export a package to all modules. - */ - void addExports(Module m, String pn); - - /** - * Updates module m1 to export a package to module m2. The export does - * not result in a strong reference to m2 (m2 can be GC'ed). - */ - void addExports(Module m1, String pkg, Module m2); - - /** - * Updates a module m to export a package to all unnamed modules. - */ - void addExportsToAllUnnamed(Module m, String pkg); - - /** - * Updates a module m to open a package to all modules. - */ - void addOpens(Module m, String pkg); - - /** - * Updates module m1 to open a package to module m2. Opening the - * package does not result in a strong reference to m2 (m2 can be GC'ed). - */ - void addOpens(Module m1, String pkg, Module m2); - - /** - * Updates a module m to open a package to all unnamed modules. - */ - void addOpensToAllUnnamed(Module m, String pkg); - - /** - * Updates a module m to use a service. - */ - void addUses(Module m, Class service); - - /** - * Returns the ServicesCatalog for the given Layer. - */ - ServicesCatalog getServicesCatalog(Layer layer); - - /** - * Returns an ordered stream of layers. The first element is is the - * given layer, the remaining elements are its parents, in DFS order. - */ - Stream layers(Layer layer); - - /** - * Returns a stream of the layers that have modules defined to the - * given class loader. - */ - Stream layers(ClassLoader loader); -} \ No newline at end of file diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaUtilResourceBundleAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaUtilResourceBundleAccess.java index b137c3d48c4..c0eb99d7dbf 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaUtilResourceBundleAccess.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaUtilResourceBundleAccess.java @@ -25,7 +25,6 @@ package jdk.internal.misc; -import java.lang.reflect.Module; import java.util.Locale; import java.util.ResourceBundle; diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java index 321a4ca1fb2..cd54d422c21 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java @@ -50,7 +50,6 @@ public class SharedSecrets { private static JavaUtilJarAccess javaUtilJarAccess; private static JavaLangAccess javaLangAccess; private static JavaLangModuleAccess javaLangModuleAccess; - private static JavaLangReflectModuleAccess javaLangReflectModuleAccess; private static JavaLangInvokeAccess javaLangInvokeAccess; private static JavaLangRefAccess javaLangRefAccess; private static JavaIOAccess javaIOAccess; @@ -119,16 +118,6 @@ public class SharedSecrets { return javaLangModuleAccess; } - public static void setJavaLangReflectModuleAccess(JavaLangReflectModuleAccess jlrma) { - javaLangReflectModuleAccess = jlrma; - } - - public static JavaLangReflectModuleAccess getJavaLangReflectModuleAccess() { - if (javaLangReflectModuleAccess == null) - unsafe.ensureClassInitialized(java.lang.reflect.Module.class); - return javaLangReflectModuleAccess; - } - public static void setJavaLangRefAccess(JavaLangRefAccess jlra) { javaLangRefAccess = jlra; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java b/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java index a502cd0c762..3914ce923fc 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java @@ -27,7 +27,6 @@ package jdk.internal.module; import java.io.PrintStream; import java.lang.invoke.MethodHandles; -import java.lang.reflect.Module; import java.net.URL; import java.security.AccessController; import java.security.CodeSource; diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java index 98f5cf0db2e..061b2294158 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java @@ -32,9 +32,6 @@ import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; -import java.lang.reflect.LayerInstantiationException; -import java.lang.reflect.Module; import java.net.URI; import java.nio.file.Path; import java.nio.file.Paths; @@ -61,7 +58,7 @@ import jdk.internal.perf.PerfCounter; * resolving a set of module names specified via the launcher (or equivalent) * -m and --add-modules options. The modules are located on a module path that * is constructed from the upgrade module path, system modules, and application - * module path. The Configuration is instantiated as the boot Layer with each + * module path. The Configuration is instantiated as the boot layer with each * module in the the configuration defined to one of the built-in class loaders. */ @@ -106,11 +103,11 @@ public final class ModuleBootstrap { } /** - * Initialize the module system, returning the boot Layer. + * Initialize the module system, returning the boot layer. * * @see java.lang.System#initPhase2() */ - public static Layer boot() { + public static ModuleLayer boot() { long t0 = System.nanoTime(); @@ -237,7 +234,6 @@ public final class ModuleBootstrap { ModuleFinder f = finder; // observable modules systemModules.findAll() .stream() - .filter(mref -> !ModuleResolution.doNotResolveByDefault(mref)) .map(ModuleReference::descriptor) .map(ModuleDescriptor::name) .filter(mn -> f.find(mn).isPresent()) // observable @@ -321,8 +317,7 @@ public final class ModuleBootstrap { if (SystemModules.hasSplitPackages() || needPostResolutionChecks) { Map packageToModule = new HashMap<>(); for (ResolvedModule resolvedModule : cf.modules()) { - ModuleDescriptor descriptor = - resolvedModule.reference().descriptor(); + ModuleDescriptor descriptor = resolvedModule.reference().descriptor(); String name = descriptor.name(); for (String p : descriptor.packages()) { String other = packageToModule.putIfAbsent(p, name); @@ -338,7 +333,7 @@ public final class ModuleBootstrap { long t4 = System.nanoTime(); // define modules to VM/runtime - Layer bootLayer = Layer.empty().defineModules(cf, clf); + ModuleLayer bootLayer = ModuleLayer.empty().defineModules(cf, clf); PerfCounters.layerCreateTime.addElapsedTimeFrom(t4); @@ -476,7 +471,7 @@ public final class ModuleBootstrap { * Process the --add-reads options to add any additional read edges that * are specified on the command-line. */ - private static void addExtraReads(Layer bootLayer) { + private static void addExtraReads(ModuleLayer bootLayer) { // decode the command line options Map> map = decode("jdk.module.addreads."); @@ -514,7 +509,7 @@ public final class ModuleBootstrap { * Process the --add-exports and --add-opens options to export/open * additional packages specified on the command-line. */ - private static void addExtraExportsAndOpens(Layer bootLayer) { + private static void addExtraExportsAndOpens(ModuleLayer bootLayer) { // --add-exports String prefix = "jdk.module.addexports."; Map> extraExports = decode(prefix); @@ -548,7 +543,7 @@ public final class ModuleBootstrap { } } - private static void addExtraExportsOrOpens(Layer bootLayer, + private static void addExtraExportsOrOpens(ModuleLayer bootLayer, Map> map, boolean opens) { diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java index 5321d2a36d3..3f5827bfc54 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java @@ -135,8 +135,9 @@ public final class ModulePatcher { Path top = file; Files.find(top, Integer.MAX_VALUE, ((path, attrs) -> attrs.isRegularFile())) - .filter(path -> !isAutomatic + .filter(path -> (!isAutomatic || path.toString().endsWith(".class")) + && !isHidden(path)) .map(path -> toPackageName(top, path)) .filter(Checks::isPackageName) .forEach(packages::add); @@ -177,11 +178,13 @@ public final class ModulePatcher { ModuleTarget target = null; ModuleHashes recordedHashes = null; + ModuleHashes.HashSupplier hasher = null; ModuleResolution mres = null; if (mref instanceof ModuleReferenceImpl) { ModuleReferenceImpl impl = (ModuleReferenceImpl)mref; target = impl.moduleTarget(); recordedHashes = impl.recordedHashes(); + hasher = impl.hasher(); mres = impl.moduleResolution(); } @@ -191,7 +194,7 @@ public final class ModulePatcher { this, target, recordedHashes, - null, + hasher, mres); } @@ -556,7 +559,7 @@ public final class ModulePatcher { /** - * Derives a package name from a file path to a .class file. + * Derives a package name from the file path of an entry in an exploded patch */ private static String toPackageName(Path top, Path file) { Path entry = top.relativize(file); @@ -568,6 +571,17 @@ public final class ModulePatcher { } } + /** + * Returns true if the given file exists and is a hidden file + */ + private boolean isHidden(Path file) { + try { + return Files.isHidden(file); + } catch (IOException ioe) { + return false; + } + } + /** * Derives a package name from the name of an entry in a JAR file. */ diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java index 89e81d178f7..75a76b0858f 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePath.java @@ -547,7 +547,6 @@ public class ModulePath implements ModuleFinder { */ private static class Patterns { static final Pattern DASH_VERSION = Pattern.compile("-(\\d+(\\.|$))"); - static final Pattern TRAILING_VERSION = Pattern.compile("(\\.|\\d)*$"); static final Pattern NON_ALPHANUM = Pattern.compile("[^A-Za-z0-9]"); static final Pattern REPEATING_DOTS = Pattern.compile("(\\.)(\\1)+"); static final Pattern LEADING_DOTS = Pattern.compile("^\\."); @@ -558,9 +557,6 @@ public class ModulePath implements ModuleFinder { * Clean up candidate module name derived from a JAR file name. */ private static String cleanModuleName(String mn) { - // drop trailing version from name - mn = Patterns.TRAILING_VERSION.matcher(mn).replaceAll(""); - // replace non-alphanumeric mn = Patterns.NON_ALPHANUM.matcher(mn).replaceAll("."); @@ -630,7 +626,7 @@ public class ModulePath implements ModuleFinder { private Set explodedPackages(Path dir) { try { return Files.find(dir, Integer.MAX_VALUE, - ((path, attrs) -> attrs.isRegularFile())) + ((path, attrs) -> attrs.isRegularFile() && !isHidden(path))) .map(path -> dir.relativize(path)) .map(this::toPackageName) .flatMap(Optional::stream) @@ -726,6 +722,17 @@ public class ModulePath implements ModuleFinder { } } + /** + * Returns true if the given file exists and is a hidden file + */ + private boolean isHidden(Path file) { + try { + return Files.isHidden(file); + } catch (IOException ioe) { + return false; + } + } + private static final PerfCounter scanTime = PerfCounter.newPerfCounter("jdk.module.finder.modulepath.scanTime"); private static final PerfCounter moduleCount diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java index 696aa64b3a5..62288625b76 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/Modules.java @@ -26,15 +26,13 @@ package jdk.internal.module; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.net.URI; import java.security.AccessController; import java.security.PrivilegedAction; import jdk.internal.loader.BootLoader; import jdk.internal.loader.ClassLoaders; -import jdk.internal.misc.JavaLangReflectModuleAccess; +import jdk.internal.misc.JavaLangAccess; import jdk.internal.misc.SharedSecrets; /** @@ -51,8 +49,7 @@ import jdk.internal.misc.SharedSecrets; public class Modules { private Modules() { } - private static final JavaLangReflectModuleAccess JLRMA - = SharedSecrets.getJavaLangReflectModuleAccess(); + private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); /** * Creates a new Module. The module has the given ModuleDescriptor and @@ -67,7 +64,7 @@ public class Modules { ModuleDescriptor descriptor, URI uri) { - return JLRMA.defineModule(loader, descriptor, uri); + return JLA.defineModule(loader, descriptor, uri); } /** @@ -75,23 +72,14 @@ public class Modules { * Same as m1.addReads(m2) but without a caller check. */ public static void addReads(Module m1, Module m2) { - JLRMA.addReads(m1, m2); + JLA.addReads(m1, m2); } /** * Update module m to read all unnamed modules. */ public static void addReadsAllUnnamed(Module m) { - JLRMA.addReadsAllUnnamed(m); - } - - /** - * Update module m to export a package to all modules. - * - * This method is for intended for use by tests only. - */ - public static void addExports(Module m, String pn) { - JLRMA.addExports(m, pn); + JLA.addReadsAllUnnamed(m); } /** @@ -99,23 +87,14 @@ public class Modules { * Same as m1.addExports(pn, m2) but without a caller check */ public static void addExports(Module m1, String pn, Module m2) { - JLRMA.addExports(m1, pn, m2); + JLA.addExports(m1, pn, m2); } /** * Updates module m to export a package to all unnamed modules. */ public static void addExportsToAllUnnamed(Module m, String pn) { - JLRMA.addExportsToAllUnnamed(m, pn); - } - - /** - * Update module m to open a package to all modules. - * - * This method is for intended for use by tests only. - */ - public static void addOpens(Module m, String pn) { - JLRMA.addOpens(m, pn); + JLA.addExportsToAllUnnamed(m, pn); } /** @@ -123,14 +102,14 @@ public class Modules { * Same as m1.addOpens(pn, m2) but without a caller check. */ public static void addOpens(Module m1, String pn, Module m2) { - JLRMA.addOpens(m1, pn, m2); + JLA.addOpens(m1, pn, m2); } /** * Updates module m to open a package to all unnamed modules. */ public static void addOpensToAllUnnamed(Module m, String pn) { - JLRMA.addOpensToAllUnnamed(m, pn); + JLA.addOpensToAllUnnamed(m, pn); } /** @@ -138,16 +117,16 @@ public class Modules { * Same as m2.addUses(service) but without a caller check. */ public static void addUses(Module m, Class service) { - JLRMA.addUses(m, service); + JLA.addUses(m, service); } /** * Updates module m to provide a service */ public static void addProvides(Module m, Class service, Class impl) { - Layer layer = m.getLayer(); + ModuleLayer layer = m.getLayer(); - if (layer == null || layer == Layer.boot()) { + if (layer == null || layer == ModuleLayer.boot()) { // update ClassLoader catalog PrivilegedAction pa = m::getClassLoader; ClassLoader loader = AccessController.doPrivileged(pa); @@ -162,9 +141,7 @@ public class Modules { if (layer != null) { // update Layer catalog - SharedSecrets.getJavaLangReflectModuleAccess() - .getServicesCatalog(layer) - .addProvider(m, service, impl); + JLA.getServicesCatalog(layer).addProvider(m, service, impl); } } diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java b/jdk/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java index d4425aadbb8..f0d7126adc8 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java @@ -25,7 +25,6 @@ package jdk.internal.module; -import java.lang.reflect.Module; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Provides; import java.util.ArrayList; diff --git a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java index c3633ff8aab..d0e2a98995a 100644 --- a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java +++ b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java @@ -27,7 +27,6 @@ package sun.invoke.util; import java.lang.reflect.Modifier; import static java.lang.reflect.Modifier.*; -import java.lang.reflect.Module; import java.util.Objects; import jdk.internal.reflect.Reflection; diff --git a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java index c86075a260b..d6cc3661d00 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java +++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java @@ -50,10 +50,8 @@ import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Opens; import java.lang.module.ModuleDescriptor.Provides; -import java.lang.reflect.Layer; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.math.BigDecimal; import java.math.RoundingMode; import java.net.URI; @@ -467,7 +465,7 @@ public final class LauncherHelper { String mn = s[0]; String pn = s[1]; - Layer.boot().findModule(mn).ifPresent(m -> { + ModuleLayer.boot().findModule(mn).ifPresent(m -> { if (m.getDescriptor().packages().contains(pn)) { if (open) { Modules.addOpensToAllUnnamed(m, pn); @@ -564,7 +562,7 @@ public final class LauncherHelper { } // main module is in the boot layer - Layer layer = Layer.boot(); + ModuleLayer layer = ModuleLayer.boot(); Optional om = layer.findModule(mainModule); if (!om.isPresent()) { // should not happen @@ -854,7 +852,7 @@ public final class LauncherHelper { private static void setFXLaunchParameters(String what, int mode) { // find the module with the FX launcher - Optional om = Layer.boot().findModule(JAVAFX_GRAPHICS_MODULE_NAME); + Optional om = ModuleLayer.boot().findModule(JAVAFX_GRAPHICS_MODULE_NAME); if (!om.isPresent()) { abort(null, "java.launcher.cls.error5"); } @@ -938,8 +936,7 @@ public final class LauncherHelper { * Called by the launcher to list the observable modules. * If called without any sub-options then the output is a simple list of * the modules. If called with sub-options then the sub-options are the - * names of the modules to list (-listmods:java.base,java.desktop for - * example). + * names of the modules to list (e.g. --list-modules java.base,java.desktop) */ static void listModules(boolean printToStderr, String optionFlag) throws IOException, ClassNotFoundException @@ -947,89 +944,97 @@ public final class LauncherHelper { initOutput(printToStderr); ModuleFinder finder = jdk.internal.module.ModuleBootstrap.finder(); - int colon = optionFlag.indexOf('='); if (colon == -1) { finder.findAll().stream() - .sorted(Comparator.comparing(ModuleReference::descriptor)) - .forEach(md -> { - ostream.println(midAndLocation(md.descriptor(), - md.location())); - }); + .sorted(Comparator.comparing(ModuleReference::descriptor)) + .forEach(mref -> describeModule(finder, mref, false)); } else { String[] names = optionFlag.substring(colon+1).split(","); for (String name: names) { ModuleReference mref = finder.find(name).orElse(null); if (mref == null) { - System.err.format("%s not observable!%n", name); + System.err.format("%s not found%n", name); continue; } - - ModuleDescriptor md = mref.descriptor(); - if (md.isOpen()) - ostream.print("open "); - if (md.isAutomatic()) - ostream.print("automatic "); - if (md.modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC)) - ostream.print("synthetic "); - if (md.modifiers().contains(ModuleDescriptor.Modifier.MANDATED)) - ostream.print("mandated "); - ostream.println("module " + midAndLocation(md, mref.location())); - - // unqualified exports (sorted by package) - Set exports = new TreeSet<>(Comparator.comparing(Exports::source)); - md.exports().stream().filter(e -> !e.isQualified()).forEach(exports::add); - for (Exports e : exports) { - String modsAndSource = Stream.concat(toStringStream(e.modifiers()), - Stream.of(e.source())) - .collect(Collectors.joining(" ")); - ostream.format(" exports %s%n", modsAndSource); - } - - for (Requires d : md.requires()) { - ostream.format(" requires %s%n", d); - } - for (String s : md.uses()) { - ostream.format(" uses %s%n", s); - } - - for (Provides ps : md.provides()) { - ostream.format(" provides %s with %s%n", ps.service(), - ps.providers().stream().collect(Collectors.joining(", "))); - } - - // qualified exports - for (Exports e : md.exports()) { - if (e.isQualified()) { - String modsAndSource = Stream.concat(toStringStream(e.modifiers()), - Stream.of(e.source())) - .collect(Collectors.joining(" ")); - ostream.format(" exports %s", modsAndSource); - formatCommaList(ostream, " to", e.targets()); - } - } - - // open packages - for (Opens obj: md.opens()) { - String modsAndSource = Stream.concat(toStringStream(obj.modifiers()), - Stream.of(obj.source())) - .collect(Collectors.joining(" ")); - ostream.format(" opens %s", modsAndSource); - if (obj.isQualified()) - formatCommaList(ostream, " to", obj.targets()); - else - ostream.println(); - } - - // non-exported/non-open packages - Set concealed = new TreeSet<>(md.packages()); - md.exports().stream().map(Exports::source).forEach(concealed::remove); - md.opens().stream().map(Opens::source).forEach(concealed::remove); - concealed.forEach(p -> ostream.format(" contains %s%n", p)); + describeModule(finder, mref, true); } } } + /** + * Describes the given module. + */ + static void describeModule(ModuleFinder finder, + ModuleReference mref, + boolean verbose) + { + ModuleDescriptor md = mref.descriptor(); + ostream.print("module " + midAndLocation(md, mref.location())); + if (md.isAutomatic()) + ostream.print(" automatic"); + ostream.println(); + + if (!verbose) + return; + + // unqualified exports (sorted by package) + Set exports = new TreeSet<>(Comparator.comparing(Exports::source)); + md.exports().stream().filter(e -> !e.isQualified()).forEach(exports::add); + for (Exports e : exports) { + String modsAndSource = Stream.concat(toStringStream(e.modifiers()), + Stream.of(e.source())) + .collect(Collectors.joining(" ")); + ostream.format(" exports %s%n", modsAndSource); + } + + for (Requires d : md.requires()) { + ostream.format(" requires %s", d); + String suffix = finder.find(d.name()) + .map(ModuleReference::descriptor) + .map(any -> any.isAutomatic() ? " automatic" : "") + .orElse(" not found"); + ostream.println(suffix); + } + for (String s : md.uses()) { + ostream.format(" uses %s%n", s); + } + + for (Provides ps : md.provides()) { + ostream.format(" provides %s with %s%n", ps.service(), + ps.providers().stream().collect(Collectors.joining(", "))); + } + + // qualified exports + for (Exports e : md.exports()) { + if (e.isQualified()) { + String modsAndSource = Stream.concat(toStringStream(e.modifiers()), + Stream.of(e.source())) + .collect(Collectors.joining(" ")); + ostream.format(" exports %s", modsAndSource); + formatCommaList(ostream, " to", e.targets()); + } + } + + // open packages + for (Opens obj: md.opens()) { + String modsAndSource = Stream.concat(toStringStream(obj.modifiers()), + Stream.of(obj.source())) + .collect(Collectors.joining(" ")); + ostream.format(" opens %s", modsAndSource); + if (obj.isQualified()) + formatCommaList(ostream, " to", obj.targets()); + else + ostream.println(); + } + + // non-exported/non-open packages + Set concealed = new TreeSet<>(md.packages()); + md.exports().stream().map(Exports::source).forEach(concealed::remove); + md.opens().stream().map(Opens::source).forEach(concealed::remove); + concealed.forEach(p -> ostream.format(" contains %s%n", p)); + } + static String toString(Set s) { return toStringStream(s).collect(Collectors.joining(" ")); } diff --git a/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java b/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java index d3d34da4967..8cb5ca08fcb 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java +++ b/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java @@ -25,7 +25,6 @@ package sun.reflect.misc; -import java.lang.reflect.Module; import java.io.EOFException; import java.security.AllPermission; import java.security.AccessController; diff --git a/jdk/src/java.base/share/native/libjava/Module.c b/jdk/src/java.base/share/native/libjava/Module.c index 083671da206..f396b8dfc49 100644 --- a/jdk/src/java.base/share/native/libjava/Module.c +++ b/jdk/src/java.base/share/native/libjava/Module.c @@ -29,12 +29,12 @@ #include "jni_util.h" #include "jvm.h" -#include "java_lang_reflect_Module.h" +#include "java_lang_Module.h" /* * Gets the UTF-8 chars for the string and translates '.' to '/'. Does no * further validation, assumption being that both calling code in - * java.lang.reflect.Module and VM will do deeper validation. + * java.lang.Module and VM will do deeper validation. */ static char* GetInternalPackageName(JNIEnv *env, jstring pkg, char* buf, jsize buf_size) @@ -68,7 +68,7 @@ GetInternalPackageName(JNIEnv *env, jstring pkg, char* buf, jsize buf_size) } JNIEXPORT void JNICALL -Java_java_lang_reflect_Module_defineModule0(JNIEnv *env, jclass cls, jobject module, +Java_java_lang_Module_defineModule0(JNIEnv *env, jclass cls, jobject module, jboolean is_open, jstring version, jstring location, jobjectArray packages) { @@ -109,14 +109,14 @@ Java_java_lang_reflect_Module_defineModule0(JNIEnv *env, jclass cls, jobject mod } JNIEXPORT void JNICALL -Java_java_lang_reflect_Module_addReads0(JNIEnv *env, jclass cls, jobject from, jobject to) +Java_java_lang_Module_addReads0(JNIEnv *env, jclass cls, jobject from, jobject to) { JVM_AddReadsModule(env, from, to); } JNIEXPORT void JNICALL -Java_java_lang_reflect_Module_addExports0(JNIEnv *env, jclass cls, jobject from, - jstring pkg, jobject to) +Java_java_lang_Module_addExports0(JNIEnv *env, jclass cls, jobject from, + jstring pkg, jobject to) { char buf[128]; char* pkg_name; @@ -136,8 +136,8 @@ Java_java_lang_reflect_Module_addExports0(JNIEnv *env, jclass cls, jobject from, } JNIEXPORT void JNICALL -Java_java_lang_reflect_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject from, - jstring pkg) +Java_java_lang_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject from, + jstring pkg) { char buf[128]; char* pkg_name; @@ -157,8 +157,8 @@ Java_java_lang_reflect_Module_addExportsToAll0(JNIEnv *env, jclass cls, jobject } JNIEXPORT void JNICALL -Java_java_lang_reflect_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls, - jobject from, jstring pkg) +Java_java_lang_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls, + jobject from, jstring pkg) { char buf[128]; char* pkg_name; @@ -178,7 +178,7 @@ Java_java_lang_reflect_Module_addExportsToAllUnnamed0(JNIEnv *env, jclass cls, } JNIEXPORT void JNICALL -Java_java_lang_reflect_Module_addPackage0(JNIEnv *env, jclass cls, jobject m, jstring pkg) +Java_java_lang_Module_addPackage0(JNIEnv *env, jclass cls, jobject m, jstring pkg) { char buf[128]; char* pkg_name; diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java index c9ac7374a00..08f31278c28 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java @@ -28,7 +28,6 @@ package javax.imageio.metadata; import org.w3c.dom.Node; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java index e5961b90e4a..dc2f2322100 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java @@ -28,7 +28,6 @@ package javax.imageio.spi; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java index 4430b4e1c89..d3a0a35b932 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java @@ -31,7 +31,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Objects; import javax.swing.event.*; -import java.lang.reflect.Module; import java.lang.ref.SoftReference; import java.util.HashMap; diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java b/jdk/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java index e0e0309468e..896f30904de 100644 --- a/jdk/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java +++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/ClassFileTransformer.java @@ -25,7 +25,6 @@ package java.lang.instrument; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java index bc4170d3af2..65d1569d0a0 100644 --- a/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java +++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/Instrumentation.java @@ -25,7 +25,6 @@ package java.lang.instrument; -import java.lang.reflect.Module; import java.security.ProtectionDomain; import java.util.List; import java.util.Map; @@ -346,7 +345,7 @@ public interface Instrumentation { /** - * Determines whether a class is modifiable by + * Tests whether a class is modifiable by * {@linkplain #retransformClasses retransformation} * or {@linkplain #redefineClasses redefinition}. * If a class is modifiable then this method returns true. @@ -711,8 +710,11 @@ public interface Instrumentation { * {@code extraProvides} map contains a service provider type that * is not a member of the module or an implementation of the service; * or {@code extraProvides} maps a key to an empty list + * @throws UnmodifiableModuleException if the module cannot be modified * @throws NullPointerException if any of the arguments are {@code null} or * any of the Sets or Maps contains a {@code null} key or value + * + * @see #isModifiableModule(Module) * @since 9 * @spec JPMS */ @@ -722,4 +724,19 @@ public interface Instrumentation { Map> extraOpens, Set> extraUses, Map, List>> extraProvides); + + /** + * Tests whether a module can be modified with {@link #redefineModule + * redefineModule}. If a module is modifiable then this method returns + * {@code true}. If a module is not modifiable then this method returns + * {@code false}. + * + * @param module the module to test if it can be modified + * @return {@code true} if the module is modifiable, otherwise {@code false} + * @throws NullPointerException if the module is {@code null} + * + * @since 9 + * @spec JPMS + */ + boolean isModifiableModule(Module module); } diff --git a/jdk/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java b/jdk/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java new file mode 100644 index 00000000000..be037b21cf6 --- /dev/null +++ b/jdk/src/java.instrument/share/classes/java/lang/instrument/UnmodifiableModuleException.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.instrument; + +/** + * Thrown to indicate that a module cannot be modified. + * + * @see Instrumentation#redefineModule + * @since 9 + * @spec JPMS + */ + +public class UnmodifiableModuleException extends RuntimeException { + private static final long serialVersionUID = 6912511912351080644L; + + /** + * Constructs an {@code UnmodifiableModuleException} with no + * detail message. + */ + public UnmodifiableModuleException() { + super(); + } + + /** + * Constructs an {@code UnmodifiableModuleException} with the + * specified detail message. + * + * @param msg the detail message. + */ + public UnmodifiableModuleException(String msg) { + super(msg); + } +} diff --git a/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java b/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java index b2c2a24e50d..f31a007443e 100644 --- a/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java +++ b/jdk/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java @@ -23,11 +23,10 @@ * questions. */ - package sun.instrument; +import java.lang.instrument.UnmodifiableModuleException; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.lang.reflect.AccessibleObject; import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.ClassDefinition; @@ -132,6 +131,13 @@ public class InstrumentationImpl implements Instrumentation { return isModifiableClass0(mNativeAgent, theClass); } + public boolean isModifiableModule(Module module) { + if (module == null) { + throw new NullPointerException("'module' is null"); + } + return true; + } + public boolean isRetransformClassesSupported() { // ask lazily since there is some overhead @@ -243,6 +249,9 @@ public class InstrumentationImpl implements Instrumentation { if (!module.isNamed()) return; + if (!isModifiableModule(module)) + throw new UnmodifiableModuleException(module.getName()); + // copy and check reads extraReads = new HashSet<>(extraReads); if (extraReads.contains(null)) @@ -312,7 +321,7 @@ public class InstrumentationImpl implements Instrumentation { return Collections.emptyMap(); Map> result = new HashMap<>(); - Set packages = Set.of(module.getPackages()); + Set packages = module.getPackages(); for (Map.Entry> e : map.entrySet()) { String pkg = e.getKey(); if (pkg == null) diff --git a/jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java b/jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java index dcac4b7ad8f..29665440f9f 100644 --- a/jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java +++ b/jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java @@ -25,10 +25,8 @@ package sun.instrument; - import java.lang.instrument.Instrumentation; import java.lang.instrument.ClassFileTransformer; -import java.lang.reflect.Module; import java.security.ProtectionDomain; /* diff --git a/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.h b/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.h index 008b2fabc6a..08d61636839 100644 --- a/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.h +++ b/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.h @@ -66,7 +66,7 @@ typedef struct _JPLISEnvironment JPLISEnvironment; #define JPLIS_INSTRUMENTIMPL_AGENTMAININVOKER_METHODSIGNATURE "(Ljava/lang/String;Ljava/lang/String;)V" #define JPLIS_INSTRUMENTIMPL_TRANSFORM_METHODNAME "transform" #define JPLIS_INSTRUMENTIMPL_TRANSFORM_METHODSIGNATURE \ - "(Ljava/lang/reflect/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[BZ)[B" + "(Ljava/lang/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[BZ)[B" /* diff --git a/jdk/src/java.logging/share/classes/java/util/logging/Level.java b/jdk/src/java.logging/share/classes/java/util/logging/Level.java index 526161bafa9..2af2c6d83d6 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/Level.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/Level.java @@ -24,10 +24,10 @@ */ package java.util.logging; + import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; diff --git a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java index cb03b2af40e..bb408fd919b 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java @@ -23,7 +23,6 @@ * questions. */ - package java.util.logging; import java.io.*; @@ -43,7 +42,6 @@ import java.util.stream.Stream; import jdk.internal.misc.JavaAWTAccess; import jdk.internal.misc.SharedSecrets; import sun.util.logging.internal.LoggingProviderImpl; -import java.lang.reflect.Module; import static jdk.internal.logger.DefaultLoggerFinder.isSystem; /** diff --git a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java index 1cfd6f98659..70ff7b2d94e 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java @@ -23,11 +23,9 @@ * questions. */ - package java.util.logging; import java.lang.ref.WeakReference; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; diff --git a/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java b/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java index 1ccf2cf7c92..432228a88d0 100644 --- a/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java +++ b/jdk/src/java.logging/share/classes/sun/util/logging/internal/LoggingProviderImpl.java @@ -32,7 +32,6 @@ import java.util.ResourceBundle; import java.util.function.Supplier; import java.lang.System.LoggerFinder; import java.lang.System.Logger; -import java.lang.reflect.Module; import java.util.Objects; import java.util.logging.LogManager; import jdk.internal.logger.DefaultLoggerFinder; diff --git a/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java index 7c5cd32811f..16eeff47d4b 100644 --- a/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -43,7 +43,6 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Module; import java.lang.reflect.Proxy; import java.net.MalformedURLException; import java.rmi.MarshalledObject; diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java index 580829c834c..5b0b6ac7695 100644 --- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java +++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java @@ -28,7 +28,6 @@ package javax.management.remote; import com.sun.jmx.mbeanserver.Util; import java.io.IOException; import java.io.UncheckedIOException; -import java.lang.reflect.Module; import java.net.MalformedURLException; import java.util.Collections; import java.util.HashMap; diff --git a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java index 4eb5742b2ba..5336177ba50 100644 --- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java +++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java @@ -45,7 +45,6 @@ import jdk.internal.misc.SharedSecrets; import java.util.ArrayList; import java.util.List; -import java.lang.reflect.Module; import java.lang.reflect.UndeclaredThrowableException; import java.security.PrivilegedAction; import java.util.Collections; @@ -181,8 +180,7 @@ public class ManagementFactoryHelper { return AccessController.doPrivileged(new PrivilegedAction<>() { @Override public Class run() { - Optional logging = java.lang.reflect.Layer.boot() - .findModule("java.logging"); + Optional logging = ModuleLayer.boot().findModule("java.logging"); if (logging.isPresent()) { return Class.forName(logging.get(), className); } diff --git a/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java b/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java index c29a88dc40c..43dbc075138 100644 --- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java +++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java @@ -176,7 +176,7 @@ public final class VersionHelper { InputStream getResourceAsStream(Class c, String name) { PrivilegedAction act = () -> { try { - java.lang.reflect.Module m = c.getModule(); + Module m = c.getModule(); return c.getModule().getResourceAsStream(resolveName(c,name)); } catch (IOException x) { return null; diff --git a/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java b/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java index 4e100fb9abb..2cd4733fb25 100644 --- a/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java +++ b/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java @@ -67,11 +67,11 @@ public interface ActivationInstantiator extends Remote { * *

          • The class to be activated and the special activation constructor are both public, * and the class resides in a package that is - * {@linkplain java.lang.reflect.Module#isExported(String,java.lang.reflect.Module) exported} + * {@linkplain Module#isExported(String,Module) exported} * to at least the {@code java.rmi} module; or * *
          • The class to be activated resides in a package that is - * {@linkplain java.lang.reflect.Module#isOpen(String,java.lang.reflect.Module) open} + * {@linkplain Module#isOpen(String,Module) open} * to at least the {@code java.rmi} module. *
          * diff --git a/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java b/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java index ecc1b6590bd..74d3c24fb3d 100644 --- a/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java +++ b/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java @@ -135,9 +135,9 @@ import sun.rmi.transport.LiveRef; * remote object's class. * *
        • Each remote interface must either be public and reside in a package that is - * {@linkplain java.lang.reflect.Module#isExported(String,java.lang.reflect.Module) exported} + * {@linkplain Module#isExported(String,Module) exported} * to at least the {@code java.rmi} module, or it must reside in a package that is - * {@linkplain java.lang.reflect.Module#isOpen(String,java.lang.reflect.Module) open} + * {@linkplain Module#isOpen(String,Module) open} * to at least the {@code java.rmi} module. * *
        • The proxy's invocation handler is a {@link diff --git a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java index c630598f199..0b752ca8bc0 100644 --- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java +++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java @@ -1022,7 +1022,7 @@ final class P11KeyStore extends KeyStoreSpi { ("trusted certificates may only be set by " + "token initialization application")); } - Module module = token.provider.nssModule; + Secmod.Module module = token.provider.nssModule; if ((module.type != ModuleType.KEYSTORE) && (module.type != ModuleType.FIPS)) { // XXX allow TRUSTANCHOR module throw new KeyStoreException("Trusted certificates can only be " diff --git a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java index a9b6de30d82..9e3ffe773e7 100644 --- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -77,7 +77,7 @@ public final class SunPKCS11 extends AuthProvider { final boolean removable; - final Module nssModule; + final Secmod.Module nssModule; final boolean nssUseSecmodTrust; @@ -148,7 +148,7 @@ public final class SunPKCS11 extends AuthProvider { boolean useSecmod = config.getNssUseSecmod(); boolean nssUseSecmodTrust = config.getNssUseSecmodTrust(); - Module nssModule = null; + Secmod.Module nssModule = null; // // Initialization via Secmod. The way this works is as follows: @@ -217,7 +217,7 @@ public final class SunPKCS11 extends AuthProvider { // XXX which exception to throw throw new ProviderException("Could not initialize NSS", e); } - List modules = secmod.getModules(); + List modules = secmod.getModules(); if (config.getShowInfo()) { System.out.println("NSS modules: " + modules); } @@ -258,7 +258,7 @@ public final class SunPKCS11 extends AuthProvider { ("Invalid external module: " + moduleName); } int k = 0; - for (Module module : modules) { + for (Secmod.Module module : modules) { if (module.getType() == ModuleType.EXTERNAL) { if (++k == moduleIndex) { nssModule = module; diff --git a/jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java b/jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java index 7e1da1c8d92..d8e44d385ab 100644 --- a/jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java +++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java @@ -25,7 +25,6 @@ package sun.tools.common; -import java.lang.reflect.Module; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c index 047796421a7..88df2d9603d 100644 --- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c +++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/ModuleReferenceImpl.c @@ -29,8 +29,8 @@ #include "ModuleReferenceImpl.h" -static jclass jlrM(JNIEnv *env) { - return findClass(env, "Ljava/lang/reflect/Module;"); +static jclass jlM(JNIEnv *env) { + return findClass(env, "Ljava/lang/Module;"); } static jboolean @@ -43,7 +43,7 @@ getName(PacketInputStream *in, PacketOutputStream *out) jobject module; if (method == NULL) { - method = getMethod(env, jlrM(env), "getName", "()Ljava/lang/String;"); + method = getMethod(env, jlM(env), "getName", "()Ljava/lang/String;"); } module = inStream_readModuleRef(getEnv(), in); if (inStream_error(in)) { @@ -71,7 +71,7 @@ getClassLoader(PacketInputStream *in, PacketOutputStream *out) jobject module; if (method == NULL) { - method = getMethod(env, jlrM(env), "getClassLoader", "()Ljava/lang/ClassLoader;"); + method = getMethod(env, jlM(env), "getClassLoader", "()Ljava/lang/ClassLoader;"); } module = inStream_readModuleRef(env, in); if (inStream_error(in)) { diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java index 5ab1bfca53a..5a0d3f223d9 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Jlink.java @@ -26,7 +26,6 @@ package jdk.tools.jlink.internal; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.nio.ByteOrder; import java.nio.file.Path; import java.util.ArrayList; @@ -55,10 +54,10 @@ public final class Jlink { * @return A new plugin or null if plugin is unknown. */ public static Plugin newPlugin(String name, - Map configuration, Layer pluginsLayer) { + Map configuration, ModuleLayer pluginsLayer) { Objects.requireNonNull(name); Objects.requireNonNull(configuration); - pluginsLayer = pluginsLayer == null ? Layer.boot() : pluginsLayer; + pluginsLayer = pluginsLayer == null ? ModuleLayer.boot() : pluginsLayer; return PluginRepository.newPlugin(configuration, name, pluginsLayer); } @@ -330,7 +329,7 @@ public final class Jlink { private PluginsConfiguration addAutoEnabledPlugins(PluginsConfiguration pluginsConfig) { List plugins = new ArrayList<>(pluginsConfig.getPlugins()); - List bootPlugins = PluginRepository.getPlugins(Layer.boot()); + List bootPlugins = PluginRepository.getPlugins(ModuleLayer.boot()); for (Plugin bp : bootPlugins) { if (Utils.isAutoEnabled(bp)) { try { diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java index 1d39c2cbfeb..b12bf00df96 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java @@ -24,7 +24,6 @@ */ package jdk.tools.jlink.internal; -import java.lang.reflect.Layer; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -56,7 +55,7 @@ public final class PluginRepository { * @return A provider or null if not found. */ public static Plugin getPlugin(String name, - Layer pluginsLayer) { + ModuleLayer pluginsLayer) { return getPlugin(Plugin.class, name, pluginsLayer); } @@ -69,7 +68,7 @@ public final class PluginRepository { * @return A plugin or null if no plugin found. */ public static Plugin newPlugin(Map config, String name, - Layer pluginsLayer) { + ModuleLayer pluginsLayer) { Objects.requireNonNull(name); Objects.requireNonNull(pluginsLayer); Plugin plugin = getPlugin(name, pluginsLayer); @@ -107,12 +106,12 @@ public final class PluginRepository { registeredPlugins.remove(name); } - public static List getPlugins(Layer pluginsLayer) { + public static List getPlugins(ModuleLayer pluginsLayer) { return getPlugins(Plugin.class, pluginsLayer); } private static T getPlugin(Class clazz, String name, - Layer pluginsLayer) { + ModuleLayer pluginsLayer) { Objects.requireNonNull(name); Objects.requireNonNull(pluginsLayer); @SuppressWarnings("unchecked") @@ -136,7 +135,7 @@ public final class PluginRepository { * @param pluginsLayer * @return The list of plugins. */ - private static List getPlugins(Class clazz, Layer pluginsLayer) { + private static List getPlugins(Class clazz, ModuleLayer pluginsLayer) { Objects.requireNonNull(pluginsLayer); List factories = new ArrayList<>(); try { diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java index 4535f9cfe7e..f5a312de8aa 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -211,7 +210,7 @@ public final class TaskHelper { private final class PluginsHelper { - private Layer pluginsLayer = Layer.boot(); + private ModuleLayer pluginsLayer = ModuleLayer.boot(); private final List plugins; private String lastSorter; private boolean listPlugins; @@ -655,7 +654,7 @@ public final class TaskHelper { return defaults; } - public Layer getPluginsLayer() { + public ModuleLayer getPluginsLayer() { return pluginOptions.pluginsLayer; } } @@ -725,18 +724,18 @@ public final class TaskHelper { return System.getProperty("java.version"); } - static Layer createPluginsLayer(List paths) { + static ModuleLayer createPluginsLayer(List paths) { Path[] dirs = paths.toArray(new Path[0]); ModuleFinder finder = ModulePath.of(Runtime.version(), true, dirs); - Configuration bootConfiguration = Layer.boot().configuration(); + Configuration bootConfiguration = ModuleLayer.boot().configuration(); try { Configuration cf = bootConfiguration .resolveAndBind(ModuleFinder.of(), finder, Collections.emptySet()); ClassLoader scl = ClassLoader.getSystemClassLoader(); - return Layer.boot().defineModulesWithOneLoader(cf, scl); + return ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); } catch (Exception ex) { // Malformed plugin modules (e.g.: same package in multiple modules). throw new PluginException("Invalid modules in the plugins path: " + ex); diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java index ef8fb392086..fd0dc135263 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java @@ -24,7 +24,6 @@ */ package jdk.tools.jlink.internal; -import java.lang.reflect.Module; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java index e778733cd06..bcdb1e90a0c 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java @@ -27,6 +27,7 @@ package jdk.tools.jlink.internal.plugins; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; +import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.module.ModuleDescriptor; import java.util.EnumSet; @@ -43,8 +44,6 @@ import jdk.tools.jlink.plugin.ResourcePool; import jdk.tools.jlink.plugin.ResourcePoolBuilder; import jdk.tools.jlink.plugin.ResourcePoolEntry; import jdk.tools.jlink.plugin.ResourcePoolModule; -import jdk.tools.jlink.plugin.Plugin.Category; -import jdk.tools.jlink.plugin.Plugin.State; import jdk.tools.jlink.plugin.Plugin; /** @@ -101,9 +100,9 @@ public final class ReleaseInfoPlugin implements Plugin { // --release-info add:build_type=fastdebug,source=openjdk,java_version=9 // and put whatever value that was passed in command line. - config.keySet().stream(). - filter(s -> !NAME.equals(s)). - forEach(s -> release.put(s, config.get(s))); + config.keySet().stream() + .filter(s -> !NAME.equals(s)) + .forEach(s -> release.put(s, config.get(s))); } break; @@ -148,8 +147,8 @@ public final class ReleaseInfoPlugin implements Plugin { // put topological sorted module names separated by space release.put("MODULES", new ModuleSorter(in.moduleView()) - .sorted().map(ResourcePoolModule::name) - .collect(Collectors.joining(" ", "\"", "\""))); + .sorted().map(ResourcePoolModule::name) + .collect(Collectors.joining(" ", "\"", "\""))); // create a TOP level ResourcePoolEntry for "release" file. out.add(ResourcePoolEntry.create("/java.base/release", @@ -160,11 +159,11 @@ public final class ReleaseInfoPlugin implements Plugin { // Parse version string and return a string that includes only version part // leaving "pre", "build" information. See also: java.lang.Runtime.Version. private static String parseVersion(String str) { - return Runtime.Version.parse(str). - version(). - stream(). - map(Object::toString). - collect(Collectors.joining(".")); + return Runtime.Version.parse(str) + .version() + .stream() + .map(Object::toString) + .collect(Collectors.joining(".")); } private static String quote(String str) { @@ -172,14 +171,12 @@ public final class ReleaseInfoPlugin implements Plugin { } private byte[] releaseFileContent() { - Properties props = new Properties(); - props.putAll(release); ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - props.store(baos, ""); - return baos.toByteArray(); - } catch (IOException ex) { - throw new UncheckedIOException(ex); + try (PrintWriter pw = new PrintWriter(baos)) { + release.entrySet().stream() + .sorted(Map.Entry.comparingByKey()) + .forEach(e -> pw.format("%s=%s%n", e.getKey(), e.getValue())); } + return baos.toByteArray(); } } diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT index e822c4f2aae..f79fb4e6e5d 100644 --- a/jdk/test/TEST.ROOT +++ b/jdk/test/TEST.ROOT @@ -26,8 +26,8 @@ groups=TEST.groups [closed/TEST.groups] # Allow querying of various System properties in @requires clauses requires.properties=sun.arch.data.model java.runtime.name -# Tests using jtreg 4.2 b05 features -requiredVersion=4.2 b05 +# Tests using jtreg 4.2 b07 features +requiredVersion=4.2 b07 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java b/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java index 1fcf2813950..e8529a3b396 100644 --- a/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java +++ b/jdk/test/java/awt/TrayIcon/SystemTrayIconHelper.java @@ -81,7 +81,7 @@ public class SystemTrayIconHelper { try { // sun.lwawt.macosx.CTrayIcon Field f_peer = getField( java.awt.TrayIcon.class, "peer"); - Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class); + Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class); m_addExports.invoke(null, "sun.lwawt.macosx", robot.getClass().getModule()); @@ -105,7 +105,7 @@ public class SystemTrayIconHelper { } else { try { // sun.awt.X11.XTrayIconPeer - Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class); + Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class); m_addExports.invoke(null, "sun.awt.X11", robot.getClass().getModule()); Field f_peer = getField(java.awt.TrayIcon.class, "peer"); diff --git a/jdk/test/java/awt/patchlib/java.desktop/java/awt/Helper.java b/jdk/test/java/awt/patchlib/java.desktop/java/awt/Helper.java index 6d8dbc4b227..d599833cb70 100644 --- a/jdk/test/java/awt/patchlib/java.desktop/java/awt/Helper.java +++ b/jdk/test/java/awt/patchlib/java.desktop/java/awt/Helper.java @@ -22,7 +22,6 @@ */ package java.awt; -import java.lang.reflect.Module; public class Helper { private Helper() { } public static void addExports(String pn, Module target) { diff --git a/jdk/test/java/awt/regtesthelpers/Util.java b/jdk/test/java/awt/regtesthelpers/Util.java index 62feee23489..dde65574460 100644 --- a/jdk/test/java/awt/regtesthelpers/Util.java +++ b/jdk/test/java/awt/regtesthelpers/Util.java @@ -445,7 +445,7 @@ public final class Util { try { final Class _clazz = clazz; - Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.reflect.Module.class); + Method m_addExports = Class.forName("java.awt.Helper").getDeclaredMethod("addExports", String.class, java.lang.Module.class); // No MToolkit anymore: nothing to do about it. // We may be called from non-X11 system, and this permission cannot be delegated to a test. m_addExports.invoke(null, "sun.awt.X11", Util.class.getModule()); diff --git a/jdk/test/java/lang/Class/GetModuleTest.java b/jdk/test/java/lang/Class/GetModuleTest.java index f0d7477c074..4059a216c02 100644 --- a/jdk/test/java/lang/Class/GetModuleTest.java +++ b/jdk/test/java/lang/Class/GetModuleTest.java @@ -31,7 +31,6 @@ */ import java.awt.Component; -import java.lang.reflect.Module; import jdk.internal.org.objectweb.asm.ClassWriter; import static jdk.internal.org.objectweb.asm.Opcodes.*; diff --git a/jdk/test/java/lang/Class/forName/modules/TestLayer.java b/jdk/test/java/lang/Class/forName/modules/TestLayer.java index ff9a772ceeb..45460d19d32 100644 --- a/jdk/test/java/lang/Class/forName/modules/TestLayer.java +++ b/jdk/test/java/lang/Class/forName/modules/TestLayer.java @@ -23,9 +23,7 @@ import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.net.URL; import java.net.URLClassLoader; import java.nio.file.Path; @@ -45,13 +43,13 @@ public class TestLayer { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = parent.resolveAndBind(ModuleFinder.of(), finder, modules); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); Module m1 = layer.findModule("m1").get(); Module m2 = layer.findModule("m2").get(); diff --git a/jdk/test/java/lang/Class/forName/modules/TestMain.java b/jdk/test/java/lang/Class/forName/modules/TestMain.java index 0da5136622c..aa821a1d08d 100644 --- a/jdk/test/java/lang/Class/forName/modules/TestMain.java +++ b/jdk/test/java/lang/Class/forName/modules/TestMain.java @@ -21,13 +21,11 @@ * questions. */ -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; public class TestMain { public static void main(String[] args) throws Exception { - Layer boot = Layer.boot(); + ModuleLayer boot = ModuleLayer.boot(); Module m1 = boot.findModule("m1").get(); Module m2 = boot.findModule("m2").get(); diff --git a/jdk/test/java/lang/Class/forName/modules/src/m2/p2/test/Main.java b/jdk/test/java/lang/Class/forName/modules/src/m2/p2/test/Main.java index 56cec626fa0..8febc9515a9 100644 --- a/jdk/test/java/lang/Class/forName/modules/src/m2/p2/test/Main.java +++ b/jdk/test/java/lang/Class/forName/modules/src/m2/p2/test/Main.java @@ -23,12 +23,9 @@ package p2.test; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; - public class Main { public static void main(String... args) throws Exception { - Layer boot = Layer.boot(); + ModuleLayer boot = ModuleLayer.boot(); Module m1 = boot.findModule("m1").get(); Module m2 = Main.class.getModule(); diff --git a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java index 25e8779ab48..92002a613e1 100644 --- a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java +++ b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java @@ -26,8 +26,6 @@ package p3; import java.io.FilePermission; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.nio.file.Path; import java.nio.file.Paths; import java.security.AccessControlException; @@ -47,7 +45,7 @@ public class NoAccess { ModuleFinder finder = ModuleFinder.of(Paths.get("mods1"), Paths.get("mods2")); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration parent = bootLayer.configuration(); Configuration cf = parent.resolveAndBind(finder, @@ -55,7 +53,7 @@ public class NoAccess { Set.of("m1", "m2")); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithManyLoaders(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithManyLoaders(cf, scl); if (sm != null) { System.setSecurityManager(sm); diff --git a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoGetClassLoaderAccess.java b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoGetClassLoaderAccess.java index 1c2ee70fcbc..aeed218ee5d 100644 --- a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoGetClassLoaderAccess.java +++ b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoGetClassLoaderAccess.java @@ -23,8 +23,6 @@ package p3; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.security.AccessControlException; import java.security.Permission; @@ -37,7 +35,7 @@ public class NoGetClassLoaderAccess { private static final Permission GET_CLASSLOADER_PERMISSION = new RuntimePermission("getClassLoader"); public static void main(String[] args) throws Exception { - Layer boot = Layer.boot(); + ModuleLayer boot = ModuleLayer.boot(); System.setSecurityManager(new SecurityManager()); Module m1 = boot.findModule("m1").get(); diff --git a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java index 5ea706de1ee..35e6ede16db 100644 --- a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java +++ b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java @@ -26,10 +26,8 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; -import java.lang.reflect.Module; import java.lang.reflect.Modifier; import java.lang.reflect.InaccessibleObjectException; -import java.lang.reflect.Layer; import java.lang.reflect.ReflectPermission; import java.net.URI; import java.nio.file.FileSystem; @@ -269,7 +267,7 @@ public class FieldSetAccessibleTest { try { return Files.walk(root) .filter(p -> p.getNameCount() > 2) - .filter(p -> Layer.boot().findModule(p.getName(1).toString()).isPresent()) + .filter(p -> ModuleLayer.boot().findModule(p.getName(1).toString()).isPresent()) .map(p -> p.subpath(2, p.getNameCount())) .map(p -> p.toString()) .filter(s -> s.endsWith(".class") && !s.endsWith("module-info.class")) diff --git a/jdk/test/java/lang/Class/getResource/Main.java b/jdk/test/java/lang/Class/getResource/Main.java index 96d4e68ac15..efd50262be2 100644 --- a/jdk/test/java/lang/Class/getResource/Main.java +++ b/jdk/test/java/lang/Class/getResource/Main.java @@ -23,7 +23,6 @@ import java.lang.module.Configuration; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -256,7 +255,7 @@ public class Main { * Returns the directory for the given module (by name). */ static Path directoryFor(String name) { - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); ResolvedModule resolvedModule = cf.findModule(name).orElse(null); if (resolvedModule == null) throw new RuntimeException("not found: " + name); diff --git a/jdk/test/java/lang/ClassLoader/getResource/automaticmodules/Main.java b/jdk/test/java/lang/ClassLoader/getResource/automaticmodules/Main.java index afde3d56bf5..8141e9977bc 100644 --- a/jdk/test/java/lang/ClassLoader/getResource/automaticmodules/Main.java +++ b/jdk/test/java/lang/ClassLoader/getResource/automaticmodules/Main.java @@ -26,7 +26,6 @@ import java.io.InputStream; import java.lang.module.ModuleReader; import java.lang.module.ModuleReference; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.net.URL; import java.util.Enumeration; @@ -74,7 +73,7 @@ public class Main { public static void main(String[] args) throws Exception { String mn = args[0]; - ModuleReference mref = Layer.boot() + ModuleReference mref = ModuleLayer.boot() .configuration() .findModule(mn) .map(ResolvedModule::reference) diff --git a/jdk/test/java/lang/ClassLoader/getResource/modules/Main.java b/jdk/test/java/lang/ClassLoader/getResource/modules/Main.java index e816f31fc8b..405132067db 100644 --- a/jdk/test/java/lang/ClassLoader/getResource/modules/Main.java +++ b/jdk/test/java/lang/ClassLoader/getResource/modules/Main.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.lang.module.Configuration; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.io.IOException; import java.net.URL; import java.nio.file.Files; @@ -309,7 +308,7 @@ public class Main { * Returns the directory for the given module (by name). */ static Path directoryFor(String mn) { - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); ResolvedModule resolvedModule = cf.findModule(mn).orElse(null); if (resolvedModule == null) throw new RuntimeException("not found: " + mn); diff --git a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java b/jdk/test/java/lang/ModuleLayer/BasicLayerTest.java similarity index 85% rename from jdk/test/java/lang/reflect/Layer/BasicLayerTest.java rename to jdk/test/java/lang/ModuleLayer/BasicLayerTest.java index 9478cac7861..eb5eeb8a256 100644 --- a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java +++ b/jdk/test/java/lang/ModuleLayer/BasicLayerTest.java @@ -28,16 +28,13 @@ * @build BasicLayerTest ModuleUtils * @compile layertest/Test.java * @run testng BasicLayerTest - * @summary Basic tests for java.lang.reflect.Layer + * @summary Basic tests for java.lang.ModuleLayer */ import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.LayerInstantiationException; -import java.lang.reflect.Module; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -63,10 +60,10 @@ public class BasicLayerTest { } /** - * Exercise Layer.empty() + * Exercise ModuleLayer.empty() */ public void testEmpty() { - Layer emptyLayer = Layer.empty(); + ModuleLayer emptyLayer = ModuleLayer.empty(); assertTrue(emptyLayer.parents().isEmpty()); @@ -84,10 +81,10 @@ public class BasicLayerTest { /** - * Exercise Layer.boot() + * Exercise ModuleLayer.boot() */ public void testBoot() { - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); // configuration Configuration cf = bootLayer.configuration(); @@ -114,12 +111,12 @@ public class BasicLayerTest { // parents assertTrue(bootLayer.parents().size() == 1); - assertTrue(bootLayer.parents().get(0) == Layer.empty()); + assertTrue(bootLayer.parents().get(0) == ModuleLayer.empty()); } /** - * Exercise Layer defineModules, created with empty layer as parent + * Exercise defineModules, created with empty layer as parent */ public void testLayerOnEmpty() { ModuleDescriptor descriptor1 = newBuilder("m1") @@ -148,7 +145,7 @@ public class BasicLayerTest { map.put("m2", loader2); map.put("m3", loader3); - Layer layer = Layer.empty().defineModules(cf, map::get); + ModuleLayer layer = ModuleLayer.empty().defineModules(cf, map::get); // configuration assertTrue(layer.configuration() == cf); @@ -193,12 +190,12 @@ public class BasicLayerTest { // parents assertTrue(layer.parents().size() == 1); - assertTrue(layer.parents().get(0) == Layer.empty()); + assertTrue(layer.parents().get(0) == ModuleLayer.empty()); } /** - * Exercise Layer defineModules, created with boot layer as parent + * Exercise defineModules, created with boot layer as parent */ public void testLayerOnBoot() { ModuleDescriptor descriptor1 = newBuilder("m1") @@ -214,12 +211,12 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = resolve(parent, finder, "m1"); ClassLoader loader = new ClassLoader() { }; - Layer layer = Layer.boot().defineModules(cf, mn -> loader); + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, mn -> loader); // configuration assertTrue(layer.configuration() == cf); @@ -255,12 +252,12 @@ public class BasicLayerTest { // parents assertTrue(layer.parents().size() == 1); - assertTrue(layer.parents().get(0) == Layer.boot()); + assertTrue(layer.parents().get(0) == ModuleLayer.boot()); } /** - * Exercise Layer defineModules with a configuration of two modules that + * Exercise defineModules with a configuration of two modules that * have the same module-private package. */ public void testPackageContainedInSelfAndOther() { @@ -280,19 +277,19 @@ public class BasicLayerTest { assertTrue(cf.modules().size() == 2); // one loader per module, should be okay - Layer.empty().defineModules(cf, mn -> new ClassLoader() { }); + ModuleLayer.empty().defineModules(cf, mn -> new ClassLoader() { }); // same class loader try { ClassLoader loader = new ClassLoader() { }; - Layer.empty().defineModules(cf, mn -> loader); + ModuleLayer.empty().defineModules(cf, mn -> loader); assertTrue(false); } catch (LayerInstantiationException expected) { } } /** - * Exercise Layer defineModules with a configuration that is a partitioned + * Exercise defineModules with a configuration that is a partitioned * graph. The same package is exported in both partitions. */ public void testSameExportInPartitionedGraph() { @@ -323,7 +320,7 @@ public class BasicLayerTest { assertTrue(cf.modules().size() == 4); // one loader per module - Layer.empty().defineModules(cf, mn -> new ClassLoader() { }); + ModuleLayer.empty().defineModules(cf, mn -> new ClassLoader() { }); // m1 & m2 in one loader, m3 & m4 in another loader ClassLoader loader1 = new ClassLoader() { }; @@ -333,19 +330,19 @@ public class BasicLayerTest { map.put("m2", loader1); map.put("m3", loader2); map.put("m4", loader2); - Layer.empty().defineModules(cf, map::get); + ModuleLayer.empty().defineModules(cf, map::get); // same loader try { ClassLoader loader = new ClassLoader() { }; - Layer.empty().defineModules(cf, mn -> loader); + ModuleLayer.empty().defineModules(cf, mn -> loader); assertTrue(false); } catch (LayerInstantiationException expected) { } } /** - * Exercise Layer defineModules with a configuration with a module that + * Exercise defineModules with a configuration with a module that * contains a package that is the same name as a non-exported package in * a parent layer. */ @@ -362,12 +359,12 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m1")); assertTrue(cf.modules().size() == 1); ClassLoader loader = new ClassLoader() { }; - Layer layer = Layer.boot().defineModules(cf, mn -> loader); + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, mn -> loader); assertTrue(layer.modules().size() == 1); } @@ -395,7 +392,7 @@ public class BasicLayerTest { Configuration cf1 = resolve(finder1, "m2"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); // cf2: m3, m3 requires m2 @@ -409,10 +406,10 @@ public class BasicLayerTest { Configuration cf2 = resolve(cf1, finder2, "m3"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer1.parents().size() == 1); - assertTrue(layer1.parents().get(0) == Layer.empty()); + assertTrue(layer1.parents().get(0) == ModuleLayer.empty()); assertTrue(layer2.parents().size() == 1); assertTrue(layer2.parents().get(0) == layer1); @@ -461,7 +458,7 @@ public class BasicLayerTest { Configuration cf1 = resolve(finder1, "m1"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); // cf2: m2, m3: m2 requires transitive m1, m3 requires m2 @@ -479,10 +476,10 @@ public class BasicLayerTest { Configuration cf2 = resolve(cf1, finder2, "m3"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer1.parents().size() == 1); - assertTrue(layer1.parents().get(0) == Layer.empty()); + assertTrue(layer1.parents().get(0) == ModuleLayer.empty()); assertTrue(layer2.parents().size() == 1); assertTrue(layer2.parents().get(0) == layer1); @@ -528,7 +525,7 @@ public class BasicLayerTest { Configuration cf1 = resolve(finder1, "m1"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); // cf2: m2 requires transitive m1 @@ -542,7 +539,7 @@ public class BasicLayerTest { Configuration cf2 = resolve(cf1, finder2, "m2"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); // cf3: m3 requires m2 @@ -556,10 +553,10 @@ public class BasicLayerTest { Configuration cf3 = resolve(cf2, finder3, "m3"); ClassLoader cl3 = new ClassLoader() { }; - Layer layer3 = layer2.defineModules(cf3, mn -> cl3); + ModuleLayer layer3 = layer2.defineModules(cf3, mn -> cl3); assertTrue(layer1.parents().size() == 1); - assertTrue(layer1.parents().get(0) == Layer.empty()); + assertTrue(layer1.parents().get(0) == ModuleLayer.empty()); assertTrue(layer2.parents().size() == 1); assertTrue(layer2.parents().get(0) == layer1); @@ -612,7 +609,7 @@ public class BasicLayerTest { Configuration cf1 = resolve(finder1, "m2"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); // cf2: m3 requires transitive m2, m4 requires m3 @@ -631,10 +628,10 @@ public class BasicLayerTest { Configuration cf2 = resolve(cf1, finder2, "m3", "m4"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer1.parents().size() == 1); - assertTrue(layer1.parents().get(0) == Layer.empty()); + assertTrue(layer1.parents().get(0) == ModuleLayer.empty()); assertTrue(layer2.parents().size() == 1); assertTrue(layer2.parents().get(0) == layer1); @@ -691,7 +688,7 @@ public class BasicLayerTest { Configuration cf = resolve(finder1, "m1", "m2"); ClassLoader cl = new ClassLoader() { }; - Layer layer = Layer.empty().defineModules(cf, mn -> cl); + ModuleLayer layer = ModuleLayer.empty().defineModules(cf, mn -> cl); assertTrue(layer.modules().size() == 2); Module m1 = layer.findModule("m1").get(); @@ -724,7 +721,7 @@ public class BasicLayerTest { Configuration cf = resolve(finder1, "m2"); ClassLoader cl = new ClassLoader() { }; - Layer layer = Layer.empty().defineModules(cf, mn -> cl); + ModuleLayer layer = ModuleLayer.empty().defineModules(cf, mn -> cl); assertTrue(layer.modules().size() == 2); Module m1 = layer.findModule("m1").get(); @@ -750,7 +747,7 @@ public class BasicLayerTest { ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); Configuration cf1 = resolve(finder1, "m1"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); assertTrue(layer1.modules().size() == 1); // create layer2 with m2 @@ -760,7 +757,7 @@ public class BasicLayerTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2); Configuration cf2 = resolve(cf1, finder2, "m2"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer2.modules().size() == 1); Module m1 = layer1.findModule("m1").get(); @@ -786,7 +783,7 @@ public class BasicLayerTest { ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); Configuration cf1 = resolve(finder1, "m1"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); assertTrue(layer1.modules().size() == 1); // create layer2 with m2 @@ -797,7 +794,7 @@ public class BasicLayerTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2); Configuration cf2 = resolve(cf1, finder2, "m2"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer2.modules().size() == 1); Module m1 = layer1.findModule("m1").get(); @@ -822,7 +819,7 @@ public class BasicLayerTest { ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); Configuration cf1 = resolve(finder1, "m1"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); assertTrue(layer1.modules().size() == 1); // create layer2 with m1 and m2 @@ -830,7 +827,7 @@ public class BasicLayerTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1, descriptor2); Configuration cf2 = resolve(cf1, finder2, "m1", "m2"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer2.modules().size() == 2); Module m1_v1 = layer1.findModule("m1").get(); @@ -860,7 +857,7 @@ public class BasicLayerTest { ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2); Configuration cf1 = resolve(finder1, "m2"); ClassLoader loader1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> loader1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> loader1); assertTrue(layer1.modules().size() == 2); // create layer2 with m1 and m3 @@ -871,7 +868,7 @@ public class BasicLayerTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor1, descriptor3); Configuration cf2 = resolve(cf1, finder2, "m1", "m3"); ClassLoader loader2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> loader2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> loader2); assertTrue(layer2.modules().size() == 2); Module m1_v1 = layer1.findModule("m1").get(); @@ -902,7 +899,7 @@ public class BasicLayerTest { ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); Configuration cf1 = resolve(finder1, "m1"); ClassLoader cl1 = new ClassLoader() { }; - Layer layer1 = Layer.empty().defineModules(cf1, mn -> cl1); + ModuleLayer layer1 = ModuleLayer.empty().defineModules(cf1, mn -> cl1); assertTrue(layer1.modules().size() == 1); // create layer2 with m2 @@ -912,7 +909,7 @@ public class BasicLayerTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2); Configuration cf2 = resolve(cf1, finder2, "m2"); ClassLoader cl2 = new ClassLoader() { }; - Layer layer2 = layer1.defineModules(cf2, mn -> cl2); + ModuleLayer layer2 = layer1.defineModules(cf2, mn -> cl2); assertTrue(layer2.modules().size() == 1); Module m1 = layer1.findModule("m1").get(); @@ -924,9 +921,9 @@ public class BasicLayerTest { } /** - * Attempt to use Layer defineModules to create a layer with a module - * defined to a class loader that already has a module of the same name - * defined to the class loader. + * Attempt to use defineModules to create a layer with a module defined + * to a class loader that already has a module of the same name defined + * to the class loader. */ @Test(expectedExceptions = { LayerInstantiationException.class }) public void testModuleAlreadyDefinedToLoader() { @@ -937,24 +934,24 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(md); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m")); ClassLoader loader = new ClassLoader() { }; - Layer.boot().defineModules(cf, mn -> loader); + ModuleLayer.boot().defineModules(cf, mn -> loader); // should throw LayerInstantiationException as m1 already defined to loader - Layer.boot().defineModules(cf, mn -> loader); + ModuleLayer.boot().defineModules(cf, mn -> loader); } /** - * Attempt to use Layer defineModules to create a Layer with a module - * containing package {@code p} where the class loader already has a module - * defined to it containing package {@code p}. + * Attempt to use defineModules to create a layer with a module containing + * package {@code p} where the class loader already has a module defined + * to it containing package {@code p}. */ @Test(expectedExceptions = { LayerInstantiationException.class }) public void testPackageAlreadyInNamedModule() { @@ -975,24 +972,24 @@ public class BasicLayerTest { // define m1 containing package p to class loader - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf1 = parent.resolve(finder, ModuleFinder.of(), Set.of("m1")); - Layer layer1 = Layer.boot().defineModules(cf1, mn -> loader); + ModuleLayer layer1 = ModuleLayer.boot().defineModules(cf1, mn -> loader); // attempt to define m2 containing package p to class loader Configuration cf2 = parent.resolve(finder, ModuleFinder.of(), Set.of("m2")); // should throw exception because p already in m1 - Layer layer2 = Layer.boot().defineModules(cf2, mn -> loader); + ModuleLayer layer2 = ModuleLayer.boot().defineModules(cf2, mn -> loader); } /** - * Attempt to use Layer defineModules to create a Layer with a module + * Attempt to use defineModules to create a layer with a module * containing a package in which a type is already loaded by the class * loader. */ @@ -1009,15 +1006,15 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(md); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m")); - Layer.boot().defineModules(cf, mn -> c.getClassLoader()); + ModuleLayer.boot().defineModules(cf, mn -> c.getClassLoader()); } /** - * Attempt to create a Layer with a module named "java.base". + * Attempt to create a layer with a module named "java.base". */ public void testLayerWithJavaBase() { ModuleDescriptor descriptor = newBuilder("java.base") @@ -1026,7 +1023,7 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor); - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("java.base")); assertTrue(cf.modules().size() == 1); @@ -1034,17 +1031,17 @@ public class BasicLayerTest { ClassLoader scl = ClassLoader.getSystemClassLoader(); try { - Layer.boot().defineModules(cf, mn -> new ClassLoader() { }); + ModuleLayer.boot().defineModules(cf, mn -> new ClassLoader() { }); assertTrue(false); } catch (LayerInstantiationException e) { } try { - Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); assertTrue(false); } catch (LayerInstantiationException e) { } try { - Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); assertTrue(false); } catch (LayerInstantiationException e) { } } @@ -1056,7 +1053,7 @@ public class BasicLayerTest { } /** - * Attempt to create a Layer with a module containing a "java" package. + * Attempt to create a layer with a module containing a "java" package. * This should only be allowed when the module is defined to the platform * class loader. */ @@ -1065,7 +1062,7 @@ public class BasicLayerTest { ModuleDescriptor descriptor = newBuilder(mn).packages(Set.of(pn)).build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor); - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of(mn)); assertTrue(cf.modules().size() == 1); @@ -1074,33 +1071,33 @@ public class BasicLayerTest { ClassLoader scl = ClassLoader.getSystemClassLoader(); try { - Layer.boot().defineModules(cf, _mn -> new ClassLoader() { }); + ModuleLayer.boot().defineModules(cf, _mn -> new ClassLoader() { }); assertTrue(false); } catch (LayerInstantiationException e) { } try { - Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); assertTrue(false); } catch (LayerInstantiationException e) { } try { - Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); assertTrue(false); } catch (LayerInstantiationException e) { } // create layer with module defined to platform class loader - Layer layer = Layer.boot().defineModules(cf, _mn -> pcl); + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, _mn -> pcl); Optional om = layer.findModule(mn); assertTrue(om.isPresent()); Module foo = om.get(); assertTrue(foo.getClassLoader() == pcl); - assertTrue(foo.getPackages().length == 1); - assertTrue(foo.getPackages()[0].equals(pn)); + assertTrue(foo.getPackages().size() == 1); + assertTrue(foo.getPackages().iterator().next().equals(pn)); } /** - * Attempt to create a Layer with a module defined to the boot loader + * Attempt to create a layer with a module defined to the boot loader */ @Test(expectedExceptions = { LayerInstantiationException.class }) public void testLayerWithBootLoader() { @@ -1109,50 +1106,47 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor); - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1")); assertTrue(cf.modules().size() == 1); - Layer.boot().defineModules(cf, mn -> null ); + ModuleLayer.boot().defineModules(cf, mn -> null ); } /** - * Parent of configuration != configuration of parent Layer + * Parent of configuration != configuration of parent layer */ @Test(expectedExceptions = { IllegalArgumentException.class }) public void testIncorrectParent1() { - ModuleDescriptor descriptor1 = newBuilder("m1") .requires("java.base") .build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("m1")); ClassLoader loader = new ClassLoader() { }; - Layer.empty().defineModules(cf, mn -> loader); + ModuleLayer.empty().defineModules(cf, mn -> loader); } /** - * Parent of configuration != configuration of parent Layer + * Parent of configuration != configuration of parent layer */ @Test(expectedExceptions = { IllegalArgumentException.class }) public void testIncorrectParent2() { - - ModuleDescriptor descriptor1 = newBuilder("m1") - .build(); + ModuleDescriptor descriptor1 = newBuilder("m1").build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1); Configuration cf = resolve(finder, "m1"); ClassLoader loader = new ClassLoader() { }; - Layer.boot().defineModules(cf, mn -> loader); + ModuleLayer.boot().defineModules(cf, mn -> loader); } @@ -1161,35 +1155,35 @@ public class BasicLayerTest { @Test(expectedExceptions = { NullPointerException.class }) public void testCreateWithNull1() { ClassLoader loader = new ClassLoader() { }; - Layer.empty().defineModules(null, mn -> loader); + ModuleLayer.empty().defineModules(null, mn -> loader); } @Test(expectedExceptions = { NullPointerException.class }) public void testCreateWithNull2() { - Configuration cf = resolve(Layer.boot().configuration(), ModuleFinder.of()); - Layer.boot().defineModules(cf, null); + Configuration cf = resolve(ModuleLayer.boot().configuration(), ModuleFinder.of()); + ModuleLayer.boot().defineModules(cf, null); } @Test(expectedExceptions = { NullPointerException.class }) public void testCreateWithNull3() { ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer.empty().defineModulesWithOneLoader(null, scl); + ModuleLayer.empty().defineModulesWithOneLoader(null, scl); } @Test(expectedExceptions = { NullPointerException.class }) public void testCreateWithNull4() { ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer.empty().defineModulesWithManyLoaders(null, scl); + ModuleLayer.empty().defineModulesWithManyLoaders(null, scl); } @Test(expectedExceptions = { NullPointerException.class }) public void testFindModuleWithNull() { - Layer.boot().findModule(null); + ModuleLayer.boot().findModule(null); } @Test(expectedExceptions = { NullPointerException.class }) public void testFindLoaderWithNull() { - Layer.boot().findLoader(null); + ModuleLayer.boot().findLoader(null); } @@ -1198,7 +1192,7 @@ public class BasicLayerTest { @Test(expectedExceptions = { UnsupportedOperationException.class }) public void testImmutableSet() { Module base = Object.class.getModule(); - Layer.boot().modules().add(base); + ModuleLayer.boot().modules().add(base); } diff --git a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java similarity index 88% rename from jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java rename to jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java index ac6c035c297..a67555a47b1 100644 --- a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java +++ b/jdk/test/java/lang/ModuleLayer/LayerAndLoadersTest.java @@ -27,7 +27,7 @@ * @modules jdk.compiler * @build LayerAndLoadersTest CompilerUtils ModuleUtils * @run testng LayerAndLoadersTest - * @summary Tests for java.lang.reflect.Layer@createWithXXX methods + * @summary Tests for java.lang.ModuleLayer@defineModulesWithXXX methods */ import java.io.IOException; @@ -36,10 +36,7 @@ import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; -import java.lang.reflect.Layer; -import java.lang.reflect.LayerInstantiationException; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; @@ -74,7 +71,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer defineModulesWithOneLoader + * Basic test of ModuleLayer.defineModulesWithOneLoader * * Test scenario: * m1 requires m2 and m3 @@ -85,7 +82,7 @@ public class LayerAndLoadersTest { ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); checkLayer(layer, "m1", "m2", "m3"); @@ -103,7 +100,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer defineModulesWithManyLoaders + * Basic test of ModuleLayer.defineModulesWithManyLoaders * * Test scenario: * m1 requires m2 and m3 @@ -114,7 +111,7 @@ public class LayerAndLoadersTest { ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); checkLayer(layer, "m1", "m2", "m3"); @@ -135,8 +132,8 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer defineModulesWithOneLoader where one of the modules - * is a service provider module. + * Basic test of ModuleLayer.defineModulesWithOneLoader where one of the + * modules is a service provider module. * * Test scenario: * m1 requires m2 and m3 @@ -149,7 +146,7 @@ public class LayerAndLoadersTest { ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); checkLayer(layer, "m1", "m2", "m3", "m4"); @@ -176,7 +173,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer defineModulesWithManyLoaders where one of the + * Basic test of ModuleLayer.defineModulesWithManyLoaders where one of the * modules is a service provider module. * * Test scenario: @@ -190,7 +187,7 @@ public class LayerAndLoadersTest { ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); checkLayer(layer, "m1", "m2", "m3", "m4"); @@ -239,19 +236,19 @@ public class LayerAndLoadersTest { String cn = this.getClass().getName(); // one loader - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, parent); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, parent); testLoad(layer, cn); // one loader with boot loader as parent - layer = Layer.boot().defineModulesWithOneLoader(cf, null); + layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, null); testLoadFail(layer, cn); // many loaders - layer = Layer.boot().defineModulesWithManyLoaders(cf, parent); + layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, parent); testLoad(layer, cn); // many loader with boot loader as parent - layer = Layer.boot().defineModulesWithManyLoaders(cf, null); + layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, null); testLoadFail(layer, cn); } @@ -274,25 +271,25 @@ public class LayerAndLoadersTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); - Configuration cf = Layer.boot() + Configuration cf = ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2")); // cannot define both module m1 and m2 to the same class loader try { - Layer.boot().defineModulesWithOneLoader(cf, null); + ModuleLayer.boot().defineModulesWithOneLoader(cf, null); assertTrue(false); } catch (LayerInstantiationException expected) { } // should be okay to have one module per class loader - Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, null); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, null); checkLayer(layer, "m1", "m2"); } /** - * Test Layer defineModulesWithXXX with split delegation. + * Test ModuleLayer.defineModulesWithXXX with split delegation. * * Test scenario: * layer1: m1 exports p, m2 exports p @@ -308,11 +305,11 @@ public class LayerAndLoadersTest { ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2); - Configuration cf1 = Layer.boot() + Configuration cf1 = ModuleLayer.boot() .configuration() .resolve(finder1, ModuleFinder.of(), Set.of("m1", "m2")); - Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null); checkLayer(layer1, "m1", "m2"); ModuleDescriptor descriptor3 @@ -333,14 +330,14 @@ public class LayerAndLoadersTest { } catch (LayerInstantiationException expected) { } // no split delegation when modules have their own class loader - Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); + ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); checkLayer(layer2, "m3", "m4"); } /** - * Test Layer defineModulesWithXXX when the modules that override same + * Test ModuleLayer.defineModulesWithXXX when the modules that override same * named modules in the parent layer. * * Test scenario: @@ -351,14 +348,14 @@ public class LayerAndLoadersTest { Configuration cf1 = resolve("m1"); - Layer layer1 = Layer.boot().defineModulesWithOneLoader(cf1, null); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithOneLoader(cf1, null); checkLayer(layer1, "m1", "m2", "m3"); ModuleFinder finder = ModuleFinder.of(MODS_DIR); Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(), Set.of("m1")); - Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null); + ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, null); checkLayer(layer2, "m1", "m2", "m3"); invoke(layer1, "m1", "p.Main"); @@ -400,14 +397,14 @@ public class LayerAndLoadersTest { Configuration cf1 = resolve("m1"); - Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null); checkLayer(layer1, "m1", "m2", "m3"); ModuleFinder finder = ModuleFinder.of(MODS_DIR); Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(), Set.of("m1")); - Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); + ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); checkLayer(layer2, "m1", "m2", "m3"); invoke(layer1, "m1", "p.Main"); @@ -484,7 +481,7 @@ public class LayerAndLoadersTest { /** - * Test Layer defineModulesWithXXX when the modules that override same + * Test ModuleLayer.defineModulesWithXXX when the modules that override same * named modules in the parent layer. * * layer1: m1, m2, m3 => same loader @@ -494,7 +491,7 @@ public class LayerAndLoadersTest { Configuration cf1 = resolve("m1"); - Layer layer1 = Layer.boot().defineModulesWithOneLoader(cf1, null); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithOneLoader(cf1, null); checkLayer(layer1, "m1", "m2", "m3"); ModuleFinder finder = finderFor("m1", "m3"); @@ -502,7 +499,7 @@ public class LayerAndLoadersTest { Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(), Set.of("m1")); - Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null); + ModuleLayer layer2 = layer1.defineModulesWithOneLoader(cf2, null); checkLayer(layer2, "m1", "m3"); invoke(layer1, "m1", "p.Main"); @@ -531,7 +528,7 @@ public class LayerAndLoadersTest { Configuration cf1 = resolve("m1"); - Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null); + ModuleLayer layer1 = ModuleLayer.boot().defineModulesWithManyLoaders(cf1, null); checkLayer(layer1, "m1", "m2", "m3"); ModuleFinder finder = finderFor("m1", "m3"); @@ -539,7 +536,7 @@ public class LayerAndLoadersTest { Configuration cf2 = cf1.resolve(finder, ModuleFinder.of(), Set.of("m1")); - Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); + ModuleLayer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); checkLayer(layer2, "m1", "m3"); invoke(layer1, "m1", "p.Main"); @@ -579,7 +576,7 @@ public class LayerAndLoadersTest { public void testResourcesOneLoader() throws Exception { Configuration cf = resolve("m1"); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); ClassLoader loader = layer.findLoader("m1"); testResourceLoading(loader, "p/Main.class"); } @@ -591,7 +588,7 @@ public class LayerAndLoadersTest { public void testResourcesManyLoaders() throws Exception { Configuration cf = resolve("m1"); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); ClassLoader loader = layer.findLoader("m1"); testResourceLoading(loader, "p/Main.class"); } @@ -623,7 +620,7 @@ public class LayerAndLoadersTest { */ private static Configuration resolve(String... roots) { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - return Layer.boot() + return ModuleLayer.boot() .configuration() .resolve(finder, ModuleFinder.of(), Set.of(roots)); } @@ -634,7 +631,7 @@ public class LayerAndLoadersTest { */ private static Configuration resolveAndBind(String... roots) { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - return Layer.boot() + return ModuleLayer.boot() .configuration() .resolveAndBind(finder, ModuleFinder.of(), Set.of(roots)); } @@ -644,7 +641,7 @@ public class LayerAndLoadersTest { * Invokes the static void main(String[]) method on the given class * in the given module. */ - private static void invoke(Layer layer, String mn, String mc) throws Exception { + private static void invoke(ModuleLayer layer, String mn, String mc) throws Exception { ClassLoader loader = layer.findLoader(mn); Class c = loader.loadClass(mc); Method mainMethod = c.getMethod("main", String[].class); @@ -656,7 +653,7 @@ public class LayerAndLoadersTest { * Checks that the given layer contains exactly the expected modules * (by name). */ - private void checkLayer(Layer layer, String ... expected) { + private void checkLayer(ModuleLayer layer, String ... expected) { Set names = layer.modules().stream() .map(Module::getName) .collect(Collectors.toSet()); @@ -671,7 +668,7 @@ public class LayerAndLoadersTest { * Test that a class can be loaded via the class loader of all modules * in the given layer. */ - static void testLoad(Layer layer, String cn) throws Exception { + static void testLoad(ModuleLayer layer, String cn) throws Exception { for (Module m : layer.modules()) { ClassLoader l = m.getClassLoader(); l.loadClass(cn); @@ -683,7 +680,7 @@ public class LayerAndLoadersTest { * Test that a class cannot be loaded via any of the class loaders of * the modules in the given layer. */ - static void testLoadFail(Layer layer, String cn) throws Exception { + static void testLoadFail(ModuleLayer layer, String cn) throws Exception { for (Module m : layer.modules()) { ClassLoader l = m.getClassLoader(); try { diff --git a/jdk/test/java/lang/reflect/Layer/LayerControllerTest.java b/jdk/test/java/lang/ModuleLayer/LayerControllerTest.java similarity index 88% rename from jdk/test/java/lang/reflect/Layer/LayerControllerTest.java rename to jdk/test/java/lang/ModuleLayer/LayerControllerTest.java index 4e4a0dbd5bd..28246cf9b66 100644 --- a/jdk/test/java/lang/reflect/Layer/LayerControllerTest.java +++ b/jdk/test/java/lang/ModuleLayer/LayerControllerTest.java @@ -26,14 +26,12 @@ * @library /lib/testlibrary * @build LayerControllerTest ModuleUtils * @run testng LayerControllerTest - * @summary Basic tests for java.lang.reflect.Layer.Controller + * @summary Basic tests for java.lang.ModuleLayer.Controller */ import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.List; import java.util.Set; @@ -48,7 +46,7 @@ public class LayerControllerTest { * Module m1 contains p1, reads java.base, does not export/open any package * Module m2 contains p2, reads java.base, does not export/open any package */ - private Layer.Controller createTestLayer() { + private ModuleLayer.Controller createTestLayer() { ModuleDescriptor descriptor1 = ModuleDescriptor.newModule("m1") .packages(Set.of("p1")) @@ -62,17 +60,17 @@ public class LayerControllerTest { .build(); ModuleFinder finder = ModuleUtils.finderOf(descriptor1, descriptor2); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer.configuration() .resolve(finder, ModuleFinder.of(), Set.of("m1", "m2")); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer.Controller controller - = Layer.defineModulesWithOneLoader(cf, List.of(bootLayer), scl); + ModuleLayer.Controller controller + = ModuleLayer.defineModulesWithOneLoader(cf, List.of(bootLayer), scl); - Layer layer = controller.layer(); + ModuleLayer layer = controller.layer(); assertTrue(layer.modules().size() == 2); assertTrue(layer.findModule("m1").isPresent()); @@ -82,12 +80,12 @@ public class LayerControllerTest { } /** - * Basic test of Layer.Controller to update modules m1 and m2 to read and + * Basic test of Controller to update modules m1 and m2 to read and * open packages to each other. */ public void testBasic() { - Layer.Controller controller = createTestLayer(); - Layer layer = controller.layer(); + ModuleLayer.Controller controller = createTestLayer(); + ModuleLayer layer = controller.layer(); Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new); Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new); @@ -132,8 +130,8 @@ public class LayerControllerTest { * Test invalid argument handling */ public void testBadArguments() { - Layer.Controller controller = createTestLayer(); - Layer layer = controller.layer(); + ModuleLayer.Controller controller = createTestLayer(); + ModuleLayer layer = controller.layer(); Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new); Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new); Module base = Object.class.getModule(); @@ -161,8 +159,8 @@ public class LayerControllerTest { * Test null handling */ public void testNulls() { - Layer.Controller controller = createTestLayer(); - Layer layer = controller.layer(); + ModuleLayer.Controller controller = createTestLayer(); + ModuleLayer layer = controller.layer(); Module m1 = layer.findModule("m1").orElseThrow(RuntimeException::new); Module m2 = layer.findModule("m2").orElseThrow(RuntimeException::new); assertTrue(m1 != null); diff --git a/jdk/test/java/lang/reflect/Layer/layertest/Test.java b/jdk/test/java/lang/ModuleLayer/layertest/Test.java similarity index 95% rename from jdk/test/java/lang/reflect/Layer/layertest/Test.java rename to jdk/test/java/lang/ModuleLayer/layertest/Test.java index f5c76ccbde5..5eac638e992 100644 --- a/jdk/test/java/lang/reflect/Layer/layertest/Test.java +++ b/jdk/test/java/lang/ModuleLayer/layertest/Test.java @@ -22,7 +22,7 @@ */ /** - * Supporting class for tests of java.lang.reflect.Layer. + * Supporting class for tests of java.lang.ModuleLayer. */ package layertest; diff --git a/jdk/test/java/lang/reflect/Layer/src/m1/module-info.java b/jdk/test/java/lang/ModuleLayer/src/m1/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m1/module-info.java rename to jdk/test/java/lang/ModuleLayer/src/m1/module-info.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m1/p/Main.java b/jdk/test/java/lang/ModuleLayer/src/m1/p/Main.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m1/p/Main.java rename to jdk/test/java/lang/ModuleLayer/src/m1/p/Main.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m1/p/Service.java b/jdk/test/java/lang/ModuleLayer/src/m1/p/Service.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m1/p/Service.java rename to jdk/test/java/lang/ModuleLayer/src/m1/p/Service.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m2/module-info.java b/jdk/test/java/lang/ModuleLayer/src/m2/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m2/module-info.java rename to jdk/test/java/lang/ModuleLayer/src/m2/module-info.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m2/q/Hello.java b/jdk/test/java/lang/ModuleLayer/src/m2/q/Hello.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m2/q/Hello.java rename to jdk/test/java/lang/ModuleLayer/src/m2/q/Hello.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m3/module-info.java b/jdk/test/java/lang/ModuleLayer/src/m3/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m3/module-info.java rename to jdk/test/java/lang/ModuleLayer/src/m3/module-info.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m3/w/Hello.java b/jdk/test/java/lang/ModuleLayer/src/m3/w/Hello.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m3/w/Hello.java rename to jdk/test/java/lang/ModuleLayer/src/m3/w/Hello.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m4/impl/ServiceImpl.java b/jdk/test/java/lang/ModuleLayer/src/m4/impl/ServiceImpl.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m4/impl/ServiceImpl.java rename to jdk/test/java/lang/ModuleLayer/src/m4/impl/ServiceImpl.java diff --git a/jdk/test/java/lang/reflect/Layer/src/m4/module-info.java b/jdk/test/java/lang/ModuleLayer/src/m4/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Layer/src/m4/module-info.java rename to jdk/test/java/lang/ModuleLayer/src/m4/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/AddExportsTest.java b/jdk/test/java/lang/ModuleTests/AddExportsTest.java similarity index 97% rename from jdk/test/java/lang/reflect/Module/AddExportsTest.java rename to jdk/test/java/lang/ModuleTests/AddExportsTest.java index 3f4453614e8..e1204615e74 100644 --- a/jdk/test/java/lang/reflect/Module/AddExportsTest.java +++ b/jdk/test/java/lang/ModuleTests/AddExportsTest.java @@ -30,8 +30,6 @@ * @summary Test Module isExported methods with exports changed by -AddExportsTest */ -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.Optional; import java.util.stream.Stream; @@ -55,7 +53,7 @@ public class AddExportsTest { assertTrue(oaddExports.isPresent()); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Module unnamedModule = AddExportsTest.class.getModule(); assertFalse(unnamedModule.isNamed()); diff --git a/jdk/test/java/lang/reflect/Module/AnnotationsTest.java b/jdk/test/java/lang/ModuleTests/AnnotationsTest.java similarity index 95% rename from jdk/test/java/lang/reflect/Module/AnnotationsTest.java rename to jdk/test/java/lang/ModuleTests/AnnotationsTest.java index d30a0c07779..b4319a7bb11 100644 --- a/jdk/test/java/lang/reflect/Module/AnnotationsTest.java +++ b/jdk/test/java/lang/ModuleTests/AnnotationsTest.java @@ -26,8 +26,6 @@ import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.nio.file.Files; import java.nio.file.Path; @@ -102,7 +100,7 @@ public class AnnotationsTest { boolean forRemoval, String since, Path output) throws IOException { - Module module = Layer.boot().findModule(name).orElse(null); + Module module = ModuleLayer.boot().findModule(name).orElse(null); assertNotNull(module, name + " not found"); InputStream in = module.getResourceAsStream("module-info.class"); @@ -141,13 +139,13 @@ public class AnnotationsTest { static Module loadModule(Path dir, String name) throws IOException { ModuleFinder finder = ModuleFinder.of(dir); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer.configuration() .resolve(finder, ModuleFinder.of(), Set.of(name)); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl); Module module = layer.findModule(name).orElse(null); assertNotNull(module, name + " not loaded"); diff --git a/jdk/test/java/lang/reflect/Module/BasicModuleTest.java b/jdk/test/java/lang/ModuleTests/BasicModuleTest.java similarity index 93% rename from jdk/test/java/lang/reflect/Module/BasicModuleTest.java rename to jdk/test/java/lang/ModuleTests/BasicModuleTest.java index 90fb62b4a2e..b2f5eaa3a14 100644 --- a/jdk/test/java/lang/reflect/Module/BasicModuleTest.java +++ b/jdk/test/java/lang/ModuleTests/BasicModuleTest.java @@ -23,8 +23,6 @@ import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.nio.file.spi.FileSystemProvider; // service type in java.base import java.util.function.Predicate; import java.util.stream.Stream; @@ -35,7 +33,7 @@ import static org.testng.Assert.*; /* * @test - * @summary Basic test of java.lang.reflect.Module + * @summary Basic test of java.lang.Module * @modules java.desktop java.xml * @run testng BasicModuleTest */ @@ -43,10 +41,10 @@ import static org.testng.Assert.*; public class BasicModuleTest { /** - * Tests that the given module reads all modules in the boot Layer. + * Tests that the given module reads all modules in the boot layer. */ private void testReadsAllBootModules(Module m) { - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); bootLayer.configuration() .modules() .stream() @@ -55,13 +53,6 @@ public class BasicModuleTest { .forEach(target -> assertTrue(m.canRead(target.get()))); } - /** - * Returns {@code true} if the array contains the given object. - */ - private boolean contains(T[] array, T obj) { - return Stream.of(array).anyMatch(obj::equals); - } - /** * Returns a {@code Predicate} to test if a package is exported. */ @@ -103,7 +94,7 @@ public class BasicModuleTest { assertTrue(thisModule.isExported("p", baseModule)); // this test is in the unnamed package - assertTrue(contains(thisModule.getPackages(), "")); + assertTrue(thisModule.getPackages().contains("")); } @@ -162,13 +153,13 @@ public class BasicModuleTest { assertTrue(base.getClassLoader() == null); // getLayer - assertTrue(base.getLayer() == Layer.boot()); + assertTrue(base.getLayer() == ModuleLayer.boot()); // toString assertEquals(base.toString(), "module java.base"); // getPackages - assertTrue(contains(base.getPackages(), "java.lang")); + assertTrue(base.getPackages().contains("java.lang")); // canRead assertTrue(base.canRead(base)); @@ -258,14 +249,14 @@ public class BasicModuleTest { assertTrue(desktop.getClassLoader() == null); // getLayer - assertTrue(desktop.getLayer() == Layer.boot()); + assertTrue(desktop.getLayer() == ModuleLayer.boot()); // toString assertEquals(desktop.toString(), "module java.desktop"); // getPackages - assertTrue(contains(desktop.getPackages(), "java.awt")); - assertTrue(contains(desktop.getPackages(), "sun.awt")); + assertTrue(desktop.getPackages().contains("java.awt")); + assertTrue(desktop.getPackages().contains("sun.awt")); // canRead assertTrue(desktop.canRead(base)); diff --git a/jdk/test/java/lang/reflect/Module/WithSecurityManager.java b/jdk/test/java/lang/ModuleTests/WithSecurityManager.java similarity index 92% rename from jdk/test/java/lang/reflect/Module/WithSecurityManager.java rename to jdk/test/java/lang/ModuleTests/WithSecurityManager.java index 794ebf00e44..88813c859ac 100644 --- a/jdk/test/java/lang/reflect/Module/WithSecurityManager.java +++ b/jdk/test/java/lang/ModuleTests/WithSecurityManager.java @@ -24,7 +24,7 @@ /** * @test * @modules jdk.compiler - * @summary Test java.lang.reflect.Module methods that specify permission checks + * @summary Test java.lang.Module methods that specify permission checks * @run main/othervm -Djava.security.policy=${test.src}/allow.policy WithSecurityManager allow * @run main/othervm WithSecurityManager deny */ @@ -34,14 +34,12 @@ import java.io.InputStream; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.Collections; import java.util.Optional; import java.util.Set; /** - * Test java.lang.reflect.Module methods that specify permission checks. + * Test java.lang.Module methods that specify permission checks. */ public class WithSecurityManager { @@ -58,7 +56,7 @@ public class WithSecurityManager { // another module, in a child layer Module other = loadModuleInChildLayer(ANOTHER_MODULE); - assertTrue(other.getLayer() != Layer.boot()); + assertTrue(other.getLayer() != ModuleLayer.boot()); System.setSecurityManager(new SecurityManager()); @@ -123,11 +121,11 @@ public class WithSecurityManager { }; // create a child configuration and layer with this module - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer .configuration() .resolve(finder, ModuleFinder.of(), Set.of(ANOTHER_MODULE)); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, null); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, null); Optional om = layer.findModule(mn); assertTrue("module " + mn + " not in child layer", om.isPresent()); diff --git a/jdk/test/java/lang/reflect/Module/access/AccessTest.java b/jdk/test/java/lang/ModuleTests/access/AccessTest.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/AccessTest.java rename to jdk/test/java/lang/ModuleTests/access/AccessTest.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/target/module-info.java b/jdk/test/java/lang/ModuleTests/access/src/target/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/src/target/module-info.java rename to jdk/test/java/lang/ModuleTests/access/src/target/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/target/p1/Helper.java b/jdk/test/java/lang/ModuleTests/access/src/target/p1/Helper.java similarity index 97% rename from jdk/test/java/lang/reflect/Module/access/src/target/p1/Helper.java rename to jdk/test/java/lang/ModuleTests/access/src/target/p1/Helper.java index e0e45e82a06..cbed4fbaec7 100644 --- a/jdk/test/java/lang/reflect/Module/access/src/target/p1/Helper.java +++ b/jdk/test/java/lang/ModuleTests/access/src/target/p1/Helper.java @@ -23,8 +23,6 @@ package p1; -import java.lang.reflect.Module; - /** * Helper class in target module to allow test invoke addExports[Private] */ diff --git a/jdk/test/java/lang/reflect/Module/access/src/target/p1/Public.java b/jdk/test/java/lang/ModuleTests/access/src/target/p1/Public.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/src/target/p1/Public.java rename to jdk/test/java/lang/ModuleTests/access/src/target/p1/Public.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/target/p2/NonPublic.java b/jdk/test/java/lang/ModuleTests/access/src/target/p2/NonPublic.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/src/target/p2/NonPublic.java rename to jdk/test/java/lang/ModuleTests/access/src/target/p2/NonPublic.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/target/q1/Public.java b/jdk/test/java/lang/ModuleTests/access/src/target/q1/Public.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/src/target/q1/Public.java rename to jdk/test/java/lang/ModuleTests/access/src/target/q1/Public.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/target/q2/NonPublic.java b/jdk/test/java/lang/ModuleTests/access/src/target/q2/NonPublic.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/src/target/q2/NonPublic.java rename to jdk/test/java/lang/ModuleTests/access/src/target/q2/NonPublic.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/test/module-info.java b/jdk/test/java/lang/ModuleTests/access/src/test/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/access/src/test/module-info.java rename to jdk/test/java/lang/ModuleTests/access/src/test/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/access/src/test/test/Main.java b/jdk/test/java/lang/ModuleTests/access/src/test/test/Main.java similarity index 99% rename from jdk/test/java/lang/reflect/Module/access/src/test/test/Main.java rename to jdk/test/java/lang/ModuleTests/access/src/test/test/Main.java index c58b8e202dd..dc81f25a563 100644 --- a/jdk/test/java/lang/reflect/Module/access/src/test/test/Main.java +++ b/jdk/test/java/lang/ModuleTests/access/src/test/test/Main.java @@ -26,9 +26,7 @@ package test; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; /** * Test access to public/non-public members of public/non-public classes in @@ -305,7 +303,7 @@ public class Main { static Module getTargetModule() { - return Layer.boot().findModule("target").get(); + return ModuleLayer.boot().findModule("target").get(); } static void tryAccessConstructor(Constructor ctor, boolean shouldSucceed) { diff --git a/jdk/test/java/lang/reflect/Module/addXXX/Driver.java b/jdk/test/java/lang/ModuleTests/addXXX/Driver.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/Driver.java rename to jdk/test/java/lang/ModuleTests/addXXX/Driver.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m1/module-info.java b/jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m1/module-info.java rename to jdk/test/java/lang/ModuleTests/addXXX/m1/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m1/p1/C.java b/jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m1/p1/C.java rename to jdk/test/java/lang/ModuleTests/addXXX/m1/p1/C.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m2/module-info.java b/jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m2/module-info.java rename to jdk/test/java/lang/ModuleTests/addXXX/m2/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m2/p2/C.java b/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java similarity index 97% rename from jdk/test/java/lang/reflect/Module/addXXX/m2/p2/C.java rename to jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java index 6a87a2eba87..d3c5f467250 100644 --- a/jdk/test/java/lang/reflect/Module/addXXX/m2/p2/C.java +++ b/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/C.java @@ -22,8 +22,6 @@ */ package p2; -import java.lang.reflect.Module; - public class C { public static void export(String pn, Module m) { diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m2/p2/internal/C.java b/jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m2/p2/internal/C.java rename to jdk/test/java/lang/ModuleTests/addXXX/m2/p2/internal/C.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m3/module-info.java b/jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m3/module-info.java rename to jdk/test/java/lang/ModuleTests/addXXX/m3/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m3/p3/C.java b/jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m3/p3/C.java rename to jdk/test/java/lang/ModuleTests/addXXX/m3/p3/C.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m4/module-info.java b/jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m4/module-info.java rename to jdk/test/java/lang/ModuleTests/addXXX/m4/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/m4/p4/C.java b/jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/m4/p4/C.java rename to jdk/test/java/lang/ModuleTests/addXXX/m4/p4/C.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/test/module-info.java b/jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/test/module-info.java rename to jdk/test/java/lang/ModuleTests/addXXX/test/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/test/test/C.java b/jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/test/test/C.java rename to jdk/test/java/lang/ModuleTests/addXXX/test/test/C.java diff --git a/jdk/test/java/lang/reflect/Module/addXXX/test/test/Main.java b/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java similarity index 99% rename from jdk/test/java/lang/reflect/Module/addXXX/test/test/Main.java rename to jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java index 924f0a87de4..9a191a1dcfc 100644 --- a/jdk/test/java/lang/reflect/Module/addXXX/test/test/Main.java +++ b/jdk/test/java/lang/ModuleTests/addXXX/test/test/Main.java @@ -27,7 +27,6 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.reflect.Constructor; -import java.lang.reflect.Module; import java.util.ServiceConfigurationError; import java.util.ServiceLoader; diff --git a/jdk/test/java/lang/reflect/Module/addXXX/test/test/Service.java b/jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/addXXX/test/test/Service.java rename to jdk/test/java/lang/ModuleTests/addXXX/test/test/Service.java diff --git a/jdk/test/java/lang/reflect/Module/allow.policy b/jdk/test/java/lang/ModuleTests/allow.policy similarity index 100% rename from jdk/test/java/lang/reflect/Module/allow.policy rename to jdk/test/java/lang/ModuleTests/allow.policy diff --git a/jdk/test/java/lang/reflect/Module/annotation/Basic.java b/jdk/test/java/lang/ModuleTests/annotation/Basic.java similarity index 98% rename from jdk/test/java/lang/reflect/Module/annotation/Basic.java rename to jdk/test/java/lang/ModuleTests/annotation/Basic.java index 43733782d58..dc17cbb5e4f 100644 --- a/jdk/test/java/lang/reflect/Module/annotation/Basic.java +++ b/jdk/test/java/lang/ModuleTests/annotation/Basic.java @@ -29,7 +29,6 @@ * @summary Basic test for annotations on modules */ -import java.lang.reflect.Module; import java.util.Arrays; import p.annotation.Foo; diff --git a/jdk/test/java/lang/reflect/Module/annotation/src/m/module-info.java b/jdk/test/java/lang/ModuleTests/annotation/src/m/module-info.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/annotation/src/m/module-info.java rename to jdk/test/java/lang/ModuleTests/annotation/src/m/module-info.java diff --git a/jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Bar.java b/jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Bar.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Bar.java rename to jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Bar.java diff --git a/jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Baz.java b/jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Baz.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Baz.java rename to jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Baz.java diff --git a/jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Foo.java b/jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Foo.java similarity index 100% rename from jdk/test/java/lang/reflect/Module/annotation/src/m/p/annotation/Foo.java rename to jdk/test/java/lang/ModuleTests/annotation/src/m/p/annotation/Foo.java diff --git a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java index 1df260bc412..8ecf21b964f 100644 --- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java +++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java @@ -33,7 +33,6 @@ import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; -import java.lang.reflect.Layer; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -82,7 +81,7 @@ public class CheckPackageAccess { void test() { final boolean isModulePresent = - Layer.boot().findModule(moduleName).isPresent(); + ModuleLayer.boot().findModule(moduleName).isPresent(); System.out.format("Testing module: %1$s. Module is%2$s present.\n", moduleName, isModulePresent ? "" : " NOT"); diff --git a/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java b/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java index 6aa14ca9342..7034f114aa3 100644 --- a/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java +++ b/jdk/test/java/lang/SecurityManager/CheckSecurityProvider.java @@ -28,7 +28,6 @@ * @run main/othervm CheckSecurityProvider */ -import java.lang.reflect.Layer; import java.security.Provider; import java.security.Security; import java.util.ArrayList; @@ -45,7 +44,7 @@ import java.util.stream.Stream; */ public class CheckSecurityProvider { public static void main(String[] args) throws Exception { - Layer layer = Layer.boot(); + ModuleLayer layer = ModuleLayer.boot(); System.setSecurityManager(new SecurityManager()); diff --git a/jdk/test/java/lang/SecurityManager/modules/Test.java b/jdk/test/java/lang/SecurityManager/modules/Test.java index 81cf617aa79..db499ff6299 100644 --- a/jdk/test/java/lang/SecurityManager/modules/Test.java +++ b/jdk/test/java/lang/SecurityManager/modules/Test.java @@ -21,8 +21,6 @@ * questions. */ -import java.lang.reflect.Module; - public class Test { public static void main(String... args) { SecurityManager sm = System.getSecurityManager(); diff --git a/jdk/test/java/lang/StackTraceElement/PublicConstructor.java b/jdk/test/java/lang/StackTraceElement/PublicConstructor.java index 254be7825f7..7deb732e4ce 100644 --- a/jdk/test/java/lang/StackTraceElement/PublicConstructor.java +++ b/jdk/test/java/lang/StackTraceElement/PublicConstructor.java @@ -29,7 +29,6 @@ */ import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Module; public class PublicConstructor { public static void main(String... args) { diff --git a/jdk/test/java/lang/StackTraceElement/lib/m1/com/app/Utils.java b/jdk/test/java/lang/StackTraceElement/lib/m1/com/app/Utils.java index 4c571af6833..ef55672ef65 100644 --- a/jdk/test/java/lang/StackTraceElement/lib/m1/com/app/Utils.java +++ b/jdk/test/java/lang/StackTraceElement/lib/m1/com/app/Utils.java @@ -25,7 +25,6 @@ package com.app; import java.lang.StackWalker.StackFrame; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Module; import java.util.Objects; public class Utils { diff --git a/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java b/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java index d1653ca5f1e..4e18babd0b0 100644 --- a/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java +++ b/jdk/test/java/lang/System/Logger/custom/CustomLoggerTest.java @@ -46,7 +46,6 @@ import java.lang.System.LoggerFinder; import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.util.stream.Stream; -import java.lang.reflect.Module; import java.security.AllPermission; /** diff --git a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java index 3db7cef65f8..ae07c7096a7 100644 --- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java +++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinder.java @@ -25,7 +25,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.lang.System.LoggerFinder; import java.lang.System.Logger; -import java.lang.reflect.Module; public class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder { diff --git a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java index cb86e513f90..5e08f15db4b 100644 --- a/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java +++ b/jdk/test/java/lang/System/LoggerFinder/BaseLoggerFinderTest/TestLoggerFinder.java @@ -30,7 +30,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; import java.lang.System.Logger; -import java.lang.reflect.Module; /** * What our test provider needs to implement. diff --git a/jdk/test/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java b/jdk/test/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java index ceab7f43be7..3c8944e437a 100644 --- a/jdk/test/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java +++ b/jdk/test/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java @@ -28,7 +28,6 @@ import java.io.PrintStream; import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.lang.System.LoggerFinder; -import java.lang.reflect.Module; import java.util.Enumeration; import java.util.Locale; import java.util.Objects; diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java index ab80d0f8bc6..ce5e714d95f 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java @@ -55,7 +55,6 @@ import java.util.function.Function; import jdk.internal.logger.DefaultLoggerFinder; import jdk.internal.logger.SimpleConsoleLogger; import sun.util.logging.PlatformLogger; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java index d28481c305f..98ecc69e3d1 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java @@ -47,7 +47,6 @@ import java.lang.System.LoggerFinder; import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.util.stream.Stream; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java index a9e441f9d7c..af15a51eba3 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java @@ -47,7 +47,6 @@ import java.lang.System.Logger.Level; import java.security.AccessControlException; import java.util.stream.Stream; import sun.util.logging.PlatformLogger; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java index 1b6a5c6e145..19b100960e5 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerAPIsTest.java @@ -30,7 +30,6 @@ import java.util.Enumeration; import java.util.List; import java.util.ResourceBundle; import java.util.Set; -import java.lang.reflect.Module; import jdk.internal.logger.BootstrapLogger; import jdk.internal.logger.LazyLoggers; diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java index f34ab76400b..8bc016b1223 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java @@ -43,7 +43,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.logger.BootstrapLogger; import jdk.internal.logger.LazyLoggers; -import java.lang.reflect.Module; /* * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java index be5ad125518..bd70d541a45 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java @@ -51,7 +51,6 @@ import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.util.stream.Stream; import sun.util.logging.PlatformLogger; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java index 6343a90312c..192be7f828f 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java @@ -53,7 +53,6 @@ import java.util.ServiceConfigurationError; import java.util.ServiceLoader; import java.util.concurrent.atomic.AtomicReference; import jdk.internal.logger.SimpleConsoleLogger; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java index 9576e17bed6..c409c22a1a3 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java @@ -49,7 +49,6 @@ import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.util.stream.Stream; import sun.util.logging.PlatformLogger; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java b/jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java index 25be130d8ec..fe0f9e53e3d 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java @@ -28,7 +28,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Layer; import java.lang.reflect.Method; /* @@ -106,7 +105,7 @@ public class SystemLoggerInPlatformLoader { } Class platformLoggerType = platformLogger.getClass(); System.out.println("platformLogger: " + platformLoggerType); - boolean simpleConsoleOnly = !Layer.boot().findModule("java.logging").isPresent(); + boolean simpleConsoleOnly = !ModuleLayer.boot().findModule("java.logging").isPresent(); if (simpleConsoleOnly) { /* Happens if the test is called with custom JDK without java.logging module or in case usage commandline option --limit-modules java.base */ diff --git a/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java b/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java index 6abc3c58e73..d2e20b354da 100644 --- a/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/internal/backend/LoggerFinderBackendTest.java @@ -78,7 +78,6 @@ import java.util.logging.LogManager; import java.util.logging.LogRecord; import java.util.logging.Logger; import sun.util.logging.internal.LoggingProviderImpl; -import java.lang.reflect.Module; /** * @author danielfuchs diff --git a/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java b/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java index cba6f7b1b44..d2348a2c9dd 100644 --- a/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java +++ b/jdk/test/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java @@ -48,7 +48,6 @@ import java.lang.System.LoggerFinder; import java.lang.System.Logger; import java.util.stream.Stream; import sun.util.logging.internal.LoggingProviderImpl; -import java.lang.reflect.Module; /** * @test diff --git a/jdk/test/java/lang/reflect/WeakPairMap/Driver.java b/jdk/test/java/lang/WeakPairMap/Driver.java similarity index 91% rename from jdk/test/java/lang/reflect/WeakPairMap/Driver.java rename to jdk/test/java/lang/WeakPairMap/Driver.java index f84956d687e..4009561a8e2 100644 --- a/jdk/test/java/lang/reflect/WeakPairMap/Driver.java +++ b/jdk/test/java/lang/WeakPairMap/Driver.java @@ -25,11 +25,11 @@ * @test * @bug 8888888 * @summary Functional test for WeakPairMap - * @build java.base/java.lang.reflect.WeakPairMapTest + * @build java.base/java.lang.WeakPairMapTest * @run main Driver */ public class Driver { public static void main(String[] args) { - java.lang.reflect.WeakPairMapTest.main(args); + java.lang.WeakPairMapTest.main(args); } } diff --git a/jdk/test/java/lang/reflect/WeakPairMap/java.base/java/lang/reflect/WeakPairMapTest.java b/jdk/test/java/lang/WeakPairMap/java.base/java/lang/WeakPairMapTest.java similarity index 99% rename from jdk/test/java/lang/reflect/WeakPairMap/java.base/java/lang/reflect/WeakPairMapTest.java rename to jdk/test/java/lang/WeakPairMap/java.base/java/lang/WeakPairMapTest.java index 3247bb317ac..6267d537f06 100644 --- a/jdk/test/java/lang/reflect/WeakPairMap/java.base/java/lang/reflect/WeakPairMapTest.java +++ b/jdk/test/java/lang/WeakPairMap/java.base/java/lang/WeakPairMapTest.java @@ -21,7 +21,7 @@ * questions. */ -package java.lang.reflect; +package java.lang; import java.lang.ref.Reference; import java.util.Objects; diff --git a/jdk/test/java/lang/instrument/ATransformerManagementTestCase.java b/jdk/test/java/lang/instrument/ATransformerManagementTestCase.java index 5f88d3c9ba5..00f3447ef6a 100644 --- a/jdk/test/java/lang/instrument/ATransformerManagementTestCase.java +++ b/jdk/test/java/lang/instrument/ATransformerManagementTestCase.java @@ -24,8 +24,6 @@ import java.io.*; import java.lang.instrument.*; - -import java.lang.reflect.Module; import java.security.ProtectionDomain; import java.util.*; diff --git a/jdk/test/java/lang/instrument/BootstrapClassPathAgent.java b/jdk/test/java/lang/instrument/BootstrapClassPathAgent.java index 96d02bfa066..6b0c71aef94 100644 --- a/jdk/test/java/lang/instrument/BootstrapClassPathAgent.java +++ b/jdk/test/java/lang/instrument/BootstrapClassPathAgent.java @@ -26,7 +26,6 @@ package p; import java.io.*; import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.Instrumentation; -import java.lang.reflect.Module; import java.security.ProtectionDomain; public class BootstrapClassPathAgent { diff --git a/jdk/test/java/lang/instrument/BootstrapClassPathTest.java b/jdk/test/java/lang/instrument/BootstrapClassPathTest.java index bee8602308e..9f60090506d 100644 --- a/jdk/test/java/lang/instrument/BootstrapClassPathTest.java +++ b/jdk/test/java/lang/instrument/BootstrapClassPathTest.java @@ -33,7 +33,6 @@ import java.io.*; import java.lang.instrument.*; -import java.lang.reflect.Module; import java.security.ProtectionDomain; public class BootstrapClassPathTest { diff --git a/jdk/test/java/lang/instrument/RedefineClassWithNativeMethodAgent.java b/jdk/test/java/lang/instrument/RedefineClassWithNativeMethodAgent.java index b1146712f30..704b85b062f 100644 --- a/jdk/test/java/lang/instrument/RedefineClassWithNativeMethodAgent.java +++ b/jdk/test/java/lang/instrument/RedefineClassWithNativeMethodAgent.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.lang.instrument.ClassDefinition; import java.lang.instrument.Instrumentation; -import java.lang.reflect.Module; import java.util.Timer; import java.util.TimerTask; diff --git a/jdk/test/java/lang/instrument/RedefineModuleAgent.java b/jdk/test/java/lang/instrument/RedefineModuleAgent.java index 8d96db1c205..aa38d6b21c9 100644 --- a/jdk/test/java/lang/instrument/RedefineModuleAgent.java +++ b/jdk/test/java/lang/instrument/RedefineModuleAgent.java @@ -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,6 @@ */ import java.lang.instrument.Instrumentation; -import java.lang.reflect.Module; import java.util.List; import java.util.Map; import java.util.Set; @@ -47,4 +46,8 @@ public class RedefineModuleAgent { Map, List>> extraProvides) { inst.redefineModule(module, extraReads, extraExports, extraOpens, extraUses, extraProvides); } + + static boolean isModifiableModule(Module module) { + return inst.isModifiableModule(module); + } } diff --git a/jdk/test/java/lang/instrument/RedefineModuleTest.java b/jdk/test/java/lang/instrument/RedefineModuleTest.java index b3f79ba4cd1..60ae18f7d09 100644 --- a/jdk/test/java/lang/instrument/RedefineModuleTest.java +++ b/jdk/test/java/lang/instrument/RedefineModuleTest.java @@ -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,8 +34,6 @@ import java.lang.TestProvider; import java.lang.instrument.Instrumentation; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.net.URLStreamHandler; import java.net.spi.URLStreamHandlerProvider; import java.nio.file.FileSystems; @@ -68,6 +66,10 @@ public class RedefineModuleTest { extraProvides); } + static boolean isModifiableModule(Module module) { + return RedefineModuleAgent.isModifiableModule(module); + } + /** * Use redefineModule to update java.base to read java.instrument @@ -138,13 +140,13 @@ public class RedefineModuleTest { // pre-conditions assertFalse(baseModule.canUse(service)); assertTrue(collect(ServiceLoader.load(service)).isEmpty()); - assertTrue(collect(ServiceLoader.load(Layer.boot(), service)).isEmpty()); + assertTrue(collect(ServiceLoader.load(ModuleLayer.boot(), service)).isEmpty()); // update java.base to use TestProvider redefineModule(baseModule, Set.of(), Map.of(), Map.of(), Set.of(service), Map.of()); assertTrue(baseModule.canUse(service)); assertTrue(collect(ServiceLoader.load(service)).isEmpty()); - assertTrue(collect(ServiceLoader.load(Layer.boot(), service)).isEmpty()); + assertTrue(collect(ServiceLoader.load(ModuleLayer.boot(), service)).isEmpty()); // update java.base to provide an implementation of TestProvider Class type1 = Class.forName("jdk.internal.test.TestProviderImpl1"); @@ -162,7 +164,7 @@ public class RedefineModuleTest { assertTrue(containsInstanceOf(collect(providers), type1)); // use ServiceLoader to load implementations in the boot layer - providers = collect(ServiceLoader.load(Layer.boot(), service)); + providers = collect(ServiceLoader.load(ModuleLayer.boot(), service)); assertTrue(collect(providers).size() == 1); assertTrue(containsInstanceOf(collect(providers), type1)); @@ -184,7 +186,7 @@ public class RedefineModuleTest { assertTrue(containsInstanceOf(providers, type2)); // use ServiceLoader to load implementations in the boot layer - providers = collect(ServiceLoader.load(Layer.boot(), service)); + providers = collect(ServiceLoader.load(ModuleLayer.boot(), service)); assertTrue(collect(providers).size() == 2); assertTrue(containsInstanceOf(providers, type1)); assertTrue(containsInstanceOf(providers, type2)); @@ -278,6 +280,19 @@ public class RedefineModuleTest { redefineModule(baseModule, Set.of(), Map.of(), Map.of(), Set.of(), extraProvides); } + /** + * Exercise IsModifiableModule + */ + @Test + public void testIsModifiableModule() { + ClassLoader pcl = ClassLoader.getPlatformClassLoader(); + ClassLoader scl = ClassLoader.getSystemClassLoader(); + assertTrue(isModifiableModule(pcl.getUnnamedModule())); + assertTrue(isModifiableModule(scl.getUnnamedModule())); + assertTrue(isModifiableModule(RedefineModuleTest.class.getModule())); + assertTrue(isModifiableModule(Object.class.getModule())); + } + /** * Test redefineClass with null */ diff --git a/jdk/test/java/lang/instrument/RetransformAgent.java b/jdk/test/java/lang/instrument/RetransformAgent.java index cdba17efc6d..698449cac14 100644 --- a/jdk/test/java/lang/instrument/RetransformAgent.java +++ b/jdk/test/java/lang/instrument/RetransformAgent.java @@ -34,7 +34,6 @@ */ import java.lang.instrument.*; -import java.lang.reflect.Module; import java.security.ProtectionDomain; import java.io.*; import asmlib.*; diff --git a/jdk/test/java/lang/instrument/SimpleIdentityTransformer.java b/jdk/test/java/lang/instrument/SimpleIdentityTransformer.java index 78e05fcb41b..f25e679596a 100644 --- a/jdk/test/java/lang/instrument/SimpleIdentityTransformer.java +++ b/jdk/test/java/lang/instrument/SimpleIdentityTransformer.java @@ -24,7 +24,6 @@ import java.lang.instrument.Instrumentation; import java.lang.instrument.ClassFileTransformer; -import java.lang.reflect.Module; import java.security.*; /* diff --git a/jdk/test/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java b/jdk/test/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java index f2391743bd0..869a655d0e3 100644 --- a/jdk/test/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java +++ b/jdk/test/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java @@ -26,7 +26,6 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import static java.lang.invoke.MethodHandles.Lookup.*; diff --git a/jdk/test/java/lang/invoke/modules/m1/p1/Main.java b/jdk/test/java/lang/invoke/modules/m1/p1/Main.java index 7a10022d78f..d708d74aa50 100644 --- a/jdk/test/java/lang/invoke/modules/m1/p1/Main.java +++ b/jdk/test/java/lang/invoke/modules/m1/p1/Main.java @@ -27,8 +27,6 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; import java.lang.invoke.MethodType; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import static java.lang.invoke.MethodHandles.Lookup.*; @@ -64,14 +62,14 @@ public class Main { } // check setup - Module m1 = Layer.boot().findModule("m1").orElse(null); + Module m1 = ModuleLayer.boot().findModule("m1").orElse(null); assertNotNull(m1); assertTrue(p1_Type1.getModule() == m1); assertTrue(p2_Type2.getModule() == m1); assertTrue(m1.isExported("p1")); assertFalse(m1.isExported("p2")); - Module m2 = Layer.boot().findModule("m2").orElse(null); + Module m2 = ModuleLayer.boot().findModule("m2").orElse(null); assertNotNull(m2); assertTrue(q1_Type1.getModule() == m2); assertTrue(q2_Type2.getModule() == m2); diff --git a/jdk/test/java/lang/module/AutomaticModulesTest.java b/jdk/test/java/lang/module/AutomaticModulesTest.java index 81d68973ffe..4fce2beb558 100644 --- a/jdk/test/java/lang/module/AutomaticModulesTest.java +++ b/jdk/test/java/lang/module/AutomaticModulesTest.java @@ -38,8 +38,6 @@ import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; import java.lang.module.ResolutionException; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -69,13 +67,8 @@ public class AutomaticModulesTest { { "foo.jar", "foo" }, { "foo4j.jar", "foo4j", }, - { "foo1.jar", "foo" }, - { "foo1.2.jar", "foo" }, - { "foo1.2.3.jar", "foo" }, - - { "foo10.jar", "foo" }, - { "foo10.20.jar", "foo" }, - { "foo10.20.30.jar", "foo" }, + { "foo1.jar", "foo1" }, + { "foo10.jar", "foo10" }, { "foo-1.jar", "foo/1" }, { "foo-1.2.jar", "foo/1.2" }, @@ -93,6 +86,9 @@ public class AutomaticModulesTest { { "foo-bar-10.jar", "foo.bar/10" }, { "foo-bar-10.20.jar", "foo.bar/10.20" }, + { "foo.bar1.jar", "foo.bar1" }, + { "foo.bar10.jar", "foo.bar10" }, + { "foo-1.2-SNAPSHOT.jar", "foo/1.2-SNAPSHOT" }, { "foo-bar-1.2-SNAPSHOT.jar", "foo.bar/1.2-SNAPSHOT" }, @@ -108,8 +104,12 @@ public class AutomaticModulesTest { public Object[][] createBadNames() { return new Object[][]{ - { ".jar", null }, - { "_.jar", null } + { ".jar", null }, + { "_.jar", null }, + + { "foo.1.jar", null }, + { "1foo.jar", null }, + { "foo.1bar.jar", null }, }; } @@ -389,7 +389,7 @@ public class AutomaticModulesTest { ModuleFinder finder = ModuleFinder.of(dir); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = resolve(parent, finder, "m"); ModuleDescriptor descriptor = findDescriptor(cf, "m"); @@ -469,11 +469,11 @@ public class AutomaticModulesTest { createDummyJarFile(dir.resolve("c.jar"), "q/T.class"); // module finder locates a and the modules in the directory - ModuleFinder finder - = ModuleFinder.compose(ModuleUtils.finderOf(descriptor1), - ModuleFinder.of(dir)); + ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); + ModuleFinder finder2 = ModuleFinder.of(dir); + ModuleFinder finder = ModuleFinder.compose(finder1, finder2); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = resolve(parent, finder, "a"); assertTrue(cf.modules().size() == 3); @@ -482,7 +482,7 @@ public class AutomaticModulesTest { assertTrue(cf.findModule("c").isPresent()); ResolvedModule base = cf.findModule("java.base").get(); - assertTrue(base.configuration() == Layer.boot().configuration()); + assertTrue(base.configuration() == ModuleLayer.boot().configuration()); ResolvedModule a = cf.findModule("a").get(); ResolvedModule b = cf.findModule("b").get(); ResolvedModule c = cf.findModule("c").get(); @@ -534,11 +534,11 @@ public class AutomaticModulesTest { createDummyJarFile(dir.resolve("d.jar"), "q/T.class"); // module finder locates a and the modules in the directory - ModuleFinder finder - = ModuleFinder.compose(ModuleUtils.finderOf(descriptor1, descriptor2), - ModuleFinder.of(dir)); + ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2); + ModuleFinder finder2 = ModuleFinder.of(dir); + ModuleFinder finder = ModuleFinder.compose(finder1, finder2); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = resolve(parent, finder, "a", "d"); assertTrue(cf.modules().size() == 4); @@ -554,7 +554,7 @@ public class AutomaticModulesTest { // readability ResolvedModule base = cf.findModule("java.base").get(); - assertTrue(base.configuration() == Layer.boot().configuration()); + assertTrue(base.configuration() == ModuleLayer.boot().configuration()); ResolvedModule a = cf.findModule("a").get(); ResolvedModule b = cf.findModule("b").get(); ResolvedModule c = cf.findModule("c").get(); @@ -607,11 +607,11 @@ public class AutomaticModulesTest { createDummyJarFile(dir.resolve("d.jar"), "q/T.class"); // module finder locates a and the modules in the directory - ModuleFinder finder - = ModuleFinder.compose(ModuleUtils.finderOf(descriptor1, descriptor2), - ModuleFinder.of(dir)); + ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2); + ModuleFinder finder2 = ModuleFinder.of(dir); + ModuleFinder finder = ModuleFinder.compose(finder1, finder2); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = resolve(parent, finder, "a", "d"); assertTrue(cf.modules().size() == 4); @@ -621,7 +621,7 @@ public class AutomaticModulesTest { assertTrue(cf.findModule("d").isPresent()); ResolvedModule base = cf.findModule("java.base").get(); - assertTrue(base.configuration() == Layer.boot().configuration()); + assertTrue(base.configuration() == ModuleLayer.boot().configuration()); ResolvedModule a = cf.findModule("a").get(); ResolvedModule b = cf.findModule("b").get(); ResolvedModule c = cf.findModule("c").get(); @@ -660,6 +660,189 @@ public class AutomaticModulesTest { } + /** + * Basic test to ensure that no automatic modules are resolved when + * an automatic module is not a root or required by other modules. + */ + public void testInConfiguration4() throws IOException { + ModuleDescriptor descriptor1 + = ModuleDescriptor.newModule("m1") + .requires("java.base") + .build(); + + // automatic modules + Path dir = Files.createTempDirectory(USER_DIR, "mods"); + createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class"); + createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class"); + createDummyJarFile(dir.resolve("auto3.jar"), "p3/C.class"); + + // module finder locates m1 and the modules in the directory + ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); + ModuleFinder finder2 = ModuleFinder.of(dir); + ModuleFinder finder = ModuleFinder.compose(finder1, finder2); + + Configuration parent = ModuleLayer.boot().configuration(); + Configuration cf = resolve(parent, finder, "m1"); + + // ensure that no automatic module is resolved + assertTrue(cf.modules().size() == 1); + assertTrue(cf.findModule("m1").isPresent()); + } + + + /** + * Basic test to ensure that if an automatic module is resolved then + * all observable automatic modules are resolved. + */ + public void testInConfiguration5() throws IOException { + // m1 requires m2 + ModuleDescriptor descriptor1 + = ModuleDescriptor.newModule("m1") + .requires("m2").build(); + + // m2 requires automatic module + ModuleDescriptor descriptor2 + = ModuleDescriptor.newModule("m2") + .requires("auto1") + .build(); + + // automatic modules + Path dir = Files.createTempDirectory(USER_DIR, "mods"); + createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class"); + createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class"); + createDummyJarFile(dir.resolve("auto3.jar"), "p3/C.class"); + + // module finder locates m1, m2, and the modules in the directory + ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1, descriptor2); + ModuleFinder finder2 = ModuleFinder.of(dir); + ModuleFinder finder = ModuleFinder.compose(finder1, finder2); + + Configuration parent = ModuleLayer.boot().configuration(); + Configuration cf = resolve(parent, finder, "m1"); + + // all automatic modules should be resolved + assertTrue(cf.modules().size() == 5); + assertTrue(cf.findModule("m1").isPresent()); + assertTrue(cf.findModule("m2").isPresent()); + assertTrue(cf.findModule("auto1").isPresent()); + assertTrue(cf.findModule("auto2").isPresent()); + assertTrue(cf.findModule("auto3").isPresent()); + + ResolvedModule base = parent.findModule("java.base") + .orElseThrow(() -> new RuntimeException()); + ResolvedModule m1 = cf.findModule("m1").get(); + ResolvedModule m2 = cf.findModule("m2").get(); + ResolvedModule auto1 = cf.findModule("auto1").get(); + ResolvedModule auto2 = cf.findModule("auto2").get(); + ResolvedModule auto3 = cf.findModule("auto3").get(); + + // m1 does not read the automatic modules + assertTrue(m1.reads().size() == 2); + assertTrue(m1.reads().contains(m2)); + assertTrue(m1.reads().contains(base)); + + // m2 should read all the automatic modules + assertTrue(m2.reads().size() == 4); + assertTrue(m2.reads().contains(auto1)); + assertTrue(m2.reads().contains(auto2)); + assertTrue(m2.reads().contains(auto3)); + assertTrue(m2.reads().contains(base)); + + assertTrue(auto1.reads().contains(m1)); + assertTrue(auto1.reads().contains(m2)); + assertTrue(auto1.reads().contains(auto2)); + assertTrue(auto1.reads().contains(auto3)); + assertTrue(auto1.reads().contains(base)); + + assertTrue(auto2.reads().contains(m1)); + assertTrue(auto2.reads().contains(m2)); + assertTrue(auto2.reads().contains(auto1)); + assertTrue(auto2.reads().contains(auto3)); + assertTrue(auto2.reads().contains(base)); + + assertTrue(auto3.reads().contains(m1)); + assertTrue(auto3.reads().contains(m2)); + assertTrue(auto3.reads().contains(auto1)); + assertTrue(auto3.reads().contains(auto2)); + assertTrue(auto3.reads().contains(base)); + } + + + /** + * Basic test of automatic modules in a child configuration. All automatic + * modules that are found with the before finder should be resolved. The + * automatic modules that are found by the after finder and not shadowed + * by the before finder, or parent configurations, should also be resolved. + */ + public void testInConfiguration6() throws IOException { + // m1 requires auto1 + ModuleDescriptor descriptor1 + = ModuleDescriptor.newModule("m1") + .requires("auto1") + .build(); + + Path dir = Files.createTempDirectory(USER_DIR, "mods"); + createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class"); + + // module finder locates m1 and auto1 + ModuleFinder finder1 = ModuleUtils.finderOf(descriptor1); + ModuleFinder finder2 = ModuleFinder.of(dir); + ModuleFinder finder = ModuleFinder.compose(finder1, finder2); + + Configuration parent = ModuleLayer.boot().configuration(); + Configuration cf1 = resolve(parent, finder, "m1"); + + assertTrue(cf1.modules().size() == 2); + assertTrue(cf1.findModule("m1").isPresent()); + assertTrue(cf1.findModule("auto1").isPresent()); + + ResolvedModule base = parent.findModule("java.base") + .orElseThrow(() -> new RuntimeException()); + ResolvedModule m1 = cf1.findModule("m1").get(); + ResolvedModule auto1 = cf1.findModule("auto1").get(); + + assertTrue(m1.reads().size() == 2); + assertTrue(m1.reads().contains(auto1)); + assertTrue(m1.reads().contains(base)); + + assertTrue(auto1.reads().contains(m1)); + assertTrue(auto1.reads().contains(base)); + + + // create child configuration - the after finder locates auto1 + + dir = Files.createTempDirectory(USER_DIR, "mods"); + createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class"); + ModuleFinder beforeFinder = ModuleFinder.of(dir); + + dir = Files.createTempDirectory(USER_DIR, "mods"); + createDummyJarFile(dir.resolve("auto1.jar"), "p1/C.class"); + createDummyJarFile(dir.resolve("auto2.jar"), "p2/C.class"); + createDummyJarFile(dir.resolve("auto3.jar"), "p3/C.class"); + ModuleFinder afterFinder = ModuleFinder.of(dir); + + Configuration cf2 = cf1.resolve(beforeFinder, afterFinder, Set.of("auto2")); + + // auto1 should be found in parent and should not be in cf2 + assertTrue(cf2.modules().size() == 2); + assertTrue(cf2.findModule("auto2").isPresent()); + assertTrue(cf2.findModule("auto3").isPresent()); + + ResolvedModule auto2 = cf2.findModule("auto2").get(); + ResolvedModule auto3 = cf2.findModule("auto3").get(); + + assertTrue(auto2.reads().contains(m1)); + assertTrue(auto2.reads().contains(auto1)); + assertTrue(auto2.reads().contains(auto3)); + assertTrue(auto2.reads().contains(base)); + + assertTrue(auto3.reads().contains(m1)); + assertTrue(auto3.reads().contains(auto1)); + assertTrue(auto3.reads().contains(auto2)); + assertTrue(auto3.reads().contains(base)); + } + + /** * Basic test of a configuration created with automatic modules * a requires b* and c* @@ -684,7 +867,7 @@ public class AutomaticModulesTest { = ModuleFinder.compose(ModuleUtils.finderOf(descriptor), ModuleFinder.of(dir)); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); resolve(parent, finder, "a"); } @@ -711,13 +894,13 @@ public class AutomaticModulesTest { = ModuleFinder.compose(ModuleUtils.finderOf(descriptor), ModuleFinder.of(dir)); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); resolve(parent, finder, "a"); } /** - * Basic test of Layer containing automatic modules + * Basic test of layer containing automatic modules */ public void testInLayer() throws IOException { ModuleDescriptor descriptor @@ -736,12 +919,12 @@ public class AutomaticModulesTest { = ModuleFinder.compose(ModuleUtils.finderOf(descriptor), ModuleFinder.of(dir)); - Configuration parent = Layer.boot().configuration(); + Configuration parent = ModuleLayer.boot().configuration(); Configuration cf = resolve(parent, finder, "a"); assertTrue(cf.modules().size() == 3); // each module gets its own loader - Layer layer = Layer.boot().defineModules(cf, mn -> new ClassLoader() { }); + ModuleLayer layer = ModuleLayer.boot().defineModules(cf, mn -> new ClassLoader() { }); // an unnamed module Module unnamed = (new ClassLoader() { }).getUnnamedModule(); @@ -804,7 +987,7 @@ public class AutomaticModulesTest { */ static void testReadAllBootModules(Configuration cf, String mn) { - Set bootModules = Layer.boot().modules().stream() + Set bootModules = ModuleLayer.boot().modules().stream() .map(Module::getName) .collect(Collectors.toSet()); @@ -813,10 +996,10 @@ public class AutomaticModulesTest { } /** - * Test that the given Module reads all module in the given Layer - * and its parent Layers. + * Test that the given Module reads all module in the given layer + * and its parent layers. */ - static void testsReadsAll(Module m, Layer layer) { + static void testsReadsAll(Module m, ModuleLayer layer) { // check that m reads all modules in the layer layer.configuration().modules().stream() .map(ResolvedModule::name) diff --git a/jdk/test/java/lang/module/ConfigurationTest.java b/jdk/test/java/lang/module/ConfigurationTest.java index d010ca30060..d59612d8638 100644 --- a/jdk/test/java/lang/module/ConfigurationTest.java +++ b/jdk/test/java/lang/module/ConfigurationTest.java @@ -40,7 +40,6 @@ import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleFinder; import java.lang.module.ResolutionException; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; @@ -1708,7 +1707,7 @@ public class ConfigurationTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor); - Configuration bootConfiguration = Layer.boot().configuration(); + Configuration bootConfiguration = ModuleLayer.boot().configuration(); // m1 contains package java.lang, java.base exports package java.lang to m1 resolve(bootConfiguration, finder, "m1"); @@ -1989,14 +1988,14 @@ public class ConfigurationTest { @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresWithNull5() { - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); Configuration.resolve(ModuleFinder.of(), List.of(cf), null, Set.of()); } @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresWithNull6() { ModuleFinder empty = ModuleFinder.of(); - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); Configuration.resolve(empty, List.of(cf), empty, null); } @@ -2024,14 +2023,14 @@ public class ConfigurationTest { @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresAndUsesWithNull5() { - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); Configuration.resolveAndBind(ModuleFinder.of(), List.of(cf), null, Set.of()); } @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresAndUsesWithNull6() { ModuleFinder empty = ModuleFinder.of(); - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); Configuration.resolveAndBind(empty, List.of(cf), empty, null); } @@ -2044,14 +2043,14 @@ public class ConfigurationTest { @Test(expectedExceptions = { UnsupportedOperationException.class }) public void testImmutableSet1() { - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); ResolvedModule base = cf.findModule("java.base").get(); cf.modules().add(base); } @Test(expectedExceptions = { UnsupportedOperationException.class }) public void testImmutableSet2() { - Configuration cf = Layer.boot().configuration(); + Configuration cf = ModuleLayer.boot().configuration(); ResolvedModule base = cf.findModule("java.base").get(); base.reads().add(base); } diff --git a/jdk/test/java/lang/module/ModuleDescriptorTest.java b/jdk/test/java/lang/module/ModuleDescriptorTest.java index 2bd63497141..f4726a59a2f 100644 --- a/jdk/test/java/lang/module/ModuleDescriptorTest.java +++ b/jdk/test/java/lang/module/ModuleDescriptorTest.java @@ -41,7 +41,6 @@ import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleDescriptor.Provides; import java.lang.module.ModuleDescriptor.Requires.Modifier; import java.lang.module.ModuleDescriptor.Version; -import java.lang.reflect.Module; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; diff --git a/jdk/test/java/lang/module/ModuleFinderTest.java b/jdk/test/java/lang/module/ModuleFinderTest.java index 3f87883277e..79feee5694b 100644 --- a/jdk/test/java/lang/module/ModuleFinderTest.java +++ b/jdk/test/java/lang/module/ModuleFinderTest.java @@ -528,6 +528,30 @@ public class ModuleFinderTest { } + /** + * Test ModuleFinder.of with a directory containing hidden files + */ + public void testOfWithHiddenFiles() throws Exception { + Path dir = Files.createTempDirectory(USER_DIR, "mods"); + createExplodedModule(dir.resolve("m"), "m", + "com/.ignore", + "com/foo/.ignore", + "com/foo/foo.properties"); + + ModuleFinder finder = ModuleFinder.of(dir); + ModuleReference mref = finder.find("m").orElse(null); + assertNotNull(mref); + + Set expectedPackages; + if (System.getProperty("os.name").startsWith("Windows")) { + expectedPackages = Set.of("com", "com.foo"); + } else { + expectedPackages = Set.of("com.foo"); + } + assertEquals(mref.descriptor().packages(), expectedPackages); + } + + /** * Test ModuleFinder.of with a truncated module-info.class */ diff --git a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java index 6e895354357..773b114f338 100644 --- a/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java +++ b/jdk/test/java/lang/module/ModuleReader/ModuleReaderTest.java @@ -37,7 +37,6 @@ import java.io.InputStream; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReader; import java.lang.module.ModuleReference; -import java.lang.reflect.Module; import java.net.URI; import java.net.URL; import java.net.URLConnection; diff --git a/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java b/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java index 3e2bf3911c7..a287e6f6807 100644 --- a/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java +++ b/jdk/test/java/lang/reflect/AccessibleObject/ModuleSetAccessibleTest.java @@ -36,7 +36,6 @@ import java.lang.reflect.Field; import java.lang.reflect.InaccessibleObjectException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Module; import jdk.internal.misc.Unsafe; diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java index 3ef48cd79fa..da7b16938f0 100644 --- a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java +++ b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java @@ -23,7 +23,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.lang.reflect.Proxy; import java.nio.file.Path; import java.nio.file.Paths; @@ -88,12 +87,12 @@ public class ProxyClassAccessTest { @Test public void testNoReadAccess() throws Exception { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer .configuration() .resolveAndBind(ModuleFinder.of(), finder, modules); ClassLoader parentLoader = this.getClass().getClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader); ClassLoader loader = layer.findLoader("m1"); Class[] interfaces = new Class[] { diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyForMethodHandle.java b/jdk/test/java/lang/reflect/Proxy/ProxyForMethodHandle.java index 1c45901783d..a5877018705 100644 --- a/jdk/test/java/lang/reflect/Proxy/ProxyForMethodHandle.java +++ b/jdk/test/java/lang/reflect/Proxy/ProxyForMethodHandle.java @@ -28,7 +28,6 @@ import java.lang.invoke.MethodType; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Module; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java index 767afd23323..c420ab4ee99 100644 --- a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java +++ b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java @@ -24,7 +24,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleFinder; import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Layer; import java.lang.reflect.Proxy; import java.nio.file.Path; import java.nio.file.Paths; @@ -70,18 +69,18 @@ public class ProxyLayerTest { } /** - * Test proxy implementing interfaces in a Layer defined in + * Test proxy implementing interfaces in a layer defined in * an unnamed module */ @Test public void testProxyInUnnamed() throws Exception { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer .configuration() .resolveAndBind(ModuleFinder.of(), finder, Arrays.asList(modules)); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl); ClassLoader loader = layer.findLoader("m1"); @@ -110,12 +109,12 @@ public class ProxyLayerTest { @Test public void testProxyInDynamicModule() throws Exception { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer .configuration() .resolveAndBind(ModuleFinder.of(), finder, Arrays.asList(modules)); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl); ClassLoader loader = layer.findLoader("m1"); @@ -140,12 +139,12 @@ public class ProxyLayerTest { @Test public void testNoReadAccess() throws Exception { ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer .configuration() .resolveAndBind(ModuleFinder.of(), finder, Arrays.asList(modules)); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl); ClassLoader loader = layer.findLoader("m1"); diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyModuleMapping.java b/jdk/test/java/lang/reflect/Proxy/ProxyModuleMapping.java index bd8d1b042b3..4985adf97ac 100644 --- a/jdk/test/java/lang/reflect/Proxy/ProxyModuleMapping.java +++ b/jdk/test/java/lang/reflect/Proxy/ProxyModuleMapping.java @@ -23,7 +23,6 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Module; import java.lang.reflect.Proxy; /* diff --git a/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/Main.java b/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/Main.java index 188e3d9e084..0a342d25c78 100644 --- a/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/Main.java +++ b/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/Main.java @@ -25,7 +25,6 @@ package jdk.test; import java.net.URL; import java.net.URLClassLoader; -import java.lang.reflect.Module; import static jdk.test.ProxyTest.*; public class Main { diff --git a/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/ProxyTest.java b/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/ProxyTest.java index bbe260bf159..ee5c0241bae 100644 --- a/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/ProxyTest.java +++ b/jdk/test/java/lang/reflect/Proxy/src/test/jdk/test/ProxyTest.java @@ -26,7 +26,6 @@ package jdk.test; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Module; import java.lang.reflect.Proxy; import java.util.Arrays; diff --git a/jdk/test/java/security/Provider/DefaultProviderList.java b/jdk/test/java/security/Provider/DefaultProviderList.java index 4aaeffeeacf..9a015b0b340 100644 --- a/jdk/test/java/security/Provider/DefaultProviderList.java +++ b/jdk/test/java/security/Provider/DefaultProviderList.java @@ -33,7 +33,6 @@ import java.security.Security; import java.util.Arrays; import java.util.Iterator; import java.util.ServiceLoader; -import java.lang.reflect.Module; public class DefaultProviderList { diff --git a/jdk/test/java/util/ResourceBundle/modules/cache/src/test/jdk/test/Main.java b/jdk/test/java/util/ResourceBundle/modules/cache/src/test/jdk/test/Main.java index a6ae87208bd..234e841f691 100644 --- a/jdk/test/java/util/ResourceBundle/modules/cache/src/test/jdk/test/Main.java +++ b/jdk/test/java/util/ResourceBundle/modules/cache/src/test/jdk/test/Main.java @@ -23,7 +23,6 @@ package jdk.test; -import java.lang.reflect.Module; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -56,4 +55,4 @@ public class Main { jdk.test.util.Bundles.getBundle(); } } -} \ No newline at end of file +} diff --git a/jdk/test/java/util/ResourceBundle/modules/security/src/test/jdk/test/Main.java b/jdk/test/java/util/ResourceBundle/modules/security/src/test/jdk/test/Main.java index ecea6abd576..88b9222f137 100644 --- a/jdk/test/java/util/ResourceBundle/modules/security/src/test/jdk/test/Main.java +++ b/jdk/test/java/util/ResourceBundle/modules/security/src/test/jdk/test/Main.java @@ -24,7 +24,6 @@ package jdk.test; import p1.Bundle; -import java.lang.reflect.Module; import java.util.ResourceBundle; public class Main { diff --git a/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java b/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java index 5e100abc89b..1b7aef1ecdd 100644 --- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java +++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java @@ -23,7 +23,6 @@ package jdk.embargo; -import java.lang.reflect.Module; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; diff --git a/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java b/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java index 8f2ca8e1206..b2df284acfc 100644 --- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java +++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java @@ -23,7 +23,6 @@ package jdk.embargo; -import java.lang.reflect.Module; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; diff --git a/jdk/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java b/jdk/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java index 54ac2e7d686..8706ab2838b 100644 --- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java +++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java @@ -23,7 +23,6 @@ package jdk.pkg.test; -import java.lang.reflect.Module; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; diff --git a/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java b/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java index 19de28a8be1..3a16a412b1c 100644 --- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java +++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java @@ -23,7 +23,6 @@ package jdk.test; -import java.lang.reflect.Module; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; diff --git a/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java b/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java index d36b53f864a..fc6cd208f2c 100644 --- a/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java +++ b/jdk/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java @@ -23,7 +23,6 @@ package jdk.test; -import java.lang.reflect.Module; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; diff --git a/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java b/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java index 8d3c2d27d3a..a1bf4abf099 100644 --- a/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java +++ b/jdk/test/java/util/ServiceLoader/modules/BadProvidersTest.java @@ -33,7 +33,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -87,14 +86,14 @@ public class BadProvidersTest { private List loadProviders(Path mp, String moduleName) throws Exception { ModuleFinder finder = ModuleFinder.of(mp); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf = bootLayer.configuration() .resolveAndBind(finder, ModuleFinder.of(), Set.of(moduleName)); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithOneLoader(cf, scl); Class service = layer.findLoader(moduleName).loadClass(TEST_SERVICE); diff --git a/jdk/test/java/util/ServiceLoader/modules/Basic.java b/jdk/test/java/util/ServiceLoader/modules/Basic.java index d697db6e993..75e30bc4413 100644 --- a/jdk/test/java/util/ServiceLoader/modules/Basic.java +++ b/jdk/test/java/util/ServiceLoader/modules/Basic.java @@ -34,7 +34,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -229,7 +228,7 @@ public class Basic { */ @Test public void testWithCustomLayer1() { - Layer layer = createCustomLayer("bananascript"); + ModuleLayer layer = createCustomLayer("bananascript"); ClassLoader loader = layer.findLoader("bananascript"); List providers @@ -258,7 +257,7 @@ public class Basic { */ @Test public void testWithCustomLayer2() { - Layer layer = createCustomLayer("bananascript"); + ModuleLayer layer = createCustomLayer("bananascript"); List factories = collectAll(ServiceLoader.load(layer, ScriptEngineFactory.class)); @@ -293,7 +292,7 @@ public class Basic { */ @Test public void testWithCustomLayer3() { - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf0 = bootLayer.configuration(); // boot layer should contain "bananascript" @@ -313,12 +312,12 @@ public class Basic { // layer1 Configuration cf1 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of()); - Layer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl); + ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl); assertTrue(layer1.modules().size() == 1); // layer2 Configuration cf2 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of()); - Layer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl); + ModuleLayer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl); assertTrue(layer2.modules().size() == 1); // layer3 with layer1 and layer2 as parents @@ -326,7 +325,8 @@ public class Basic { List.of(cf1, cf2), ModuleFinder.of(), Set.of()); - Layer layer3 = Layer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer(); + ModuleLayer layer3 + = ModuleLayer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer(); assertTrue(layer3.modules().size() == 1); @@ -390,12 +390,12 @@ public class Basic { @Test(expectedExceptions = { NullPointerException.class }) public void testLoadNull3() { class S { } - ServiceLoader.load((Layer) null, S.class); + ServiceLoader.load((ModuleLayer) null, S.class); } @Test(expectedExceptions = { NullPointerException.class }) public void testLoadNull4() { - ServiceLoader.load(Layer.empty(), null); + ServiceLoader.load(ModuleLayer.empty(), null); } @Test(expectedExceptions = { NullPointerException.class }) @@ -404,19 +404,19 @@ public class Basic { } /** - * Create a custom Layer by resolving the given module names. The modules + * Create a custom layer by resolving the given module names. The modules * are located in the {@code ${test.classes}/modules} directory. */ - private Layer createCustomLayer(String... modules) { + private ModuleLayer createCustomLayer(String... modules) { Path dir = Paths.get(System.getProperty("test.classes", "."), "modules"); ModuleFinder finder = ModuleFinder.of(dir); Set roots = new HashSet<>(); Collections.addAll(roots, modules); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration parent = bootLayer.configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), roots); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl); assertTrue(layer.modules().size() == 1); return layer; } diff --git a/jdk/test/java/util/logging/LocalizedLevelName.java b/jdk/test/java/util/logging/LocalizedLevelName.java index 627789f200e..4bb75b6dafd 100644 --- a/jdk/test/java/util/logging/LocalizedLevelName.java +++ b/jdk/test/java/util/logging/LocalizedLevelName.java @@ -21,7 +21,6 @@ * questions. */ -import java.lang.reflect.Module; import java.util.*; import java.util.logging.*; diff --git a/jdk/test/java/util/logging/modules/pkgs/p3/test/ResourceBundleTest.java b/jdk/test/java/util/logging/modules/pkgs/p3/test/ResourceBundleTest.java index 03d26146837..0eef17a3f67 100644 --- a/jdk/test/java/util/logging/modules/pkgs/p3/test/ResourceBundleTest.java +++ b/jdk/test/java/util/logging/modules/pkgs/p3/test/ResourceBundleTest.java @@ -23,7 +23,6 @@ package p3.test; -import java.lang.reflect.Module; import java.util.logging.Logger; import java.util.MissingResourceException; import java.util.PropertyResourceBundle; diff --git a/jdk/test/java/util/spi/ResourceBundleControlProvider/test/jdk/test/ResourceBundleDelegate.java b/jdk/test/java/util/spi/ResourceBundleControlProvider/test/jdk/test/ResourceBundleDelegate.java index 13a604abfb6..b9f2a5970f4 100644 --- a/jdk/test/java/util/spi/ResourceBundleControlProvider/test/jdk/test/ResourceBundleDelegate.java +++ b/jdk/test/java/util/spi/ResourceBundleControlProvider/test/jdk/test/ResourceBundleDelegate.java @@ -23,7 +23,6 @@ package jdk.test; -import java.lang.reflect.Module; import java.util.Locale; import java.util.ResourceBundle; diff --git a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java index d5c31961aca..994b6d0f7ac 100644 --- a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java +++ b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java @@ -39,7 +39,6 @@ import com.sun.org.apache.xml.internal.serializer.EncodingInfo; import com.sun.org.apache.xml.internal.serializer.Encodings; import java.io.InputStreamReader; -import java.lang.reflect.Module; import java.lang.reflect.Method; import java.nio.charset.Charset; import java.util.ArrayList; diff --git a/jdk/test/jdk/internal/jimage/JImageOpenTest.java b/jdk/test/jdk/internal/jimage/JImageOpenTest.java index 06c19937a41..9c828d71003 100644 --- a/jdk/test/jdk/internal/jimage/JImageOpenTest.java +++ b/jdk/test/jdk/internal/jimage/JImageOpenTest.java @@ -21,7 +21,6 @@ * questions. */ -import java.lang.reflect.Layer; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; @@ -48,7 +47,7 @@ public class JImageOpenTest { final List names = Files.walk(root) .filter(p -> p.getNameCount() > 2) - .filter(p -> Layer.boot().findModule(p.getName(1).toString()).isPresent()) + .filter(p -> ModuleLayer.boot().findModule(p.getName(1).toString()).isPresent()) .map(p -> p.subpath(2, p.getNameCount())) .map(p -> p.toString()) .filter(s -> s.endsWith(".class") && !s.endsWith("module-info.class")) diff --git a/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java b/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java index 0948f420f1a..d4dc0ea3818 100644 --- a/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java +++ b/jdk/test/jdk/modules/etc/JdkQualifiedExportTest.java @@ -40,7 +40,6 @@ import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Opens; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; -import java.lang.reflect.Module; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; diff --git a/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java index 182fb4ee985..2d8b30c4eea 100644 --- a/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java +++ b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java @@ -31,8 +31,6 @@ import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.Set; import static java.util.stream.Collectors.toSet; @@ -49,7 +47,7 @@ public class VerifyModuleDelegation { = ModuleDescriptor.newModule(JAVA_BASE).build(); private static final Set MREFS - = Layer.boot().modules().stream().map(Module::getDescriptor) + = ModuleLayer.boot().modules().stream().map(Module::getDescriptor) .collect(toSet()); private void check(ModuleDescriptor md, ModuleDescriptor ref) { @@ -69,7 +67,7 @@ public class VerifyModuleDelegation { @Test public void checkLoaderDelegation() { - Layer boot = Layer.boot(); + ModuleLayer boot = ModuleLayer.boot(); MREFS.stream() .forEach(md -> md.requires().stream().forEach(req -> { diff --git a/jdk/test/jdk/modules/incubator/DefaultImage.java b/jdk/test/jdk/modules/incubator/DefaultImage.java index ff6f5261f14..dc2236351c8 100644 --- a/jdk/test/jdk/modules/incubator/DefaultImage.java +++ b/jdk/test/jdk/modules/incubator/DefaultImage.java @@ -34,6 +34,9 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; +import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleFinder; +import java.lang.module.ModuleReference; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -41,13 +44,13 @@ import java.util.function.Consumer; import java.util.stream.Stream; import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static java.nio.charset.StandardCharsets.UTF_8; import static jdk.testlibrary.ProcessTools.executeCommand; import static org.testng.Assert.*; +@Test public class DefaultImage { private static final String JAVA_HOME = System.getProperty("java.home"); private static final Path TEST_SRC = Paths.get(System.getProperty("test.src")); @@ -72,19 +75,13 @@ public class DefaultImage { .resultChecker(r -> r.assertOutputDoesNotContain("jdk.incubator")); } - @DataProvider(name = "tokens") - public Object[][] singleModuleValues() throws IOException { - return new Object[][]{ { "ALL-DEFAULT" }, { "ALL-SYSTEM"} }; - } - - @Test(dataProvider = "tokens") - public void testAddMods(String addModsToken) throws Throwable { + public void testAllDefault() throws Throwable { if (isExplodedBuild()) { System.out.println("Test cannot run on exploded build"); return; } - java("--add-modules", addModsToken, + java("--add-modules", "ALL-DEFAULT", "-cp", CP_DIR.toString(), "listmods.ListModules") .assertSuccess() @@ -92,6 +89,22 @@ public class DefaultImage { .resultChecker(r -> r.assertOutputDoesNotContain("jdk.incubator")); } + public void testAllSystem() throws Throwable { + if (isExplodedBuild()) { + System.out.println("Test cannot run on exploded build"); + return; + } + + if (containsAnyIncubatorModules()) { + java("--add-modules", "ALL-SYSTEM", + "-cp", CP_DIR.toString(), + "listmods.ListModules") + .assertSuccess() + .resultChecker(r -> r.assertOutputContains("java.base")) + .resultChecker(r -> r.assertOutputContains("jdk.incubator")); + } + } + static ToolResult java(String... opts) throws Throwable { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); @@ -155,4 +168,14 @@ public class DefaultImage { Path modulesPath = Paths.get(JAVA_HOME).resolve("lib").resolve("modules"); return Files.notExists(modulesPath); } + + static boolean containsAnyIncubatorModules() { + return ModuleFinder.ofSystem().findAll().stream() + .map(ModuleReference::descriptor) + .map(ModuleDescriptor::name) + .filter(mn -> mn.startsWith("jdk.incubator")) + .map(mn -> true) + .findAny() + .orElse(false); + } } diff --git a/jdk/test/jdk/modules/incubator/ImageModules.java b/jdk/test/jdk/modules/incubator/ImageModules.java index 347b1d4e221..cf3d297ae9f 100644 --- a/jdk/test/jdk/modules/incubator/ImageModules.java +++ b/jdk/test/jdk/modules/incubator/ImageModules.java @@ -98,7 +98,7 @@ public class ImageModules { List.of("hello world", "message.converter", "java.base"), List.of("WARNING") }, { "--do-not-resolve-by-default", - List.of("ALL-DEFAULT", "ALL-SYSTEM"), + List.of("ALL-DEFAULT"), ToolResult.ASSERT_FAILURE, List.of("java.base", "java.lang.ClassNotFoundException: converter.MessageConverter"), List.of("WARNING", "message.converter") }, @@ -109,7 +109,7 @@ public class ImageModules { "WARNING: Using incubator modules: message.converter"), List.of() }, { "--do-not-resolve-by-default --warn-if-resolved=incubating", - List.of("ALL-DEFAULT", "ALL-SYSTEM"), + List.of("ALL-DEFAULT"), ToolResult.ASSERT_FAILURE, List.of("java.base", "java.lang.ClassNotFoundException: converter.MessageConverter"), List.of("WARNING", "message.converter") }, @@ -215,13 +215,13 @@ public class ImageModules { List.of() }, { "--do-not-resolve-by-default", "", - List.of("ALL-DEFAULT", "ALL-SYSTEM"), + List.of("ALL-DEFAULT"), ToolResult.ASSERT_FAILURE, List.of("java.lang.ClassNotFoundException: writer.MessageWriter", "java.base"), List.of("message.writer") }, { "--do-not-resolve-by-default", "--do-not-resolve-by-default", - List.of("ALL-DEFAULT", "ALL-SYSTEM"), + List.of("ALL-DEFAULT"), ToolResult.ASSERT_FAILURE, List.of("java.lang.ClassNotFoundException: writer.MessageWriter", "java.base"), List.of("message.converter", "message.writer") }, @@ -239,7 +239,8 @@ public class ImageModules { ToolResult.ASSERT_SUCCESS, List.of("HELLO CHEGAR !!!", "message.writer", "message.converter", "java.base", "WARNING: Using incubator modules: message.converter"), - List.of() } }; + List.of() } + }; return values; } diff --git a/jdk/test/jdk/modules/incubator/src/cp/listmods/ListModules.java b/jdk/test/jdk/modules/incubator/src/cp/listmods/ListModules.java index 2d80d198ee0..ceac4c516da 100644 --- a/jdk/test/jdk/modules/incubator/src/cp/listmods/ListModules.java +++ b/jdk/test/jdk/modules/incubator/src/cp/listmods/ListModules.java @@ -23,13 +23,11 @@ package listmods; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import static java.util.stream.Collectors.joining; public class ListModules { public static void main(String[] args) throws Exception { - System.out.println(Layer.boot() + System.out.println(ModuleLayer.boot() .modules() .stream() .map(Module::getName) diff --git a/jdk/test/jdk/modules/incubator/src/cp/test/ConvertToLowerCase.java b/jdk/test/jdk/modules/incubator/src/cp/test/ConvertToLowerCase.java index cf0d1c7cba9..4d0cc85252b 100644 --- a/jdk/test/jdk/modules/incubator/src/cp/test/ConvertToLowerCase.java +++ b/jdk/test/jdk/modules/incubator/src/cp/test/ConvertToLowerCase.java @@ -23,13 +23,11 @@ package test; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import static java.util.stream.Collectors.joining; public class ConvertToLowerCase { public static void main(String[] args) { - System.out.println(Layer.boot() + System.out.println(ModuleLayer.boot() .modules() .stream() .map(Module::getName) diff --git a/jdk/test/jdk/modules/incubator/src/cp/test/WriteUpperCase.java b/jdk/test/jdk/modules/incubator/src/cp/test/WriteUpperCase.java index 844fccb2fcf..f0662a55ed2 100644 --- a/jdk/test/jdk/modules/incubator/src/cp/test/WriteUpperCase.java +++ b/jdk/test/jdk/modules/incubator/src/cp/test/WriteUpperCase.java @@ -23,13 +23,11 @@ package test; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import static java.util.stream.Collectors.joining; public class WriteUpperCase { public static void main(String[] args) { - System.out.println(Layer.boot() + System.out.println(ModuleLayer.boot() .modules() .stream() .map(Module::getName) diff --git a/jdk/test/jdk/modules/open/Basic.java b/jdk/test/jdk/modules/open/Basic.java index 2af576e61e1..f63b1452b83 100644 --- a/jdk/test/jdk/modules/open/Basic.java +++ b/jdk/test/jdk/modules/open/Basic.java @@ -36,7 +36,6 @@ import java.lang.invoke.MethodType; import java.lang.module.ModuleDescriptor; import java.lang.reflect.Constructor; import java.lang.reflect.InaccessibleObjectException; -import java.lang.reflect.Module; import org.testng.annotations.Test; import org.testng.annotations.BeforeTest; diff --git a/jdk/test/jdk/modules/scenarios/automaticmodules/src/basictest/test/Main.java b/jdk/test/jdk/modules/scenarios/automaticmodules/src/basictest/test/Main.java index 01d8283a4b3..4a729799e29 100644 --- a/jdk/test/jdk/modules/scenarios/automaticmodules/src/basictest/test/Main.java +++ b/jdk/test/jdk/modules/scenarios/automaticmodules/src/basictest/test/Main.java @@ -23,9 +23,6 @@ package test; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; - import http.HttpServer; /** @@ -47,8 +44,8 @@ public class Main { cl = ClassLoader.getSystemClassLoader(); assertTrue(httpModule.canRead(cl.getUnnamedModule())); - // and read all modules in the boot Layer - Layer layer = Layer.boot(); + // and read all modules in the boot layer + ModuleLayer layer = ModuleLayer.boot(); layer.modules().forEach(m -> assertTrue(httpModule.canRead(m))); // run code in the automatic modue, ensures access is allowed diff --git a/jdk/test/jdk/modules/scenarios/automaticmodules/src/sptest/test/Main.java b/jdk/test/jdk/modules/scenarios/automaticmodules/src/sptest/test/Main.java index 5897d671321..dc079b876b3 100644 --- a/jdk/test/jdk/modules/scenarios/automaticmodules/src/sptest/test/Main.java +++ b/jdk/test/jdk/modules/scenarios/automaticmodules/src/sptest/test/Main.java @@ -26,8 +26,6 @@ package test; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleDescriptor.Provides; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.Map; import java.util.Optional; import java.util.ServiceLoader; @@ -36,7 +34,7 @@ import java.util.stream.Collectors; import javax.script.ScriptEngineFactory; /** - * Test that the automatic module "bananascript" is in the boot Layer and + * Test that the automatic module "bananascript" is in the boot layer and * it behaves as a service provider. */ @@ -44,7 +42,7 @@ public class Main { public static void main(String[] args) throws Exception { - Optional om = Layer.boot().findModule("bananascript"); + Optional om = ModuleLayer.boot().findModule("bananascript"); assertTrue(om.isPresent()); ModuleDescriptor descriptor = om.get().getDescriptor(); diff --git a/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java b/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java index ca3f0f3a0d2..05b8513114e 100644 --- a/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java +++ b/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java @@ -27,9 +27,7 @@ import java.io.File; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; import java.lang.module.ResolvedModule; -import java.lang.reflect.Layer; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Set; @@ -43,7 +41,7 @@ public class Main { public static void main(String[] args) throws Exception { System.out.println("Boot layer"); - Layer.boot() + ModuleLayer.boot() .modules() .stream() .map(Module::getName) @@ -70,7 +68,7 @@ public class Main { ModuleFinder finder = ModuleFinder.of(paths); - Configuration cf = Layer.boot().configuration() + Configuration cf = ModuleLayer.boot().configuration() .resolveAndBind(finder, ModuleFinder.of(), Set.of(appModuleName)); @@ -81,9 +79,9 @@ public class Main { .sorted() .forEach(mn -> System.out.format(" %s%n", mn)); - // reify the configuration as a Layer + // reify the configuration as a module layer ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = Layer.boot().defineModulesWithManyLoaders(cf, scl); + ModuleLayer layer = ModuleLayer.boot().defineModulesWithManyLoaders(cf, scl); // invoke application main method ClassLoader loader = layer.findLoader(appModuleName); diff --git a/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java b/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java index 39c555eee9e..c9ee9169e26 100644 --- a/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java +++ b/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java @@ -26,7 +26,6 @@ package test.loggerfinder; import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.lang.System.LoggerFinder; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Optional; diff --git a/jdk/test/sun/tools/jconsole/ResourceCheckTest.java b/jdk/test/sun/tools/jconsole/ResourceCheckTest.java index 6a8b62d0d2c..a678a476136 100644 --- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.java +++ b/jdk/test/sun/tools/jconsole/ResourceCheckTest.java @@ -34,7 +34,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/jdk/test/tools/jar/modularJar/Basic.java b/jdk/test/tools/jar/modularJar/Basic.java index 8ee9f1005a3..92cc0a981b0 100644 --- a/jdk/test/tools/jar/modularJar/Basic.java +++ b/jdk/test/tools/jar/modularJar/Basic.java @@ -869,8 +869,8 @@ public class Basic { return new Object[][] { // JAR file name module-name[@version] { "foo.jar", "foo" }, + { "foo1.jar", "foo1" }, { "foo4j.jar", "foo4j", }, - { "foo1.2.3.jar", "foo" }, { "foo-1.2.3.4.jar", "foo@1.2.3.4" }, { "foo-bar.jar", "foo.bar" }, { "foo-1.2-SNAPSHOT.jar", "foo@1.2-SNAPSHOT" }, diff --git a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java index 2d1d844c818..a7bd3f1c222 100644 --- a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java +++ b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java @@ -28,7 +28,6 @@ import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Provides; import java.lang.module.ModuleReference; import java.lang.module.ResolvedModule; -import java.lang.reflect.Module; import java.util.Optional; import java.util.StringJoiner; import java.util.HashSet; diff --git a/jdk/test/tools/jlink/JLink2Test.java b/jdk/test/tools/jlink/JLink2Test.java index 9eed823069a..5c0f7f33571 100644 --- a/jdk/test/tools/jlink/JLink2Test.java +++ b/jdk/test/tools/jlink/JLink2Test.java @@ -39,7 +39,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -88,7 +87,7 @@ public class JLink2Test { private static void testOptions() throws Exception { List builtInPlugins = new ArrayList<>(); - builtInPlugins.addAll(PluginRepository.getPlugins(Layer.boot())); + builtInPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot())); if(builtInPlugins.isEmpty()) { throw new Exception("No builtin plugins"); } diff --git a/jdk/test/tools/jlink/JLinkTest.java b/jdk/test/tools/jlink/JLinkTest.java index a964a694a8d..64b220710e5 100644 --- a/jdk/test/tools/jlink/JLinkTest.java +++ b/jdk/test/tools/jlink/JLinkTest.java @@ -25,7 +25,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -88,7 +87,7 @@ public class JLinkTest { { // number of built-in plugins List builtInPlugins = new ArrayList<>(); - builtInPlugins.addAll(PluginRepository.getPlugins(Layer.boot())); + builtInPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot())); totalPlugins = builtInPlugins.size(); // actual num. of plugins loaded from jdk.jlink module int actualJLinkPlugins = 0; diff --git a/jdk/test/tools/jlink/basic/src/test/jdk/test/Test.java b/jdk/test/tools/jlink/basic/src/test/jdk/test/Test.java index e038745c80b..79d07d85ad3 100644 --- a/jdk/test/tools/jlink/basic/src/test/jdk/test/Test.java +++ b/jdk/test/tools/jlink/basic/src/test/jdk/test/Test.java @@ -23,9 +23,6 @@ package jdk.test; -import java.lang.reflect.Module; -import java.lang.reflect.Layer; - public class Test { public static void main(String[] args) { System.out.println(Test.class + " ..."); @@ -36,7 +33,7 @@ public class Test { ClassLoader scl = ClassLoader.getSystemClassLoader(); ClassLoader cl1 = Test.class.getClassLoader(); Module testModule = Test.class.getModule(); - ClassLoader cl2 = Layer.boot().findLoader(testModule.getName()); + ClassLoader cl2 = ModuleLayer.boot().findLoader(testModule.getName()); if (cl1 != scl) throw new RuntimeException("Not loaded by system class loader"); diff --git a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java index 6119fe41d92..17ae87e13bf 100644 --- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java +++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java @@ -30,7 +30,6 @@ * jdk.jlink/jdk.tools.jlink.plugin * @run main/othervm PluginsNegativeTest */ -import java.lang.reflect.Layer; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -63,7 +62,7 @@ public class PluginsNegativeTest { private void testDuplicateBuiltInProviders() { List javaPlugins = new ArrayList<>(); - javaPlugins.addAll(PluginRepository.getPlugins(Layer.boot())); + javaPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot())); for (Plugin javaPlugin : javaPlugins) { System.out.println("Registered plugin: " + javaPlugin.getName()); } @@ -72,7 +71,7 @@ public class PluginsNegativeTest { try { PluginRepository.registerPlugin(new CustomPlugin(pluginName)); try { - PluginRepository.getPlugin(pluginName, Layer.boot()); + PluginRepository.getPlugin(pluginName, ModuleLayer.boot()); throw new AssertionError("Exception is not thrown for duplicate plugin: " + pluginName); } catch (Exception ignored) { } @@ -83,7 +82,7 @@ public class PluginsNegativeTest { } private void testUnknownProvider() { - if (PluginRepository.getPlugin("unknown", Layer.boot()) != null) { + if (PluginRepository.getPlugin("unknown", ModuleLayer.boot()) != null) { throw new AssertionError("Exception expected for unknown plugin name"); } } diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java index 7128e1cfacd..ecdebe5b42e 100644 --- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java +++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java @@ -24,7 +24,6 @@ import java.io.File; import java.io.IOException; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java index 9d3a769eefa..aef19f535ef 100644 --- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java +++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m1/p1/Main.java @@ -26,8 +26,6 @@ package p1; import java.io.InputStream; import java.io.IOException; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m3/p3/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m3/p3/Main.java index c7ff38e6d50..aa7563e666e 100644 --- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m3/p3/Main.java +++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m3/p3/Main.java @@ -26,7 +26,6 @@ package p3; import p4.Foo; import java.lang.module.ModuleDescriptor; import java.lang.reflect.Field; -import java.lang.reflect.Module; import static java.lang.module.ModuleDescriptor.Exports.Modifier.*; diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java index 66e18604913..a08fe01c67c 100644 --- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java +++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m4/p4/Main.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.io.InputStream; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; @@ -100,7 +99,7 @@ public class Main { private static void checkModule(String mn, String... packages) throws IOException { // verify ModuleDescriptor from the runtime module - ModuleDescriptor md = Layer.boot().findModule(mn).get() + ModuleDescriptor md = ModuleLayer.boot().findModule(mn).get() .getDescriptor(); checkModuleDescriptor(md, packages); diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m5/p5/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m5/p5/Main.java index f22dfc5c10d..f0f46e68dff 100644 --- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m5/p5/Main.java +++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/m5/p5/Main.java @@ -23,7 +23,6 @@ package p5; -import java.lang.reflect.Layer; import p3.Foo; import p3.Lib; @@ -32,7 +31,7 @@ import p3.Lib; */ public class Main { public static void main(String... args) { - boolean libPresent = Layer.boot().findModule("m3").isPresent(); + boolean libPresent = ModuleLayer.boot().findModule("m3").isPresent(); if (LibHelper.libClassFound != libPresent) { throw new RuntimeException("Expected module m3 not in the boot layer"); } diff --git a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/test/jdk/test/Main.java b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/test/jdk/test/Main.java index e5c6fe8e6ca..d7f36589093 100644 --- a/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/test/jdk/test/Main.java +++ b/jdk/test/tools/jlink/plugins/SystemModuleDescriptors/src/test/jdk/test/Main.java @@ -24,8 +24,6 @@ package jdk.test; import java.lang.module.ModuleDescriptor; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.net.URI; import java.nio.file.FileSystem; import java.nio.file.FileSystems; @@ -65,7 +63,7 @@ public class Main { // check the module descriptor of a system module for (int i=0; i < modules.size(); i++) { String mn = modules.get(i); - Module module = Layer.boot().findModule(mn).orElseThrow( + Module module = ModuleLayer.boot().findModule(mn).orElseThrow( () -> new RuntimeException(mn + " not found") ); diff --git a/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java b/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java index fe9a293be57..afb1fbc78f1 100644 --- a/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java +++ b/jdk/test/tools/launcher/modules/dryrun/DryRunTest.java @@ -167,22 +167,6 @@ public class DryRunTest { // test main method with and without --add-modules mm int exitValue = exec("--module-path", LIBS_DIR.toString(), "-m", mid); - assertTrue(exitValue != 0); - - exitValue = exec("--module-path", LIBS_DIR.toString(), - "--add-modules", M_MODULE, - "-m", mid); - assertTrue(exitValue == 0); - - // test dry run with and without --add-modules m - // no resolution failure - exitValue = exec("--dry-run", "--module-path", LIBS_DIR.toString(), - "-m", mid); - assertTrue(exitValue == 0); - - exitValue = exec("--dry-run", "--module-path", LIBS_DIR.toString(), - "--add-modules", M_MODULE, - "-m", mid); assertTrue(exitValue == 0); } diff --git a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java index 7b1dd9340e7..8628539481e 100644 --- a/jdk/test/tools/launcher/modules/listmods/ListModsTest.java +++ b/jdk/test/tools/launcher/modules/listmods/ListModsTest.java @@ -115,7 +115,7 @@ public class ListModsTest { .outputTo(System.out) .errorTo(System.out); output.shouldNotContain("java.base"); - output.shouldContain("java.rhubarb not observable"); + output.shouldContain("java.rhubarb not found"); assertTrue(output.getExitValue() == 0); } diff --git a/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java b/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java index f274a17ad2a..e23e38d2fba 100644 --- a/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java +++ b/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java @@ -28,8 +28,6 @@ package jdk.test; -import java.lang.reflect.Module; - public class Main { public static void main(String[] args) throws Exception { diff --git a/jdk/test/tools/launcher/modules/upgrademodulepath/src/test/jdk/test/Main.java b/jdk/test/tools/launcher/modules/upgrademodulepath/src/test/jdk/test/Main.java index e5540aded8b..b6ab2656a45 100644 --- a/jdk/test/tools/launcher/modules/upgrademodulepath/src/test/jdk/test/Main.java +++ b/jdk/test/tools/launcher/modules/upgrademodulepath/src/test/jdk/test/Main.java @@ -24,7 +24,6 @@ package jdk.test; import java.lang.module.ModuleReference; -import java.lang.reflect.Layer; import java.net.URI; import javax.enterprise.context.Scope; @@ -53,7 +52,7 @@ public class Main { // javax.transaction should be found in boot layer. ModuleReference ref = - Layer.boot().configuration().findModule(TRANSACTION_MODULE).get().reference(); + ModuleLayer.boot().configuration().findModule(TRANSACTION_MODULE).get().reference(); // check uri of java.transaction found on the upgrade module path. URI uri = ref.location().get(); System.out.println("uri: " + uri); From 481f056ca927e5c1341e59d1e8810fcf4009b613 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:08:26 +0000 Subject: [PATCH 35/75] 8177530: Module system implementation refresh (4/2017) Co-authored-by: Jan Lahoda Reviewed-by: jjg --- .../crules/CodingRulesAnalyzerPlugin.java | 4 +- .../classes/javax/tools/ToolProvider.java | 2 +- .../com/sun/tools/javac/comp/Modules.java | 14 +++- .../com/sun/tools/javac/file/Locations.java | 3 +- .../sun/tools/javac/util/JDK9Wrappers.java | 12 +-- .../toolkit/taglets/TagletManager.java | 2 +- .../sun/tools/javadoc/main/DocletInvoker.java | 2 +- langtools/test/TEST.ROOT | 4 +- .../testCustomTag/taglets/CustomTag.java | 2 - .../testtaglets/BoldTaglet.java | 2 - .../testtaglets/GreenTaglet.java | 2 - .../testtaglets/UnderlineTaglet.java | 2 - .../sun/javadoc/testTaglets/taglets/Foo.java | 2 - .../jdk/javadoc/tool/CheckResourceKeys.java | 4 +- langtools/test/jdk/jshell/KullaTesting.java | 5 +- .../test/tools/javac/6410653/T6410653.java | 1 - langtools/test/tools/javac/T6406771.java | 4 +- .../test/tools/javac/diags/CheckExamples.java | 4 +- .../tools/javac/diags/CheckResourceKeys.java | 4 +- .../javac/diags/examples/NoJavaLang.java | 2 +- .../javac/fatalErrors/NoJavaLangTest.java | 2 +- .../lib/JavacTestingAbstractProcessor.java | 4 +- .../tools/javac/modules/AddLimitMods.java | 4 +- .../tools/javac/modules/AutomaticModules.java | 75 +++++++++++++++++-- .../tools/javac/modules/IncubatingTest.java | 7 +- .../javac/treeannotests/TestProcessor.java | 2 - .../warnings/VerifyLintDescriptions.java | 4 +- .../test/tools/javadoc/CheckResourceKeys.java | 4 +- 28 files changed, 112 insertions(+), 67 deletions(-) diff --git a/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java b/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java index 5e60f3f3c5c..0144c00495c 100644 --- a/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java +++ b/langtools/make/tools/crules/CodingRulesAnalyzerPlugin.java @@ -23,8 +23,6 @@ package crules; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -76,7 +74,7 @@ public class CodingRulesAnalyzerPlugin implements Plugin { private void addExports(String moduleName, String... packageNames) { for (String packageName : packageNames) { try { - Layer layer = Layer.boot(); + ModuleLayer layer = ModuleLayer.boot(); Optional m = layer.findModule(moduleName); if (!m.isPresent()) throw new Error("module not found: " + moduleName); diff --git a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java index a77f161aa81..91203e18996 100644 --- a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java +++ b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java @@ -106,7 +106,7 @@ public class ToolProvider { static { Class c = null; try { - c = Class.forName("java.lang.reflect.Module"); + c = Class.forName("java.lang.Module"); } catch (Throwable t) { } useLegacy = (c == null); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java index bb25b93d492..8bee15ab32c 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java @@ -1240,7 +1240,7 @@ public class Modules extends JCTree.Visitor { case ALL_SYSTEM: modules = new HashSet<>(syms.getAllModules()) .stream() - .filter(systemModulePred.and(observablePred).and(noIncubatorPred)); + .filter(systemModulePred.and(observablePred)); break; case ALL_MODULE_PATH: modules = new HashSet<>(syms.getAllModules()) @@ -1265,6 +1265,15 @@ public class Modules extends JCTree.Visitor { result.add(syms.unnamedModule); + boolean hasAutomatic = result.stream().anyMatch(IS_AUTOMATIC); + + if (hasAutomatic) { + syms.getAllModules() + .stream() + .filter(IS_AUTOMATIC) + .forEach(result::add); + } + String incubatingModules = result.stream() .filter(msym -> msym.resolutionFlags.contains(ModuleResolutionFlags.WARN_INCUBATING)) .map(msym -> msym.name.toString()) @@ -1282,6 +1291,9 @@ public class Modules extends JCTree.Visitor { rootModules.forEach(m -> m.version = version); } } + //where: + private static final Predicate IS_AUTOMATIC = + m -> (m.flags_field & Flags.AUTOMATIC_MODULE) != 0; public boolean isInModuleGraph(ModuleSymbol msym) { return allModules == null || allModules.contains(msym); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java index e6a779cde47..29d801a0430 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java @@ -1282,8 +1282,7 @@ public class Locations { } // finally clean up the module name - mn = mn.replaceAll("(\\.|\\d)*$", "") // remove trailing version - .replaceAll("[^A-Za-z0-9]", ".") // replace non-alphanumeric + mn = mn.replaceAll("[^A-Za-z0-9]", ".") // replace non-alphanumeric .replaceAll("(\\.)(\\1)+", ".") // collapse repeating dots .replaceAll("^\\.", "") // drop leading dots .replaceAll("\\.$", ""); // drop trailing dots diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java index f7b3a82146f..40b8f249b8f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java @@ -183,7 +183,7 @@ public class JDK9Wrappers { } /** - * Wrapper class for java.lang.reflect.Module. To materialize a handle use the static factory + * Wrapper class for java.lang.Module. To materialize a handle use the static factory * methods Module#getModule(Class) or Module#getUnnamedModule(ClassLoader). */ public static class Module { @@ -236,9 +236,9 @@ public class JDK9Wrappers { } // ----------------------------------------------------------------------------------------- - // on java.lang.reflect.Module + // on java.lang.Module private static Method addExportsMethod = null; - // on java.lang.reflect.Module + // on java.lang.Module private static Method addUsesMethod = null; // on java.lang.Class private static Method getModuleMethod; @@ -248,7 +248,7 @@ public class JDK9Wrappers { private static void init() { if (addExportsMethod == null) { try { - Class moduleClass = Class.forName("java.lang.reflect.Module", false, null); + Class moduleClass = Class.forName("java.lang.Module", false, null); addUsesMethod = moduleClass.getDeclaredMethod("addUses", new Class[] { Class.class }); addExportsMethod = moduleClass.getDeclaredMethod("addExports", new Class[] { String.class, moduleClass }); @@ -318,7 +318,7 @@ public class JDK9Wrappers { } /** - * Wrapper class for java.lang.module.Layer. + * Wrapper class for java.lang.ModuleLayer. */ public static final class Layer { private final Object theRealLayer; @@ -372,7 +372,7 @@ public class JDK9Wrappers { private static void init() { if (layerClass == null) { try { - layerClass = Class.forName("java.lang.reflect.Layer", false, null); + layerClass = Class.forName("java.lang.ModuleLayer", false, null); bootMethod = layerClass.getDeclaredMethod("boot"); defineModulesWithOneLoaderMethod = layerClass.getDeclaredMethod("defineModulesWithOneLoader", Configuration.getConfigurationClass(), diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java index aa5a2dc62e6..030dc662ccc 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java @@ -292,7 +292,7 @@ public class TagletManager { Method getModuleMethod = Class.class.getDeclaredMethod("getModule"); Object thisModule = getModuleMethod.invoke(getClass()); - Class moduleClass = Class.forName("java.lang.reflect.Module"); + Class moduleClass = Class.forName("java.lang.Module"); Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass); Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule"); diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java index 46265861e33..5cd96e5fdbe 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java @@ -379,7 +379,7 @@ public class DocletInvoker { Method getModuleMethod = Class.class.getDeclaredMethod("getModule"); Object thisModule = getModuleMethod.invoke(getClass()); - Class moduleClass = Class.forName("java.lang.reflect.Module"); + Class moduleClass = Class.forName("java.lang.Module"); Method addExportsMethod = moduleClass.getDeclaredMethod("addExports", String.class, moduleClass); Method getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule"); diff --git a/langtools/test/TEST.ROOT b/langtools/test/TEST.ROOT index a4780af47ab..30351ed463d 100644 --- a/langtools/test/TEST.ROOT +++ b/langtools/test/TEST.ROOT @@ -14,8 +14,8 @@ keys=intermittent randomness # Group definitions groups=TEST.groups -# Tests using jtreg 4.2 b05 features -requiredVersion=4.2 b05 +# Tests using jtreg 4.2 b07 features +requiredVersion=4.2 b07 # Use new module options useNewOptions=true diff --git a/langtools/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java b/langtools/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java index cb6f9e2649a..d626771141e 100644 --- a/langtools/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java +++ b/langtools/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java @@ -23,8 +23,6 @@ package taglets; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import com.sun.javadoc.*; diff --git a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java index 951406e6782..82f3a159d37 100644 --- a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java +++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/BoldTaglet.java @@ -23,8 +23,6 @@ package testtaglets; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import com.sun.javadoc.*; diff --git a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java index daff71f24e0..87273c41388 100644 --- a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java +++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/GreenTaglet.java @@ -23,8 +23,6 @@ package testtaglets; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import com.sun.javadoc.*; diff --git a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java index f22ebe4c0d4..f5465fd7e64 100644 --- a/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java +++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/testtaglets/UnderlineTaglet.java @@ -23,8 +23,6 @@ package testtaglets; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import com.sun.javadoc.*; diff --git a/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java b/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java index da37f80b6ee..731f253dd49 100644 --- a/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java +++ b/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java @@ -23,8 +23,6 @@ package taglets; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import com.sun.javadoc.*; diff --git a/langtools/test/jdk/javadoc/tool/CheckResourceKeys.java b/langtools/test/jdk/javadoc/tool/CheckResourceKeys.java index e1df11e793a..898a8fcf315 100644 --- a/langtools/test/jdk/javadoc/tool/CheckResourceKeys.java +++ b/langtools/test/jdk/javadoc/tool/CheckResourceKeys.java @@ -33,8 +33,6 @@ */ import java.io.*; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import javax.tools.*; import com.sun.tools.classfile.*; @@ -265,7 +263,7 @@ public class CheckResourceKeys { * Get the set of keys from the javadoc resource bundles. */ Set getResourceKeys() { - Module jdk_javadoc = Layer.boot().findModule("jdk.javadoc").get(); + Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get(); String[] names = { "jdk.javadoc.internal.doclets.formats.html.resources.standard", "jdk.javadoc.internal.doclets.toolkit.resources.doclets", diff --git a/langtools/test/jdk/jshell/KullaTesting.java b/langtools/test/jdk/jshell/KullaTesting.java index b8cc5de931d..a2ea8e159b0 100644 --- a/langtools/test/jdk/jshell/KullaTesting.java +++ b/langtools/test/jdk/jshell/KullaTesting.java @@ -30,7 +30,6 @@ import java.io.StringWriter; import java.lang.reflect.Method; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.nio.file.Paths; import java.nio.file.Path; import java.util.ArrayList; @@ -211,11 +210,11 @@ public class KullaTesting { public ClassLoader createAndRunFromModule(String moduleName, Path modPath) { ModuleFinder finder = ModuleFinder.of(modPath); - Layer parent = Layer.boot(); + ModuleLayer parent = ModuleLayer.boot(); Configuration cf = parent.configuration() .resolve(finder, ModuleFinder.of(), Set.of(moduleName)); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = parent.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl); ClassLoader loader = layer.findLoader(moduleName); ClassLoader ccl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(loader); diff --git a/langtools/test/tools/javac/6410653/T6410653.java b/langtools/test/tools/javac/6410653/T6410653.java index 338b77f8b85..632574c9327 100644 --- a/langtools/test/tools/javac/6410653/T6410653.java +++ b/langtools/test/tools/javac/6410653/T6410653.java @@ -31,7 +31,6 @@ */ import java.lang.reflect.Field; -import java.lang.reflect.Module; import java.io.File; import java.io.ByteArrayOutputStream; import javax.tools.*; diff --git a/langtools/test/tools/javac/T6406771.java b/langtools/test/tools/javac/T6406771.java index a6ddd05ea4b..78d0e2c8c07 100644 --- a/langtools/test/tools/javac/T6406771.java +++ b/langtools/test/tools/javac/T6406771.java @@ -11,9 +11,9 @@ // Editing the imports and other leading text may affect the golden text in the tests field. // Also beware of scripts that auto-expand tabs to spaces. + + import java.io.*; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import javax.annotation.processing.*; import javax.lang.model.*; diff --git a/langtools/test/tools/javac/diags/CheckExamples.java b/langtools/test/tools/javac/diags/CheckExamples.java index 0e52111d673..f27aca40ec5 100644 --- a/langtools/test/tools/javac/diags/CheckExamples.java +++ b/langtools/test/tools/javac/diags/CheckExamples.java @@ -39,8 +39,6 @@ */ import java.io.*; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.util.*; @@ -111,7 +109,7 @@ public class CheckExamples { } } - Module jdk_compiler = Layer.boot().findModule("jdk.compiler").get(); + Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get(); ResourceBundle b = ResourceBundle.getBundle("com.sun.tools.javac.resources.compiler", jdk_compiler); Set resourceKeys = new TreeSet(b.keySet()); diff --git a/langtools/test/tools/javac/diags/CheckResourceKeys.java b/langtools/test/tools/javac/diags/CheckResourceKeys.java index 7178856cf3d..9ebe1f961fd 100644 --- a/langtools/test/tools/javac/diags/CheckResourceKeys.java +++ b/langtools/test/tools/javac/diags/CheckResourceKeys.java @@ -31,8 +31,6 @@ */ import java.io.*; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import javax.tools.*; import com.sun.tools.classfile.*; @@ -395,7 +393,7 @@ public class CheckResourceKeys { * Get the set of keys from the javac resource bundles. */ Set getResourceKeys() { - Module jdk_compiler = Layer.boot().findModule("jdk.compiler").get(); + Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get(); Set results = new TreeSet(); for (String name : new String[]{"javac", "compiler"}) { ResourceBundle b = diff --git a/langtools/test/tools/javac/diags/examples/NoJavaLang.java b/langtools/test/tools/javac/diags/examples/NoJavaLang.java index 50258746972..330243dbc96 100644 --- a/langtools/test/tools/javac/diags/examples/NoJavaLang.java +++ b/langtools/test/tools/javac/diags/examples/NoJavaLang.java @@ -22,7 +22,7 @@ */ // key: compiler.misc.fatal.err.no.java.lang -// options: -source 8 -target 8 -Xbootclasspath: +// options: -source 8 -target 8 -Xbootclasspath: -classpath . // run: backdoor class NoJavaLang { } diff --git a/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java b/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java index 6b93de44682..b200c4c0719 100644 --- a/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java +++ b/langtools/test/tools/javac/fatalErrors/NoJavaLangTest.java @@ -74,7 +74,7 @@ public class NoJavaLangTest { // test with bootclasspath, for as long as its around void testBootClassPath() { - String[] bcpOpts = { "-Xlint:-options", "-source", "8", "-bootclasspath", "." }; + String[] bcpOpts = { "-Xlint:-options", "-source", "8", "-bootclasspath", ".", "-classpath", "." }; test(bcpOpts, compilerErrorMessage); } diff --git a/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java b/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java index f253356f27b..6509542c1ba 100644 --- a/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java +++ b/langtools/test/tools/javac/lib/JavacTestingAbstractProcessor.java @@ -21,8 +21,6 @@ * questions. */ -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import javax.annotation.processing.*; import javax.lang.model.SourceVersion; @@ -102,7 +100,7 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor { protected void addExports(String moduleName, String... packageNames) { for (String packageName : packageNames) { try { - Layer layer = Layer.boot(); + ModuleLayer layer = ModuleLayer.boot(); Optional m = layer.findModule(moduleName); if (!m.isPresent()) throw new Error("module not found: " + moduleName); diff --git a/langtools/test/tools/javac/modules/AddLimitMods.java b/langtools/test/tools/javac/modules/AddLimitMods.java index 09be5b5e97e..55b5d82c158 100644 --- a/langtools/test/tools/javac/modules/AddLimitMods.java +++ b/langtools/test/tools/javac/modules/AddLimitMods.java @@ -418,13 +418,13 @@ public class AddLimitMods extends ModuleTestBase { " public static void main(String... args) throws Exception {\n"); for (Entry e : MODULES_TO_CHECK_TO_SAMPLE_CLASS.entrySet()) { - testClassNamed.append(" System.err.println(\"visible:" + e.getKey() + ":\" + java.lang.reflect.Layer.boot().findModule(\"" + e.getKey() + "\").isPresent());\n"); + testClassNamed.append(" System.err.println(\"visible:" + e.getKey() + ":\" + ModuleLayer.boot().findModule(\"" + e.getKey() + "\").isPresent());\n"); } testClassNamed.append(" Class cp = Class.forName(Test.class.getClassLoader().getUnnamedModule(), \"cp.CP\");\n"); testClassNamed.append(" cp.getDeclaredMethod(\"runMe\").invoke(null);\n"); - testClassNamed.append(" Class automatic = Class.forName(java.lang.reflect.Layer.boot().findModule(\"automatic\").get(), \"automatic.Automatic\");\n"); + testClassNamed.append(" Class automatic = Class.forName(ModuleLayer.boot().findModule(\"automatic\").get(), \"automatic.Automatic\");\n"); testClassNamed.append(" automatic.getDeclaredMethod(\"runMe\").invoke(null);\n"); testClassNamed.append(" }\n" + diff --git a/langtools/test/tools/javac/modules/AutomaticModules.java b/langtools/test/tools/javac/modules/AutomaticModules.java index fa7524d1786..526a193e801 100644 --- a/langtools/test/tools/javac/modules/AutomaticModules.java +++ b/langtools/test/tools/javac/modules/AutomaticModules.java @@ -300,9 +300,8 @@ public class AutomaticModules extends ModuleTestBase { .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - expected = Arrays.asList("Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read: m1x, apiB, automaticB)", - "Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)", - "2 errors"); + expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)", + "1 error"); if (!expected.equals(log)) { throw new Exception("expected output not found: " + log); @@ -310,7 +309,7 @@ public class AutomaticModules extends ModuleTestBase { } @Test - public void testDropTrailingVersion(Path base) throws Exception { + public void testWithTrailingVersion(Path base) throws Exception { Path legacySrc = base.resolve("legacy-src"); tb.writeJavaFiles(legacySrc, "package api; public class Api {}"); @@ -348,7 +347,7 @@ public class AutomaticModules extends ModuleTestBase { Files.createDirectories(classes); tb.writeJavaFiles(m, - "module m { requires test; }", + "module m { requires test1; }", "package impl; public class Impl { public void e(api.Api api) { } }"); new JavacTask(tb) @@ -358,4 +357,70 @@ public class AutomaticModules extends ModuleTestBase { .run() .writeAll(); } + + @Test + public void testMultipleAutomatic(Path base) throws Exception { + Path modulePath = base.resolve("module-path"); + + Files.createDirectories(modulePath); + + for (char c : new char[] {'A', 'B'}) { + Path automaticSrc = base.resolve("automaticSrc" + c); + tb.writeJavaFiles(automaticSrc, "package api" + c + "; public class Api {}"); + Path automaticClasses = base.resolve("automaticClasses" + c); + tb.createDirectories(automaticClasses); + + String automaticLog = new JavacTask(tb) + .outdir(automaticClasses) + .files(findJavaFiles(automaticSrc)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!automaticLog.isEmpty()) + throw new Exception("expected output not found: " + automaticLog); + + Path automaticJar = modulePath.resolve("automatic" + c + "-1.0.jar"); + + new JarTask(tb, automaticJar) + .baseDir(automaticClasses) + .files("api" + c + "/Api.class") + .run(); + } + + Path src = base.resolve("src"); + + tb.writeJavaFiles(src.resolve("m1x"), + "package impl; public class Impl { apiA.Api a; apiB.Api b; }"); + + Path classes = base.resolve("classes"); + + Files.createDirectories(classes); + + List log = new JavacTask(tb) + .options("--module-path", modulePath.toString(), + "-XDrawDiagnostics") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + List expected = Arrays.asList("Impl.java:1:35: compiler.err.package.not.visible: apiA, (compiler.misc.not.def.access.does.not.read.from.unnamed: apiA, automaticA)", + "Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read.from.unnamed: apiB, automaticB)", + "2 errors"); + + if (!expected.equals(log)) { + throw new Exception("expected output not found: " + log); + } + + new JavacTask(tb) + .options("--module-path", modulePath.toString(), + "--add-modules", "automaticA", + "-XDrawDiagnostics") + .outdir(classes) + .files(findJavaFiles(src)) + .run() + .writeAll(); + } } diff --git a/langtools/test/tools/javac/modules/IncubatingTest.java b/langtools/test/tools/javac/modules/IncubatingTest.java index a839237c4e1..796d8df343f 100644 --- a/langtools/test/tools/javac/modules/IncubatingTest.java +++ b/langtools/test/tools/javac/modules/IncubatingTest.java @@ -122,14 +122,11 @@ public class IncubatingTest extends ModuleTestBase { "-XDrawDiagnostics") .outdir(testClasses) .files(findJavaFiles(testSrc)) - .run(Expect.FAIL) + .run(Expect.SUCCESS) .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - expected = Arrays.asList( - "T.java:1:11: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.from.unnamed: api, jdk.i)", - "1 error" - ); + expected = Arrays.asList(""); if (!expected.equals(log)) { throw new AssertionError("Unexpected output: " + log); diff --git a/langtools/test/tools/javac/treeannotests/TestProcessor.java b/langtools/test/tools/javac/treeannotests/TestProcessor.java index 99fd780e463..2bc6d7eb5d3 100644 --- a/langtools/test/tools/javac/treeannotests/TestProcessor.java +++ b/langtools/test/tools/javac/treeannotests/TestProcessor.java @@ -21,8 +21,6 @@ * questions. */ -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.io.*; import java.util.*; import javax.annotation.processing.*; diff --git a/langtools/test/tools/javac/warnings/VerifyLintDescriptions.java b/langtools/test/tools/javac/warnings/VerifyLintDescriptions.java index 04aaa8418b4..54472a3b682 100644 --- a/langtools/test/tools/javac/warnings/VerifyLintDescriptions.java +++ b/langtools/test/tools/javac/warnings/VerifyLintDescriptions.java @@ -30,8 +30,6 @@ * jdk.compiler/com.sun.tools.javac.util */ -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -42,7 +40,7 @@ import com.sun.tools.javac.util.Log.PrefixKind; public class VerifyLintDescriptions { public static void main(String... args) { - Layer boot = Layer.boot(); + ModuleLayer boot = ModuleLayer.boot(); Module jdk_compiler = boot.findModule("jdk.compiler").get(); ResourceBundle b = ResourceBundle.getBundle("com.sun.tools.javac.resources.javac", Locale.US, diff --git a/langtools/test/tools/javadoc/CheckResourceKeys.java b/langtools/test/tools/javadoc/CheckResourceKeys.java index 70a705e729c..aafd039487a 100644 --- a/langtools/test/tools/javadoc/CheckResourceKeys.java +++ b/langtools/test/tools/javadoc/CheckResourceKeys.java @@ -32,8 +32,6 @@ */ import java.io.*; -import java.lang.reflect.Layer; -import java.lang.reflect.Module; import java.util.*; import javax.tools.*; import com.sun.tools.classfile.*; @@ -229,7 +227,7 @@ public class CheckResourceKeys { * Get the set of keys from the javadoc resource bundles. */ Set getResourceKeys() { - Module jdk_javadoc = Layer.boot().findModule("jdk.javadoc").get(); + Module jdk_javadoc = ModuleLayer.boot().findModule("jdk.javadoc").get(); String[] names = { "com.sun.tools.doclets.formats.html.resources.standard", "com.sun.tools.doclets.internal.toolkit.resources.doclets", From 0803dc262b80d936f56073ea92f00ed10177c50f Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 7 Apr 2017 08:08:42 +0000 Subject: [PATCH 36/75] 8177530: Module system implementation refresh (4/2017) Reviewed-by: mchung --- .../beans/CallerSensitiveDynamicMethod.java | 1 - .../jdk/dynalink/beans/CheckRestrictedPackage.java | 1 - .../jdk/dynalink/linker/support/Lookup.java | 1 - .../jdk/nashorn/internal/runtime/Context.java | 14 ++++++-------- .../nashorn/internal/runtime/NashornLoader.java | 1 - .../jdk/nashorn/internal/runtime/ScriptLoader.java | 1 - .../nashorn/internal/runtime/StructureLoader.java | 1 - .../runtime/linker/JavaAdapterClassLoader.java | 1 - .../internal/scripts/ModuleGraphManipulator.java | 1 - nashorn/test/TEST.ROOT | 2 +- .../src/jdk/nashorn/test/models/Reflector.java | 1 - 11 files changed, 7 insertions(+), 18 deletions(-) diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java index 016873489d5..6d12e2f2fd8 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CallerSensitiveDynamicMethod.java @@ -92,7 +92,6 @@ import java.lang.reflect.Executable; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java index 2427cc63205..22ce67ee968 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/beans/CheckRestrictedPackage.java @@ -84,7 +84,6 @@ package jdk.dynalink.beans; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java index b996821d8f3..d9de82e0b4e 100644 --- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java +++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/linker/support/Lookup.java @@ -89,7 +89,6 @@ import java.lang.invoke.MethodType; import java.lang.reflect.Constructor; import java.lang.reflect.Executable; import java.lang.reflect.Field; -import java.lang.reflect.Module; import java.lang.reflect.Method; /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java index d64a02aa60a..aeec38cc796 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java @@ -51,9 +51,7 @@ import java.lang.module.ModuleFinder; import java.lang.module.ModuleReader; import java.lang.module.ModuleReference; import java.lang.reflect.Field; -import java.lang.reflect.Layer; import java.lang.reflect.Modifier; -import java.lang.reflect.Module; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Path; @@ -378,7 +376,7 @@ public final class Context { static final boolean javaSqlFound, javaSqlRowsetFound; static { - final Layer boot = Layer.boot(); + final ModuleLayer boot = ModuleLayer.boot(); javaSqlFound = boot.findModule("java.sql").isPresent(); javaSqlRowsetFound = boot.findModule("java.sql.rowset").isPresent(); } @@ -1334,7 +1332,7 @@ public final class Context { * @return the new Module */ static Module createModuleTrusted(final ModuleDescriptor descriptor, final ClassLoader loader) { - return createModuleTrusted(Layer.boot(), descriptor, loader); + return createModuleTrusted(ModuleLayer.boot(), descriptor, loader); } /** @@ -1346,7 +1344,7 @@ public final class Context { * @param loader the class loader of the module * @return the new Module */ - static Module createModuleTrusted(final Layer parent, final ModuleDescriptor descriptor, final ClassLoader loader) { + static Module createModuleTrusted(final ModuleLayer parent, final ModuleDescriptor descriptor, final ClassLoader loader) { final String mn = descriptor.name(); final ModuleReference mref = new ModuleReference(descriptor, null) { @@ -1374,8 +1372,8 @@ public final class Context { final Configuration cf = parent.configuration() .resolve(finder, ModuleFinder.of(), Set.of(mn)); - final PrivilegedAction pa = () -> parent.defineModules(cf, name -> loader); - final Layer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT); + final PrivilegedAction pa = () -> parent.defineModules(cf, name -> loader); + final ModuleLayer layer = AccessController.doPrivileged(pa, GET_LOADER_ACC_CTXT); final Module m = layer.findModule(mn).get(); assert m.getLayer() == layer; @@ -1796,7 +1794,7 @@ public final class Context { collect(Collectors.toSet()); } - final Layer boot = Layer.boot(); + final ModuleLayer boot = ModuleLayer.boot(); final Configuration conf = boot.configuration(). resolve(mf, ModuleFinder.of(), rootMods); final String firstMod = rootMods.iterator().next(); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java index c9d48053bd3..cc86b464355 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java @@ -34,7 +34,6 @@ import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; -import java.lang.reflect.Module; import java.security.AccessController; import java.security.CodeSource; import java.security.Permission; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java index 24e8cc884ea..d0e0ca14899 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java @@ -27,7 +27,6 @@ package jdk.nashorn.internal.runtime; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Modifier; -import java.lang.reflect.Module; import java.security.CodeSource; import java.util.Objects; import java.util.Set; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java index 55335ba0a68..f1c9ef315b0 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java @@ -32,7 +32,6 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FI import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Modifier; -import java.lang.reflect.Module; import java.security.ProtectionDomain; import java.util.Set; import jdk.nashorn.internal.codegen.ObjectClassGenerator; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java index a488e6cd4cb..feb4bafc2f3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java @@ -27,7 +27,6 @@ package jdk.nashorn.internal.runtime.linker; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Module; import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java index b3e165ad226..72e0be1d255 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/ModuleGraphManipulator.java @@ -25,7 +25,6 @@ package jdk.nashorn.internal.scripts; -import java.lang.reflect.Module; import jdk.nashorn.api.scripting.JSObject; /** diff --git a/nashorn/test/TEST.ROOT b/nashorn/test/TEST.ROOT index 08e6c7f53f2..37d8a1cece7 100644 --- a/nashorn/test/TEST.ROOT +++ b/nashorn/test/TEST.ROOT @@ -8,7 +8,7 @@ keys=intermittent randomness groups=TEST.groups # Minimum jtreg version -requiredVersion=4.2 b04 +requiredVersion=4.2 b07 # Use new module options useNewOptions=true diff --git a/nashorn/test/src/jdk/nashorn/test/models/Reflector.java b/nashorn/test/src/jdk/nashorn/test/models/Reflector.java index 9722694bab0..72f2938d0d4 100644 --- a/nashorn/test/src/jdk/nashorn/test/models/Reflector.java +++ b/nashorn/test/src/jdk/nashorn/test/models/Reflector.java @@ -29,7 +29,6 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Executable; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.lang.reflect.Module; import jdk.nashorn.internal.runtime.Context; /** From 961c251005a407fd9873a38568fd84171960bca4 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Fri, 7 Apr 2017 10:45:26 +0200 Subject: [PATCH 37/75] 8177963: Parallel GC fails fast when per-thread task log overflows Instead of exiting the VM when per-thread task log overflows, print warnings once and ignore any further log addition attempt. Reviewed-by: ysr, kbarrett, sangheki --- .../src/share/vm/gc/parallel/gcTaskThread.cpp | 41 ++++++++++++------- .../src/share/vm/gc/parallel/gcTaskThread.hpp | 9 ++-- hotspot/src/share/vm/runtime/globals.hpp | 4 +- .../parallel/TestPrintGCDetailsVerbose.java | 5 ++- hotspot/test/native/runtime/test_globals.cpp | 2 +- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp index 48eb3c4163d..e300f8c2309 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,8 +54,26 @@ GCTaskThread::~GCTaskThread() { } } +void GCTaskThread::add_task_timestamp(const char* name, jlong t_entry, jlong t_exit) { + if (_time_stamp_index < GCTaskTimeStampEntries) { + GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index); + time_stamp->set_name(name); + time_stamp->set_entry_time(t_entry); + time_stamp->set_exit_time(t_exit); + } else { + if (_time_stamp_index == GCTaskTimeStampEntries) { + log_warning(gc, task, time)("GC-thread %u: Too many timestamps, ignoring future ones. " + "Increase GCTaskTimeStampEntries to get more info.", + id()); + } + // Let _time_stamp_index keep counting to give the user an idea about how many + // are needed. + } + _time_stamp_index++; +} + GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) { - guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries"); + assert(index < GCTaskTimeStampEntries, "Precondition"); if (_time_stamps == NULL) { // We allocate the _time_stamps array lazily since logging can be enabled dynamically GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC); @@ -65,7 +83,6 @@ GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) { FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps); } } - return &(_time_stamps[index]); } @@ -75,8 +92,11 @@ void GCTaskThread::print_task_time_stamps() { // Since _time_stamps is now lazily allocated we need to check that it // has in fact been allocated when calling this function. if (_time_stamps != NULL) { - log_debug(gc, task, time)("GC-Thread %u entries: %d", id(), _time_stamp_index); - for(uint i=0; i<_time_stamp_index; i++) { + log_debug(gc, task, time)("GC-Thread %u entries: %d%s", id(), + _time_stamp_index, + _time_stamp_index >= GCTaskTimeStampEntries ? " (overflow)" : ""); + const uint max_index = MIN2(_time_stamp_index, GCTaskTimeStampEntries); + for (uint i = 0; i < max_index; i++) { GCTaskTimeStamp* time_stamp = time_stamp_at(i); log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]", time_stamp->name(), @@ -144,16 +164,7 @@ void GCTaskThread::run() { if (log_is_enabled(Debug, gc, task, time)) { timer.update(); - - GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index); - - time_stamp->set_name(name); - time_stamp->set_entry_time(entry_time); - time_stamp->set_exit_time(timer.ticks()); - - // Update the index after we have set up the entry correctly since - // GCTaskThread::print_task_time_stamps() may read this value concurrently. - _time_stamp_index++; + add_task_timestamp(name, entry_time, timer.ticks()); } } else { // idle tasks complete outside the normal accounting diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp index 59e6286f26e..d4fbe4b96b7 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,7 @@ private: uint _time_stamp_index; GCTaskTimeStamp* time_stamp_at(uint index); + void add_task_timestamp(const char* name, jlong t_entry, jlong t_exit); bool _is_working; // True if participating in GC tasks @@ -92,16 +93,16 @@ class GCTaskTimeStamp : public CHeapObj private: jlong _entry_time; jlong _exit_time; - char* _name; + const char* _name; public: jlong entry_time() { return _entry_time; } jlong exit_time() { return _exit_time; } - const char* name() const { return (const char*)_name; } + const char* name() const { return _name; } void set_entry_time(jlong time) { _entry_time = time; } void set_exit_time(jlong time) { _exit_time = time; } - void set_name(char* name) { _name = name; } + void set_name(const char* name) { _name = name; } }; #endif // SHARE_VM_GC_PARALLEL_GCTASKTHREAD_HPP diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 8209f62efc6..77acae0abc4 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1457,9 +1457,9 @@ public: "Number of threads concurrent gc will use") \ constraint(ConcGCThreadsConstraintFunc,AfterErgo) \ \ - product(uintx, GCTaskTimeStampEntries, 200, \ + product(uint, GCTaskTimeStampEntries, 200, \ "Number of time stamp entries per gc worker thread") \ - range(1, max_uintx) \ + range(1, max_jint) \ \ product(bool, AlwaysTenure, false, \ "Always tenure objects in eden (ParallelGC only)") \ diff --git a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java index 1069b417d47..ccba8fcb8d5 100644 --- a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java +++ b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,13 @@ /* * @test TestPrintGCDetailsVerbose - * @bug 8016740 + * @bug 8016740 8177963 * @summary Tests that jvm with maximally verbose GC logging does not crash when ParOldGC has no memory * @key gc * @requires vm.gc.Parallel * @modules java.base/jdk.internal.misc * @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose + * @run main/othervm -Xmx50m -XX:+UseParallelGC -XX:GCTaskTimeStampEntries=1 -Xlog:gc*=trace TestPrintGCDetailsVerbose */ public class TestPrintGCDetailsVerbose { diff --git a/hotspot/test/native/runtime/test_globals.cpp b/hotspot/test/native/runtime/test_globals.cpp index 2b6a99771d2..3a84f2ce714 100644 --- a/hotspot/test/native/runtime/test_globals.cpp +++ b/hotspot/test/native/runtime/test_globals.cpp @@ -53,7 +53,7 @@ TEST_VM(FlagGuard, uint_flag) { } TEST_VM(FlagGuard, uintx_flag) { - TEST_FLAG(GCTaskTimeStampEntries, uintx, 1337); + TEST_FLAG(GCTaskTimeStampEntries, uint, 1337); } TEST_VM(FlagGuard, size_t_flag) { From 19becf9f6185a1458162fa8dded0963b1fd56752 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 7 Apr 2017 10:39:46 +0100 Subject: [PATCH 38/75] 8178161: Default multicast interface on Mac Reviewed-by: michaelm, bpb --- .../classes/java/net/DefaultInterface.java | 53 ++++++++++++++----- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java index 573de6986f8..b68e3aa0034 100644 --- a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java +++ b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java @@ -50,10 +50,11 @@ class DefaultInterface { } /** - * Choose a default interface. This method returns an interface that is - * both "up" and supports multicast. This method choses an interface in + * Choose a default interface. This method returns the first interface that + * is both "up" and supports multicast. This method chooses an interface in * order of preference: * 1. neither loopback nor point to point + * ( prefer interfaces with dual IP support ) * 2. point to point * 3. loopback * @@ -66,32 +67,56 @@ class DefaultInterface { try { nifs = NetworkInterface.getNetworkInterfaces(); } catch (IOException ignore) { - // unable to enumate network interfaces + // unable to enumerate network interfaces return null; } + NetworkInterface preferred = null; NetworkInterface ppp = null; NetworkInterface loopback = null; while (nifs.hasMoreElements()) { NetworkInterface ni = nifs.nextElement(); try { - if (ni.isUp() && ni.supportsMulticast()) { - boolean isLoopback = ni.isLoopback(); - boolean isPPP = ni.isPointToPoint(); - if (!isLoopback && !isPPP) { - // found an interface that is not the loopback or a - // point-to-point interface + if (!ni.isUp() || !ni.supportsMulticast()) + continue; + + boolean ip4 = false, ip6 = false; + Enumeration addrs = ni.getInetAddresses(); + while (addrs.hasMoreElements()) { + InetAddress addr = addrs.nextElement(); + if (!addr.isAnyLocalAddress()) { + if (addr instanceof Inet4Address) { + ip4 = true; + } else if (addr instanceof Inet6Address) { + ip6 = true; + } + } + } + + boolean isLoopback = ni.isLoopback(); + boolean isPPP = ni.isPointToPoint(); + if (!isLoopback && !isPPP) { + // found an interface that is not the loopback or a + // point-to-point interface + if (preferred == null) { + preferred = ni; + } else if (ip4 && ip6){ return ni; } - if (ppp == null && isPPP) - ppp = ni; - if (loopback == null && isLoopback) - loopback = ni; } + if (ppp == null && isPPP) + ppp = ni; + if (loopback == null && isLoopback) + loopback = ni; + } catch (IOException skip) { } } - return (ppp != null) ? ppp : loopback; + if (preferred != null) { + return preferred; + } else { + return (ppp != null) ? ppp : loopback; + } } } From 7b865d0e6610a5df5dcdeb402b40bfdbed0e5028 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 7 Apr 2017 13:42:00 +0100 Subject: [PATCH 39/75] 8170812: Metaspace corruption caused by incorrect memory size for MethodCounters Reviewed-by: kbarrett, coleenp --- hotspot/src/share/vm/oops/constMethod.hpp | 4 +++- hotspot/src/share/vm/oops/constantPool.hpp | 4 +++- hotspot/src/share/vm/oops/cpCache.hpp | 4 +++- hotspot/src/share/vm/oops/method.hpp | 4 +++- hotspot/src/share/vm/oops/methodCounters.hpp | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp index 45246ba209b..7453ecbf689 100644 --- a/hotspot/src/share/vm/oops/constMethod.hpp +++ b/hotspot/src/share/vm/oops/constMethod.hpp @@ -359,7 +359,9 @@ public: } // Sizing - static int header_size() { return sizeof(ConstMethod)/wordSize; } + static int header_size() { + return align_size_up(sizeof(ConstMethod), wordSize) / wordSize; + } // Size needed static int size(int code_size, InlineTableSizes* sizes); diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp index 38a71f525d2..86cfa192171 100644 --- a/hotspot/src/share/vm/oops/constantPool.hpp +++ b/hotspot/src/share/vm/oops/constantPool.hpp @@ -705,7 +705,9 @@ class ConstantPool : public Metadata { } // Sizing (in words) - static int header_size() { return sizeof(ConstantPool)/wordSize; } + static int header_size() { + return align_size_up(sizeof(ConstantPool), wordSize) / wordSize; + } static int size(int length) { return align_metadata_size(header_size() + length); } int size() const { return size(length()); } #if INCLUDE_SERVICES diff --git a/hotspot/src/share/vm/oops/cpCache.hpp b/hotspot/src/share/vm/oops/cpCache.hpp index e58d7c16ceb..e68c68a5098 100644 --- a/hotspot/src/share/vm/oops/cpCache.hpp +++ b/hotspot/src/share/vm/oops/cpCache.hpp @@ -359,7 +359,9 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC { return (TosState)((_flags >> tos_state_shift) & tos_state_mask); } // Code generation support - static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / wordSize); } + static WordSize size() { + return in_WordSize(align_size_up(sizeof(ConstantPoolCacheEntry), wordSize) / wordSize); + } static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); } static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); } static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); } diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp index ebd5f0feef2..6675410db81 100644 --- a/hotspot/src/share/vm/oops/method.hpp +++ b/hotspot/src/share/vm/oops/method.hpp @@ -671,7 +671,9 @@ class Method : public Metadata { #endif // sizing - static int header_size() { return sizeof(Method)/wordSize; } + static int header_size() { + return align_size_up(sizeof(Method), wordSize) / wordSize; + } static int size(bool is_native); int size() const { return method_size(); } #if INCLUDE_SERVICES diff --git a/hotspot/src/share/vm/oops/methodCounters.hpp b/hotspot/src/share/vm/oops/methodCounters.hpp index df96b638735..73c438b71ea 100644 --- a/hotspot/src/share/vm/oops/methodCounters.hpp +++ b/hotspot/src/share/vm/oops/methodCounters.hpp @@ -116,7 +116,9 @@ class MethodCounters: public MetaspaceObj { AOT_ONLY(Method* method() const { return _method; }) - static int size() { return sizeof(MethodCounters) / wordSize; } + static int size() { + return align_size_up(sizeof(MethodCounters), wordSize) / wordSize; + } bool is_klass() const { return false; } From d950713f32c58659d8860d38f8359f63fc0a98f9 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 7 Apr 2017 15:46:31 +0100 Subject: [PATCH 40/75] 8178283: tools/javac/lambda/speculative/T8177933.java fails with assertion error Disable test on solaris Reviewed-by: darcy --- langtools/test/tools/javac/lambda/speculative/T8177933.java | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/test/tools/javac/lambda/speculative/T8177933.java b/langtools/test/tools/javac/lambda/speculative/T8177933.java index 2487f7bb1c4..d9a1ac276aa 100644 --- a/langtools/test/tools/javac/lambda/speculative/T8177933.java +++ b/langtools/test/tools/javac/lambda/speculative/T8177933.java @@ -29,6 +29,7 @@ * @summary Stackoverflow during compilation, starting jdk-9+163 * * @library /tools/javac/lib + * @requires !(os.family == "solaris") * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.code * jdk.compiler/com.sun.tools.javac.comp From 06164475decd52f2bc8822e3b3f8afa9f9c90cf0 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 7 Apr 2017 11:31:57 -0700 Subject: [PATCH 41/75] 8178074: (ch) java/nio/channels/etc/AdaptorCloseAndInterrupt.java: add instrumentation Add some print statements to indicate state at strategic points Reviewed-by: chegar --- .../etc/AdaptorCloseAndInterrupt.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java b/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java index 3e48ace3274..368437a3803 100644 --- a/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java +++ b/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.Random; @@ -46,6 +47,9 @@ public class AdaptorCloseAndInterrupt { final DatagramChannel peer; final int port; + final AtomicBoolean isClosed = new AtomicBoolean(); + final AtomicBoolean isInterrupted = new AtomicBoolean(); + public AdaptorCloseAndInterrupt() { listener = null; peer = null; @@ -96,6 +100,7 @@ public class AdaptorCloseAndInterrupt { try { sc.socket().getInputStream().read(new byte[100]); + System.err.format("close() was invoked: %s%n", isClosed.get()); throw new RuntimeException("read should not have completed"); } catch (ClosedChannelException expected) {} @@ -119,7 +124,10 @@ public class AdaptorCloseAndInterrupt { sc.socket().getInputStream().read(new byte[100]); throw new RuntimeException("read should not have completed"); } catch (ClosedByInterruptException expected) { - Thread.currentThread().interrupted(); + System.out.format("interrupt() was invoked: %s%n", + isInterrupted.get()); + System.out.format("scReadAsyncInterrupt was interrupted: %s%n", + Thread.currentThread().interrupted()); } if (!sc.socket().isClosed()) @@ -140,6 +148,7 @@ public class AdaptorCloseAndInterrupt { try { dc.socket().receive(new DatagramPacket(new byte[100], 100)); + System.err.format("close() was invoked: %s%n", isClosed.get()); throw new RuntimeException("receive should not have completed"); } catch (ClosedChannelException expected) {} @@ -159,7 +168,16 @@ public class AdaptorCloseAndInterrupt { dc.socket().receive(new DatagramPacket(new byte[100], 100)); throw new RuntimeException("receive should not have completed"); } catch (ClosedByInterruptException expected) { - Thread.currentThread().interrupted(); + System.out.format("interrupt() was invoked: %s%n", + isInterrupted.get()); + System.out.format("dcReceiveAsyncInterrupt was interrupted: %s%n", + Thread.currentThread().interrupted()); + } catch (SocketTimeoutException unexpected) { + System.err.format("Receive thread interrupt invoked: %s%n", + isInterrupted.get()); + System.err.format("Receive thread was interrupted: %s%n", + Thread.currentThread().isInterrupted()); + throw unexpected; } if (!dc.socket().isClosed()) @@ -175,6 +193,7 @@ public class AdaptorCloseAndInterrupt { try { ssc.socket().accept(); + System.err.format("close() was invoked: %s%n", isClosed.get()); throw new RuntimeException("accept should not have completed"); } catch (ClosedChannelException expected) {} @@ -193,7 +212,10 @@ public class AdaptorCloseAndInterrupt { ssc.socket().accept(); throw new RuntimeException("accept should not have completed"); } catch (ClosedByInterruptException expected) { - Thread.currentThread().interrupted(); + System.out.format("interrupt() was invoked: %s%n", + isInterrupted.get()); + System.out.format("ssAcceptAsyncInterrupt was interrupted: %s%n", + Thread.currentThread().interrupted()); } if (!ssc.socket().isClosed()) @@ -204,6 +226,7 @@ public class AdaptorCloseAndInterrupt { AdaptorCloseAndInterrupt.pool.schedule(new Callable() { public Void call() throws Exception { sc.close(); + isClosed.set(true); return null; } }, new Random().nextInt(1000), TimeUnit.MILLISECONDS); @@ -214,6 +237,7 @@ public class AdaptorCloseAndInterrupt { AdaptorCloseAndInterrupt.pool.schedule(new Callable() { public Void call() throws Exception { current.interrupt(); + isInterrupted.set(true); return null; } }, new Random().nextInt(1000), TimeUnit.MILLISECONDS); From 80eb904ede5503fba9d7c0d6cb8c7c5a21750727 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Fri, 7 Apr 2017 15:41:07 -0700 Subject: [PATCH 42/75] 8173152: Wrong wording in Comparator.compare() method spec Reviewed-by: bpb --- .../share/classes/java/lang/Comparable.java | 4 ++-- .../share/classes/java/util/Comparator.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Comparable.java b/jdk/src/java.base/share/classes/java/lang/Comparable.java index ff8892caacf..b1c27f1911d 100644 --- a/jdk/src/java.base/share/classes/java/lang/Comparable.java +++ b/jdk/src/java.base/share/classes/java/lang/Comparable.java @@ -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 @@ -124,7 +124,7 @@ public interface Comparable { * {@code sgn(}expression{@code )} designates the mathematical * signum function, which is defined to return one of {@code -1}, * {@code 0}, or {@code 1} according to whether the value of - * expression is negative, zero or positive. + * expression is negative, zero, or positive, respectively. * * @param o the object to be compared. * @return a negative integer, zero, or a positive integer as this object diff --git a/jdk/src/java.base/share/classes/java/util/Comparator.java b/jdk/src/java.base/share/classes/java/util/Comparator.java index ade582dbd3b..85f25beaf63 100644 --- a/jdk/src/java.base/share/classes/java/util/Comparator.java +++ b/jdk/src/java.base/share/classes/java/util/Comparator.java @@ -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 @@ -112,12 +112,6 @@ public interface Comparator { * zero, or a positive integer as the first argument is less than, equal * to, or greater than the second.

          * - * In the foregoing description, the notation - * {@code sgn(}expression{@code )} designates the mathematical - * signum function, which is defined to return one of {@code -1}, - * {@code 0}, or {@code 1} according to whether the value of - * expression is negative, zero or positive.

          - * * The implementor must ensure that {@code sgn(compare(x, y)) == * -sgn(compare(y, x))} for all {@code x} and {@code y}. (This * implies that {@code compare(x, y)} must throw an exception if and only @@ -135,7 +129,13 @@ public interface Comparator { * {@code (compare(x, y)==0) == (x.equals(y))}. Generally speaking, * any comparator that violates this condition should clearly indicate * this fact. The recommended language is "Note: this comparator - * imposes orderings that are inconsistent with equals." + * imposes orderings that are inconsistent with equals."

          + * + * In the foregoing description, the notation + * {@code sgn(}expression{@code )} designates the mathematical + * signum function, which is defined to return one of {@code -1}, + * {@code 0}, or {@code 1} according to whether the value of + * expression is negative, zero, or positive, respectively. * * @param o1 the first object to be compared. * @param o2 the second object to be compared. From c4d0e650156950beb970ebe0a82e07cfecb0d48b Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 7 Apr 2017 19:36:35 -0700 Subject: [PATCH 43/75] 8178333: CTW/PathHandler uses == instead of String::equals for string comparison Reviewed-by: kvn --- .../ctw/src/sun/hotspot/tools/ctw/PathHandler.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java index 36e6ddea8be..f5347cd8242 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,8 +151,9 @@ public abstract class PathHandler { if (id >= Utils.COMPILE_THE_WORLD_START_AT) { try { Class aClass = loader.loadClass(name); - if (name != "sun.reflect.misc.Trampoline" - && name != "sun.tools.jconsole.OutputViewer") { // workaround for JDK-8159155 + if (!"sun.reflect.misc.Trampoline".equals(name) + // workaround for JDK-8159155 + && !"sun.tools.jconsole.OutputViewer".equals(name)) { UNSAFE.ensureClassInitialized(aClass); } CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name); From 5622eecc0a443563bf2b2a033ed15988918f9065 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Sun, 9 Apr 2017 14:25:07 -0400 Subject: [PATCH 44/75] 8178130: Minor update to the Connection javadocs Reviewed-by: bpb --- .../share/classes/java/sql/Connection.java | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/jdk/src/java.sql/share/classes/java/sql/Connection.java b/jdk/src/java.sql/share/classes/java/sql/Connection.java index 944042aeb65..446f63c0f36 100644 --- a/jdk/src/java.sql/share/classes/java/sql/Connection.java +++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java @@ -1535,8 +1535,9 @@ throws SQLException; *

        • The connection pool caches {@code PooledConnection} objects
        • *
        • Returns a logical connection handle when {@code getConnection} is * called by the application
        • - *
        • The pool manager calls {@code Connection.close} on the logical connection handle - * prior to returning the {@code PooledConnection} back to the cache
        • + *
        • The logical {@code Connection} is closed by calling + * {@code Connection.close} prior to returning the {@code PooledConnection} + * to the cache.
        • *
        * @throws SQLException if an error occurs * @since 9 @@ -1577,8 +1578,9 @@ throws SQLException; *
      • The connection pool caches {@code PooledConnection} objects
      • *
      • Returns a logical connection handle when {@code getConnection} is * called by the application
      • - *
      • The pool manager calls {@code Connection.close} on the logical connection handle - * prior to returning the {@code PooledConnection} back to the cache
      • + *
      • The logical {@code Connection} is closed by calling + * {@code Connection.close} prior to returning the {@code PooledConnection} + * to the cache.
      • * * @throws SQLException if an error occurs * @since 9 @@ -1590,7 +1592,10 @@ throws SQLException; } /** - * Sets and validates the sharding keys for this connection. + * Sets and validates the sharding keys for this connection. A {@code null} + * value may be specified for the sharding Key. The validity + * of a {@code null} sharding key is vendor-specific. Consult your vendor's + * documentation for additional information. * @implSpec * The default implementation will throw a * {@code SQLFeatureNotSupportedException}. @@ -1600,7 +1605,8 @@ throws SQLException; * {@code Connection}. The timeout value indicates how long the driver * should wait for the {@code Connection} to verify that the sharding key * is valid before {@code setShardingKeyIfValid} returns false. - * @param shardingKey the sharding key to be validated against this connection + * @param shardingKey the sharding key to be validated against this connection. + * The sharding key may be {@code null} * @param superShardingKey the super sharding key to be validated against this * connection. The super sharding key may be {@code null}. * @param timeout time in seconds before which the validation process is expected to @@ -1610,10 +1616,10 @@ throws SQLException; * and set on this connection; false if the sharding keys are not valid or * the timeout period expires before the operation completes. * @throws SQLException if an error occurs while performing this validation; - * the {@code shardingkey} is {@code null}; a {@code superSharedingKey} is specified + * a {@code superSharedingKey} is specified * without a {@code shardingKey}; * this method is called on a closed {@code connection}; or - * the {@code timeout} value is less than 0. + * the {@code timeout} value is negative. * @throws SQLFeatureNotSupportedException if the driver does not support sharding * @since 9 * @see ShardingKey @@ -1626,7 +1632,10 @@ throws SQLException; } /** - * Sets and validates the sharding key for this connection. + * Sets and validates the sharding key for this connection. A {@code null} + * value may be specified for the sharding Key. The validity + * of a {@code null} sharding key is vendor-specific. Consult your vendor's + * documentation for additional information. * @implSpec * The default implementation will throw a * {@code SQLFeatureNotSupportedException}. @@ -1635,7 +1644,8 @@ throws SQLException; * {@code Connection}. The timeout value indicates how long the driver * should wait for the {@code Connection} to verify that the sharding key * is valid before {@code setShardingKeyIfValid} returns false. - * @param shardingKey the sharding key to be validated against this connection + * @param shardingKey the sharding key to be validated against this connection. + * The sharding key may be {@code null} * @param timeout time in seconds before which the validation process is expected to * be completed,else the validation process is aborted. A value of 0 indicates * the validation process will not time out. @@ -1643,8 +1653,8 @@ throws SQLException; * set on this connection; false if the sharding key is not valid or * the timeout period expires before the operation completes. * @throws SQLException if there is an error while performing this validation; - * this method is called on a closed {@code connection}; the {@code shardingkey} - * is {@code null}; or the {@code timeout} value is less than 0. + * this method is called on a closed {@code connection}; + * or the {@code timeout} value is negative. * @throws SQLFeatureNotSupportedException if the driver does not support sharding * @since 9 * @see ShardingKey @@ -1664,12 +1674,12 @@ throws SQLException; * This method sets the specified sharding keys but does not require a * round trip to the database to validate that the sharding keys are valid * for the {@code Connection}. - * @param shardingKey the sharding key to set on this connection. + * @param shardingKey the sharding key to set on this connection. The sharding + * key may be {@code null} * @param superShardingKey the super sharding key to set on this connection. * The super sharding key may be {@code null} * @throws SQLException if an error occurs setting the sharding keys; - * this method is called on a closed {@code connection}; - * the {@code shardingkey} is {@code null}; or + * this method is called on a closed {@code connection}; or * a {@code superSharedingKey} is specified without a {@code shardingKey} * @throws SQLFeatureNotSupportedException if the driver does not support sharding * @since 9 @@ -1690,10 +1700,10 @@ throws SQLException; * This method sets the specified sharding key but does not require a * round trip to the database to validate that the sharding key is valid * for the {@code Connection}. - * @param shardingKey the sharding key to set on this connection. - * @throws SQLException if an error occurs setting the sharding key; - * this method is called on a closed {@code connection}; or the - * {@code shardkingKey} is {@code null} + * @param shardingKey the sharding key to set on this connection. The sharding + * key may be {@code null} + * @throws SQLException if an error occurs setting the sharding key; or + * this method is called on a closed {@code connection} * @throws SQLFeatureNotSupportedException if the driver does not support sharding * @since 9 * @see ShardingKey From 28f4bade5b11037045538849ea6ef57fec8ed9e4 Mon Sep 17 00:00:00 2001 From: Amit Sapre Date: Mon, 10 Apr 2017 12:15:13 +0530 Subject: [PATCH 45/75] 8176204: [DOC] ThreadMXBean Fails to Detect ReentrantReadWriteLock Deadlock Update LockInfo class javadoc for own-able synchronizer examples Reviewed-by: dholmes --- .../share/classes/java/lang/management/LockInfo.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java b/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java index 7ad4760a869..91e5545e387 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java +++ b/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ import sun.management.LockInfoCompositeData; * a synchronizer that may be exclusively owned by a thread and uses * {@link AbstractOwnableSynchronizer AbstractOwnableSynchronizer} * (or its subclass) to implement its synchronization property. - * {@link ReentrantLock ReentrantLock} and - * {@link ReentrantReadWriteLock ReentrantReadWriteLock} are + * {@link ReentrantLock ReentrantLock} and the write-lock (but not + * the read-lock) of {@link ReentrantReadWriteLock ReentrantReadWriteLock} are * two examples of ownable synchronizers provided by the platform. * *

        MXBean Mapping

        From d38fa28ac933dfdb2fd2f8f5d4452ca1c1b20d62 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 10 Apr 2017 11:08:59 +0200 Subject: [PATCH 46/75] 8178011: Automatic module warnings Adding lints for automatic modules in requires and requires transitive directives. Reviewed-by: jjg --- .../com/sun/tools/javac/code/Lint.java | 11 + .../com/sun/tools/javac/comp/Check.java | 12 ++ .../com/sun/tools/javac/comp/Modules.java | 1 + .../tools/javac/resources/compiler.properties | 6 + .../tools/javac/resources/javac.properties | 6 + langtools/test/tools/javac/diags/Example.java | 60 +++++- .../RequiresAutomatic/module-info.java | 28 +++ .../RequiresAutomatic/modulepath/a/A.java | 24 +++ .../module-info.java | 27 +++ .../modulepath/a/A.java | 24 +++ .../tools/javac/modules/AutomaticModules.java | 193 +++++++++++++++++- 11 files changed, 388 insertions(+), 4 deletions(-) create mode 100644 langtools/test/tools/javac/diags/examples/RequiresAutomatic/module-info.java create mode 100644 langtools/test/tools/javac/diags/examples/RequiresAutomatic/modulepath/a/A.java create mode 100644 langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/module-info.java create mode 100644 langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/modulepath/a/A.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java index 8a050922259..1e301d55729 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java @@ -118,6 +118,7 @@ public class Lint if (source.compareTo(Source.JDK1_9) >= 0) { values.add(LintCategory.DEP_ANN); } + values.add(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC); values.add(LintCategory.OPENS); values.add(LintCategory.MODULE); values.add(LintCategory.REMOVAL); @@ -253,6 +254,16 @@ public class Lint */ REMOVAL("removal"), + /** + * Warn about use of automatic modules in the requires clauses. + */ + REQUIRES_AUTOMATIC("requires-automatic"), + + /** + * Warn about automatic modules in requires transitive. + */ + REQUIRES_TRANSITIVE_AUTOMATIC("requires-transitive-automatic"), + /** * Warn about Serializable classes that do not provide a serial version ID. */ diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index f8b9ee6761e..317f759e4c4 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -3908,4 +3908,16 @@ public class Check { } } + void checkModuleRequires(final DiagnosticPosition pos, final RequiresDirective rd) { + if ((rd.module.flags() & Flags.AUTOMATIC_MODULE) != 0) { + deferredLintHandler.report(() -> { + if (rd.isTransitive() && lint.isEnabled(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC)) { + log.warning(pos, Warnings.RequiresTransitiveAutomatic); + } else if (lint.isEnabled(LintCategory.REQUIRES_AUTOMATIC)) { + log.warning(pos, Warnings.RequiresAutomatic); + } + }); + } + } + } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java index 8bee15ab32c..3e9e184c8b1 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java @@ -1084,6 +1084,7 @@ public class Modules extends JCTree.Visitor { public void visitRequires(JCRequires tree) { if (tree.directive != null && allModules().contains(tree.directive.module)) { chk.checkDeprecated(tree.moduleName.pos(), msym, tree.directive.module); + chk.checkModuleRequires(tree.moduleName.pos(), tree.directive); msym.directives = msym.directives.prepend(tree.directive); } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index f72baf51d57..08484b1a278 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -1664,6 +1664,12 @@ compiler.warn.option.obsolete.suppression=\ compiler.warn.future.attr=\ {0} attribute introduced in version {1}.{2} class files is ignored in version {3}.{4} class files +compiler.warn.requires.automatic=\ + requires directive for an automatic module + +compiler.warn.requires.transitive.automatic=\ + requires transitive directive for an automatic module + # Warnings related to annotation processing # 0: string compiler.warn.proc.package.does.not.exist=\ diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties index 97327c63329..18d8c2d67c0 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties @@ -230,6 +230,12 @@ javac.opt.Xlint.desc.rawtypes=\ javac.opt.Xlint.desc.removal=\ Warn about use of API that has been marked for removal. +javac.opt.Xlint.desc.requires-automatic=\ + Warn about use of automatic modules in the requires clauses. + +javac.opt.Xlint.desc.requires-transitive-automatic=\ + Warn about automatic modules in requires transitive. + javac.opt.Xlint.desc.serial=\ Warn about Serializable classes that do not provide a serial version ID. \n\ \ Also warn about access to non-public members from a serializable element. diff --git a/langtools/test/tools/javac/diags/Example.java b/langtools/test/tools/javac/diags/Example.java index f72dc5c243a..8cadd96a4c3 100644 --- a/langtools/test/tools/javac/diags/Example.java +++ b/langtools/test/tools/javac/diags/Example.java @@ -24,8 +24,18 @@ import java.io.*; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; +import java.util.Map.Entry; +import java.util.jar.JarFile; +import java.util.jar.JarOutputStream; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.regex.*; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; + import javax.annotation.processing.Processor; import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; @@ -210,9 +220,53 @@ class Example implements Comparable { File modulepathDir = new File(tempDir, "modulepath"); modulepathDir.mkdirs(); clean(modulepathDir); - List sOpts = Arrays.asList("-d", modulepathDir.getPath(), - "--module-source-path", new File(file, "modulepath").getAbsolutePath()); - new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles); + boolean hasModuleInfo = + modulePathFiles.stream() + .anyMatch(f -> f.getName().equalsIgnoreCase("module-info.java")); + Path modulePath = new File(file, "modulepath").toPath().toAbsolutePath(); + if (hasModuleInfo) { + //ordinary modules + List sOpts = + Arrays.asList("-d", modulepathDir.getPath(), + "--module-source-path", modulePath.toString()); + new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles); + } else { + //automatic modules: + Map> module2Files = + modulePathFiles.stream() + .map(f -> f.toPath()) + .collect(Collectors.groupingBy(p -> modulePath.relativize(p) + .getName(0) + .toString())); + for (Entry> e : module2Files.entrySet()) { + File scratchDir = new File(tempDir, "scratch"); + scratchDir.mkdirs(); + clean(scratchDir); + List sOpts = + Arrays.asList("-d", scratchDir.getPath()); + new Jsr199Compiler(verbose).run(null, + null, + false, + sOpts, + e.getValue().stream() + .map(p -> p.toFile()) + .collect(Collectors.toList())); + try (JarOutputStream jarOut = + new JarOutputStream(new FileOutputStream(new File(modulepathDir, e.getKey() + ".jar")))) { + Files.find(scratchDir.toPath(), Integer.MAX_VALUE, (p, attr) -> attr.isRegularFile()) + .forEach(p -> { + try (InputStream in = Files.newInputStream(p)) { + jarOut.putNextEntry(new ZipEntry(scratchDir.toPath() + .relativize(p) + .toString())); + jarOut.write(in.readAllBytes()); + } catch (IOException ex) { + throw new IllegalStateException(ex); + } + }); + } + } + } opts.add("--module-path"); opts.add(modulepathDir.getAbsolutePath()); } diff --git a/langtools/test/tools/javac/diags/examples/RequiresAutomatic/module-info.java b/langtools/test/tools/javac/diags/examples/RequiresAutomatic/module-info.java new file mode 100644 index 00000000000..349b4f57dbf --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/RequiresAutomatic/module-info.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +//options: -Xlint:requires-automatic +//key: compiler.warn.requires.automatic +module RequiresAutomatic { + requires a; +} diff --git a/langtools/test/tools/javac/diags/examples/RequiresAutomatic/modulepath/a/A.java b/langtools/test/tools/javac/diags/examples/RequiresAutomatic/modulepath/a/A.java new file mode 100644 index 00000000000..45d652e3604 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/RequiresAutomatic/modulepath/a/A.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +public class A {} diff --git a/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/module-info.java b/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/module-info.java new file mode 100644 index 00000000000..99948503a08 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/module-info.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +//key: compiler.warn.requires.transitive.automatic +module RequiresTransitiveAutomatic { + requires transitive a; +} diff --git a/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/modulepath/a/A.java b/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/modulepath/a/A.java new file mode 100644 index 00000000000..45d652e3604 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/RequiresTransitiveAutomatic/modulepath/a/A.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +public class A {} diff --git a/langtools/test/tools/javac/modules/AutomaticModules.java b/langtools/test/tools/javac/modules/AutomaticModules.java index 526a193e801..75b03739437 100644 --- a/langtools/test/tools/javac/modules/AutomaticModules.java +++ b/langtools/test/tools/javac/modules/AutomaticModules.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8155026 + * @bug 8155026 8178011 * @summary Test automatic modules * @library /tools/lib * @modules @@ -423,4 +423,195 @@ public class AutomaticModules extends ModuleTestBase { .run() .writeAll(); } + + @Test + public void testLintRequireAutomatic(Path base) throws Exception { + Path modulePath = base.resolve("module-path"); + + Files.createDirectories(modulePath); + + for (char c : new char[] {'A', 'B'}) { + Path automaticSrc = base.resolve("automaticSrc" + c); + tb.writeJavaFiles(automaticSrc, "package api" + c + "; public class Api {}"); + Path automaticClasses = base.resolve("automaticClasses" + c); + tb.createDirectories(automaticClasses); + + String automaticLog = new JavacTask(tb) + .outdir(automaticClasses) + .files(findJavaFiles(automaticSrc)) + .run() + .writeAll() + .getOutput(Task.OutputKind.DIRECT); + + if (!automaticLog.isEmpty()) + throw new Exception("expected output not found: " + automaticLog); + + Path automaticJar = modulePath.resolve("automatic" + c + "-1.0.jar"); + + new JarTask(tb, automaticJar) + .baseDir(automaticClasses) + .files("api" + c + "/Api.class") + .run(); + } + + Path src = base.resolve("src"); + + tb.writeJavaFiles(src, + "module m1x {\n" + + " requires transitive automaticA;\n" + + " requires automaticB;\n" + + "}"); + + Path classes = base.resolve("classes"); + + Files.createDirectories(classes); + + List expected; + List log; + + log = new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + expected = Arrays.asList("module-info.java:2:25: compiler.warn.requires.transitive.automatic", + "- compiler.err.warnings.and.werror", + "1 error", + "1 warning"); + + if (!expected.equals(log)) { + throw new Exception("expected output not found: " + log); + } + + log = new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-Xlint:requires-automatic", + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + expected = Arrays.asList("module-info.java:2:25: compiler.warn.requires.transitive.automatic", + "module-info.java:3:14: compiler.warn.requires.automatic", + "- compiler.err.warnings.and.werror", + "1 error", + "2 warnings"); + + if (!expected.equals(log)) { + throw new Exception("expected output not found: " + log); + } + + log = new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-Xlint:-requires-transitive-automatic,requires-automatic", + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + expected = Arrays.asList("module-info.java:2:25: compiler.warn.requires.automatic", + "module-info.java:3:14: compiler.warn.requires.automatic", + "- compiler.err.warnings.and.werror", + "1 error", + "2 warnings"); + + if (!expected.equals(log)) { + throw new Exception("expected output not found: " + log); + } + + new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-Xlint:-requires-transitive-automatic", + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.SUCCESS) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + tb.writeJavaFiles(src, + "@SuppressWarnings(\"requires-transitive-automatic\")\n" + + "module m1x {\n" + + " requires transitive automaticA;\n" + + " requires automaticB;\n" + + "}"); + + new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.SUCCESS) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + log = new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-Xlint:requires-automatic", + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + expected = Arrays.asList("module-info.java:3:25: compiler.warn.requires.automatic", + "module-info.java:4:14: compiler.warn.requires.automatic", + "- compiler.err.warnings.and.werror", + "1 error", + "2 warnings"); + + if (!expected.equals(log)) { + throw new Exception("expected output not found: " + log); + } + + tb.writeJavaFiles(src, + "@SuppressWarnings(\"requires-automatic\")\n" + + "module m1x {\n" + + " requires transitive automaticA;\n" + + " requires automaticB;\n" + + "}"); + + log = new JavacTask(tb) + .options("--source-path", src.toString(), + "--module-path", modulePath.toString(), + "-Xlint:requires-automatic", + "-XDrawDiagnostics", + "-Werror") + .outdir(classes) + .files(findJavaFiles(src)) + .run(Task.Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + expected = Arrays.asList("module-info.java:3:25: compiler.warn.requires.transitive.automatic", + "- compiler.err.warnings.and.werror", + "1 error", + "1 warning"); + + if (!expected.equals(log)) { + throw new Exception("expected output not found: " + log); + } + } + } From 673bad6edb4ae22199933dceadf81cede075167f Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Mon, 10 Apr 2017 13:42:13 -0700 Subject: [PATCH 47/75] 8177855: Clean up legal files Reviewed-by: alanb, darcy --- jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md b/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md index 54343b7483d..2555613c67c 100644 --- a/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md +++ b/jaxws/src/jdk.xml.bind/share/legal/relaxngdatatype.md @@ -3,7 +3,7 @@ ### RelaxNG Datatype License
         
        -Copyright (c) 2001, Thai Open Source Software Center Ltd, Sun Microsystems.
        +Copyright (c) 2005, 2010 Thai Open Source Software Center Ltd
         All rights reserved.
         
         Redistribution and use in source and binary forms, with or without
        
        From 05b72d87e7f0a3ea7568f6e505b4cd77ea32421f Mon Sep 17 00:00:00 2001
        From: Doug Lea 
        Date: Mon, 10 Apr 2017 13:46:16 -0700
        Subject: [PATCH 48/75] 8176402: parameter name switcharoo in ConcurrentHashMap
        
        Reviewed-by: martin, psandoz
        ---
         .../util/concurrent/ConcurrentHashMap.java    | 25 ++++++++++---------
         1 file changed, 13 insertions(+), 12 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
        index 1d80077b58c..8ebdae0e1cc 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
        @@ -1032,9 +1032,10 @@ public class ConcurrentHashMap extends AbstractMap
                     }
                     else if ((fh = f.hash) == MOVED)
                         tab = helpTransfer(tab, f);
        -            else if (onlyIfAbsent && fh == hash &&  // check first node
        -                     ((fk = f.key) == key || fk != null && key.equals(fk)) &&
        -                     (fv = f.val) != null)
        +            else if (onlyIfAbsent // check first node without acquiring lock
        +                     && fh == hash
        +                     && ((fk = f.key) == key || (fk != null && key.equals(fk)))
        +                     && (fv = f.val) != null)
                         return fv;
                     else {
                         V oldVal = null;
        @@ -1728,9 +1729,9 @@ public class ConcurrentHashMap extends AbstractMap
                     }
                     else if ((fh = f.hash) == MOVED)
                         tab = helpTransfer(tab, f);
        -            else if (fh == h &&                  // check first node
        -                     ((fk = f.key) == key || fk != null && key.equals(fk)) &&
        -                     (fv = f.val) != null)
        +            else if (fh == h    // check first node without acquiring lock
        +                     && ((fk = f.key) == key || (fk != null && key.equals(fk)))
        +                     && (fv = f.val) != null)
                         return fv;
                     else {
                         boolean added = false;
        @@ -3468,9 +3469,9 @@ public class ConcurrentHashMap extends AbstractMap
         
             static final class KeyIterator extends BaseIterator
                 implements Iterator, Enumeration {
        -        KeyIterator(Node[] tab, int index, int size, int limit,
        +        KeyIterator(Node[] tab, int size, int index, int limit,
                             ConcurrentHashMap map) {
        -            super(tab, index, size, limit, map);
        +            super(tab, size, index, limit, map);
                 }
         
                 public final K next() {
        @@ -3488,9 +3489,9 @@ public class ConcurrentHashMap extends AbstractMap
         
             static final class ValueIterator extends BaseIterator
                 implements Iterator, Enumeration {
        -        ValueIterator(Node[] tab, int index, int size, int limit,
        +        ValueIterator(Node[] tab, int size, int index, int limit,
                               ConcurrentHashMap map) {
        -            super(tab, index, size, limit, map);
        +            super(tab, size, index, limit, map);
                 }
         
                 public final V next() {
        @@ -3508,9 +3509,9 @@ public class ConcurrentHashMap extends AbstractMap
         
             static final class EntryIterator extends BaseIterator
                 implements Iterator> {
        -        EntryIterator(Node[] tab, int index, int size, int limit,
        +        EntryIterator(Node[] tab, int size, int index, int limit,
                               ConcurrentHashMap map) {
        -            super(tab, index, size, limit, map);
        +            super(tab, size, index, limit, map);
                 }
         
                 public final Map.Entry next() {
        
        From b3ea0dd6291c2833aafaffa093b6ee77c0a3fd5d Mon Sep 17 00:00:00 2001
        From: Doug Lea 
        Date: Mon, 10 Apr 2017 13:46:19 -0700
        Subject: [PATCH 49/75] 8176543: Miscellaneous changes imported from jsr166 CVS
         2017-04
        
        Reviewed-by: martin, psandoz
        ---
         .../concurrent/ConcurrentSkipListMap.java     |  1 -
         .../concurrent/ConcurrentSkipListSet.java     |  1 -
         .../java/util/concurrent/ForkJoinPool.java    | 12 +++----
         .../util/concurrent/ForkJoinWorkerThread.java | 20 +++++------
         .../locks/ReentrantReadWriteLock.java         |  2 +-
         .../util/concurrent/tck/ArrayDeque8Test.java  |  1 -
         .../util/concurrent/tck/ArrayDequeTest.java   |  2 --
         .../util/concurrent/tck/ArrayListTest.java    |  2 --
         .../tck/AtomicReferenceFieldUpdaterTest.java  |  4 +--
         .../concurrent/tck/AtomicReferenceTest.java   |  2 +-
         .../concurrent/tck/CompletableFutureTest.java | 16 ++++-----
         .../tck/ConcurrentHashMap8Test.java           | 12 +++----
         .../concurrent/tck/ConcurrentHashMapTest.java |  6 ++--
         .../tck/ConcurrentLinkedDequeTest.java        |  3 +-
         .../tck/ConcurrentLinkedQueueTest.java        |  3 +-
         .../tck/ConcurrentSkipListSetTest.java        |  6 ++--
         .../tck/ConcurrentSkipListSubSetTest.java     |  6 ++--
         .../tck/CopyOnWriteArrayListTest.java         |  1 -
         .../concurrent/tck/CountedCompleter8Test.java |  3 --
         .../concurrent/tck/CountedCompleterTest.java  |  1 -
         .../util/concurrent/tck/ExchangerTest.java    |  4 +--
         .../tck/ExecutorCompletionService9Test.java   |  1 -
         .../tck/ExecutorCompletionServiceTest.java    |  2 +-
         .../util/concurrent/tck/ExecutorsTest.java    | 24 +++++--------
         .../concurrent/tck/ForkJoinPool8Test.java     |  6 ++--
         .../concurrent/tck/ForkJoinPool9Test.java     |  4 +--
         .../util/concurrent/tck/ForkJoinPoolTest.java |  2 +-
         .../concurrent/tck/ForkJoinTask8Test.java     |  6 ++--
         .../util/concurrent/tck/JSR166TestCase.java   | 35 ++++++++++---------
         .../tck/LinkedBlockingDeque8Test.java         |  1 -
         .../tck/LinkedBlockingDequeTest.java          |  4 +--
         .../tck/LinkedBlockingQueue8Test.java         |  1 -
         .../tck/LinkedBlockingQueueTest.java          |  2 +-
         .../util/concurrent/tck/LinkedListTest.java   |  3 +-
         .../tck/LinkedTransferQueueTest.java          |  4 +--
         .../tck/PriorityBlockingQueueTest.java        |  4 +--
         .../concurrent/tck/PriorityQueueTest.java     |  3 +-
         .../concurrent/tck/RecursiveActionTest.java   |  4 +--
         .../concurrent/tck/RecursiveTaskTest.java     |  6 ++--
         .../util/concurrent/tck/StampedLockTest.java  |  4 +--
         .../tck/SubmissionPublisherTest.java          |  2 +-
         .../concurrent/tck/SynchronousQueueTest.java  |  2 +-
         .../tck/ThreadPoolExecutorSubclassTest.java   |  8 ++---
         .../tck/ThreadPoolExecutorTest.java           | 27 ++++++++++----
         .../java/util/concurrent/tck/ThreadTest.java  |  2 +-
         .../java/util/concurrent/tck/TreeSetTest.java |  4 +--
         .../util/concurrent/tck/TreeSubSetTest.java   |  6 ++--
         .../java/util/concurrent/tck/VectorTest.java  |  2 --
         48 files changed, 128 insertions(+), 149 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java
        index 2ae29aa42f3..d34c74cd9a9 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java
        @@ -48,7 +48,6 @@ import java.util.Comparator;
         import java.util.Iterator;
         import java.util.List;
         import java.util.Map;
        -import java.util.NavigableMap;
         import java.util.NavigableSet;
         import java.util.NoSuchElementException;
         import java.util.Set;
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java
        index 86be622c78b..ccd7f647d83 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListSet.java
        @@ -43,7 +43,6 @@ import java.util.Collections;
         import java.util.Comparator;
         import java.util.Iterator;
         import java.util.Map;
        -import java.util.NavigableMap;
         import java.util.NavigableSet;
         import java.util.Set;
         import java.util.SortedSet;
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
        index 330f4fb78a3..d8697970586 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
        @@ -2354,7 +2354,7 @@ public class ForkJoinPool extends AbstractExecutorService {
                 checkPermission();
             }
         
        -    private Object newInstanceFromSystemProperty(String property)
        +    private static Object newInstanceFromSystemProperty(String property)
                 throws ReflectiveOperationException {
                 String className = System.getProperty(property);
                 return (className == null)
        @@ -2524,15 +2524,13 @@ public class ForkJoinPool extends AbstractExecutorService {
              * @throws RejectedExecutionException if the task cannot be
              *         scheduled for execution
              */
        +    @SuppressWarnings("unchecked")
             public ForkJoinTask submit(Runnable task) {
                 if (task == null)
                     throw new NullPointerException();
        -        ForkJoinTask job;
        -        if (task instanceof ForkJoinTask) // avoid re-wrap
        -            job = (ForkJoinTask) task;
        -        else
        -            job = new ForkJoinTask.AdaptedRunnableAction(task);
        -        return externalSubmit(job);
        +        return externalSubmit((task instanceof ForkJoinTask)
        +            ? (ForkJoinTask) task // avoid re-wrap
        +            : new ForkJoinTask.AdaptedRunnableAction(task));
             }
         
             /**
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java
        index a3054b865ba..b1550f9f648 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java
        @@ -203,21 +203,19 @@ public class ForkJoinWorkerThread extends Thread {
             static final class InnocuousForkJoinWorkerThread extends ForkJoinWorkerThread {
                 /** The ThreadGroup for all InnocuousForkJoinWorkerThreads */
                 private static final ThreadGroup innocuousThreadGroup =
        -            java.security.AccessController.doPrivileged(
        -                new java.security.PrivilegedAction<>() {
        -                    public ThreadGroup run() {
        -                        ThreadGroup group = Thread.currentThread().getThreadGroup();
        -                        for (ThreadGroup p; (p = group.getParent()) != null; )
        -                            group = p;
        -                        return new ThreadGroup(group, "InnocuousForkJoinWorkerThreadGroup");
        -                    }});
        +            AccessController.doPrivileged(new PrivilegedAction<>() {
        +                public ThreadGroup run() {
        +                    ThreadGroup group = Thread.currentThread().getThreadGroup();
        +                    for (ThreadGroup p; (p = group.getParent()) != null; )
        +                        group = p;
        +                    return new ThreadGroup(
        +                        group, "InnocuousForkJoinWorkerThreadGroup");
        +                }});
         
                 /** An AccessControlContext supporting no privileges */
                 private static final AccessControlContext INNOCUOUS_ACC =
                     new AccessControlContext(
        -                new ProtectionDomain[] {
        -                    new ProtectionDomain(null, null)
        -                });
        +                new ProtectionDomain[] { new ProtectionDomain(null, null) });
         
                 InnocuousForkJoinWorkerThread(ForkJoinPool pool) {
                     super(pool,
        diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java
        index ab43971e84d..4f093bf5631 100644
        --- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java
        +++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java
        @@ -444,7 +444,7 @@ public class ReentrantReadWriteLock
                     }
                 }
         
        -        private IllegalMonitorStateException unmatchedUnlockException() {
        +        private static IllegalMonitorStateException unmatchedUnlockException() {
                     return new IllegalMonitorStateException(
                         "attempt to unlock read lock, not locked by current thread");
                 }
        diff --git a/jdk/test/java/util/concurrent/tck/ArrayDeque8Test.java b/jdk/test/java/util/concurrent/tck/ArrayDeque8Test.java
        index 0a7f26bfe64..c2079555218 100644
        --- a/jdk/test/java/util/concurrent/tck/ArrayDeque8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/ArrayDeque8Test.java
        @@ -37,7 +37,6 @@ import java.util.Collections;
         import java.util.Spliterator;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class ArrayDeque8Test extends JSR166TestCase {
             public static void main(String[] args) {
        diff --git a/jdk/test/java/util/concurrent/tck/ArrayDequeTest.java b/jdk/test/java/util/concurrent/tck/ArrayDequeTest.java
        index 1bbd98106ac..344b63c9b79 100644
        --- a/jdk/test/java/util/concurrent/tck/ArrayDequeTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ArrayDequeTest.java
        @@ -35,7 +35,6 @@
         import java.util.ArrayDeque;
         import java.util.Arrays;
         import java.util.Collection;
        -import java.util.Collections;
         import java.util.Deque;
         import java.util.Iterator;
         import java.util.NoSuchElementException;
        @@ -44,7 +43,6 @@ import java.util.Random;
         import java.util.concurrent.ThreadLocalRandom;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class ArrayDequeTest extends JSR166TestCase {
             public static void main(String[] args) {
        diff --git a/jdk/test/java/util/concurrent/tck/ArrayListTest.java b/jdk/test/java/util/concurrent/tck/ArrayListTest.java
        index 193b4af8aca..535f04d34b5 100644
        --- a/jdk/test/java/util/concurrent/tck/ArrayListTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ArrayListTest.java
        @@ -33,11 +33,9 @@
          */
         
         import java.util.ArrayList;
        -import java.util.Collection;
         import java.util.List;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class ArrayListTest extends JSR166TestCase {
             public static void main(String[] args) {
        diff --git a/jdk/test/java/util/concurrent/tck/AtomicReferenceFieldUpdaterTest.java b/jdk/test/java/util/concurrent/tck/AtomicReferenceFieldUpdaterTest.java
        index fb50658ea91..5fdf279238c 100644
        --- a/jdk/test/java/util/concurrent/tck/AtomicReferenceFieldUpdaterTest.java
        +++ b/jdk/test/java/util/concurrent/tck/AtomicReferenceFieldUpdaterTest.java
        @@ -75,7 +75,7 @@ public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase {
                     assertTrue(a.compareAndSet(this, two, m4));
                     assertSame(m4, a.get(this));
                     assertFalse(a.compareAndSet(this, m5, seven));
        -            assertFalse(seven == a.get(this));
        +            assertNotSame(seven, a.get(this));
                     assertTrue(a.compareAndSet(this, m4, seven));
                     assertSame(seven, a.get(this));
                 }
        @@ -208,7 +208,7 @@ public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase {
                 assertTrue(a.compareAndSet(this, two, m4));
                 assertSame(m4, a.get(this));
                 assertFalse(a.compareAndSet(this, m5, seven));
        -        assertFalse(seven == a.get(this));
        +        assertNotSame(seven, a.get(this));
                 assertTrue(a.compareAndSet(this, m4, seven));
                 assertSame(seven, a.get(this));
             }
        diff --git a/jdk/test/java/util/concurrent/tck/AtomicReferenceTest.java b/jdk/test/java/util/concurrent/tck/AtomicReferenceTest.java
        index 6242374ee89..eb8c0b7b565 100644
        --- a/jdk/test/java/util/concurrent/tck/AtomicReferenceTest.java
        +++ b/jdk/test/java/util/concurrent/tck/AtomicReferenceTest.java
        @@ -153,7 +153,7 @@ public class AtomicReferenceTest extends JSR166TestCase {
                 AtomicReference z = serialClone(x);
                 assertNotSame(y, z);
                 assertEquals(one, x.get());
        -        assertEquals(null, y.get());
        +        assertNull(y.get());
                 assertEquals(one, z.get());
             }
         
        diff --git a/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java b/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java
        index 6def2fffb3a..6439a40fcb0 100644
        --- a/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java
        +++ b/jdk/test/java/util/concurrent/tck/CompletableFutureTest.java
        @@ -2589,28 +2589,28 @@ public class CompletableFutureTest extends JSR166TestCase {
         
                 // unspecified behavior - both source completions available
                 try {
        -            assertEquals(null, h0.join());
        +            assertNull(h0.join());
                     rs[0].assertValue(v1);
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h0, ex);
                     rs[0].assertNotInvoked();
                 }
                 try {
        -            assertEquals(null, h1.join());
        +            assertNull(h1.join());
                     rs[1].assertValue(v1);
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h1, ex);
                     rs[1].assertNotInvoked();
                 }
                 try {
        -            assertEquals(null, h2.join());
        +            assertNull(h2.join());
                     rs[2].assertValue(v1);
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h2, ex);
                     rs[2].assertNotInvoked();
                 }
                 try {
        -            assertEquals(null, h3.join());
        +            assertNull(h3.join());
                     rs[3].assertValue(v1);
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h3, ex);
        @@ -2849,28 +2849,28 @@ public class CompletableFutureTest extends JSR166TestCase {
         
                 // unspecified behavior - both source completions available
                 try {
        -            assertEquals(null, h0.join());
        +            assertNull(h0.join());
                     rs[0].assertInvoked();
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h0, ex);
                     rs[0].assertNotInvoked();
                 }
                 try {
        -            assertEquals(null, h1.join());
        +            assertNull(h1.join());
                     rs[1].assertInvoked();
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h1, ex);
                     rs[1].assertNotInvoked();
                 }
                 try {
        -            assertEquals(null, h2.join());
        +            assertNull(h2.join());
                     rs[2].assertInvoked();
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h2, ex);
                     rs[2].assertNotInvoked();
                 }
                 try {
        -            assertEquals(null, h3.join());
        +            assertNull(h3.join());
                     rs[3].assertInvoked();
                 } catch (CompletionException ok) {
                     checkCompletedWithWrappedException(h3, ex);
        diff --git a/jdk/test/java/util/concurrent/tck/ConcurrentHashMap8Test.java b/jdk/test/java/util/concurrent/tck/ConcurrentHashMap8Test.java
        index 00f8dc6bb28..e0d9f81a7f1 100644
        --- a/jdk/test/java/util/concurrent/tck/ConcurrentHashMap8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/ConcurrentHashMap8Test.java
        @@ -237,8 +237,8 @@ public class ConcurrentHashMap8Test extends JSR166TestCase {
                 Set set1 = map.keySet();
                 Set set2 = map.keySet(true);
                 set2.add(six);
        -        assertTrue(((ConcurrentHashMap.KeySetView)set2).getMap() == map);
        -        assertTrue(((ConcurrentHashMap.KeySetView)set1).getMap() == map);
        +        assertSame(map, ((ConcurrentHashMap.KeySetView)set2).getMap());
        +        assertSame(map, ((ConcurrentHashMap.KeySetView)set1).getMap());
                 assertEquals(set2.size(), map.size());
                 assertEquals(set1.size(), map.size());
                 assertTrue((Boolean)map.get(six));
        @@ -332,10 +332,10 @@ public class ConcurrentHashMap8Test extends JSR166TestCase {
                 assertFalse(set.add(one));
                 assertTrue(set.add(six));
                 assertTrue(set.add(seven));
        -        assertTrue(set.getMappedValue() == one);
        -        assertTrue(map.get(one) != one);
        -        assertTrue(map.get(six) == one);
        -        assertTrue(map.get(seven) == one);
        +        assertSame(one, set.getMappedValue());
        +        assertNotSame(one, map.get(one));
        +        assertSame(one, map.get(six));
        +        assertSame(one, map.get(seven));
             }
         
             void checkSpliteratorCharacteristics(Spliterator sp,
        diff --git a/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java b/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java
        index 1485d2c4dca..729a6e3d146 100644
        --- a/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java
        @@ -43,8 +43,6 @@ import java.util.Map;
         import java.util.Random;
         import java.util.Set;
         import java.util.concurrent.ConcurrentHashMap;
        -import java.util.concurrent.ExecutorService;
        -import java.util.concurrent.Executors;
         
         import junit.framework.Test;
         import junit.framework.TestSuite;
        @@ -148,7 +146,7 @@ public class ConcurrentHashMapTest extends JSR166TestCase {
                 ConcurrentHashMap m =
                     new ConcurrentHashMap();
                 for (int i = 0; i < size; i++) {
        -            assertTrue(m.put(new CI(i), true) == null);
        +            assertNull(m.put(new CI(i), true));
                 }
                 for (int i = 0; i < size; i++) {
                     assertTrue(m.containsKey(new CI(i)));
        @@ -169,7 +167,7 @@ public class ConcurrentHashMapTest extends JSR166TestCase {
                     BS bs = new BS(String.valueOf(i));
                     LexicographicList bis = new LexicographicList(bi);
                     LexicographicList bss = new LexicographicList(bs);
        -            assertTrue(m.putIfAbsent(bis, true) == null);
        +            assertNull(m.putIfAbsent(bis, true));
                     assertTrue(m.containsKey(bis));
                     if (m.putIfAbsent(bss, true) == null)
                         assertTrue(m.containsKey(bss));
        diff --git a/jdk/test/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java b/jdk/test/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java
        index aac0bb73910..8a8ffeb6ff9 100644
        --- a/jdk/test/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ConcurrentLinkedDequeTest.java
        @@ -43,7 +43,6 @@ import java.util.Random;
         import java.util.concurrent.ConcurrentLinkedDeque;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class ConcurrentLinkedDequeTest extends JSR166TestCase {
         
        @@ -67,7 +66,7 @@ public class ConcurrentLinkedDequeTest extends JSR166TestCase {
              * Returns a new deque of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private ConcurrentLinkedDeque populatedDeque(int n) {
        +    private static ConcurrentLinkedDeque populatedDeque(int n) {
                 ConcurrentLinkedDeque q = new ConcurrentLinkedDeque<>();
                 assertTrue(q.isEmpty());
                 for (int i = 0; i < n; ++i)
        diff --git a/jdk/test/java/util/concurrent/tck/ConcurrentLinkedQueueTest.java b/jdk/test/java/util/concurrent/tck/ConcurrentLinkedQueueTest.java
        index 57689cce48d..ee6827a660f 100644
        --- a/jdk/test/java/util/concurrent/tck/ConcurrentLinkedQueueTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ConcurrentLinkedQueueTest.java
        @@ -41,7 +41,6 @@ import java.util.Queue;
         import java.util.concurrent.ConcurrentLinkedQueue;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class ConcurrentLinkedQueueTest extends JSR166TestCase {
         
        @@ -65,7 +64,7 @@ public class ConcurrentLinkedQueueTest extends JSR166TestCase {
              * Returns a new queue of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private ConcurrentLinkedQueue populatedQueue(int n) {
        +    private static ConcurrentLinkedQueue populatedQueue(int n) {
                 ConcurrentLinkedQueue q = new ConcurrentLinkedQueue<>();
                 assertTrue(q.isEmpty());
                 for (int i = 0; i < n; ++i)
        diff --git a/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java b/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java
        index ae91219f622..cb28b6ae0e7 100644
        --- a/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java
        @@ -64,7 +64,7 @@ public class ConcurrentSkipListSetTest extends JSR166TestCase {
              * Returns a new set of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private ConcurrentSkipListSet populatedSet(int n) {
        +    private static ConcurrentSkipListSet populatedSet(int n) {
                 ConcurrentSkipListSet q =
                     new ConcurrentSkipListSet();
                 assertTrue(q.isEmpty());
        @@ -80,7 +80,7 @@ public class ConcurrentSkipListSetTest extends JSR166TestCase {
             /**
              * Returns a new set of first 5 ints.
              */
        -    private ConcurrentSkipListSet set5() {
        +    private static ConcurrentSkipListSet set5() {
                 ConcurrentSkipListSet q = new ConcurrentSkipListSet();
                 assertTrue(q.isEmpty());
                 q.add(one);
        @@ -229,7 +229,7 @@ public class ConcurrentSkipListSetTest extends JSR166TestCase {
                 } catch (ClassCastException success) {
                     assertTrue(q.size() < 2);
                     for (int i = 0, size = q.size(); i < size; i++)
        -                assertTrue(q.pollFirst().getClass() == Object.class);
        +                assertSame(Object.class, q.pollFirst().getClass());
                     assertNull(q.pollFirst());
                     assertTrue(q.isEmpty());
                     assertEquals(0, q.size());
        diff --git a/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java b/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java
        index 4b299e74b83..19d34cc01e1 100644
        --- a/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java
        @@ -59,7 +59,7 @@ public class ConcurrentSkipListSubSetTest extends JSR166TestCase {
              * Returns a new set of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private NavigableSet populatedSet(int n) {
        +    private static NavigableSet populatedSet(int n) {
                 ConcurrentSkipListSet q =
                     new ConcurrentSkipListSet();
                 assertTrue(q.isEmpty());
        @@ -79,7 +79,7 @@ public class ConcurrentSkipListSubSetTest extends JSR166TestCase {
             /**
              * Returns a new set of first 5 ints.
              */
        -    private NavigableSet set5() {
        +    private static NavigableSet set5() {
                 ConcurrentSkipListSet q = new ConcurrentSkipListSet();
                 assertTrue(q.isEmpty());
                 q.add(one);
        @@ -97,7 +97,7 @@ public class ConcurrentSkipListSubSetTest extends JSR166TestCase {
             /**
              * Returns a new set of first 5 negative ints.
              */
        -    private NavigableSet dset5() {
        +    private static NavigableSet dset5() {
                 ConcurrentSkipListSet q = new ConcurrentSkipListSet();
                 assertTrue(q.isEmpty());
                 q.add(m1);
        diff --git a/jdk/test/java/util/concurrent/tck/CopyOnWriteArrayListTest.java b/jdk/test/java/util/concurrent/tck/CopyOnWriteArrayListTest.java
        index 329010b308b..2b13e130701 100644
        --- a/jdk/test/java/util/concurrent/tck/CopyOnWriteArrayListTest.java
        +++ b/jdk/test/java/util/concurrent/tck/CopyOnWriteArrayListTest.java
        @@ -44,7 +44,6 @@ import java.util.NoSuchElementException;
         import java.util.concurrent.CopyOnWriteArrayList;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class CopyOnWriteArrayListTest extends JSR166TestCase {
         
        diff --git a/jdk/test/java/util/concurrent/tck/CountedCompleter8Test.java b/jdk/test/java/util/concurrent/tck/CountedCompleter8Test.java
        index eb23564ed77..77e800c23b3 100644
        --- a/jdk/test/java/util/concurrent/tck/CountedCompleter8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/CountedCompleter8Test.java
        @@ -32,9 +32,6 @@
          * http://creativecommons.org/publicdomain/zero/1.0/
          */
         
        -import static java.util.concurrent.TimeUnit.MILLISECONDS;
        -import static java.util.concurrent.TimeUnit.SECONDS;
        -
         import java.util.concurrent.CountedCompleter;
         import java.util.concurrent.ThreadLocalRandom;
         import java.util.concurrent.atomic.AtomicInteger;
        diff --git a/jdk/test/java/util/concurrent/tck/CountedCompleterTest.java b/jdk/test/java/util/concurrent/tck/CountedCompleterTest.java
        index 3113b57a563..66e5bd61761 100644
        --- a/jdk/test/java/util/concurrent/tck/CountedCompleterTest.java
        +++ b/jdk/test/java/util/concurrent/tck/CountedCompleterTest.java
        @@ -40,7 +40,6 @@ import java.util.concurrent.CountedCompleter;
         import java.util.concurrent.ExecutionException;
         import java.util.concurrent.ForkJoinPool;
         import java.util.concurrent.ForkJoinTask;
        -import java.util.concurrent.ThreadLocalRandom;
         import java.util.concurrent.TimeoutException;
         import java.util.concurrent.atomic.AtomicInteger;
         import java.util.concurrent.atomic.AtomicReference;
        diff --git a/jdk/test/java/util/concurrent/tck/ExchangerTest.java b/jdk/test/java/util/concurrent/tck/ExchangerTest.java
        index ba6c5443623..36eacc7891e 100644
        --- a/jdk/test/java/util/concurrent/tck/ExchangerTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ExchangerTest.java
        @@ -160,12 +160,12 @@ public class ExchangerTest extends JSR166TestCase {
                     public void realRun() throws InterruptedException {
                         assertSame(one, e.exchange(two));
                         exchanged.countDown();
        -                interrupted.await();
        +                await(interrupted);
                         assertSame(three, e.exchange(one));
                     }});
                 Thread t3 = newStartedThread(new CheckedRunnable() {
                     public void realRun() throws InterruptedException {
        -                interrupted.await();
        +                await(interrupted);
                         assertSame(one, e.exchange(three));
                     }});
         
        diff --git a/jdk/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java b/jdk/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java
        index 4ca78a09a49..92e92478cbc 100644
        --- a/jdk/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java
        +++ b/jdk/test/java/util/concurrent/tck/ExecutorCompletionService9Test.java
        @@ -37,7 +37,6 @@ import java.util.Collection;
         import java.util.Comparator;
         import java.util.List;
         import java.util.Set;
        -import java.util.HashSet;
         import java.util.concurrent.Callable;
         import java.util.concurrent.CompletionService;
         import java.util.concurrent.ExecutionException;
        diff --git a/jdk/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java b/jdk/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java
        index 0ab6084b978..9b7251e6865 100644
        --- a/jdk/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ExecutorCompletionServiceTest.java
        @@ -172,7 +172,7 @@ public class ExecutorCompletionServiceTest extends JSR166TestCase {
                 CompletionService cs = new ExecutorCompletionService(cachedThreadPool);
                 final CountDownLatch proceed = new CountDownLatch(1);
                 cs.submit(new Callable() { public String call() throws Exception {
        -            proceed.await();
        +            await(proceed);
                     return TEST_STRING;
                 }});
                 assertNull(cs.poll());
        diff --git a/jdk/test/java/util/concurrent/tck/ExecutorsTest.java b/jdk/test/java/util/concurrent/tck/ExecutorsTest.java
        index 441a52a5922..90764242502 100644
        --- a/jdk/test/java/util/concurrent/tck/ExecutorsTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ExecutorsTest.java
        @@ -333,16 +333,12 @@ public class ExecutorsTest extends JSR166TestCase {
                     public void realRun() {
                         try {
                             Thread current = Thread.currentThread();
        -                    assertTrue(!current.isDaemon());
        +                    assertFalse(current.isDaemon());
                             assertTrue(current.getPriority() <= Thread.NORM_PRIORITY);
        -                    ThreadGroup g = current.getThreadGroup();
                             SecurityManager s = System.getSecurityManager();
        -                    if (s != null)
        -                        assertTrue(g == s.getThreadGroup());
        -                    else
        -                        assertTrue(g == egroup);
        -                    String name = current.getName();
        -                    assertTrue(name.endsWith("thread-1"));
        +                    assertSame(current.getThreadGroup(),
        +                               (s == null) ? egroup : s.getThreadGroup());
        +                    assertTrue(current.getName().endsWith("thread-1"));
                         } catch (SecurityException ok) {
                             // Also pass if not allowed to change setting
                         }
        @@ -370,16 +366,12 @@ public class ExecutorsTest extends JSR166TestCase {
                         Runnable r = new CheckedRunnable() {
                             public void realRun() {
                                 Thread current = Thread.currentThread();
        -                        assertTrue(!current.isDaemon());
        +                        assertFalse(current.isDaemon());
                                 assertTrue(current.getPriority() <= Thread.NORM_PRIORITY);
        -                        ThreadGroup g = current.getThreadGroup();
                                 SecurityManager s = System.getSecurityManager();
        -                        if (s != null)
        -                            assertTrue(g == s.getThreadGroup());
        -                        else
        -                            assertTrue(g == egroup);
        -                        String name = current.getName();
        -                        assertTrue(name.endsWith("thread-1"));
        +                        assertSame(current.getThreadGroup(),
        +                                   (s == null) ? egroup : s.getThreadGroup());
        +                        assertTrue(current.getName().endsWith("thread-1"));
                                 assertSame(thisccl, current.getContextClassLoader());
                                 assertEquals(thisacc, AccessController.getContext());
                                 done.countDown();
        diff --git a/jdk/test/java/util/concurrent/tck/ForkJoinPool8Test.java b/jdk/test/java/util/concurrent/tck/ForkJoinPool8Test.java
        index b0fea9a0bfe..f24de8828dc 100644
        --- a/jdk/test/java/util/concurrent/tck/ForkJoinPool8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/ForkJoinPool8Test.java
        @@ -206,7 +206,7 @@ public class ForkJoinPool8Test extends JSR166TestCase {
                 public FJException(Throwable cause) { super(cause); }
             }
         
        -    // A simple recursive action for testing
        +    /** A simple recursive action for testing. */
             final class FibAction extends CheckedRecursiveAction {
                 final int number;
                 int result;
        @@ -224,7 +224,7 @@ public class ForkJoinPool8Test extends JSR166TestCase {
                 }
             }
         
        -    // A recursive action failing in base case
        +    /** A recursive action failing in base case. */
             static final class FailingFibAction extends RecursiveAction {
                 final int number;
                 int result;
        @@ -932,7 +932,7 @@ public class ForkJoinPool8Test extends JSR166TestCase {
                 }
             }
         
        -    // Version of CCF with forced failure in left completions
        +    /** Version of CCF with forced failure in left completions. */
             abstract static class FailingCCF extends CountedCompleter {
                 int number;
                 int rnumber;
        diff --git a/jdk/test/java/util/concurrent/tck/ForkJoinPool9Test.java b/jdk/test/java/util/concurrent/tck/ForkJoinPool9Test.java
        index 8a87e473a6f..b4153481d61 100644
        --- a/jdk/test/java/util/concurrent/tck/ForkJoinPool9Test.java
        +++ b/jdk/test/java/util/concurrent/tck/ForkJoinPool9Test.java
        @@ -32,8 +32,6 @@
          * http://creativecommons.org/publicdomain/zero/1.0/
          */
         
        -import static java.util.concurrent.TimeUnit.MILLISECONDS;
        -
         import java.lang.invoke.MethodHandles;
         import java.lang.invoke.VarHandle;
         import java.util.concurrent.CountDownLatch;
        @@ -93,7 +91,7 @@ public class ForkJoinPool9Test extends JSR166TestCase {
                 Future f = ForkJoinPool.commonPool().submit(runInCommonPool);
                 // Ensure runInCommonPool is truly running in the common pool,
                 // by giving this thread no opportunity to "help" on get().
        -        assertTrue(taskStarted.await(LONG_DELAY_MS, MILLISECONDS));
        +        await(taskStarted);
                 assertNull(f.get());
             }
         
        diff --git a/jdk/test/java/util/concurrent/tck/ForkJoinPoolTest.java b/jdk/test/java/util/concurrent/tck/ForkJoinPoolTest.java
        index bf5a3652f09..766e35081e3 100644
        --- a/jdk/test/java/util/concurrent/tck/ForkJoinPoolTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ForkJoinPoolTest.java
        @@ -244,7 +244,7 @@ public class ForkJoinPoolTest extends JSR166TestCase {
                             taskStarted.countDown();
                             assertEquals(1, p.getPoolSize());
                             assertEquals(1, p.getActiveThreadCount());
        -                    done.await();
        +                    await(done);
                         }};
                     Future future = p.submit(task);
                     await(taskStarted);
        diff --git a/jdk/test/java/util/concurrent/tck/ForkJoinTask8Test.java b/jdk/test/java/util/concurrent/tck/ForkJoinTask8Test.java
        index c1063da31aa..6415111510c 100644
        --- a/jdk/test/java/util/concurrent/tck/ForkJoinTask8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/ForkJoinTask8Test.java
        @@ -127,7 +127,8 @@ public class ForkJoinTask8Test extends JSR166TestCase {
                 assertNull(a.getException());
                 assertNull(a.getRawResult());
                 if (a instanceof BinaryAsyncAction)
        -            assertTrue(((BinaryAsyncAction)a).getForkJoinTaskTag() == INITIAL_STATE);
        +            assertEquals(INITIAL_STATE,
        +                         ((BinaryAsyncAction)a).getForkJoinTaskTag());
         
                 try {
                     a.get(0L, SECONDS);
        @@ -148,7 +149,8 @@ public class ForkJoinTask8Test extends JSR166TestCase {
                 assertNull(a.getException());
                 assertSame(expected, a.getRawResult());
                 if (a instanceof BinaryAsyncAction)
        -            assertTrue(((BinaryAsyncAction)a).getForkJoinTaskTag() == COMPLETE_STATE);
        +            assertEquals(COMPLETE_STATE,
        +                         ((BinaryAsyncAction)a).getForkJoinTaskTag());
         
                 {
                     Thread.currentThread().interrupt();
        diff --git a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java
        index 1037eb8f3e7..9625be26fea 100644
        --- a/jdk/test/java/util/concurrent/tck/JSR166TestCase.java
        +++ b/jdk/test/java/util/concurrent/tck/JSR166TestCase.java
        @@ -26,8 +26,9 @@
          * However, the following notice accompanied the original version of this
          * file:
          *
        - * Written by Doug Lea with assistance from members of JCP JSR-166
        - * Expert Group and released to the public domain, as explained at
        + * Written by Doug Lea and Martin Buchholz with assistance from
        + * members of JCP JSR-166 Expert Group and released to the public
        + * domain, as explained at
          * http://creativecommons.org/publicdomain/zero/1.0/
          * Other contributors include Andrew Wright, Jeffrey Hayes,
          * Pat Fisher, Mike Judd.
        @@ -35,32 +36,33 @@
         
         /*
          * @test
        - * @summary JSR-166 tck tests (conformance testing mode)
        + * @summary JSR-166 tck tests, in a number of variations.
        + *          The first is the conformance testing variant,
        + *          while others also test implementation details.
          * @build *
          * @modules java.management
          * @run junit/othervm/timeout=1000 JSR166TestCase
        - */
        -
        -/*
        - * @test
        - * @summary JSR-166 tck tests (whitebox tests allowed)
        - * @build *
        - * @modules java.base/java.util.concurrent:open
        - *          java.base/java.lang:open
        - *          java.management
          * @run junit/othervm/timeout=1000
        + *      --add-opens java.base/java.util.concurrent=ALL-UNNAMED
        + *      --add-opens java.base/java.lang=ALL-UNNAMED
          *      -Djsr166.testImplementationDetails=true
          *      JSR166TestCase
          * @run junit/othervm/timeout=1000
        + *      --add-opens java.base/java.util.concurrent=ALL-UNNAMED
        + *      --add-opens java.base/java.lang=ALL-UNNAMED
          *      -Djsr166.testImplementationDetails=true
          *      -Djava.util.concurrent.ForkJoinPool.common.parallelism=0
          *      JSR166TestCase
          * @run junit/othervm/timeout=1000
        + *      --add-opens java.base/java.util.concurrent=ALL-UNNAMED
        + *      --add-opens java.base/java.lang=ALL-UNNAMED
          *      -Djsr166.testImplementationDetails=true
          *      -Djava.util.concurrent.ForkJoinPool.common.parallelism=1
          *      -Djava.util.secureRandomSeed=true
          *      JSR166TestCase
          * @run junit/othervm/timeout=1000/policy=tck.policy
        + *      --add-opens java.base/java.util.concurrent=ALL-UNNAMED
        + *      --add-opens java.base/java.lang=ALL-UNNAMED
          *      -Djsr166.testImplementationDetails=true
          *      JSR166TestCase
          */
        @@ -79,8 +81,6 @@ import java.lang.management.ThreadMXBean;
         import java.lang.reflect.Constructor;
         import java.lang.reflect.Method;
         import java.lang.reflect.Modifier;
        -import java.nio.file.Files;
        -import java.nio.file.Paths;
         import java.security.CodeSource;
         import java.security.Permission;
         import java.security.PermissionCollection;
        @@ -118,7 +118,6 @@ import java.util.concurrent.ThreadPoolExecutor;
         import java.util.concurrent.TimeoutException;
         import java.util.concurrent.atomic.AtomicBoolean;
         import java.util.concurrent.atomic.AtomicReference;
        -import java.util.regex.Matcher;
         import java.util.regex.Pattern;
         
         import junit.framework.AssertionFailedError;
        @@ -328,9 +327,11 @@ public class JSR166TestCase extends TestCase {
         
         //     public static String cpuModel() {
         //         try {
        -//             Matcher matcher = Pattern.compile("model name\\s*: (.*)")
        +//             java.util.regex.Matcher matcher
        +//               = Pattern.compile("model name\\s*: (.*)")
         //                 .matcher(new String(
        -//                      Files.readAllBytes(Paths.get("/proc/cpuinfo")), "UTF-8"));
        +//                     java.nio.file.Files.readAllBytes(
        +//                         java.nio.file.Paths.get("/proc/cpuinfo")), "UTF-8"));
         //             matcher.find();
         //             return matcher.group(1);
         //         } catch (Exception ex) { return null; }
        diff --git a/jdk/test/java/util/concurrent/tck/LinkedBlockingDeque8Test.java b/jdk/test/java/util/concurrent/tck/LinkedBlockingDeque8Test.java
        index 44dcedc0f01..cdcc7a27334 100644
        --- a/jdk/test/java/util/concurrent/tck/LinkedBlockingDeque8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/LinkedBlockingDeque8Test.java
        @@ -36,7 +36,6 @@ import java.util.concurrent.LinkedBlockingDeque;
         import java.util.Spliterator;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class LinkedBlockingDeque8Test extends JSR166TestCase {
             public static void main(String[] args) {
        diff --git a/jdk/test/java/util/concurrent/tck/LinkedBlockingDequeTest.java b/jdk/test/java/util/concurrent/tck/LinkedBlockingDequeTest.java
        index 2559fdffe9d..00fbcc9734b 100644
        --- a/jdk/test/java/util/concurrent/tck/LinkedBlockingDequeTest.java
        +++ b/jdk/test/java/util/concurrent/tck/LinkedBlockingDequeTest.java
        @@ -85,7 +85,7 @@ public class LinkedBlockingDequeTest extends JSR166TestCase {
              * Returns a new deque of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private LinkedBlockingDeque populatedDeque(int n) {
        +    private static LinkedBlockingDeque populatedDeque(int n) {
                 LinkedBlockingDeque q =
                     new LinkedBlockingDeque(n);
                 assertTrue(q.isEmpty());
        @@ -801,7 +801,7 @@ public class LinkedBlockingDequeTest extends JSR166TestCase {
                         }
                     }});
         
        -        aboutToWait.await();
        +        await(aboutToWait);
                 waitForThreadToEnterWaitState(t);
                 t.interrupt();
                 awaitTermination(t);
        diff --git a/jdk/test/java/util/concurrent/tck/LinkedBlockingQueue8Test.java b/jdk/test/java/util/concurrent/tck/LinkedBlockingQueue8Test.java
        index 9900c33da70..2c3e498aeaa 100644
        --- a/jdk/test/java/util/concurrent/tck/LinkedBlockingQueue8Test.java
        +++ b/jdk/test/java/util/concurrent/tck/LinkedBlockingQueue8Test.java
        @@ -36,7 +36,6 @@ import java.util.concurrent.LinkedBlockingQueue;
         import java.util.Spliterator;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class LinkedBlockingQueue8Test extends JSR166TestCase {
             public static void main(String[] args) {
        diff --git a/jdk/test/java/util/concurrent/tck/LinkedBlockingQueueTest.java b/jdk/test/java/util/concurrent/tck/LinkedBlockingQueueTest.java
        index 153cbce667a..cdccb75ed87 100644
        --- a/jdk/test/java/util/concurrent/tck/LinkedBlockingQueueTest.java
        +++ b/jdk/test/java/util/concurrent/tck/LinkedBlockingQueueTest.java
        @@ -85,7 +85,7 @@ public class LinkedBlockingQueueTest extends JSR166TestCase {
              * Returns a new queue of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private LinkedBlockingQueue populatedQueue(int n) {
        +    private static LinkedBlockingQueue populatedQueue(int n) {
                 LinkedBlockingQueue q =
                     new LinkedBlockingQueue(n);
                 assertTrue(q.isEmpty());
        diff --git a/jdk/test/java/util/concurrent/tck/LinkedListTest.java b/jdk/test/java/util/concurrent/tck/LinkedListTest.java
        index 08a2ddd9dab..66dd8c02c7a 100644
        --- a/jdk/test/java/util/concurrent/tck/LinkedListTest.java
        +++ b/jdk/test/java/util/concurrent/tck/LinkedListTest.java
        @@ -40,7 +40,6 @@ import java.util.LinkedList;
         import java.util.NoSuchElementException;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class LinkedListTest extends JSR166TestCase {
             public static void main(String[] args) {
        @@ -70,7 +69,7 @@ public class LinkedListTest extends JSR166TestCase {
              * Returns a new queue of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private LinkedList populatedQueue(int n) {
        +    private static LinkedList populatedQueue(int n) {
                 LinkedList q = new LinkedList<>();
                 assertTrue(q.isEmpty());
                 for (int i = 0; i < n; ++i)
        diff --git a/jdk/test/java/util/concurrent/tck/LinkedTransferQueueTest.java b/jdk/test/java/util/concurrent/tck/LinkedTransferQueueTest.java
        index 6a22b0e20a9..7f38351a30a 100644
        --- a/jdk/test/java/util/concurrent/tck/LinkedTransferQueueTest.java
        +++ b/jdk/test/java/util/concurrent/tck/LinkedTransferQueueTest.java
        @@ -321,7 +321,7 @@ public class LinkedTransferQueueTest extends JSR166TestCase {
                         assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
                     }});
         
        -        aboutToWait.await();
        +        await(aboutToWait);
                 waitForThreadToEnterWaitState(t);
                 t.interrupt();
                 awaitTermination(t);
        @@ -826,7 +826,7 @@ public class LinkedTransferQueueTest extends JSR166TestCase {
                 Thread first = newStartedThread(new CheckedRunnable() {
                     public void realRun() throws InterruptedException {
                         q.transfer(four);
        -                assertTrue(!q.contains(four));
        +                assertFalse(q.contains(four));
                         assertEquals(1, q.size());
                     }});
         
        diff --git a/jdk/test/java/util/concurrent/tck/PriorityBlockingQueueTest.java b/jdk/test/java/util/concurrent/tck/PriorityBlockingQueueTest.java
        index 088c389b2cc..aa826b80f1b 100644
        --- a/jdk/test/java/util/concurrent/tck/PriorityBlockingQueueTest.java
        +++ b/jdk/test/java/util/concurrent/tck/PriorityBlockingQueueTest.java
        @@ -93,7 +93,7 @@ public class PriorityBlockingQueueTest extends JSR166TestCase {
              * Returns a new queue of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private PriorityBlockingQueue populatedQueue(int n) {
        +    private static PriorityBlockingQueue populatedQueue(int n) {
                 PriorityBlockingQueue q =
                     new PriorityBlockingQueue(n);
                 assertTrue(q.isEmpty());
        @@ -445,7 +445,7 @@ public class PriorityBlockingQueueTest extends JSR166TestCase {
                         }
                     }});
         
        -        aboutToWait.await();
        +        await(aboutToWait);
                 waitForThreadToEnterWaitState(t);
                 t.interrupt();
                 awaitTermination(t);
        diff --git a/jdk/test/java/util/concurrent/tck/PriorityQueueTest.java b/jdk/test/java/util/concurrent/tck/PriorityQueueTest.java
        index c1564730cdf..1c3984dd197 100644
        --- a/jdk/test/java/util/concurrent/tck/PriorityQueueTest.java
        +++ b/jdk/test/java/util/concurrent/tck/PriorityQueueTest.java
        @@ -42,7 +42,6 @@ import java.util.PriorityQueue;
         import java.util.Queue;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class PriorityQueueTest extends JSR166TestCase {
             public static void main(String[] args) {
        @@ -70,7 +69,7 @@ public class PriorityQueueTest extends JSR166TestCase {
              * Returns a new queue of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private PriorityQueue populatedQueue(int n) {
        +    private static PriorityQueue populatedQueue(int n) {
                 PriorityQueue q = new PriorityQueue<>(n);
                 assertTrue(q.isEmpty());
                 for (int i = n - 1; i >= 0; i -= 2)
        diff --git a/jdk/test/java/util/concurrent/tck/RecursiveActionTest.java b/jdk/test/java/util/concurrent/tck/RecursiveActionTest.java
        index 01bd92770b7..132b8dad7b0 100644
        --- a/jdk/test/java/util/concurrent/tck/RecursiveActionTest.java
        +++ b/jdk/test/java/util/concurrent/tck/RecursiveActionTest.java
        @@ -195,7 +195,7 @@ public class RecursiveActionTest extends JSR166TestCase {
                 public FJException(Throwable cause) { super(cause); }
             }
         
        -    // A simple recursive action for testing
        +    /** A simple recursive action for testing. */
             final class FibAction extends CheckedRecursiveAction {
                 final int number;
                 int result;
        @@ -213,7 +213,7 @@ public class RecursiveActionTest extends JSR166TestCase {
                 }
             }
         
        -    // A recursive action failing in base case
        +    /** A recursive action failing in base case. */
             static final class FailingFibAction extends RecursiveAction {
                 final int number;
                 int result;
        diff --git a/jdk/test/java/util/concurrent/tck/RecursiveTaskTest.java b/jdk/test/java/util/concurrent/tck/RecursiveTaskTest.java
        index ce13daa8e7b..49723adcff7 100644
        --- a/jdk/test/java/util/concurrent/tck/RecursiveTaskTest.java
        +++ b/jdk/test/java/util/concurrent/tck/RecursiveTaskTest.java
        @@ -210,10 +210,10 @@ public class RecursiveTaskTest extends JSR166TestCase {
                 public FJException() { super(); }
             }
         
        -    // An invalid return value for Fib
        +    /** An invalid return value for Fib. */
             static final Integer NoResult = Integer.valueOf(-17);
         
        -    // A simple recursive task for testing
        +    /** A simple recursive task for testing. */
             final class FibTask extends CheckedRecursiveTask {
                 final int number;
                 FibTask(int n) { number = n; }
        @@ -231,7 +231,7 @@ public class RecursiveTaskTest extends JSR166TestCase {
                 }
             }
         
        -    // A recursive action failing in base case
        +    /** A recursive action failing in base case. */
             final class FailingFibTask extends RecursiveTask {
                 final int number;
                 int result;
        diff --git a/jdk/test/java/util/concurrent/tck/StampedLockTest.java b/jdk/test/java/util/concurrent/tck/StampedLockTest.java
        index 65ef48d046b..5f44312c88c 100644
        --- a/jdk/test/java/util/concurrent/tck/StampedLockTest.java
        +++ b/jdk/test/java/util/concurrent/tck/StampedLockTest.java
        @@ -518,7 +518,7 @@ public class StampedLockTest extends JSR166TestCase {
                         lock.unlockWrite(s);
                     }});
         
        -        aboutToLock.await();
        +        await(aboutToLock);
                 waitForThreadToEnterWaitState(t);
                 assertFalse(lock.isWriteLocked());
                 assertTrue(lock.isReadLocked());
        @@ -777,7 +777,7 @@ public class StampedLockTest extends JSR166TestCase {
                         lock.writeLockInterruptibly();
                     }});
         
        -        locked.await();
        +        await(locked);
                 assertFalse(lock.validate(p));
                 assertEquals(0L, lock.tryOptimisticRead());
                 waitForThreadToEnterWaitState(t);
        diff --git a/jdk/test/java/util/concurrent/tck/SubmissionPublisherTest.java b/jdk/test/java/util/concurrent/tck/SubmissionPublisherTest.java
        index 102d1b5e3ef..ecd472f2cbe 100644
        --- a/jdk/test/java/util/concurrent/tck/SubmissionPublisherTest.java
        +++ b/jdk/test/java/util/concurrent/tck/SubmissionPublisherTest.java
        @@ -519,7 +519,7 @@ public class SubmissionPublisherTest extends JSR166TestCase {
                 s1.request = false;
                 p.subscribe(s1);
                 s1.awaitSubscribe();
        -        assertTrue(p.estimateMinimumDemand() == 0);
        +        assertEquals(0, p.estimateMinimumDemand());
                 TestSubscriber s2 = new TestSubscriber();
                 p.subscribe(s2);
                 p.submit(1);
        diff --git a/jdk/test/java/util/concurrent/tck/SynchronousQueueTest.java b/jdk/test/java/util/concurrent/tck/SynchronousQueueTest.java
        index 345ac9c7305..afa4f5c026c 100644
        --- a/jdk/test/java/util/concurrent/tck/SynchronousQueueTest.java
        +++ b/jdk/test/java/util/concurrent/tck/SynchronousQueueTest.java
        @@ -596,7 +596,7 @@ public class SynchronousQueueTest extends JSR166TestCase {
                         fail("timed out");
                     Thread.yield();
                 }
        -        assertTrue(l.size() == 1);
        +        assertEquals(1, l.size());
                 assertSame(one, l.get(0));
                 awaitTermination(t);
             }
        diff --git a/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java b/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
        index 38862ceee5d..90065c65790 100644
        --- a/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
        @@ -265,7 +265,7 @@ public class ThreadPoolExecutorSubclassTest extends JSR166TestCase {
                     final Runnable task = new CheckedRunnable() {
                         public void realRun() { done.countDown(); }};
                     p.execute(task);
        -            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
        +            await(done);
                 }
             }
         
        @@ -359,13 +359,13 @@ public class ThreadPoolExecutorSubclassTest extends JSR166TestCase {
                         public void realRun() throws InterruptedException {
                             threadStarted.countDown();
                             assertEquals(0, p.getCompletedTaskCount());
        -                    threadProceed.await();
        +                    await(threadProceed);
                             threadDone.countDown();
                         }});
                     await(threadStarted);
                     assertEquals(0, p.getCompletedTaskCount());
                     threadProceed.countDown();
        -            threadDone.await();
        +            await(threadDone);
                     long startTime = System.nanoTime();
                     while (p.getCompletedTaskCount() != 1) {
                         if (millisElapsedSince(startTime) > LONG_DELAY_MS)
        @@ -1953,7 +1953,7 @@ public class ThreadPoolExecutorSubclassTest extends JSR166TestCase {
                             public void realRun() {
                                 done.countDown();
                             }});
        -            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
        +            await(done);
                 }
             }
         
        diff --git a/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorTest.java b/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorTest.java
        index cf0b0971270..9cbb98562f6 100644
        --- a/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ThreadPoolExecutorTest.java
        @@ -45,7 +45,6 @@ import java.util.concurrent.Callable;
         import java.util.concurrent.CancellationException;
         import java.util.concurrent.CountDownLatch;
         import java.util.concurrent.ExecutionException;
        -import java.util.concurrent.Executors;
         import java.util.concurrent.ExecutorService;
         import java.util.concurrent.Future;
         import java.util.concurrent.FutureTask;
        @@ -118,7 +117,7 @@ public class ThreadPoolExecutorTest extends JSR166TestCase {
                     final Runnable task = new CheckedRunnable() {
                         public void realRun() { done.countDown(); }};
                     p.execute(task);
        -            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
        +            await(done);
                 }
             }
         
        @@ -212,13 +211,13 @@ public class ThreadPoolExecutorTest extends JSR166TestCase {
                         public void realRun() throws InterruptedException {
                             threadStarted.countDown();
                             assertEquals(0, p.getCompletedTaskCount());
        -                    threadProceed.await();
        +                    await(threadProceed);
                             threadDone.countDown();
                         }});
                     await(threadStarted);
                     assertEquals(0, p.getCompletedTaskCount());
                     threadProceed.countDown();
        -            threadDone.await();
        +            await(threadDone);
                     long startTime = System.nanoTime();
                     while (p.getCompletedTaskCount() != 1) {
                         if (millisElapsedSince(startTime) > LONG_DELAY_MS)
        @@ -301,6 +300,20 @@ public class ThreadPoolExecutorTest extends JSR166TestCase {
                 }
             }
         
        +    /**
        +     * The default rejected execution handler is AbortPolicy.
        +     */
        +    public void testDefaultRejectedExecutionHandler() {
        +        final ThreadPoolExecutor p =
        +            new ThreadPoolExecutor(1, 2,
        +                                   LONG_DELAY_MS, MILLISECONDS,
        +                                   new ArrayBlockingQueue(10));
        +        try (PoolCleaner cleaner = cleaner(p)) {
        +            assertTrue(p.getRejectedExecutionHandler()
        +                       instanceof ThreadPoolExecutor.AbortPolicy);
        +        }
        +    }
        +
             /**
              * getRejectedExecutionHandler returns handler in constructor if not set
              */
        @@ -1139,7 +1152,7 @@ public class ThreadPoolExecutorTest extends JSR166TestCase {
                             await(done);
                         }};
                     for (int i = 0; i < 2; ++i)
        -                p.submit(Executors.callable(task));
        +                p.execute(task);
                     for (int i = 0; i < 2; ++i) {
                         try {
                             p.execute(task);
        @@ -1955,7 +1968,7 @@ public class ThreadPoolExecutorTest extends JSR166TestCase {
                             public void realRun() {
                                 done.countDown();
                             }});
        -            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
        +            await(done);
                 }
             }
         
        @@ -2048,7 +2061,7 @@ public class ThreadPoolExecutorTest extends JSR166TestCase {
                         }
                     }
                     // enough time to run all tasks
        -            assertTrue(done.await(nTasks * SHORT_DELAY_MS, MILLISECONDS));
        +            await(done, nTasks * SHORT_DELAY_MS);
                 }
             }
         
        diff --git a/jdk/test/java/util/concurrent/tck/ThreadTest.java b/jdk/test/java/util/concurrent/tck/ThreadTest.java
        index 92b2aca52a6..1cd9f0fbce4 100644
        --- a/jdk/test/java/util/concurrent/tck/ThreadTest.java
        +++ b/jdk/test/java/util/concurrent/tck/ThreadTest.java
        @@ -76,7 +76,7 @@ public class ThreadTest extends JSR166TestCase {
              * setDefaultUncaughtExceptionHandler.
              */
             public void testGetAndSetDefaultUncaughtExceptionHandler() {
        -        assertEquals(null, Thread.getDefaultUncaughtExceptionHandler());
        +        assertNull(Thread.getDefaultUncaughtExceptionHandler());
                 // failure due to SecurityException is OK.
                 // Would be nice to explicitly test both ways, but cannot yet.
                 Thread.UncaughtExceptionHandler defaultHandler
        diff --git a/jdk/test/java/util/concurrent/tck/TreeSetTest.java b/jdk/test/java/util/concurrent/tck/TreeSetTest.java
        index a37922e525b..55b28d613d9 100644
        --- a/jdk/test/java/util/concurrent/tck/TreeSetTest.java
        +++ b/jdk/test/java/util/concurrent/tck/TreeSetTest.java
        @@ -69,7 +69,7 @@ public class TreeSetTest extends JSR166TestCase {
              * Returns a new set of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private TreeSet populatedSet(int n) {
        +    private static TreeSet populatedSet(int n) {
                 TreeSet q = new TreeSet<>();
                 assertTrue(q.isEmpty());
                 for (int i = n - 1; i >= 0; i -= 2)
        @@ -84,7 +84,7 @@ public class TreeSetTest extends JSR166TestCase {
             /**
              * Returns a new set of first 5 ints.
              */
        -    private TreeSet set5() {
        +    private static TreeSet set5() {
                 TreeSet q = new TreeSet();
                 assertTrue(q.isEmpty());
                 q.add(one);
        diff --git a/jdk/test/java/util/concurrent/tck/TreeSubSetTest.java b/jdk/test/java/util/concurrent/tck/TreeSubSetTest.java
        index 37edc1fb04c..a0f2b96ee57 100644
        --- a/jdk/test/java/util/concurrent/tck/TreeSubSetTest.java
        +++ b/jdk/test/java/util/concurrent/tck/TreeSubSetTest.java
        @@ -60,7 +60,7 @@ public class TreeSubSetTest extends JSR166TestCase {
              * Returns a new set of given size containing consecutive
              * Integers 0 ... n - 1.
              */
        -    private NavigableSet populatedSet(int n) {
        +    private static NavigableSet populatedSet(int n) {
                 TreeSet q = new TreeSet<>();
                 assertTrue(q.isEmpty());
         
        @@ -79,7 +79,7 @@ public class TreeSubSetTest extends JSR166TestCase {
             /**
              * Returns a new set of first 5 ints.
              */
        -    private NavigableSet set5() {
        +    private static NavigableSet set5() {
                 TreeSet q = new TreeSet();
                 assertTrue(q.isEmpty());
                 q.add(one);
        @@ -94,7 +94,7 @@ public class TreeSubSetTest extends JSR166TestCase {
                 return s;
             }
         
        -    private NavigableSet dset5() {
        +    private static NavigableSet dset5() {
                 TreeSet q = new TreeSet();
                 assertTrue(q.isEmpty());
                 q.add(m1);
        diff --git a/jdk/test/java/util/concurrent/tck/VectorTest.java b/jdk/test/java/util/concurrent/tck/VectorTest.java
        index 78c236402f6..1878a78cc93 100644
        --- a/jdk/test/java/util/concurrent/tck/VectorTest.java
        +++ b/jdk/test/java/util/concurrent/tck/VectorTest.java
        @@ -33,11 +33,9 @@
          */
         
         import java.util.Vector;
        -import java.util.Collection;
         import java.util.List;
         
         import junit.framework.Test;
        -import junit.framework.TestSuite;
         
         public class VectorTest extends JSR166TestCase {
             public static void main(String[] args) {
        
        From aae40befa180c832716f8857f141aa82ccc974e6 Mon Sep 17 00:00:00 2001
        From: Mandy Chung 
        Date: Mon, 10 Apr 2017 13:51:40 -0700
        Subject: [PATCH 50/75] 8177855: Clean up legal files
        
        Reviewed-by: alanb, darcy
        ---
         jdk/src/java.desktop/share/legal/jpeg.md | 2 +-
         jdk/src/jdk.crypto.ec/share/legal/ecc.md | 3 ++-
         2 files changed, 3 insertions(+), 2 deletions(-)
        
        diff --git a/jdk/src/java.desktop/share/legal/jpeg.md b/jdk/src/java.desktop/share/legal/jpeg.md
        index 91f27bd838a..da64b2f7683 100644
        --- a/jdk/src/java.desktop/share/legal/jpeg.md
        +++ b/jdk/src/java.desktop/share/legal/jpeg.md
        @@ -1,4 +1,4 @@
        -## JPEG release 6b
        +## Independent JPEG Group: JPEG release 6b
         
         ### JPEG License
         
        diff --git a/jdk/src/jdk.crypto.ec/share/legal/ecc.md b/jdk/src/jdk.crypto.ec/share/legal/ecc.md
        index 2ce66e448b1..300b7d4ebca 100644
        --- a/jdk/src/jdk.crypto.ec/share/legal/ecc.md
        +++ b/jdk/src/jdk.crypto.ec/share/legal/ecc.md
        @@ -6,7 +6,8 @@
         This notice is provided with respect to Elliptic Curve Cryptography,
         which is included with JRE, JDK, and OpenJDK.
         
        -You are receiving a copy of the Elliptic Curve Cryptography library in source
        +You are receiving a [copy](http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/jdk.crypto.ec/share/native/libsunec/impl)
        +of the Elliptic Curve Cryptography library in source
         form with the JDK and OpenJDK source distributions, and as object code in
         the JRE & JDK runtimes.
         
        
        From 9ab899d4810d264f7f7f1eefe2e64a7fd75c2568 Mon Sep 17 00:00:00 2001
        From: Claes Redestad 
        Date: Tue, 11 Apr 2017 11:24:12 +0200
        Subject: [PATCH 51/75] 8178384: Reduce work in java.lang.invoke initializers
        
        Reviewed-by: vlivanov, psandoz
        ---
         .../java/lang/invoke/BoundMethodHandle.java   |  39 +++--
         .../java/lang/invoke/DirectMethodHandle.java  | 136 ++++++++++--------
         .../lang/invoke/InvokerBytecodeGenerator.java |   2 +-
         .../classes/java/lang/invoke/Invokers.java    |  84 ++++++-----
         .../classes/java/lang/invoke/LambdaForm.java  |  41 +++---
         .../java/lang/invoke/LambdaFormEditor.java    |   7 +-
         .../java/lang/invoke/MethodHandleImpl.java    |  78 ++++++----
         .../classes/sun/invoke/util/Wrapper.java      |  28 ++--
         8 files changed, 240 insertions(+), 175 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
        index cec436690b9..6dc51f3f2e5 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
        @@ -450,32 +450,29 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
              */
             static class Factory {
         
        -        static final String JLO_SIG  = "Ljava/lang/Object;";
        -        static final String JLS_SIG  = "Ljava/lang/String;";
        -        static final String JLC_SIG  = "Ljava/lang/Class;";
        -        static final String MH       = "java/lang/invoke/MethodHandle";
        -        static final String MH_SIG   = "L"+MH+";";
        -        static final String BMH      = "java/lang/invoke/BoundMethodHandle";
        -        static final String BMH_SIG  = "L"+BMH+";";
        -        static final String SPECIES_DATA     = "java/lang/invoke/BoundMethodHandle$SpeciesData";
        -        static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
        -        static final String STABLE_SIG       = "Ljdk/internal/vm/annotation/Stable;";
        +        private static final String JLO_SIG  = "Ljava/lang/Object;";
        +        private static final String MH       = "java/lang/invoke/MethodHandle";
        +        private static final String MH_SIG   = "L"+MH+";";
        +        private static final String BMH      = "java/lang/invoke/BoundMethodHandle";
        +        private static final String BMH_NAME = "java.lang.invoke.BoundMethodHandle";
        +        private static final String BMH_SIG  = "L"+BMH+";";
        +        private static final String SPECIES_DATA     = "java/lang/invoke/BoundMethodHandle$SpeciesData";
        +        private static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
        +        private static final String STABLE_SIG       = "Ljdk/internal/vm/annotation/Stable;";
         
        -        static final String SPECIES_PREFIX_NAME = "Species_";
        -        static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
        -        static final String SPECIES_CLASS_PREFIX = SPECIES_PREFIX_PATH.replace('/', '.');
        +        private static final String SPECIES_PREFIX_NAME = "Species_";
        +        private static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
        +        private static final String SPECIES_CLASS_PREFIX = BMH_NAME + "$" + SPECIES_PREFIX_NAME;
         
        -        static final String BMHSPECIES_DATA_EWI_SIG = "(B)" + SPECIES_DATA_SIG;
        -        static final String BMHSPECIES_DATA_GFC_SIG = "(" + JLS_SIG + JLC_SIG + ")" + SPECIES_DATA_SIG;
        -        static final String MYSPECIES_DATA_SIG = "()" + SPECIES_DATA_SIG;
        -        static final String VOID_SIG   = "()V";
        -        static final String INT_SIG    = "()I";
        +        private static final String BMHSPECIES_DATA_EWI_SIG = "(B)" + SPECIES_DATA_SIG;
        +        private static final String MYSPECIES_DATA_SIG = "()" + SPECIES_DATA_SIG;
        +        private static final String INT_SIG    = "()I";
         
        -        static final String SIG_INCIPIT = "(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;";
        +        private static final String SIG_INCIPIT = "(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;";
         
        -        static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" };
        +        private static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" };
         
        -        static final ConcurrentMap> CLASS_CACHE = new ConcurrentHashMap<>();
        +        private static final ConcurrentMap> CLASS_CACHE = new ConcurrentHashMap<>();
         
                 /**
                  * Get a concrete subclass of BMH for a given combination of bound types.
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
        index 0b4bd58b624..bd06ffa5348 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
        @@ -224,12 +224,12 @@ class DirectMethodHandle extends MethodHandle {
                 assert(names.length == nameCursor);
                 if (doesAlloc) {
                     // names = { argx,y,z,... new C, init method }
        -            names[NEW_OBJ] = new Name(NF_allocateInstance, names[DMH_THIS]);
        -            names[GET_MEMBER] = new Name(NF_constructorMethod, names[DMH_THIS]);
        +            names[NEW_OBJ] = new Name(getFunction(NF_allocateInstance), names[DMH_THIS]);
        +            names[GET_MEMBER] = new Name(getFunction(NF_constructorMethod), names[DMH_THIS]);
                 } else if (needsInit) {
        -            names[GET_MEMBER] = new Name(NF_internalMemberNameEnsureInit, names[DMH_THIS]);
        +            names[GET_MEMBER] = new Name(getFunction(NF_internalMemberNameEnsureInit), names[DMH_THIS]);
                 } else {
        -            names[GET_MEMBER] = new Name(NF_internalMemberName, names[DMH_THIS]);
        +            names[GET_MEMBER] = new Name(getFunction(NF_internalMemberName), names[DMH_THIS]);
                 }
                 assert(findDirectMethodHandle(names[GET_MEMBER]) == names[DMH_THIS]);
                 Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, GET_MEMBER+1, Object[].class);
        @@ -249,10 +249,10 @@ class DirectMethodHandle extends MethodHandle {
                 return lform;
             }
         
        -    static Object findDirectMethodHandle(Name name) {
        -        if (name.function == NF_internalMemberName ||
        -            name.function == NF_internalMemberNameEnsureInit ||
        -            name.function == NF_constructorMethod) {
        +    /* assert */ static Object findDirectMethodHandle(Name name) {
        +        if (name.function.equals(getFunction(NF_internalMemberName)) ||
        +            name.function.equals(getFunction(NF_internalMemberNameEnsureInit)) ||
        +            name.function.equals(getFunction(NF_constructorMethod))) {
                     assert(name.arguments.length == 1);
                     return name.arguments[0];
                 }
        @@ -674,18 +674,18 @@ class DirectMethodHandle extends MethodHandle {
                 final int RESULT    = nameCursor-1;  // either the call or the cast
                 Name[] names = arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
                 if (needsInit)
        -            names[INIT_BAR] = new Name(NF_ensureInitialized, names[DMH_THIS]);
        +            names[INIT_BAR] = new Name(getFunction(NF_ensureInitialized), names[DMH_THIS]);
                 if (needsCast && !isGetter)
        -            names[PRE_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[SET_VALUE]);
        +            names[PRE_CAST] = new Name(getFunction(NF_checkCast), names[DMH_THIS], names[SET_VALUE]);
                 Object[] outArgs = new Object[1 + linkerType.parameterCount()];
                 assert(outArgs.length == (isGetter ? 3 : 4));
        -        outArgs[0] = names[U_HOLDER] = new Name(NF_UNSAFE);
        +        outArgs[0] = names[U_HOLDER] = new Name(getFunction(NF_UNSAFE));
                 if (isStatic) {
        -            outArgs[1] = names[F_HOLDER]  = new Name(NF_staticBase, names[DMH_THIS]);
        -            outArgs[2] = names[F_OFFSET]  = new Name(NF_staticOffset, names[DMH_THIS]);
        +            outArgs[1] = names[F_HOLDER]  = new Name(getFunction(NF_staticBase), names[DMH_THIS]);
        +            outArgs[2] = names[F_OFFSET]  = new Name(getFunction(NF_staticOffset), names[DMH_THIS]);
                 } else {
        -            outArgs[1] = names[OBJ_CHECK] = new Name(NF_checkBase, names[OBJ_BASE]);
        -            outArgs[2] = names[F_OFFSET]  = new Name(NF_fieldOffset, names[DMH_THIS]);
        +            outArgs[1] = names[OBJ_CHECK] = new Name(getFunction(NF_checkBase), names[OBJ_BASE]);
        +            outArgs[2] = names[F_OFFSET]  = new Name(getFunction(NF_fieldOffset), names[DMH_THIS]);
                 }
                 if (!isGetter) {
                     outArgs[3] = (needsCast ? names[PRE_CAST] : names[SET_VALUE]);
        @@ -693,7 +693,7 @@ class DirectMethodHandle extends MethodHandle {
                 for (Object a : outArgs)  assert(a != null);
                 names[LINKER_CALL] = new Name(linker, outArgs);
                 if (needsCast && isGetter)
        -            names[POST_CAST] = new Name(NF_checkCast, names[DMH_THIS], names[LINKER_CALL]);
        +            names[POST_CAST] = new Name(getFunction(NF_checkCast), names[DMH_THIS], names[LINKER_CALL]);
                 for (Name n : names)  assert(n != null);
         
                 LambdaForm form;
        @@ -726,48 +726,72 @@ class DirectMethodHandle extends MethodHandle {
         
             /**
              * Pre-initialized NamedFunctions for bootstrapping purposes.
        -     * Factored in an inner class to delay initialization until first usage.
              */
        -    static final NamedFunction
        -            NF_internalMemberName,
        -            NF_internalMemberNameEnsureInit,
        -            NF_ensureInitialized,
        -            NF_fieldOffset,
        -            NF_checkBase,
        -            NF_staticBase,
        -            NF_staticOffset,
        -            NF_checkCast,
        -            NF_allocateInstance,
        -            NF_constructorMethod,
        -            NF_UNSAFE;
        -    static {
        +    static final byte NF_internalMemberName = 0,
        +            NF_internalMemberNameEnsureInit = 1,
        +            NF_ensureInitialized = 2,
        +            NF_fieldOffset = 3,
        +            NF_checkBase = 4,
        +            NF_staticBase = 5,
        +            NF_staticOffset = 6,
        +            NF_checkCast = 7,
        +            NF_allocateInstance = 8,
        +            NF_constructorMethod = 9,
        +            NF_UNSAFE = 10,
        +            NF_LIMIT = 11;
        +
        +    private static final @Stable NamedFunction[] NFS = new NamedFunction[NF_LIMIT];
        +
        +    private static NamedFunction getFunction(byte func) {
        +        NamedFunction nf = NFS[func];
        +        if (nf != null) {
        +            return nf;
        +        }
        +        // Each nf must be statically invocable or we get tied up in our bootstraps.
        +        nf = NFS[func] = createFunction(func);
        +        assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf));
        +        return nf;
        +    }
        +
        +    private static NamedFunction createFunction(byte func) {
                 try {
        -            NamedFunction nfs[] = {
        -                    NF_internalMemberName = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("internalMemberName", Object.class)),
        -                    NF_internalMemberNameEnsureInit = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("internalMemberNameEnsureInit", Object.class)),
        -                    NF_ensureInitialized = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("ensureInitialized", Object.class)),
        -                    NF_fieldOffset = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("fieldOffset", Object.class)),
        -                    NF_checkBase = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("checkBase", Object.class)),
        -                    NF_staticBase = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("staticBase", Object.class)),
        -                    NF_staticOffset = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("staticOffset", Object.class)),
        -                    NF_checkCast = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("checkCast", Object.class, Object.class)),
        -                    NF_allocateInstance = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("allocateInstance", Object.class)),
        -                    NF_constructorMethod = new NamedFunction(DirectMethodHandle.class
        -                            .getDeclaredMethod("constructorMethod", Object.class)),
        -                    NF_UNSAFE = new NamedFunction(new MemberName(MethodHandleStatics.class
        -                            .getDeclaredField("UNSAFE")))
        -            };
        -            // Each nf must be statically invocable or we get tied up in our bootstraps.
        -            assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
        +            switch (func) {
        +                case NF_internalMemberName:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("internalMemberName", Object.class));
        +                case NF_internalMemberNameEnsureInit:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("internalMemberNameEnsureInit", Object.class));
        +                case NF_ensureInitialized:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("ensureInitialized", Object.class));
        +                case NF_fieldOffset:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("fieldOffset", Object.class));
        +                case NF_checkBase:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("checkBase", Object.class));
        +                case NF_staticBase:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("staticBase", Object.class));
        +                case NF_staticOffset:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("staticOffset", Object.class));
        +                case NF_checkCast:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("checkCast", Object.class, Object.class));
        +                case NF_allocateInstance:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("allocateInstance", Object.class));
        +                case NF_constructorMethod:
        +                    return new NamedFunction(DirectMethodHandle.class
        +                            .getDeclaredMethod("constructorMethod", Object.class));
        +                case NF_UNSAFE:
        +                    return new NamedFunction(new MemberName(MethodHandleStatics.class
        +                            .getDeclaredField("UNSAFE")));
        +                default:
        +                    throw newInternalError("Unknown function: " + func);
        +            }
                 } catch (ReflectiveOperationException ex) {
                     throw newInternalError(ex);
                 }
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        index ec81f5093b6..6e57d209bba 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        @@ -908,7 +908,7 @@ class InvokerBytecodeGenerator {
                 //MethodHandle.class already covered
             };
         
        -    static boolean isStaticallyInvocable(NamedFunction[] functions) {
        +    static boolean isStaticallyInvocable(NamedFunction ... functions) {
                 for (NamedFunction nf : functions) {
                     if (!isStaticallyInvocable(nf.member())) {
                         return false;
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
        index a221af7e086..8eeb4c3954e 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
        @@ -313,15 +313,15 @@ class Invokers {
                 Object[] outArgs = Arrays.copyOfRange(names, CALL_MH, OUTARG_LIMIT, Object[].class);
                 Object mtypeArg = (customized ? mtype : names[MTYPE_ARG]);
                 if (!isGeneric) {
        -            names[CHECK_TYPE] = new Name(NF_checkExactType, names[CALL_MH], mtypeArg);
        +            names[CHECK_TYPE] = new Name(getFunction(NF_checkExactType), names[CALL_MH], mtypeArg);
                     // mh.invokeExact(a*):R => checkExactType(mh, TYPEOF(a*:R)); mh.invokeBasic(a*)
                 } else {
        -            names[CHECK_TYPE] = new Name(NF_checkGenericType, names[CALL_MH], mtypeArg);
        +            names[CHECK_TYPE] = new Name(getFunction(NF_checkGenericType), names[CALL_MH], mtypeArg);
                     // mh.invokeGeneric(a*):R => checkGenericType(mh, TYPEOF(a*:R)).invokeBasic(a*)
                     outArgs[0] = names[CHECK_TYPE];
                 }
                 if (CHECK_CUSTOM != -1) {
        -            names[CHECK_CUSTOM] = new Name(NF_checkCustomized, outArgs[0]);
        +            names[CHECK_CUSTOM] = new Name(getFunction(NF_checkCustomized), outArgs[0]);
                 }
                 names[LINKER_CALL] = new Name(outCallType, outArgs);
                 if (customized) {
        @@ -368,7 +368,7 @@ class Invokers {
                 }
                 names[VAD_ARG] = new Name(ARG_LIMIT, BasicType.basicType(Object.class));
         
        -        names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[THIS_VH], names[VAD_ARG]);
        +        names[CHECK_TYPE] = new Name(getFunction(NF_checkVarHandleGenericType), names[THIS_VH], names[VAD_ARG]);
         
                 Object[] outArgs = new Object[ARG_LIMIT + 1];
                 outArgs[0] = names[CHECK_TYPE];
        @@ -377,7 +377,7 @@ class Invokers {
                 }
         
                 if (CHECK_CUSTOM != -1) {
        -            names[CHECK_CUSTOM] = new Name(NF_checkCustomized, outArgs[0]);
        +            names[CHECK_CUSTOM] = new Name(getFunction(NF_checkCustomized), outArgs[0]);
                 }
         
                 MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class)
        @@ -420,9 +420,9 @@ class Invokers {
                 names[VAD_ARG] = new Name(getter, names[THIS_MH]);
         
                 if (isExact) {
        -            names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]);
        +            names[CHECK_TYPE] = new Name(getFunction(NF_checkVarHandleExactType), names[CALL_VH], names[VAD_ARG]);
                 } else {
        -            names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]);
        +            names[CHECK_TYPE] = new Name(getFunction(NF_checkVarHandleGenericType), names[CALL_VH], names[VAD_ARG]);
                 }
                 Object[] outArgs = new Object[ARG_LIMIT];
                 outArgs[0] = names[CHECK_TYPE];
        @@ -543,7 +543,7 @@ class Invokers {
                 assert(names.length == nameCursor);
                 assert(names[APPENDIX_ARG] != null);
                 if (!skipCallSite)
        -            names[CALL_MH] = new Name(NF_getCallSiteTarget, names[CSITE_ARG]);
        +            names[CALL_MH] = new Name(getFunction(NF_getCallSiteTarget), names[CSITE_ARG]);
                 // (site.)invokedynamic(a*):R => mh = site.getTarget(); mh.invokeBasic(a*)
                 final int PREPEND_MH = 0, PREPEND_COUNT = 1;
                 Object[] outArgs = Arrays.copyOfRange(names, ARG_BASE, OUTARG_LIMIT + PREPEND_COUNT, Object[].class);
        @@ -586,31 +586,51 @@ class Invokers {
             }
         
             // Local constant functions:
        -    private static final NamedFunction
        -        NF_checkExactType,
        -        NF_checkGenericType,
        -        NF_getCallSiteTarget,
        -        NF_checkCustomized,
        -        NF_checkVarHandleGenericType,
        -        NF_checkVarHandleExactType;
        -    static {
        +    private static final byte NF_checkExactType = 0,
        +        NF_checkGenericType = 1,
        +        NF_getCallSiteTarget = 2,
        +        NF_checkCustomized = 3,
        +        NF_checkVarHandleGenericType = 4,
        +        NF_checkVarHandleExactType = 5,
        +        NF_LIMIT = 6;
        +
        +    private static final @Stable NamedFunction[] NFS = new NamedFunction[NF_LIMIT];
        +
        +    private static NamedFunction getFunction(byte func) {
        +        NamedFunction nf = NFS[func];
        +        if (nf != null) {
        +            return nf;
        +        }
        +        NFS[func] = nf = createFunction(func);
        +        // Each nf must be statically invocable or we get tied up in our bootstraps.
        +        assert(InvokerBytecodeGenerator.isStaticallyInvocable(nf));
        +        return nf;
        +    }
        +
        +    private static NamedFunction createFunction(byte func) {
                 try {
        -            NamedFunction nfs[] = {
        -                NF_checkExactType = new NamedFunction(Invokers.class
        -                        .getDeclaredMethod("checkExactType", MethodHandle.class,  MethodType.class)),
        -                NF_checkGenericType = new NamedFunction(Invokers.class
        -                        .getDeclaredMethod("checkGenericType", MethodHandle.class,  MethodType.class)),
        -                NF_getCallSiteTarget = new NamedFunction(Invokers.class
        -                        .getDeclaredMethod("getCallSiteTarget", CallSite.class)),
        -                NF_checkCustomized = new NamedFunction(Invokers.class
        -                        .getDeclaredMethod("checkCustomized", MethodHandle.class)),
        -                NF_checkVarHandleGenericType = new NamedFunction(Invokers.class
        -                        .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class)),
        -                NF_checkVarHandleExactType = new NamedFunction(Invokers.class
        -                        .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class)),
        -            };
        -            // Each nf must be statically invocable or we get tied up in our bootstraps.
        -            assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs));
        +            switch (func) {
        +                case NF_checkExactType:
        +                    return new NamedFunction(Invokers.class
        +                        .getDeclaredMethod("checkExactType", MethodHandle.class,  MethodType.class));
        +                case NF_checkGenericType:
        +                    return new NamedFunction(Invokers.class
        +                        .getDeclaredMethod("checkGenericType", MethodHandle.class,  MethodType.class));
        +                case NF_getCallSiteTarget:
        +                    return new NamedFunction(Invokers.class
        +                        .getDeclaredMethod("getCallSiteTarget", CallSite.class));
        +                case NF_checkCustomized:
        +                    return new NamedFunction(Invokers.class
        +                        .getDeclaredMethod("checkCustomized", MethodHandle.class));
        +                case NF_checkVarHandleGenericType:
        +                    return new NamedFunction(Invokers.class
        +                        .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class));
        +                case NF_checkVarHandleExactType:
        +                    return new NamedFunction(Invokers.class
        +                        .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class));
        +                default:
        +                    throw newInternalError("Unknown function: " + func);
        +            }
                 } catch (ReflectiveOperationException ex) {
                     throw newInternalError(ex);
                 }
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        index 0048afbfd9e..2f107facd77 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        @@ -270,21 +270,21 @@ class LambdaForm {
                 GENERIC("invoke"),
                 ZERO("zero"),
                 IDENTITY("identity"),
        -        BOUND_REINVOKER("BMH.reinvoke"),
        -        REINVOKER("MH.reinvoke"),
        -        DELEGATE("MH.delegate"),
        -        EXACT_LINKER("MH.invokeExact_MT"),
        -        EXACT_INVOKER("MH.exactInvoker"),
        -        GENERIC_LINKER("MH.invoke_MT"),
        -        GENERIC_INVOKER("MH.invoker"),
        +        BOUND_REINVOKER("BMH.reinvoke", "reinvoke"),
        +        REINVOKER("MH.reinvoke", "reinvoke"),
        +        DELEGATE("MH.delegate", "delegate"),
        +        EXACT_LINKER("MH.invokeExact_MT", "invokeExact_MT"),
        +        EXACT_INVOKER("MH.exactInvoker", "exactInvoker"),
        +        GENERIC_LINKER("MH.invoke_MT", "invoke_MT"),
        +        GENERIC_INVOKER("MH.invoker", "invoker"),
                 LINK_TO_TARGET_METHOD("linkToTargetMethod"),
                 LINK_TO_CALL_SITE("linkToCallSite"),
        -        DIRECT_INVOKE_VIRTUAL("DMH.invokeVirtual"),
        -        DIRECT_INVOKE_SPECIAL("DMH.invokeSpecial"),
        -        DIRECT_INVOKE_STATIC("DMH.invokeStatic"),
        -        DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial"),
        -        DIRECT_INVOKE_INTERFACE("DMH.invokeInterface"),
        -        DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit"),
        +        DIRECT_INVOKE_VIRTUAL("DMH.invokeVirtual", "invokeVirtual"),
        +        DIRECT_INVOKE_SPECIAL("DMH.invokeSpecial", "invokeSpecial"),
        +        DIRECT_INVOKE_STATIC("DMH.invokeStatic", "invokeStatic"),
        +        DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial", "newInvokeSpecial"),
        +        DIRECT_INVOKE_INTERFACE("DMH.invokeInterface", "invokeInterface"),
        +        DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit", "invokeStaticInit"),
                 GET_OBJECT("getObject"),
                 PUT_OBJECT("putObject"),
                 GET_OBJECT_VOLATILE("getObjectVolatile"),
        @@ -330,20 +330,19 @@ class LambdaForm {
                 GUARD("guard"),
                 GUARD_WITH_CATCH("guardWithCatch"),
                 VARHANDLE_EXACT_INVOKER("VH.exactInvoker"),
        -        VARHANDLE_INVOKER("VH.invoker"),
        -        VARHANDLE_LINKER("VH.invoke_MT");
        +        VARHANDLE_INVOKER("VH.invoker", "invoker"),
        +        VARHANDLE_LINKER("VH.invoke_MT", "invoke_MT");
         
                 final String defaultLambdaName;
                 final String methodName;
         
                 private Kind(String defaultLambdaName) {
        +            this(defaultLambdaName, defaultLambdaName);
        +        }
        +
        +        private Kind(String defaultLambdaName, String methodName) {
                     this.defaultLambdaName = defaultLambdaName;
        -            int p = defaultLambdaName.indexOf('.');
        -            if (p > -1) {
        -                this.methodName = defaultLambdaName.substring(p + 1);
        -            } else {
        -                this.methodName = defaultLambdaName;
        -            }
        +            this.methodName = methodName;
                 }
             }
         
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
        index 2d9c87ad0d4..e066a60838c 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
        @@ -532,7 +532,8 @@ class LambdaFormEditor {
                 assert(pos > 0);  // cannot spread the MH arg itself
         
                 Name spreadParam = new Name(L_TYPE);
        -        Name checkSpread = new Name(MethodHandleImpl.NF_checkSpreadArgument, spreadParam, arrayLength);
        +        Name checkSpread = new Name(MethodHandleImpl.getFunction(MethodHandleImpl.NF_checkSpreadArgument),
        +                spreadParam, arrayLength);
         
                 // insert the new expressions
                 int exprPos = lambdaForm.arity();
        @@ -932,14 +933,14 @@ class LambdaFormEditor {
         
                 // replace the null entry in the MHImpl.loop invocation with localTypes
                 Name invokeLoop = lambdaForm.names[pos + 1];
        -        assert(invokeLoop.function == NF_loop);
        +        assert(invokeLoop.function.equals(MethodHandleImpl.getFunction(NF_loop)));
                 Object[] args = Arrays.copyOf(invokeLoop.arguments, invokeLoop.arguments.length);
                 assert(args[0] == null);
                 args[0] = localTypes;
         
                 LambdaFormBuffer buf = buffer();
                 buf.startEdit();
        -        buf.changeName(pos + 1, new Name(NF_loop, args));
        +        buf.changeName(pos + 1, new Name(MethodHandleImpl.getFunction(NF_loop), args));
                 form = buf.endEdit();
         
                 return putInCache(key, form);
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
        index 8ea5553fccc..7beb35a6600 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
        @@ -589,7 +589,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
                         // Spread the array.
                         MethodHandle aload = MethodHandles.arrayElementGetter(spreadArgType);
                         Name array = names[argIndex];
        -                names[nameCursor++] = new Name(NF_checkSpreadArgument, array, spreadArgCount);
        +                names[nameCursor++] = new Name(getFunction(NF_checkSpreadArgument), array, spreadArgCount);
                         for (int j = 0; j < spreadArgCount; i++, j++) {
                             indexes[i] = nameCursor;
                             names[nameCursor++] = new Name(aload, array, j);
        @@ -934,7 +934,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
         
                 // profile branch
                 if (PROFILE != -1) {
        -            names[PROFILE] = new Name(NF_profileBoolean, names[CALL_TEST], names[GET_COUNTERS]);
        +            names[PROFILE] = new Name(getFunction(NF_profileBoolean), names[CALL_TEST], names[GET_COUNTERS]);
                 }
                 // call selectAlternative
                 names[SELECT_ALT] = new Name(getConstantHandle(MH_selectAlternative), names[TEST], names[GET_TARGET], names[GET_FALLBACK]);
        @@ -1012,7 +1012,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
         
                 // t_{i+1}:L=MethodHandleImpl.guardWithCatch(target:L,exType:L,catcher:L,t_{i}:L);
                 Object[] gwcArgs = new Object[] {names[GET_TARGET], names[GET_CLASS], names[GET_CATCHER], names[BOXED_ARGS]};
        -        names[TRY_CATCH] = new Name(NF_guardWithCatch, gwcArgs);
        +        names[TRY_CATCH] = new Name(getFunction(NF_guardWithCatch), gwcArgs);
         
                 // t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L);
                 MethodHandle invokeBasicUnbox = MethodHandles.basicInvoker(MethodType.methodType(basicType.rtype(), Object.class));
        @@ -1085,7 +1085,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
                     mh = MethodHandles.dropArguments(mh, 1, Arrays.copyOfRange(type.parameterArray(), 1, arity));
                     return mh;
                 }
        -        return makePairwiseConvert(NF_throwException.resolvedHandle(), type, false, true);
        +        return makePairwiseConvert(getFunction(NF_throwException).resolvedHandle(), type, false, true);
             }
         
             static  Empty throwException(T t) throws T { throw t; }
        @@ -1673,33 +1673,57 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
             }
         
             // Local constant functions:
        -    /*non-public*/ static final NamedFunction
        -        NF_checkSpreadArgument,
        -        NF_guardWithCatch,
        -        NF_throwException,
        -        NF_tryFinally,
        -        NF_loop,
        -        NF_profileBoolean;
         
        -    static {
        +    static final byte NF_checkSpreadArgument = 0,
        +            NF_guardWithCatch = 1,
        +            NF_throwException = 2,
        +            NF_tryFinally = 3,
        +            NF_loop = 4,
        +            NF_profileBoolean = 5,
        +            NF_LIMIT = 6;
        +
        +    /*non-public*/
        +    private static final @Stable NamedFunction[] NFS = new NamedFunction[NF_LIMIT];
        +
        +    static NamedFunction getFunction(byte func) {
        +        NamedFunction nf = NFS[func];
        +        if (nf != null) {
        +            return nf;
        +        }
        +        return NFS[func] = createFunction(func);
        +    }
        +
        +    private static NamedFunction createFunction(byte func) {
                 try {
        -            NF_checkSpreadArgument = new NamedFunction(MethodHandleImpl.class
        -                    .getDeclaredMethod("checkSpreadArgument", Object.class, int.class));
        -            NF_guardWithCatch = new NamedFunction(MethodHandleImpl.class
        -                    .getDeclaredMethod("guardWithCatch", MethodHandle.class, Class.class,
        -                            MethodHandle.class, Object[].class));
        -            NF_tryFinally = new NamedFunction(MethodHandleImpl.class
        -                    .getDeclaredMethod("tryFinally", MethodHandle.class, MethodHandle.class, Object[].class));
        -            NF_loop = new NamedFunction(MethodHandleImpl.class
        -                    .getDeclaredMethod("loop", BasicType[].class, LoopClauses.class, Object[].class));
        -            NF_throwException = new NamedFunction(MethodHandleImpl.class
        -                    .getDeclaredMethod("throwException", Throwable.class));
        -            NF_profileBoolean = new NamedFunction(MethodHandleImpl.class
        -                    .getDeclaredMethod("profileBoolean", boolean.class, int[].class));
        +            switch (func) {
        +                case NF_checkSpreadArgument:
        +                    return new NamedFunction(MethodHandleImpl.class
        +                            .getDeclaredMethod("checkSpreadArgument", Object.class, int.class));
        +                case NF_guardWithCatch:
        +                    return new NamedFunction(MethodHandleImpl.class
        +                            .getDeclaredMethod("guardWithCatch", MethodHandle.class, Class.class,
        +                                    MethodHandle.class, Object[].class));
        +                case NF_tryFinally:
        +                    return new NamedFunction(MethodHandleImpl.class
        +                            .getDeclaredMethod("tryFinally", MethodHandle.class, MethodHandle.class, Object[].class));
        +                case NF_loop:
        +                    return new NamedFunction(MethodHandleImpl.class
        +                            .getDeclaredMethod("loop", BasicType[].class, LoopClauses.class, Object[].class));
        +                case NF_throwException:
        +                    return new NamedFunction(MethodHandleImpl.class
        +                            .getDeclaredMethod("throwException", Throwable.class));
        +                case NF_profileBoolean:
        +                    return new NamedFunction(MethodHandleImpl.class
        +                            .getDeclaredMethod("profileBoolean", boolean.class, int[].class));
        +                default:
        +                    throw new InternalError("Undefined function: " + func);
        +            }
                 } catch (ReflectiveOperationException ex) {
                     throw newInternalError(ex);
                 }
        +    }
         
        +    static {
                 SharedSecrets.setJavaLangInvokeAccess(new JavaLangInvokeAccess() {
                     @Override
                     public Object newMemberName() {
        @@ -1878,7 +1902,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
                     Object[] lArgs =
                             new Object[]{null, // placeholder for BasicType[] localTypes - will be added by LambdaFormEditor
                                     names[GET_CLAUSE_DATA], names[BOXED_ARGS]};
        -            names[LOOP] = new Name(NF_loop, lArgs);
        +            names[LOOP] = new Name(getFunction(NF_loop), lArgs);
         
                     // t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L);
                     MethodHandle invokeBasicUnbox = MethodHandles.basicInvoker(MethodType.methodType(basicType.rtype(), Object.class));
        @@ -2113,7 +2137,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
         
                 // t_{i+1}:L=MethodHandleImpl.tryFinally(target:L,exType:L,catcher:L,t_{i}:L);
                 Object[] tfArgs = new Object[] {names[GET_TARGET], names[GET_CLEANUP], names[BOXED_ARGS]};
        -        names[TRY_FINALLY] = new Name(NF_tryFinally, tfArgs);
        +        names[TRY_FINALLY] = new Name(getFunction(NF_tryFinally), tfArgs);
         
                 // t_{i+2}:I=MethodHandle.invokeBasic(unbox:L,t_{i+1}:L);
                 MethodHandle invokeBasicUnbox = MethodHandles.basicInvoker(MethodType.methodType(basicType.rtype(), Object.class));
        diff --git a/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java b/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
        index f22eda0ea45..d0e4df33d77 100644
        --- a/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
        +++ b/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
        @@ -26,20 +26,20 @@
         package sun.invoke.util;
         
         public enum Wrapper {
        -    //        wrapperType    primitiveType  char     emptyArray          format
        -    BOOLEAN(  Boolean.class, boolean.class, 'Z', new boolean[0], Format.unsigned( 1)),
        +    //        wrapperType      simple     primitiveType  simple     char  emptyArray     format
        +    BOOLEAN(  Boolean.class,   "Boolean", boolean.class, "boolean", 'Z', new boolean[0], Format.unsigned( 1)),
             // These must be in the order defined for widening primitive conversions in JLS 5.1.2
             // Avoid boxing integral types here to defer initialization of internal caches
        -    BYTE   (     Byte.class,    byte.class, 'B', new    byte[0], Format.signed(   8)),
        -    SHORT  (    Short.class,   short.class, 'S', new   short[0], Format.signed(  16)),
        -    CHAR   (Character.class,    char.class, 'C', new    char[0], Format.unsigned(16)),
        -    INT    (  Integer.class,     int.class, 'I', new     int[0], Format.signed(  32)),
        -    LONG   (     Long.class,    long.class, 'J', new    long[0], Format.signed(  64)),
        -    FLOAT  (    Float.class,   float.class, 'F', new   float[0], Format.floating(32)),
        -    DOUBLE (   Double.class,  double.class, 'D', new  double[0], Format.floating(64)),
        -    OBJECT (   Object.class,  Object.class, 'L', new  Object[0], Format.other(    1)),
        +    BYTE   (     Byte.class,      "Byte",    byte.class,    "byte", 'B', new    byte[0], Format.signed(   8)),
        +    SHORT  (    Short.class,     "Short",   short.class,   "short", 'S', new   short[0], Format.signed(  16)),
        +    CHAR   (Character.class, "Character",    char.class,    "char", 'C', new    char[0], Format.unsigned(16)),
        +    INT    (  Integer.class,   "Integer",     int.class,     "int", 'I', new     int[0], Format.signed(  32)),
        +    LONG   (     Long.class,      "Long",    long.class,    "long", 'J', new    long[0], Format.signed(  64)),
        +    FLOAT  (    Float.class,     "Float",   float.class,   "float", 'F', new   float[0], Format.floating(32)),
        +    DOUBLE (   Double.class,    "Double",  double.class,  "double", 'D', new  double[0], Format.floating(64)),
        +    OBJECT (   Object.class,    "Object",  Object.class,  "Object", 'L', new  Object[0], Format.other(    1)),
             // VOID must be the last type, since it is "assignable" from any other type:
        -    VOID   (     Void.class,    void.class, 'V',           null, Format.other(    0)),
        +    VOID   (     Void.class,      "Void",    void.class,    "void", 'V',           null, Format.other(    0)),
             ;
         
             public static final int COUNT = 10;
        @@ -52,14 +52,14 @@ public enum Wrapper {
             private final String   wrapperSimpleName;
             private final String   primitiveSimpleName;
         
        -    private Wrapper(Class wtype, Class ptype, char tchar, Object emptyArray, int format) {
        +    private Wrapper(Class wtype, String wtypeName, Class ptype, String ptypeName, char tchar, Object emptyArray, int format) {
                 this.wrapperType = wtype;
                 this.primitiveType = ptype;
                 this.basicTypeChar = tchar;
                 this.emptyArray = emptyArray;
                 this.format = format;
        -        this.wrapperSimpleName = wtype.getSimpleName();
        -        this.primitiveSimpleName = ptype.getSimpleName();
        +        this.wrapperSimpleName = wtypeName;
        +        this.primitiveSimpleName = ptypeName;
             }
         
             /** For debugging, give the details of this wrapper. */
        
        From 864cf0d5ca2405d37e163c04f4f3488260e0048e Mon Sep 17 00:00:00 2001
        From: Claes Redestad 
        Date: Tue, 11 Apr 2017 18:57:46 +0200
        Subject: [PATCH 52/75] 8178387: Reduce memory churn when creating
         java.lang.invoke entities
        
        Reviewed-by: psandoz, vlivanov
        ---
         .../java/lang/invoke/BoundMethodHandle.java   | 18 +++++++--
         .../lang/invoke/InvokerBytecodeGenerator.java | 34 ++++++++++-------
         .../classes/java/lang/invoke/LambdaForm.java  | 34 +++--------------
         .../classes/java/lang/invoke/MemberName.java  |  2 +-
         .../java/lang/invoke/MethodHandleImpl.java    |  2 +-
         .../classes/java/lang/invoke/MethodType.java  | 38 ++++++++++++++-----
         .../classes/sun/invoke/util/VerifyAccess.java |  9 +++--
         .../classes/sun/invoke/util/Wrapper.java      |  6 ---
         8 files changed, 76 insertions(+), 67 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
        index 6dc51f3f2e5..f4675e15905 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
        @@ -827,15 +827,27 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
         
                 private static String makeSignature(String types, boolean ctor) {
                     StringBuilder buf = new StringBuilder(SIG_INCIPIT);
        -            for (char c : types.toCharArray()) {
        -                buf.append(typeSig(c));
        +            int len = types.length();
        +            for (int i = 0; i < len; i++) {
        +                buf.append(typeSig(types.charAt(i)));
                     }
                     return buf.append(')').append(ctor ? "V" : BMH_SIG).toString();
                 }
         
        +        private static MethodType makeConstructorType(String types) {
        +            int length = types.length();
        +            Class ptypes[] = new Class[length + 2];
        +            ptypes[0] = MethodType.class;
        +            ptypes[1] = LambdaForm.class;
        +            for (int i = 0; i < length; i++) {
        +                ptypes[i + 2] = BasicType.basicType(types.charAt(i)).basicTypeClass();
        +            }
        +            return MethodType.makeImpl(BoundMethodHandle.class, ptypes, true);
        +        }
        +
                 static MethodHandle makeCbmhCtor(Class cbmh, String types) {
                     try {
        -                return LOOKUP.findStatic(cbmh, "make", MethodType.fromDescriptor(makeSignature(types, false), null));
        +                return LOOKUP.findStatic(cbmh, "make", makeConstructorType(types));
                     } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | TypeNotPresentException e) {
                         throw newInternalError(e);
                     }
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        index 6e57d209bba..9c05acb791a 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        @@ -73,6 +73,7 @@ class InvokerBytecodeGenerator {
             private static final String LL_SIG  = "(L" + OBJ + ";)L" + OBJ + ";";
             private static final String LLV_SIG = "(L" + OBJ + ";L" + OBJ + ";)V";
             private static final String CLASS_PREFIX = LF + "$";
        +    private static final String SOURCE_PREFIX = "LambdaForm$";
         
             /** Name of its super class*/
             static final String INVOKER_SUPER_NAME = OBJ;
        @@ -80,9 +81,6 @@ class InvokerBytecodeGenerator {
             /** Name of new class */
             private final String className;
         
        -    /** Name of the source file (for stack trace printing). */
        -    private final String sourceFile;
        -
             private final LambdaForm lambdaForm;
             private final String     invokerName;
             private final MethodType invokerType;
        @@ -109,8 +107,7 @@ class InvokerBytecodeGenerator {
                 if (DUMP_CLASS_FILES) {
                     className = makeDumpableClassName(className);
                 }
        -        this.className  = CLASS_PREFIX + className;
        -        this.sourceFile = "LambdaForm$" + className;
        +        this.className  = className;
                 this.lambdaForm = lambdaForm;
                 this.invokerName = invokerName;
                 this.invokerType = invokerType;
        @@ -173,6 +170,13 @@ class InvokerBytecodeGenerator {
                 }
             }
         
        +    private void maybeDump(final byte[] classFile) {
        +        if (DUMP_CLASS_FILES) {
        +            maybeDump(CLASS_PREFIX + className, classFile);
        +        }
        +    }
        +
        +    // Also used from BoundMethodHandle
             static void maybeDump(final String className, final byte[] classFile) {
                 if (DUMP_CLASS_FILES) {
                     java.security.AccessController.doPrivileged(
        @@ -306,8 +310,9 @@ class InvokerBytecodeGenerator {
             private ClassWriter classFilePrologue() {
                 final int NOT_ACC_PUBLIC = 0;  // not ACC_PUBLIC
                 cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
        -        cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, INVOKER_SUPER_NAME, null);
        -        cw.visitSource(sourceFile, null);
        +        cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
        +                CLASS_PREFIX + className, null, INVOKER_SUPER_NAME, null);
        +        cw.visitSource(SOURCE_PREFIX + className, null);
                 return cw;
             }
         
        @@ -617,12 +622,11 @@ class InvokerBytecodeGenerator {
                 return resolvedMember;
             }
         
        -    private static MemberName lookupPregenerated(LambdaForm form) {
        +    private static MemberName lookupPregenerated(LambdaForm form, MethodType invokerType) {
                 if (form.customized != null) {
                     // No pre-generated version for customized LF
                     return null;
                 }
        -        MethodType invokerType = form.methodType();
                 String name = form.kind.methodName;
                 switch (form.kind) {
                     case BOUND_REINVOKER: {
        @@ -669,8 +673,10 @@ class InvokerBytecodeGenerator {
             /**
              * Generate customized bytecode for a given LambdaForm.
              */
        -    static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) {
        -        MemberName pregenerated = lookupPregenerated(form);
        +    static MemberName generateCustomizedCode(LambdaForm form) {
        +        final MethodType invokerType = form.methodType();
        +
        +        MemberName pregenerated = lookupPregenerated(form, invokerType);
                 if (pregenerated != null)  return pregenerated; // pre-generated bytecode
         
                 InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("MH", form, invokerType);
        @@ -720,7 +726,7 @@ class InvokerBytecodeGenerator {
                 bogusMethod(lambdaForm);
         
                 final byte[] classFile = toByteArray();
        -        maybeDump(className, classFile);
        +        maybeDump(classFile);
                 return classFile;
             }
         
        @@ -1761,7 +1767,7 @@ class InvokerBytecodeGenerator {
                 bogusMethod(invokerType);
         
                 final byte[] classFile = cw.toByteArray();
        -        maybeDump(className, classFile);
        +        maybeDump(classFile);
                 return classFile;
             }
         
        @@ -1829,7 +1835,7 @@ class InvokerBytecodeGenerator {
                 bogusMethod(dstType);
         
                 final byte[] classFile = cw.toByteArray();
        -        maybeDump(className, classFile);
        +        maybeDump(classFile);
                 return classFile;
             }
         
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        index 2f107facd77..4880a7b58aa 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        @@ -641,7 +641,7 @@ class LambdaForm {
                 for (int i = 0; i < arity; ++i) {
                     ptypes[i] = parameterType(i).btClass;
                 }
        -        return MethodType.methodType(returnType().btClass, ptypes);
        +        return MethodType.makeImpl(returnType().btClass, ptypes, true);
             }
         
             /** Return ABC_Z, where the ABC are parameter type characters, and Z is the return type character. */
        @@ -677,7 +677,7 @@ class LambdaForm {
                 for (int i = 0; i < ptypes.length; i++)
                     ptypes[i] = basicType(sig.charAt(i)).btClass;
                 Class rtype = signatureReturn(sig).btClass;
        -        return MethodType.methodType(rtype, ptypes);
        +        return MethodType.makeImpl(rtype, ptypes, true);
             }
         
             /**
        @@ -847,10 +847,9 @@ class LambdaForm {
                 if (vmentry != null && isCompiled) {
                     return;  // already compiled somehow
                 }
        -        MethodType invokerType = methodType();
        -        assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
        +        assert(vmentry == null || vmentry.getMethodType().basicType().equals(methodType()));
                 try {
        -            vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this, invokerType);
        +            vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this);
                     if (TRACE_INTERPRETER)
                         traceInterpreter("compileToBytecode", this);
                     isCompiled = true;
        @@ -901,10 +900,6 @@ class LambdaForm {
                 }
                 return true;
             }
        -    private static boolean returnTypesMatch(String sig, Object[] av, Object res) {
        -        MethodHandle mh = (MethodHandle) av[0];
        -        return valueMatches(signatureReturn(sig), mh.type().returnType(), res);
        -    }
             private static boolean checkInt(Class type, Object x) {
                 assert(x instanceof Integer);
                 if (type == int.class)  return true;
        @@ -1179,7 +1174,6 @@ class LambdaForm {
                     // If we have a cached invoker, call it right away.
                     // NOTE: The invoker always returns a reference value.
                     if (TRACE_INTERPRETER)  return invokeWithArgumentsTracing(arguments);
        -            assert(checkArgumentTypes(arguments, methodType()));
                     return invoker().invokeBasic(resolvedHandle(), arguments);
                 }
         
        @@ -1197,7 +1191,6 @@ class LambdaForm {
                             traceInterpreter("| resolve", this);
                             resolvedHandle();
                         }
        -                assert(checkArgumentTypes(arguments, methodType()));
                         rval = invoker().invokeBasic(resolvedHandle(), arguments);
                     } catch (Throwable ex) {
                         traceInterpreter("] throw =>", ex);
        @@ -1213,23 +1206,6 @@ class LambdaForm {
                     return invoker = computeInvoker(methodType().form());
                 }
         
        -        private static boolean checkArgumentTypes(Object[] arguments, MethodType methodType) {
        -            if (true)  return true;  // FIXME
        -            MethodType dstType = methodType.form().erasedType();
        -            MethodType srcType = dstType.basicType().wrap();
        -            Class[] ptypes = new Class[arguments.length];
        -            for (int i = 0; i < arguments.length; i++) {
        -                Object arg = arguments[i];
        -                Class ptype = arg == null ? Object.class : arg.getClass();
        -                // If the dest. type is a primitive we keep the
        -                // argument type.
        -                ptypes[i] = dstType.parameterType(i).isPrimitive() ? ptype : Object.class;
        -            }
        -            MethodType argType = MethodType.methodType(srcType.returnType(), ptypes).wrap();
        -            assert(argType.isConvertibleTo(srcType)) : "wrong argument types: cannot convert " + argType + " to " + srcType;
        -            return true;
        -        }
        -
                 MethodType methodType() {
                     if (resolvedHandle != null)
                         return resolvedHandle.type();
        @@ -1725,7 +1701,7 @@ class LambdaForm {
                 boolean isVoid = (type == V_TYPE);
                 Class btClass = type.btClass;
                 MethodType zeType = MethodType.methodType(btClass);
        -        MethodType idType = (isVoid) ? zeType : zeType.appendParameterTypes(btClass);
        +        MethodType idType = (isVoid) ? zeType : MethodType.methodType(btClass, btClass);
         
                 // Look up symbolic names.  It might not be necessary to have these,
                 // but if we need to emit direct references to bytecodes, it helps.
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
        index 97efa4f1066..cfd622a2b91 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
        @@ -149,7 +149,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
                         Object[] typeInfo = (Object[]) type;
                         Class[] ptypes = (Class[]) typeInfo[1];
                         Class rtype = (Class) typeInfo[0];
        -                MethodType res = MethodType.methodType(rtype, ptypes);
        +                MethodType res = MethodType.makeImpl(rtype, ptypes, true);
                         type = res;
                     }
                     // Make sure type is a MethodType for racing threads.
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
        index 7beb35a6600..a12fa138252 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
        @@ -1674,6 +1674,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
         
             // Local constant functions:
         
        +    /* non-public */
             static final byte NF_checkSpreadArgument = 0,
                     NF_guardWithCatch = 1,
                     NF_throwException = 2,
        @@ -1682,7 +1683,6 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
                     NF_profileBoolean = 5,
                     NF_LIMIT = 6;
         
        -    /*non-public*/
             private static final @Stable NamedFunction[] NFS = new NamedFunction[NF_LIMIT];
         
             static NamedFunction getFunction(byte func) {
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java
        index 860ef23f019..df7904de00d 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java
        @@ -95,7 +95,7 @@ class MethodType implements java.io.Serializable {
             private static final long serialVersionUID = 292L;  // {rtype, {ptype...}}
         
             // The rtype and ptypes fields define the structural identity of the method type:
        -    private final Class   rtype;
        +    private final @Stable Class   rtype;
             private final @Stable Class[] ptypes;
         
             // The remaining fields are caches of various sorts:
        @@ -117,7 +117,8 @@ class MethodType implements java.io.Serializable {
         
             /**
              * Construct a temporary unchecked instance of MethodType for use only as a key to the intern table.
        -     * Does not check the given parameters for validity, and must be discarded after it is used as a searching key.
        +     * Does not check the given parameters for validity, and must discarded (if untrusted) or checked
        +     * (if trusted) after it has been used as a searching key.
              * The parameters are reversed for this constructor, so that it is not accidentally used.
              */
             private MethodType(Class[] ptypes, Class rtype) {
        @@ -181,6 +182,7 @@ class MethodType implements java.io.Serializable {
                 checkSlotCount(ptypes.length + slots);
                 return slots;
             }
        +
             static {
                 // MAX_JVM_ARITY must be power of 2 minus 1 for following code trick to work:
                 assert((MAX_JVM_ARITY & (MAX_JVM_ARITY+1)) == 0);
        @@ -303,18 +305,26 @@ class MethodType implements java.io.Serializable {
              */
             /*trusted*/ static
             MethodType makeImpl(Class rtype, Class[] ptypes, boolean trusted) {
        -        MethodType mt = internTable.get(new MethodType(ptypes, rtype));
        -        if (mt != null)
        -            return mt;
                 if (ptypes.length == 0) {
                     ptypes = NO_PTYPES; trusted = true;
                 }
        -        mt = new MethodType(rtype, ptypes, trusted);
        +        MethodType primordialMT = new MethodType(ptypes, rtype);
        +        MethodType mt = internTable.get(primordialMT);
        +        if (mt != null)
        +            return mt;
        +
                 // promote the object to the Real Thing, and reprobe
        +        if (trusted) {
        +            MethodType.checkRtype(rtype);
        +            MethodType.checkPtypes(ptypes);
        +            mt = primordialMT;
        +        } else {
        +            mt = new MethodType(rtype, ptypes, false);
        +        }
                 mt.form = MethodTypeForm.findForm(mt);
                 return internTable.add(mt);
             }
        -    private static final MethodType[] objectOnlyTypes = new MethodType[20];
        +    private static final @Stable MethodType[] objectOnlyTypes = new MethodType[20];
         
             /**
              * Finds or creates a method type whose components are {@code Object} with an optional trailing {@code Object[]} array.
        @@ -398,9 +408,14 @@ class MethodType implements java.io.Serializable {
                 checkSlotCount(parameterSlotCount() + ptypesToInsert.length + ins);
                 int ilen = ptypesToInsert.length;
                 if (ilen == 0)  return this;
        -        Class[] nptypes = Arrays.copyOfRange(ptypes, 0, len+ilen);
        -        System.arraycopy(nptypes, num, nptypes, num+ilen, len-num);
        +        Class[] nptypes = new Class[len + ilen];
        +        if (num > 0) {
        +            System.arraycopy(ptypes, 0, nptypes, 0, num);
        +        }
                 System.arraycopy(ptypesToInsert, 0, nptypes, num, ilen);
        +        if (num < len) {
        +            System.arraycopy(ptypes, num, nptypes, num+ilen, len-num);
        +        }
                 return makeImpl(rtype, nptypes, true);
             }
         
        @@ -636,11 +651,14 @@ class MethodType implements java.io.Serializable {
                 return form.basicType();
             }
         
        +    private static final @Stable Class[] METHOD_HANDLE_ARRAY
        +            = new Class[] { MethodHandle.class };
        +
             /**
              * @return a version of the original type with MethodHandle prepended as the first argument
              */
             /*non-public*/ MethodType invokerType() {
        -        return insertParameterTypes(0, MethodHandle.class);
        +        return insertParameterTypes(0, METHOD_HANDLE_ARRAY);
             }
         
             /**
        diff --git a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java
        index c3633ff8aab..a4d2f80adc7 100644
        --- a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java
        +++ b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java
        @@ -297,10 +297,13 @@ public class VerifyAccess {
              * @param refc the class attempting to make the reference
              */
             public static boolean isTypeVisible(java.lang.invoke.MethodType type, Class refc) {
        -        for (int n = -1, max = type.parameterCount(); n < max; n++) {
        -            Class ptype = (n < 0 ? type.returnType() : type.parameterType(n));
        -            if (!isTypeVisible(ptype, refc))
        +        if (!isTypeVisible(type.returnType(), refc)) {
        +            return false;
        +        }
        +        for (int n = 0, max = type.parameterCount(); n < max; n++) {
        +            if (!isTypeVisible(type.parameterType(n), refc)) {
                         return false;
        +            }
                 }
                 return true;
             }
        diff --git a/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java b/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
        index d0e4df33d77..9f1f31218b4 100644
        --- a/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
        +++ b/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java
        @@ -518,12 +518,6 @@ public enum Wrapper {
              * If the target type is a primitive, change it to a wrapper.
              */
             static  Class forceType(Class type, Class exampleType) {
        -        boolean z = (type == exampleType ||
        -               type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
        -               exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
        -               type == Object.class && !exampleType.isPrimitive());
        -        if (!z)
        -            System.out.println(type+" <= "+exampleType);
                 assert(type == exampleType ||
                        type.isPrimitive() && forPrimitiveType(type) == findWrapperType(exampleType) ||
                        exampleType.isPrimitive() && forPrimitiveType(exampleType) == findWrapperType(type) ||
        
        From 3b47209a32b54c6c368dc8a4bc565e103e907764 Mon Sep 17 00:00:00 2001
        From: Claes Redestad 
        Date: Tue, 11 Apr 2017 22:32:49 +0200
        Subject: [PATCH 53/75] 8178480: Wrong exception being thrown on an invalid
         MethodType
        
        Reviewed-by: psandoz
        ---
         .../java/lang/invoke/InvokerBytecodeGenerator.java       | 4 +---
         .../share/classes/java/lang/invoke/LambdaForm.java       | 9 +++++++--
         2 files changed, 8 insertions(+), 5 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        index 9c05acb791a..7349ea2bec4 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
        @@ -673,9 +673,7 @@ class InvokerBytecodeGenerator {
             /**
              * Generate customized bytecode for a given LambdaForm.
              */
        -    static MemberName generateCustomizedCode(LambdaForm form) {
        -        final MethodType invokerType = form.methodType();
        -
        +    static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) {
                 MemberName pregenerated = lookupPregenerated(form, invokerType);
                 if (pregenerated != null)  return pregenerated; // pre-generated bytecode
         
        diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        index 4880a7b58aa..bde94381ddc 100644
        --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
        @@ -847,9 +847,14 @@ class LambdaForm {
                 if (vmentry != null && isCompiled) {
                     return;  // already compiled somehow
                 }
        -        assert(vmentry == null || vmentry.getMethodType().basicType().equals(methodType()));
        +
        +        // Obtain the invoker MethodType outside of the following try block.
        +        // This ensures that an IllegalArgumentException is directly thrown if the
        +        // type would have 256 or more parameters
        +        MethodType invokerType = methodType();
        +        assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
                 try {
        -            vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this);
        +            vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this, invokerType);
                     if (TRACE_INTERPRETER)
                         traceInterpreter("compileToBytecode", this);
                     isCompiled = true;
        
        From 66c8241a1e2b31a01ebd7ce0ac1f2c613ed9de00 Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 11 Apr 2017 13:55:51 -0700
        Subject: [PATCH 54/75] 8178340: remove unneeded "throws" from
         ProcessTools::createJavaProcessBuilder
        
        Reviewed-by: dholmes
        ---
         test/lib/jdk/test/lib/process/ProcessTools.java | 4 ++--
         1 file changed, 2 insertions(+), 2 deletions(-)
        
        diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java
        index 3f4bbb7fa79..30fa60faca2 100644
        --- a/test/lib/jdk/test/lib/process/ProcessTools.java
        +++ b/test/lib/jdk/test/lib/process/ProcessTools.java
        @@ -335,7 +335,7 @@ public final class ProcessTools {
              * Create ProcessBuilder using the java launcher from the jdk to be tested and
              * with any platform specific arguments prepended
              */
        -    public static ProcessBuilder createJavaProcessBuilder(String... command) throws Exception {
        +    public static ProcessBuilder createJavaProcessBuilder(String... command) {
                 return createJavaProcessBuilder(false, command);
             }
         
        @@ -348,7 +348,7 @@ public final class ProcessTools {
              * @param command Arguments to pass to the java command.
              * @return The ProcessBuilder instance representing the java command.
              */
        -    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
        +    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
                 String javapath = JDKToolFinder.getJDKTool("java");
         
                 ArrayList args = new ArrayList<>();
        
        From 58e01d64a12fc189e4974da16fd4e9b6a35c3aae Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 11 Apr 2017 13:55:52 -0700
        Subject: [PATCH 55/75] 8178340: remove unneeded "throws" from
         ProcessTools::createJavaProcessBuilder
        
        Reviewed-by: dholmes
        ---
         .../javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java    | 5 ++---
         1 file changed, 2 insertions(+), 3 deletions(-)
        
        diff --git a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java
        index 35cffc1c994..3c7a45ba748 100644
        --- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java
        +++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java
        @@ -283,8 +283,7 @@ public final class ProcessTools {
              * @param command Arguments to pass to the java command.
              * @return The ProcessBuilder instance representing the java command.
              */
        -    public static ProcessBuilder createJavaProcessBuilder(String... command)
        -            throws Exception {
        +    public static ProcessBuilder createJavaProcessBuilder(String... command) {
                 return createJavaProcessBuilder(false, command);
             }
         
        @@ -297,7 +296,7 @@ public final class ProcessTools {
              * @param command Arguments to pass to the java command.
              * @return The ProcessBuilder instance representing the java command.
              */
        -    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
        +    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
                 String javapath = JDKToolFinder.getJDKTool("java");
         
                 ArrayList args = new ArrayList<>();
        
        From a167d496f1e698a48bb093cff9b63fab08b1b76b Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 11 Apr 2017 13:55:53 -0700
        Subject: [PATCH 56/75] 8178340: remove unneeded "throws" from
         ProcessTools::createJavaProcessBuilder
        
        Reviewed-by: dholmes
        ---
         jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java | 5 ++---
         1 file changed, 2 insertions(+), 3 deletions(-)
        
        diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
        index 224ab0e067d..8246c8fd707 100644
        --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
        +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
        @@ -283,8 +283,7 @@ public final class ProcessTools {
              * @param command Arguments to pass to the java command.
              * @return The ProcessBuilder instance representing the java command.
              */
        -    public static ProcessBuilder createJavaProcessBuilder(String... command)
        -            throws Exception {
        +    public static ProcessBuilder createJavaProcessBuilder(String... command) {
                 return createJavaProcessBuilder(false, command);
             }
         
        @@ -297,7 +296,7 @@ public final class ProcessTools {
              * @param command Arguments to pass to the java command.
              * @return The ProcessBuilder instance representing the java command.
              */
        -    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
        +    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
                 String javapath = JDKToolFinder.getJDKTool("java");
         
                 ArrayList args = new ArrayList<>();
        
        From 05d6891929153c34d101c05a7e04185ebbd05849 Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 11 Apr 2017 21:59:23 -0700
        Subject: [PATCH 57/75] 8178415: remove ProcessTools::getPlatformSpecificVMArgs
         from testlibary
        
        Reviewed-by: dholmes
        ---
         test/lib/jdk/test/lib/JDKToolLauncher.java      |  3 ---
         test/lib/jdk/test/lib/process/ProcessTools.java | 16 ----------------
         2 files changed, 19 deletions(-)
        
        diff --git a/test/lib/jdk/test/lib/JDKToolLauncher.java b/test/lib/jdk/test/lib/JDKToolLauncher.java
        index 38e7b4530bf..6c264700215 100644
        --- a/test/lib/jdk/test/lib/JDKToolLauncher.java
        +++ b/test/lib/jdk/test/lib/JDKToolLauncher.java
        @@ -24,9 +24,7 @@
         package jdk.test.lib;
         
         import java.util.ArrayList;
        -import java.util.Arrays;
         import java.util.List;
        -import jdk.test.lib.process.ProcessTools;
         
         /**
          * A utility for constructing command lines for starting JDK tool processes.
        @@ -59,7 +57,6 @@ public class JDKToolLauncher {
                 } else {
                     executable = JDKToolFinder.getTestJDKTool(tool);
                 }
        -        vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
             }
         
             /**
        diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java
        index 30fa60faca2..365ef26c91d 100644
        --- a/test/lib/jdk/test/lib/process/ProcessTools.java
        +++ b/test/lib/jdk/test/lib/process/ProcessTools.java
        @@ -45,7 +45,6 @@ import java.util.function.Consumer;
         import java.util.stream.Collectors;
         
         import jdk.test.lib.JDKToolFinder;
        -import jdk.test.lib.Platform;
         import jdk.test.lib.Utils;
         
         public final class ProcessTools {
        @@ -315,20 +314,6 @@ public final class ProcessTools {
                 return args.toArray(new String[args.size()]);
             }
         
        -    /**
        -     * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
        -     *
        -     * @return String[] with platform specific arguments, empty if there are
        -     *         none
        -     */
        -    public static String[] getPlatformSpecificVMArgs() {
        -
        -    if (Platform.is64bit() && Platform.isSolaris()) {
        -            return new String[] { "-d64" };
        -        }
        -
        -        return new String[] {};
        -    }
         
         
             /**
        @@ -353,7 +338,6 @@ public final class ProcessTools {
         
                 ArrayList args = new ArrayList<>();
                 args.add(javapath);
        -        Collections.addAll(args, getPlatformSpecificVMArgs());
         
                 args.add("-cp");
                 args.add(System.getProperty("java.class.path"));
        
        From 167e2b089f6d4cba006f3d93ee36bbdf26f81c81 Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 11 Apr 2017 21:59:24 -0700
        Subject: [PATCH 58/75] 8178415: remove ProcessTools::getPlatformSpecificVMArgs
         from testlibary
        
        Reviewed-by: dholmes
        ---
         .../libs/jdk/testlibrary/JDKToolLauncher.java  |  2 --
         .../libs/jdk/testlibrary/ProcessTools.java     | 18 ------------------
         2 files changed, 20 deletions(-)
        
        diff --git a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java
        index 777e8cf5336..a535e631bce 100644
        --- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java
        +++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/JDKToolLauncher.java
        @@ -24,7 +24,6 @@
         package jdk.testlibrary;
         
         import java.util.ArrayList;
        -import java.util.Arrays;
         import java.util.List;
         
         /**
        @@ -60,7 +59,6 @@ public class JDKToolLauncher {
                 } else {
                     executable = JDKToolFinder.getTestJDKTool(tool);
                 }
        -        vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
             }
         
             /**
        diff --git a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java
        index 3c7a45ba748..bc5cb740207 100644
        --- a/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java
        +++ b/jaxp/test/javax/xml/jaxp/libs/jdk/testlibrary/ProcessTools.java
        @@ -259,23 +259,6 @@ public final class ProcessTools {
                 return ProcessHandle.current().getPid();
             }
         
        -    /**
        -     * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
        -     *
        -     * @return String[] with platform specific arguments, empty if there are
        -     *         none
        -     */
        -    public static String[] getPlatformSpecificVMArgs() {
        -        String osName = System.getProperty("os.name");
        -        String dataModel = System.getProperty("sun.arch.data.model");
        -
        -        if (osName.equals("SunOS") && dataModel.equals("64")) {
        -            return new String[] { "-d64" };
        -        }
        -
        -        return new String[] {};
        -    }
        -
             /**
              * Create ProcessBuilder using the java launcher from the jdk to be tested,
              * and with any platform specific arguments prepended.
        @@ -301,7 +284,6 @@ public final class ProcessTools {
         
                 ArrayList args = new ArrayList<>();
                 args.add(javapath);
        -        Collections.addAll(args, getPlatformSpecificVMArgs());
         
                 if (addTestVmAndJavaOptions) {
                     // -cp is needed to make sure the same classpath is used whether the test is
        
        From a9374cc0bcf024330afeb84517a1d3191eb1be5a Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Tue, 11 Apr 2017 21:59:26 -0700
        Subject: [PATCH 59/75] 8178415: remove ProcessTools::getPlatformSpecificVMArgs
         from testlibary
        
        Reviewed-by: dholmes
        ---
         .../jdk/testlibrary/JDKToolLauncher.java       |  2 --
         .../jdk/testlibrary/ProcessTools.java          | 18 ------------------
         2 files changed, 20 deletions(-)
        
        diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java
        index cd3b7cea022..c19cb5df63a 100644
        --- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java
        +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java
        @@ -24,7 +24,6 @@
         package jdk.testlibrary;
         
         import java.util.ArrayList;
        -import java.util.Arrays;
         import java.util.List;
         
         /**
        @@ -60,7 +59,6 @@ public class JDKToolLauncher {
                 } else {
                     executable = JDKToolFinder.getTestJDKTool(tool);
                 }
        -        vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
             }
         
             /**
        diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
        index 8246c8fd707..cc3a93ffcab 100644
        --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
        +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java
        @@ -259,23 +259,6 @@ public final class ProcessTools {
                 return ProcessHandle.current().getPid();
             }
         
        -    /**
        -     * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
        -     *
        -     * @return String[] with platform specific arguments, empty if there are
        -     *         none
        -     */
        -    public static String[] getPlatformSpecificVMArgs() {
        -        String osName = System.getProperty("os.name");
        -        String dataModel = System.getProperty("sun.arch.data.model");
        -
        -        if (osName.equals("SunOS") && dataModel.equals("64")) {
        -            return new String[] { "-d64" };
        -        }
        -
        -        return new String[] {};
        -    }
        -
             /**
              * Create ProcessBuilder using the java launcher from the jdk to be tested,
              * and with any platform specific arguments prepended.
        @@ -301,7 +284,6 @@ public final class ProcessTools {
         
                 ArrayList args = new ArrayList<>();
                 args.add(javapath);
        -        Collections.addAll(args, getPlatformSpecificVMArgs());
         
                 if (addTestVmAndJavaOptions) {
                     // -cp is needed to make sure the same classpath is used whether the test is
        
        From 298bfc1057aedc9d9309f58d70aac67c920bbdff Mon Sep 17 00:00:00 2001
        From: Weijun Wang 
        Date: Thu, 13 Apr 2017 08:15:19 +0800
        Subject: [PATCH 60/75] 8172422: jarsigner needs to understand -?
        
        Reviewed-by: mullan
        ---
         .../share/classes/sun/security/tools/keytool/Main.java        | 4 +++-
         .../share/classes/sun/security/tools/jarsigner/Main.java      | 1 +
         2 files changed, 4 insertions(+), 1 deletion(-)
        
        diff --git a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java
        index 53ea9706207..6208565c74b 100644
        --- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java
        +++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java
        @@ -485,7 +485,9 @@ public final class Main {
         
                     if (c != null) {
                         command = c;
        -            } else if (collator.compare(flags, "-help") == 0) {
        +            } else if (collator.compare(flags, "-help") == 0 ||
        +                    collator.compare(flags, "-h") == 0 ||
        +                    collator.compare(flags, "-?") == 0) {
                         help = true;
                     } else if (collator.compare(flags, "-conf") == 0) {
                         i++;
        diff --git a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
        index a42dfe21882..cb86682f7da 100644
        --- a/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
        +++ b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
        @@ -444,6 +444,7 @@ public class Main {
                     } else if (collator.compare(flags, "-strict") ==0) {
                         strict = true;
                     } else if (collator.compare(flags, "-h") == 0 ||
        +                        collator.compare(flags, "-?") == 0 ||
                                 collator.compare(flags, "-help") == 0) {
                         fullusage();
                     } else {
        
        From 363e8e03cd0333d4205ecf90d72f100251b1e2ce Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Wed, 12 Apr 2017 19:28:01 -0700
        Subject: [PATCH 61/75] 8164944: Refactor ProcessTools to get rid of dependency
         on java.management
        
        Reviewed-by: kvn, gtriantafill, dfazunen, dholmes
        ---
         .../test/lib/cli/CommandLineOptionTest.java   |  5 +-
         .../test/lib/management/InputArguments.java   | 41 +++++++++++++
         .../jdk/test/lib/process/ProcessTools.java    | 59 ++++---------------
         3 files changed, 57 insertions(+), 48 deletions(-)
         create mode 100644 test/lib/jdk/test/lib/management/InputArguments.java
        
        diff --git a/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java
        index 8c574875f8a..71369150b1c 100644
        --- a/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java
        +++ b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -28,6 +28,7 @@ import java.util.ArrayList;
         import java.util.Collections;
         import java.util.function.BooleanSupplier;
         
        +import jdk.test.lib.management.InputArguments;
         import jdk.test.lib.process.ExitCode;
         import jdk.test.lib.process.ProcessTools;
         import jdk.test.lib.process.OutputAnalyzer;
        @@ -105,7 +106,7 @@ public abstract class CommandLineOptionTest {
                             throws Throwable {
                 List finalOptions = new ArrayList<>();
                 if (addTestVMOptions) {
        -            Collections.addAll(finalOptions, ProcessTools.getVmInputArgs());
        +            Collections.addAll(finalOptions, InputArguments.getVmInputArgs());
                     Collections.addAll(finalOptions, Utils.getTestJavaOpts());
                 }
                 Collections.addAll(finalOptions, options);
        diff --git a/test/lib/jdk/test/lib/management/InputArguments.java b/test/lib/jdk/test/lib/management/InputArguments.java
        new file mode 100644
        index 00000000000..dca3a023cf2
        --- /dev/null
        +++ b/test/lib/jdk/test/lib/management/InputArguments.java
        @@ -0,0 +1,41 @@
        +/*
        + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +package jdk.test.lib.management;
        +
        +import java.lang.management.ManagementFactory;
        +import java.lang.management.RuntimeMXBean;
        +import java.util.List;
        +
        +public class InputArguments {
        +    /**
        +     * Gets the array of strings containing input arguments passed to the VM
        +     *
        +     * @return arguments
        +     */
        +    public static String[] getVmInputArgs() {
        +        RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
        +        List args = runtime.getInputArguments();
        +        return args.toArray(new String[args.size()]);
        +    }
        +}
        diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java
        index 365ef26c91d..f2ec073ec6f 100644
        --- a/test/lib/jdk/test/lib/process/ProcessTools.java
        +++ b/test/lib/jdk/test/lib/process/ProcessTools.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -28,13 +28,10 @@ import java.io.IOException;
         import java.io.InputStream;
         import java.io.OutputStream;
         import java.io.PrintStream;
        -import java.lang.management.ManagementFactory;
        -import java.lang.management.RuntimeMXBean;
         import java.util.ArrayList;
         import java.util.Arrays;
         import java.util.Collections;
         import java.util.concurrent.CountDownLatch;
        -import java.util.List;
         import java.util.Map;
         import java.util.concurrent.ExecutionException;
         import java.util.concurrent.Future;
        @@ -65,23 +62,23 @@ public final class ProcessTools {
             }
         
             /**
        -    * Pumps stdout and stderr from running the process into a String.
        -    *
        -    * @param processHandler ProcessHandler to run.
        -    * @return Output from process.
        -    * @throws IOException If an I/O error occurs.
        -    */
        +     * Pumps stdout and stderr from running the process into a String.
        +     *
        +     * @param processHandler ProcessHandler to run.
        +     * @return Output from process.
        +     * @throws IOException If an I/O error occurs.
        +     */
             public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException {
                 return getOutput(processBuilder.start());
             }
         
             /**
        -    * Pumps stdout and stderr the running process into a String.
        -    *
        -    * @param process Process to pump.
        -    * @return Output from process.
        -    * @throws IOException If an I/O error occurs.
        -    */
        +     * Pumps stdout and stderr the running process into a String.
        +     *
        +     * @param process Process to pump.
        +     * @return Output from process.
        +     * @throws IOException If an I/O error occurs.
        +     */
             public static OutputBuffer getOutput(Process process) throws IOException {
                 ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
                 ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
        @@ -303,16 +300,6 @@ public final class ProcessTools {
             public static long getProcessId() throws Exception {
                 return ProcessHandle.current().getPid();
             }
        -    /**
        -     * Gets the array of strings containing input arguments passed to the VM
        -     *
        -     * @return arguments
        -     */
        -    public static String[] getVmInputArgs() {
        -        RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
        -        List args = runtime.getInputArguments();
        -        return args.toArray(new String[args.size()]);
        -    }
         
         
         
        @@ -368,26 +355,6 @@ public final class ProcessTools {
                 }
             }
         
        -    /**
        -     * Executes a test jvm process, waits for it to finish and returns the process output.
        -     * The default jvm options from the test's run command, jtreg, test.vm.opts and test.java.opts, are added.
        -     * The java from the test.jdk is used to execute the command.
        -     *
        -     * The command line will be like:
        -     * {test.jdk}/bin/java {test.fromRun.opts} {test.vm.opts} {test.java.opts} cmds
        -     *
        -     * @param cmds User specifed arguments.
        -     * @return The output from the process.
        -     */
        -    public static OutputAnalyzer executeTestJvmAllArgs(String... cmds) throws Throwable {
        -        List argsList = new ArrayList<>();
        -        String[] testArgs = getVmInputArgs();
        -        Collections.addAll(argsList, testArgs);
        -        Collections.addAll(argsList, Utils.addTestJavaOpts(cmds));
        -        ProcessBuilder pb = createJavaProcessBuilder(argsList.toArray(new String[argsList.size()]));
        -        return executeProcess(pb);
        -    }
        -
             /**
              * Executes a test jvm process, waits for it to finish and returns the process output.
              * The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
        
        From 48440aaf232b54a21def41b4b5ee83554d7a57a3 Mon Sep 17 00:00:00 2001
        From: Igor Ignatyev 
        Date: Wed, 12 Apr 2017 19:28:47 -0700
        Subject: [PATCH 62/75] 8164944: Refactor ProcessTools to get rid of dependency
         on java.management
        
        Reviewed-by: kvn, gtriantafill, dfazunen, dholmes
        ---
         .../compiler/c2/cr7200264/TestDriver.java     |  5 ++---
         .../share/scenario/Executor.java              | 14 +++++++++----
         .../jvmci/compilerToVM/DebugOutputTest.java   | 21 +++++++++++++------
         3 files changed, 27 insertions(+), 13 deletions(-)
        
        diff --git a/hotspot/test/compiler/c2/cr7200264/TestDriver.java b/hotspot/test/compiler/c2/cr7200264/TestDriver.java
        index 558592ba693..bc8a987ffb2 100644
        --- a/hotspot/test/compiler/c2/cr7200264/TestDriver.java
        +++ b/hotspot/test/compiler/c2/cr7200264/TestDriver.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -26,7 +26,6 @@ package compiler.c2.cr7200264;
         import java.util.HashMap;
         import java.util.List;
         import java.util.Map;
        -import java.util.regex.Pattern;
         
         import jdk.test.lib.Asserts;
         import jdk.test.lib.process.OutputAnalyzer;
        @@ -45,7 +44,7 @@ public class TestDriver {
             }
         
             private List executeApplication() throws Throwable {
        -        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvmAllArgs(
        +        OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
                     "-Xbatch",
                     "-XX:-TieredCompilation",
                     "-XX:+PrintCompilation",
        diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java b/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java
        index fbd3f13259b..19ebd612e7c 100644
        --- a/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java
        +++ b/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -25,6 +25,7 @@ package compiler.compilercontrol.share.scenario;
         
         import compiler.compilercontrol.share.actions.BaseAction;
         import jdk.test.lib.Asserts;
        +import jdk.test.lib.management.InputArguments;
         import jdk.test.lib.process.OutputAnalyzer;
         import jdk.test.lib.process.ProcessTools;
         import jdk.test.lib.dcmd.CommandExecutor;
        @@ -38,6 +39,7 @@ import java.lang.reflect.Executable;
         import java.net.ServerSocket;
         import java.net.Socket;
         import java.util.ArrayList;
        +import java.util.Arrays;
         import java.util.Collections;
         import java.util.List;
         import java.util.Map;
        @@ -97,9 +99,13 @@ public class Executor {
                         // Start separate thread to connect with test VM
                         new Thread(() -> connectTestVM(serverSocket)).start();
                     }
        -            // Start test VM
        -            output = ProcessTools.executeTestJvmAllArgs(
        -                    vmOptions.toArray(new String[vmOptions.size()]));
        +            // Start a test VM using vm flags from @run and from vm options
        +            String[] vmInputArgs = InputArguments.getVmInputArgs();
        +            String[] cmds = Arrays.copyOf(vmInputArgs,
        +                    vmInputArgs.length + vmOptions.size());
        +            System.arraycopy(vmOptions.toArray(), 0, cmds, vmInputArgs.length,
        +                    vmOptions.size());
        +            output = ProcessTools.executeTestJvm(cmds);
                 } catch (Throwable thr) {
                     throw new Error("Execution failed: " + thr.getMessage(), thr);
                 }
        diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
        index a66a448b5b1..f07c570fa16 100644
        --- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
        +++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -30,11 +30,9 @@
          * @modules java.base/jdk.internal.misc
          * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
          * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
        - * @run main/othervm compiler.jvmci.compilerToVM.DebugOutputTest
        + * @run driver compiler.jvmci.compilerToVM.DebugOutputTest
          */
         
        - // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' should be replaced w/ '@run driver'
        -
         package compiler.jvmci.compilerToVM;
         
         import jdk.test.lib.process.OutputAnalyzer;
        @@ -42,8 +40,11 @@ import jdk.test.lib.process.ProcessTools;
         import jdk.vm.ci.hotspot.CompilerToVMHelper;
         
         import java.util.Arrays;
        +import java.nio.file.Path;
        +import java.nio.file.Paths;
         
         public class DebugOutputTest {
        +    private static final String VM_CI_MODULE = "jdk.internal.vm.ci";
             public static void main(String[] args) {
                 new DebugOutputTest().test();
             }
        @@ -53,10 +54,18 @@ public class DebugOutputTest {
                     System.out.println(testCase);
                     OutputAnalyzer oa;
                     try {
        -                oa = ProcessTools.executeTestJvmAllArgs(
        +                Path patch = Paths.get(System.getProperty("test.patch.path"));
        +                Path jvmciPath = patch.resolve(VM_CI_MODULE).toAbsolutePath();
        +                if (!jvmciPath.toFile().exists()) {
        +                    throw new Error("TESTBUG: patch for " + VM_CI_MODULE + " : "
        +                            + jvmciPath.toString() + " does not exist");
        +                }
        +                oa = ProcessTools.executeTestJvm(
                                 "-XX:+UnlockExperimentalVMOptions",
                                 "-XX:+EnableJVMCI",
        -                        "-Xbootclasspath/a:.",
        +                        "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
        +                        "--add-exports", "jdk.internal.vm.ci/jdk.vm.ci.hotspot=ALL-UNNAMED",
        +                        "--patch-module", VM_CI_MODULE + "=" + jvmciPath.toString(),
                                 DebugOutputTest.Worker.class.getName(),
                                 testCase.name());
                        } catch (Throwable e) {
        
        From a09496cc0cefb78b2f0c5cee790597a42b19ba77 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:11 +0000
        Subject: [PATCH 63/75] Added tag jdk-9+165 for changeset 7197d737baa8
        
        ---
         .hgtags-top-repo | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/.hgtags-top-repo b/.hgtags-top-repo
        index 2ceddccce3a..5b8767812e2 100644
        --- a/.hgtags-top-repo
        +++ b/.hgtags-top-repo
        @@ -407,3 +407,4 @@ cda60babd152d889aba4d8f20a8f643ab151d3de jdk-9+161
         21b063d75b3edbffb9bebc8872d990920c4ae1e5 jdk-9+162
         c38c6b270ccc8e2b86d1631bcf42248241b54d2c jdk-9+163
         7810f75d016a52e32295c4233009de5ca90e31af jdk-9+164
        +aff4f339acd40942d3dab499846b52acd87b3af1 jdk-9+165
        
        From 4011fea8d2d4739d22d124601941668eea79d509 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:11 +0000
        Subject: [PATCH 64/75] Added tag jdk-9+165 for changeset 944ceffabd2f
        
        ---
         corba/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/corba/.hgtags b/corba/.hgtags
        index c7d4d1bca92..232769ce993 100644
        --- a/corba/.hgtags
        +++ b/corba/.hgtags
        @@ -407,3 +407,4 @@ c7688f2fa07936b089ca0e9a0a0eff68ff37a542 jdk-9+160
         18ffcf99a3b4a10457853d94190e825bdf07e39b jdk-9+162
         493011dee80e51c2a2b064d049183c047df36d80 jdk-9+163
         965bbae3072702f7c0d95c240523b65e6bb19261 jdk-9+164
        +a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
        
        From 364be0f74242f39069f0f3dad3713b7ae779d5f0 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:12 +0000
        Subject: [PATCH 65/75] Added tag jdk-9+165 for changeset 731e3ea86eb2
        
        ---
         hotspot/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/hotspot/.hgtags b/hotspot/.hgtags
        index 2429aab5a6d..6207adc5e99 100644
        --- a/hotspot/.hgtags
        +++ b/hotspot/.hgtags
        @@ -567,3 +567,4 @@ b2d0a906afd73dcf27f572217eb1be0f196ec16c jdk-9+157
         b01c519b715ef6f785d0631adee0a6537cf6c12e jdk-9+162
         983fe207555724d98f4876991e1cbafbcf2733e8 jdk-9+163
         0af429be8bbaeaaf0cb838e9af28c953dda6a9c8 jdk-9+164
        +c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
        
        From 3fe34a4d98289db836a7832db49e6af9ce078ad4 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:13 +0000
        Subject: [PATCH 66/75] Added tag jdk-9+165 for changeset 803449de2403
        
        ---
         jaxws/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/jaxws/.hgtags b/jaxws/.hgtags
        index c94b3ee8c8c..b2b70eef8a4 100644
        --- a/jaxws/.hgtags
        +++ b/jaxws/.hgtags
        @@ -410,3 +410,4 @@ e53b322357382209fb553b9a1541ccfd12cbcb6c jdk-9+158
         b8aebe5292f23689f97cb8e66a9f327834dd43e6 jdk-9+162
         3890f96e8995be8c84f330d1f65269b03ac36b24 jdk-9+163
         1a52de2da827459e866fd736f9e9c62eb2ecd6bb jdk-9+164
        +a987401bac0d528475e57732c9d5d93f4405804c jdk-9+165
        
        From 4153d0c1a70dd113e6db4fbec1dff6ed75205137 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:13 +0000
        Subject: [PATCH 67/75] Added tag jdk-9+165 for changeset 1a28bb4f21ce
        
        ---
         jdk/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/jdk/.hgtags b/jdk/.hgtags
        index a0eb89d18be..97cfd83618d 100644
        --- a/jdk/.hgtags
        +++ b/jdk/.hgtags
        @@ -407,3 +407,4 @@ cac788454598b95d8b0153c021a7fae3cd7e6fda jdk-9+160
         f6bf027e88e9a4dd19f721001a7af00157af42c4 jdk-9+162
         50171f8c47961710cbf87aead6f03fa431d8d240 jdk-9+163
         6dea581453d7c0e767e3169cfec8b423a381e71d jdk-9+164
        +a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165
        
        From 8aabd7d262dcb13a542611d71b49a876a8939e10 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:13 +0000
        Subject: [PATCH 68/75] Added tag jdk-9+165 for changeset 2ee2259a06e2
        
        ---
         jaxp/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/jaxp/.hgtags b/jaxp/.hgtags
        index 26d248e74a5..1d14662313d 100644
        --- a/jaxp/.hgtags
        +++ b/jaxp/.hgtags
        @@ -407,3 +407,4 @@ fb8f2c8e15295120ff0f281dc057cfffb309e90e jdk-9+160
         d02b6fbcab06c59a5f5a4a6736bd4ec6d2567855 jdk-9+162
         92a38c75cd277d8b11f4382511a62087044659a1 jdk-9+163
         6dc790a4e8310c86712cfdf7561a9820818546e6 jdk-9+164
        +55419603989707ec50c84bb379bbdc1adeec3ab2 jdk-9+165
        
        From b0a3ecb73ab811a59024c07f1ee1cbaeab613f79 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:14 +0000
        Subject: [PATCH 69/75] Added tag jdk-9+165 for changeset 9e18c9ce29e7
        
        ---
         langtools/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/langtools/.hgtags b/langtools/.hgtags
        index aa208afd528..6aacb84243a 100644
        --- a/langtools/.hgtags
        +++ b/langtools/.hgtags
        @@ -407,3 +407,4 @@ dfcfdb2db85f1bb434209f56ca557ea6f9830aa8 jdk-9+155
         440c45c2e8cee78f6883fa6f2505a781505f323c jdk-9+162
         24582dd2649a155876de89273975ebe1adb5f18c jdk-9+163
         c7f3df19667b093538c6eecb73dcb3fb531706b4 jdk-9+164
        +98108b7d4cb6078773e2d27ad8471dc25d4d6124 jdk-9+165
        
        From 7415535c2e86c32a8a88bf9bc61d6b0a4d0ef4b9 Mon Sep 17 00:00:00 2001
        From: Lana Steuck 
        Date: Thu, 13 Apr 2017 16:01:15 +0000
        Subject: [PATCH 70/75] Added tag jdk-9+165 for changeset c792851e0f57
        
        ---
         nashorn/.hgtags | 1 +
         1 file changed, 1 insertion(+)
        
        diff --git a/nashorn/.hgtags b/nashorn/.hgtags
        index 52a00dd571a..5aaedad0e5d 100644
        --- a/nashorn/.hgtags
        +++ b/nashorn/.hgtags
        @@ -398,3 +398,4 @@ d6ef419af865dccf1e5be8047b0aba09286ffa93 jdk-9+161
         2cd29b339692524de64d049b329873facaff9727 jdk-9+162
         5e5e436543daea0c174d878d5e3ff8dd791e538a jdk-9+163
         b473fab09baab51a06ffba02eb06c7f5ee8578f7 jdk-9+164
        +e36e62d3ea53c316f295b37bcc19867fbf510235 jdk-9+165
        
        From dccdbdd2d23bcb2bcee04a5dc606c23f4a976343 Mon Sep 17 00:00:00 2001
        From: Claes Redestad 
        Date: Tue, 18 Apr 2017 18:25:09 +0200
        Subject: [PATCH 71/75] 8178889: Move creation of AbstractChronology
         comparators to call sites
        
        Reviewed-by: rriggs
        ---
         .../java/time/chrono/AbstractChronology.java  | 30 -------------------
         .../java/time/chrono/ChronoLocalDate.java     |  5 +++-
         .../java/time/chrono/ChronoLocalDateTime.java |  9 +++++-
         .../java/time/chrono/ChronoZonedDateTime.java |  9 +++++-
         4 files changed, 20 insertions(+), 33 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/time/chrono/AbstractChronology.java b/jdk/src/java.base/share/classes/java/time/chrono/AbstractChronology.java
        index c2e91d7f5f8..a32ecb78da1 100644
        --- a/jdk/src/java.base/share/classes/java/time/chrono/AbstractChronology.java
        +++ b/jdk/src/java.base/share/classes/java/time/chrono/AbstractChronology.java
        @@ -126,36 +126,6 @@ import sun.util.logging.PlatformLogger;
          */
         public abstract class AbstractChronology implements Chronology {
         
        -    /**
        -     * ChronoLocalDate order constant.
        -     */
        -    static final Comparator DATE_ORDER =
        -        (Comparator & Serializable) (date1, date2) -> {
        -            return Long.compare(date1.toEpochDay(), date2.toEpochDay());
        -        };
        -    /**
        -     * ChronoLocalDateTime order constant.
        -     */
        -    static final Comparator> DATE_TIME_ORDER =
        -        (Comparator> & Serializable) (dateTime1, dateTime2) -> {
        -            int cmp = Long.compare(dateTime1.toLocalDate().toEpochDay(), dateTime2.toLocalDate().toEpochDay());
        -            if (cmp == 0) {
        -                cmp = Long.compare(dateTime1.toLocalTime().toNanoOfDay(), dateTime2.toLocalTime().toNanoOfDay());
        -            }
        -            return cmp;
        -        };
        -    /**
        -     * ChronoZonedDateTime order constant.
        -     */
        -    static final Comparator> INSTANT_ORDER =
        -            (Comparator> & Serializable) (dateTime1, dateTime2) -> {
        -                int cmp = Long.compare(dateTime1.toEpochSecond(), dateTime2.toEpochSecond());
        -                if (cmp == 0) {
        -                    cmp = Long.compare(dateTime1.toLocalTime().getNano(), dateTime2.toLocalTime().getNano());
        -                }
        -                return cmp;
        -            };
        -
             /**
              * Map of available calendars by ID.
              */
        diff --git a/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java b/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java
        index 03a7a48d209..fb6938664ec 100644
        --- a/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java
        +++ b/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java
        @@ -66,6 +66,7 @@ import static java.time.temporal.ChronoField.ERA;
         import static java.time.temporal.ChronoField.YEAR;
         import static java.time.temporal.ChronoUnit.DAYS;
         
        +import java.io.Serializable;
         import java.time.DateTimeException;
         import java.time.LocalDate;
         import java.time.LocalTime;
        @@ -256,7 +257,9 @@ public interface ChronoLocalDate
              * @see #isEqual
              */
             static Comparator timeLineOrder() {
        -        return AbstractChronology.DATE_ORDER;
        +        return (Comparator & Serializable) (date1, date2) -> {
        +            return Long.compare(date1.toEpochDay(), date2.toEpochDay());
        +        };
             }
         
             //-----------------------------------------------------------------------
        diff --git a/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java b/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java
        index b211a52ff84..d8411961697 100644
        --- a/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java
        +++ b/jdk/src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java
        @@ -66,6 +66,7 @@ import static java.time.temporal.ChronoField.NANO_OF_DAY;
         import static java.time.temporal.ChronoUnit.FOREVER;
         import static java.time.temporal.ChronoUnit.NANOS;
         
        +import java.io.Serializable;
         import java.time.DateTimeException;
         import java.time.Instant;
         import java.time.LocalDateTime;
        @@ -136,7 +137,13 @@ public interface ChronoLocalDateTime
              * @see #isEqual
              */
             static Comparator> timeLineOrder() {
        -        return AbstractChronology.DATE_TIME_ORDER;
        +        return (Comparator> & Serializable) (dateTime1, dateTime2) -> {
        +            int cmp = Long.compare(dateTime1.toLocalDate().toEpochDay(), dateTime2.toLocalDate().toEpochDay());
        +            if (cmp == 0) {
        +                cmp = Long.compare(dateTime1.toLocalTime().toNanoOfDay(), dateTime2.toLocalTime().toNanoOfDay());
        +            }
        +            return cmp;
        +        };
             }
         
             //-----------------------------------------------------------------------
        diff --git a/jdk/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java b/jdk/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java
        index 8227c482831..eadcf9df958 100644
        --- a/jdk/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java
        +++ b/jdk/src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java
        @@ -66,6 +66,7 @@ import static java.time.temporal.ChronoField.OFFSET_SECONDS;
         import static java.time.temporal.ChronoUnit.FOREVER;
         import static java.time.temporal.ChronoUnit.NANOS;
         
        +import java.io.Serializable;
         import java.time.DateTimeException;
         import java.time.Instant;
         import java.time.LocalTime;
        @@ -137,7 +138,13 @@ public interface ChronoZonedDateTime
              * @see #isEqual
              */
             static Comparator> timeLineOrder() {
        -        return AbstractChronology.INSTANT_ORDER;
        +        return (Comparator> & Serializable) (dateTime1, dateTime2) -> {
        +                int cmp = Long.compare(dateTime1.toEpochSecond(), dateTime2.toEpochSecond());
        +                if (cmp == 0) {
        +                    cmp = Long.compare(dateTime1.toLocalTime().getNano(), dateTime2.toLocalTime().getNano());
        +                }
        +                return cmp;
        +            };
             }
         
             //-----------------------------------------------------------------------
        
        From bfe18c7aee5cc90dcea7814c7a41297c27d899c3 Mon Sep 17 00:00:00 2001
        From: Michael McMahon 
        Date: Thu, 20 Apr 2017 09:40:41 +0100
        Subject: [PATCH 72/75] 8177452: Syntax errors in ContentHandler class
         documentation
        
        Reviewed-by: chegar
        ---
         .../share/classes/java/net/ContentHandler.java        | 11 ++++++-----
         1 file changed, 6 insertions(+), 5 deletions(-)
        
        diff --git a/jdk/src/java.base/share/classes/java/net/ContentHandler.java b/jdk/src/java.base/share/classes/java/net/ContentHandler.java
        index bea0391b1ea..119af89fed4 100644
        --- a/jdk/src/java.base/share/classes/java/net/ContentHandler.java
        +++ b/jdk/src/java.base/share/classes/java/net/ContentHandler.java
        @@ -37,10 +37,10 @@ import java.io.IOException;
          * application calls the {@code getContent} method in class
          * {@code URL} or in {@code URLConnection}.
          * The application's content handler factory (an instance of a class that
        - * implements the interface {@code ContentHandlerFactory} set
        - * up by a call to {@code setContentHandler}) is
        - * called with a {@code String} giving the MIME type of the
        - * object being received on the socket. The factory returns an
        + * implements the interface {@code ContentHandlerFactory} set up by a call to
        + * {@link URLConnection#setContentHandlerFactory(ContentHandlerFactory)
        + * setContentHandlerFactory} is called with a {@code String} giving the
        + * MIME type of the object being received on the socket. The factory returns an
          * instance of a subclass of {@code ContentHandler}, and its
          * {@code getContent} method is called to create the object.
          * 

        @@ -99,7 +99,8 @@ public abstract class ContentHandler { * representation of an object, this method reads that stream and * creates an object that matches one of the types specified. * - * The default implementation of this method should call getContent() + * The default implementation of this method should call + * {@link #getContent(URLConnection)} * and screen the return type for a match of the suggested types. * * @param urlc a URL connection. From 94e80364ae45169d66bb35762ecedfad4678b59e Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 20 Apr 2017 09:42:13 +0100 Subject: [PATCH 73/75] 8177457: Syntax errors in URLConnection class documentation Reviewed-by: chegar --- .../share/classes/java/net/URLConnection.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/URLConnection.java b/jdk/src/java.base/share/classes/java/net/URLConnection.java index e2ed0cfcbdd..f834d1255f0 100644 --- a/jdk/src/java.base/share/classes/java/net/URLConnection.java +++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java @@ -876,7 +876,7 @@ public abstract class URLConnection { * Sets the value of the {@code doInput} field for this * {@code URLConnection} to the specified value. *

        - * A URL connection can be used for input and/or output. Set the DoInput + * A URL connection can be used for input and/or output. Set the doInput * flag to true if you intend to use the URL connection for input, * false if not. The default is true. * @@ -906,7 +906,7 @@ public abstract class URLConnection { * Sets the value of the {@code doOutput} field for this * {@code URLConnection} to the specified value. *

        - * A URL connection can be used for input and/or output. Set the DoOutput + * A URL connection can be used for input and/or output. Set the doOutput * flag to true if you intend to use the URL connection for output, * false if not. The default is false. * @@ -972,7 +972,7 @@ public abstract class URLConnection { * Returns the default value of the {@code allowUserInteraction} * field. *

        - * Ths default is "sticky", being a part of the static state of all + * This default is "sticky", being a part of the static state of all * URLConnections. This flag applies to the next, and all following * URLConnections that are created. * @@ -993,7 +993,7 @@ public abstract class URLConnection { * "reload" button in a browser). If the UseCaches flag on a connection * is true, the connection is allowed to use whatever caches it can. * If false, caches are to be ignored. - * The default value comes from DefaultUseCaches, which defaults to + * The default value comes from defaultUseCaches, which defaults to * true. A default value can also be set per-protocol using * {@link #setDefaultUseCaches(String,boolean)}. * @@ -1252,7 +1252,7 @@ public abstract class URLConnection { * application. It can be called at most once by an application. *

        * The {@code ContentHandlerFactory} instance is used to - * construct a content handler from a content type + * construct a content handler from a content type. *

        * If there is a security manager, this method first calls * the security manager's {@code checkSetFactory} method From df7e220509934119edc402e318a911e72b606473 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 23:10:05 +0200 Subject: [PATCH 74/75] Added tag jdk-10+4 for changeset 02253db2ace1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 6cf5a0c58e0..04e85b43e5f 100644 --- a/.hgtags +++ b/.hgtags @@ -411,3 +411,4 @@ f4aff695ffe05cfdb69d8af25a4ddc6a029754ea jdk-9+155 74116beae88a8f17a80301aa6c83865c82f10ece jdk-10+1 4a79ad46e578112fce68f1af9dd931025cc235cb jdk-10+2 d1cab6c7e608479be4ebfad48a25b0ed48600f62 jdk-10+3 +02253db2ace1422f576f58502fc7831ead77424b jdk-10+4 From 01dcb28c4e83fed3d2033e6cb333ee4148db9ab7 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 23:11:56 +0200 Subject: [PATCH 75/75] Added tag jdk-9+165 for changeset 3965b747cfe1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a7cf253e636..a6cb07be7f0 100644 --- a/.hgtags +++ b/.hgtags @@ -408,3 +408,4 @@ f6883b1a5a6478437cd4181c4bd45328ab24feaf jdk-9+161 d16aebbb56d37f12e0c0b0a4fb427db65e1fb1a8 jdk-9+162 18c41483a082e097ac2f5f983c1226ed94aa4215 jdk-9+163 32db52c675e7d5bc413605d2e89b68b608b19be0 jdk-9+164 +3965b747cfe1e6cbd66b8739da5a1ea6ec6985e9 jdk-9+165

        Opened Packages Opens 
        PackageDescriptionAll Modules 
        All Packages " - + "Exported Packages" + + "Exports" + " " - + "Concealed Packages 
        concealedpkgmdlANone  
        (Implementation(s): TestClassInModuleB)
        All Packages " - + "Exported Packages " - + "Opened Packages Exported Packages Exports 
        PackageModule" + + "PublicChild​()private " + + "PrivateParent​(int i)" + + "