--- a/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -366,3 +366,4 @@
18e5cdecb37a2f03ba74f6c8f022858bcbaacf56 jdk-9+121
7693aa00e131493ceb42b93305e2f014c9922a3b jdk-9+122
d53037a90c441cb528dc41c30827985de0e67c62 jdk-9+123
+2a5697a98620c4f40e4a1a71478464399b8878de jdk-9+124
--- a/.hgtags-top-repo Mon Jun 20 06:13:28 2016 -0700
+++ b/.hgtags-top-repo Mon Jun 27 10:00:47 2016 -0700
@@ -366,3 +366,4 @@
cae471d3b87783e0a3deea658e1e1c84b2485b6c jdk-9+121
346be2df0f5b31d423807f53a719d1b9a67f3354 jdk-9+122
405d811c0d7b9b48ff718ae6c240b732f098c028 jdk-9+123
+f80c841ae2545eaf9acd2724bccc305d98cefbe2 jdk-9+124
--- a/common/autoconf/generated-configure.sh Mon Jun 20 06:13:28 2016 -0700
+++ b/common/autoconf/generated-configure.sh Mon Jun 27 10:00:47 2016 -0700
@@ -5094,7 +5094,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1466007828
+DATE_WHEN_GENERATED=1467039751
###############################################################################
#
@@ -36621,7 +36621,6 @@
# Setup the assembler (AS)
#
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
- # FIXME: should this really be solaris, or solstudio?
# Publish this variable in the help.
@@ -37105,6 +37104,9 @@
fi
fi
+ if test "x$AS" = x; then
+ as_fn_error $? "Solaris assembler (as) is required. Please install via \"pkg install pkg:/developer/assembler\"." "$LINENO" 5
+ fi
else
# FIXME: is this correct for microsoft?
AS="$CC -c"
--- a/common/autoconf/toolchain.m4 Mon Jun 20 06:13:28 2016 -0700
+++ b/common/autoconf/toolchain.m4 Mon Jun 27 10:00:47 2016 -0700
@@ -597,9 +597,11 @@
# Setup the assembler (AS)
#
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
- # FIXME: should this really be solaris, or solstudio?
BASIC_PATH_PROGS(AS, as)
BASIC_FIXUP_EXECUTABLE(AS)
+ if test "x$AS" = x; then
+ AC_MSG_ERROR([Solaris assembler (as) is required. Please install via "pkg install pkg:/developer/assembler".])
+ fi
else
# FIXME: is this correct for microsoft?
AS="$CC -c"
--- a/common/bin/compare.sh Mon Jun 20 06:13:28 2016 -0700
+++ b/common/bin/compare.sh Mon Jun 27 10:00:47 2016 -0700
@@ -360,9 +360,11 @@
$RM $OTHER_FILE $THIS_FILE
#Note that | doesn't work on mac sed.
HTML_FILTER="$SED \
- -e 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}/<DATE>/g' \
+ -e 's/20[0-9]\{2\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}/<DATE>/g' \
+ -e 's/20[0-9]\{2\}-[0-9]\{2\}-[0-9]\{2\}/<DATE>/g' \
-e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
- -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [0-9]\{4\} [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/<DATE>/'
+ -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [0-9]\{4\} [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/<DATE>/' \
+ -e 's/from .*\.idl/\.idl/' \
"
$CAT $OTHER_DIR/$f | eval "$HTML_FILTER" > $OTHER_FILE &
$CAT $THIS_DIR/$f | eval "$HTML_FILTER" > $THIS_FILE &
--- a/corba/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/corba/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -366,3 +366,4 @@
9a5fc5a27560ac272c1341f8f3838338fba49059 jdk-9+121
a39131aafc51a6fd8836e6ebe1b04458702ce7d6 jdk-9+122
e33a34cc551907617d8129c4faaf1a5a7e61d21c jdk-9+123
+45121d5afb9d5bfadab75378572ad96832e0809e jdk-9+124
--- a/corba/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java Mon Jun 20 06:13:28 2016 -0700
+++ b/corba/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java Mon Jun 27 10:00:47 2016 -0700
@@ -2230,7 +2230,7 @@
* REVISIT -- This code doesn't do what the comment says to when
* getField() is null!
*/
- private void inputClassFields(Object o, Class cl,
+ private void inputClassFields(Object o, Class<?> cl,
ObjectStreamField[] fields,
com.sun.org.omg.SendingContext.CodeBase sender)
throws InvalidClassException, StreamCorruptedException,
@@ -2239,6 +2239,8 @@
int primFields = fields.length - currentClassDesc.objFields;
+ // this will leave primitives in the inputstream
+ // should really consume and discard where necessary
if (o != null) {
for (int i = 0; i < primFields; ++i) {
inputPrimitiveField(o, cl, fields[i]);
@@ -2264,21 +2266,32 @@
}
try {
- Class fieldCl = fields[i].getClazz();
+ Class<?> fieldCl = fields[i].getClazz();
if ((objectValue != null)
&& (!fieldCl.isAssignableFrom(
objectValue.getClass()))) {
throw new IllegalArgumentException("Field mismatch");
}
- Field classField = null;
+ Field declaredClassField = null;
+ final String inputStreamFieldName = fields[i].getName();
try {
- classField = cl.getDeclaredField(fields[i].getName());
- } catch (NoSuchFieldException nsfEx) {
- throw new IllegalArgumentException(nsfEx);
+ declaredClassField = getDeclaredField( cl, inputStreamFieldName);
+ } catch (PrivilegedActionException paEx) {
+ throw new IllegalArgumentException(
+ (NoSuchFieldException) paEx.getException());
} catch (SecurityException secEx) {
- throw new IllegalArgumentException(secEx.getCause());
+ throw new IllegalArgumentException(secEx);
+ } catch (NullPointerException npEx) {
+ continue;
+ } catch (NoSuchFieldException e) {
+ continue;
}
- Class<?> declaredFieldClass = classField.getType();
+
+ if (declaredClassField == null) {
+ continue;
+ }
+
+ Class<?> declaredFieldClass = declaredClassField.getType();
// check input field type is a declared field type
// input field is a subclass of the declared field
@@ -2291,15 +2304,24 @@
}
bridge.putObject( o, fields[i].getFieldID(), objectValue ) ;
// reflective code: fields[i].getField().set( o, objectValue ) ;
- } catch (IllegalArgumentException e) {
- ClassCastException exc = new ClassCastException("Assigning instance of class " +
- objectValue.getClass().getName() +
- " to field " +
- currentClassDesc.getName() +
- '#' +
- fields[i].getField().getName());
- exc.initCause( e ) ;
- throw exc ;
+ } catch (IllegalArgumentException iaEx) {
+ String objectValueClassName = "null";
+ String currentClassDescClassName = "null";
+ String fieldName = "null";
+ if (objectValue != null) {
+ objectValueClassName = objectValue.getClass().getName();
+ }
+ if (currentClassDesc != null) {
+ currentClassDescClassName = currentClassDesc.getName();
+ }
+ if (fields[i] != null && fields[i].getField() != null) {
+ fieldName = fields[i].getField().getName();
+ }
+ ClassCastException ccEx = new ClassCastException(
+ "Assigning instance of class " + objectValueClassName
+ + " to field " + currentClassDescClassName + '#' + fieldName);
+ ccEx.initCause( iaEx ) ;
+ throw ccEx ;
}
} // end : for loop
}
@@ -2592,12 +2614,11 @@
throw cce ;
}
}
-
}
- private static void setObjectField(Object o, Class c, String fieldName, Object v) {
+ private static void setObjectField(Object o, Class<?> c, String fieldName, Object v) {
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
Class fieldCl = fld.getType();
if(v != null && !fieldCl.isInstance(v)) {
throw new Exception();
@@ -2617,10 +2638,10 @@
}
}
- private static void setBooleanField(Object o, Class c, String fieldName, boolean v)
+ private static void setBooleanField(Object o, Class<?> c, String fieldName, boolean v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Boolean.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putBoolean( o, key, v ) ;
@@ -2640,10 +2661,10 @@
}
}
- private static void setByteField(Object o, Class c, String fieldName, byte v)
+ private static void setByteField(Object o, Class<?> c, String fieldName, byte v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Byte.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putByte( o, key, v ) ;
@@ -2663,10 +2684,10 @@
}
}
- private static void setCharField(Object o, Class c, String fieldName, char v)
+ private static void setCharField(Object o, Class<?> c, String fieldName, char v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Character.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putChar( o, key, v ) ;
@@ -2686,10 +2707,10 @@
}
}
- private static void setShortField(Object o, Class c, String fieldName, short v)
+ private static void setShortField(Object o, Class<?> c, String fieldName, short v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Short.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putShort( o, key, v ) ;
@@ -2709,10 +2730,10 @@
}
}
- private static void setIntField(Object o, Class c, String fieldName, int v)
+ private static void setIntField(Object o, Class<?> c, String fieldName, int v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Integer.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putInt( o, key, v ) ;
@@ -2732,10 +2753,10 @@
}
}
- private static void setLongField(Object o, Class c, String fieldName, long v)
+ private static void setLongField(Object o, Class<?> c, String fieldName, long v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Long.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putLong( o, key, v ) ;
@@ -2755,10 +2776,10 @@
}
}
- private static void setFloatField(Object o, Class c, String fieldName, float v)
+ private static void setFloatField(Object o, Class<?> c, String fieldName, float v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Float.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putFloat( o, key, v ) ;
@@ -2778,10 +2799,10 @@
}
}
- private static void setDoubleField(Object o, Class c, String fieldName, double v)
+ private static void setDoubleField(Object o, Class<?> c, String fieldName, double v)
{
try {
- Field fld = c.getDeclaredField( fieldName ) ;
+ Field fld = getDeclaredField( c, fieldName ) ;
if ((fld != null) && (fld.getType() == Double.TYPE)) {
long key = bridge.objectFieldOffset( fld ) ;
bridge.putDouble( o, key, v ) ;
@@ -2801,6 +2822,22 @@
}
}
+
+ private static Field getDeclaredField(final Class<?> c,
+ final String fieldName)
+ throws PrivilegedActionException, NoSuchFieldException, SecurityException {
+ if (System.getSecurityManager() == null) {
+ return c.getDeclaredField(fieldName);
+ } else {
+ return AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Field>() {
+ public Field run() throws NoSuchFieldException {
+ return c.getDeclaredField(fieldName);
+ }
+ });
+ }
+ }
+
/**
* This class maintains a map of stream position to
* an Object currently being deserialized. It is used
@@ -2811,12 +2848,12 @@
*/
static class ActiveRecursionManager
{
- private Map offsetToObjectMap;
+ private Map<Integer, Object> offsetToObjectMap;
public ActiveRecursionManager() {
// A hash map is unsynchronized and allows
// null values
- offsetToObjectMap = new HashMap();
+ offsetToObjectMap = new HashMap<>();
}
// Called right after allocating a new object.
--- a/hotspot/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -526,3 +526,4 @@
7e293105dbb0789a468655f81320c891f491f371 jdk-9+121
af6b4ad908e732d23021f12e8322b204433d5cf6 jdk-9+122
75f81e1fecfb444f34f357295fe06af60e2762d9 jdk-9+123
+479631362b4930be985245ea063d87d821a472eb jdk-9+124
--- a/hotspot/src/os/aix/vm/globals_aix.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/os/aix/vm/globals_aix.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -35,6 +35,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
notproduct, \
range, \
constraint, \
--- a/hotspot/src/os/bsd/vm/globals_bsd.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/os/bsd/vm/globals_bsd.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -33,6 +33,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
notproduct, \
range, \
constraint, \
--- a/hotspot/src/os/linux/vm/globals_linux.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/os/linux/vm/globals_linux.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -33,6 +33,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
notproduct, \
range, \
constraint, \
--- a/hotspot/src/os/solaris/vm/globals_solaris.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/os/solaris/vm/globals_solaris.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -33,6 +33,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
notproduct, \
range, \
constraint, \
--- a/hotspot/src/os/windows/vm/globals_windows.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/os/windows/vm/globals_windows.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -33,6 +33,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
notproduct, \
range, \
constraint, \
--- a/hotspot/src/share/vm/c1/c1_globals.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/c1/c1_globals.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -30,6 +30,7 @@
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
+ MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
--- a/hotspot/src/share/vm/c1/c1_globals.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/c1/c1_globals.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -65,6 +65,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
notproduct, \
range, \
constraint, \
@@ -356,6 +357,7 @@
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
+ DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
--- a/hotspot/src/share/vm/gc/g1/g1_globals.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1_globals.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -30,6 +30,7 @@
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
+ MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_EXPERIMENTAL_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG, \
MATERIALIZE_MANAGEABLE_FLAG, \
--- a/hotspot/src/share/vm/gc/g1/g1_globals.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1_globals.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -36,6 +36,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
@@ -323,6 +324,7 @@
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
+ DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
DECLARE_MANAGEABLE_FLAG, \
--- a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -32,6 +32,7 @@
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
+ MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_EXPERIMENTAL_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG,
IGNORE_RANGE, \
@@ -89,6 +90,7 @@
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_DIAGNOSTIC_FLAG_VALUE_CHANGED_CHECK_CODE, \
+ JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
@@ -104,6 +106,7 @@
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
+ JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
@@ -129,6 +132,7 @@
JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_PD_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
+ JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \
IGNORE_RANGE, \
@@ -168,6 +172,7 @@
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_DIAGNOSTIC_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
+ JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
@@ -181,6 +186,7 @@
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
+ JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
IGNORE_RANGE, \
@@ -206,6 +212,7 @@
JVMCI_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_PD_PRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
+ JVMCI_IGNORE_FLAG_THREE_PARAM, \
JVMCI_IGNORE_FLAG_FOUR_PARAM, \
JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \
IGNORE_RANGE, \
--- a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -37,6 +37,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
experimental, \
notproduct, \
range, \
@@ -102,6 +103,7 @@
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
+ DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
--- a/hotspot/src/share/vm/opto/c2_globals.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/opto/c2_globals.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -30,6 +30,7 @@
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
+ MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_EXPERIMENTAL_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
--- a/hotspot/src/share/vm/opto/c2_globals.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -66,6 +66,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
experimental, \
notproduct, \
range, \
@@ -203,7 +204,7 @@
"Map number of unrolls for main loop via " \
"Superword Level Parallelism analysis") \
\
- product_pd(bool, PostLoopMultiversioning, \
+ diagnostic_pd(bool, PostLoopMultiversioning, \
"Multi versioned post loops to eliminate range checks") \
\
notproduct(bool, TraceSuperWordLoopUnrollAnalysis, false, \
@@ -764,6 +765,7 @@
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
+ DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -211,6 +211,7 @@
#define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
#define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
#define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc) ); emit_constraint_##type(#name
+#define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc) ); emit_constraint_##type(#name
#define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
#define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) ); emit_constraint_##type(#name
#define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
@@ -233,6 +234,7 @@
EMIT_CONSTRAINT_PRODUCT_FLAG,
EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
+ EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
EMIT_CONSTRAINT_MANAGEABLE_FLAG,
@@ -260,6 +262,7 @@
EMIT_CONSTRAINT_PRODUCT_FLAG,
EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
+ EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
IGNORE_RANGE,
EMIT_CONSTRAINT_CHECK,
@@ -272,6 +275,7 @@
EMIT_CONSTRAINT_PRODUCT_FLAG,
EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
+ EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
IGNORE_RANGE,
@@ -285,6 +289,7 @@
EMIT_CONSTRAINT_PRODUCT_FLAG,
EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
+ EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
EMIT_CONSTRAINT_MANAGEABLE_FLAG,
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -278,6 +278,7 @@
#define EMIT_RANGE_MANAGEABLE_FLAG(type, name, value, doc) ); emit_range_##type(#name
#define EMIT_RANGE_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_range_##type(#name
#define EMIT_RANGE_PD_PRODUCT_FLAG(type, name, doc) ); emit_range_##type(#name
+#define EMIT_RANGE_PD_DIAGNOSTIC_FLAG(type, name, doc) ); emit_range_##type(#name
#define EMIT_RANGE_DEVELOPER_FLAG(type, name, value, doc) ); emit_range_##type(#name
#define EMIT_RANGE_PD_DEVELOPER_FLAG(type, name, doc) ); emit_range_##type(#name
#define EMIT_RANGE_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_range_##type(#name
@@ -299,6 +300,7 @@
EMIT_RANGE_PRODUCT_FLAG,
EMIT_RANGE_PD_PRODUCT_FLAG,
EMIT_RANGE_DIAGNOSTIC_FLAG,
+ EMIT_RANGE_PD_DIAGNOSTIC_FLAG,
EMIT_RANGE_EXPERIMENTAL_FLAG,
EMIT_RANGE_NOTPRODUCT_FLAG,
EMIT_RANGE_MANAGEABLE_FLAG,
@@ -325,6 +327,7 @@
EMIT_RANGE_PRODUCT_FLAG,
EMIT_RANGE_PD_PRODUCT_FLAG,
EMIT_RANGE_DIAGNOSTIC_FLAG,
+ EMIT_RANGE_PD_DIAGNOSTIC_FLAG,
EMIT_RANGE_EXPERIMENTAL_FLAG,
EMIT_RANGE_NOTPRODUCT_FLAG,
EMIT_RANGE_CHECK,
@@ -338,6 +341,7 @@
EMIT_RANGE_PRODUCT_FLAG,
EMIT_RANGE_PD_PRODUCT_FLAG,
EMIT_RANGE_DIAGNOSTIC_FLAG,
+ EMIT_RANGE_PD_DIAGNOSTIC_FLAG,
EMIT_RANGE_NOTPRODUCT_FLAG,
EMIT_RANGE_CHECK,
IGNORE_CONSTRAINT,
@@ -350,6 +354,7 @@
EMIT_RANGE_PRODUCT_FLAG,
EMIT_RANGE_PD_PRODUCT_FLAG,
EMIT_RANGE_DIAGNOSTIC_FLAG,
+ EMIT_RANGE_PD_DIAGNOSTIC_FLAG,
EMIT_RANGE_EXPERIMENTAL_FLAG,
EMIT_RANGE_NOTPRODUCT_FLAG,
EMIT_RANGE_CHECK,
@@ -363,6 +368,7 @@
EMIT_RANGE_PRODUCT_FLAG,
EMIT_RANGE_PD_PRODUCT_FLAG,
EMIT_RANGE_DIAGNOSTIC_FLAG,
+ EMIT_RANGE_PD_DIAGNOSTIC_FLAG,
EMIT_RANGE_EXPERIMENTAL_FLAG,
EMIT_RANGE_NOTPRODUCT_FLAG,
EMIT_RANGE_MANAGEABLE_FLAG,
--- a/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -108,6 +108,7 @@
#define EMIT_WRITEABLE_PD_PRODUCT_FLAG(type, name, doc) ); emit_writeable_##type(#name
#define EMIT_WRITEABLE_DEVELOPER_FLAG(type, name, value, doc) ); emit_writeable_##type(#name
#define EMIT_WRITEABLE_PD_DEVELOPER_FLAG(type, name, doc) ); emit_writeable_##type(#name
+#define EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG(type, name, doc) ); emit_writeable_##type(#name
#define EMIT_WRITEABLE_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name
#define EMIT_WRITEABLE_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name
@@ -126,6 +127,7 @@
EMIT_WRITEABLE_PRODUCT_FLAG,
EMIT_WRITEABLE_PD_PRODUCT_FLAG,
EMIT_WRITEABLE_DIAGNOSTIC_FLAG,
+ EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG,
EMIT_WRITEABLE_EXPERIMENTAL_FLAG,
EMIT_WRITEABLE_NOTPRODUCT_FLAG,
EMIT_WRITEABLE_MANAGEABLE_FLAG,
@@ -152,6 +154,7 @@
EMIT_WRITEABLE_PRODUCT_FLAG,
EMIT_WRITEABLE_PD_PRODUCT_FLAG,
EMIT_WRITEABLE_DIAGNOSTIC_FLAG,
+ EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG,
EMIT_WRITEABLE_EXPERIMENTAL_FLAG,
EMIT_WRITEABLE_NOTPRODUCT_FLAG,
IGNORE_RANGE,
@@ -165,6 +168,7 @@
EMIT_WRITEABLE_PRODUCT_FLAG,
EMIT_WRITEABLE_PD_PRODUCT_FLAG,
EMIT_WRITEABLE_DIAGNOSTIC_FLAG,
+ EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG,
EMIT_WRITEABLE_NOTPRODUCT_FLAG,
IGNORE_RANGE,
IGNORE_CONSTRAINT,
@@ -177,6 +181,7 @@
EMIT_WRITEABLE_PRODUCT_FLAG,
EMIT_WRITEABLE_PD_PRODUCT_FLAG,
EMIT_WRITEABLE_DIAGNOSTIC_FLAG,
+ EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG,
EMIT_WRITEABLE_EXPERIMENTAL_FLAG,
EMIT_WRITEABLE_NOTPRODUCT_FLAG,
IGNORE_RANGE,
@@ -190,6 +195,7 @@
EMIT_WRITEABLE_PRODUCT_FLAG,
EMIT_WRITEABLE_PD_PRODUCT_FLAG,
EMIT_WRITEABLE_DIAGNOSTIC_FLAG,
+ EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG,
EMIT_WRITEABLE_EXPERIMENTAL_FLAG,
EMIT_WRITEABLE_NOTPRODUCT_FLAG,
EMIT_WRITEABLE_MANAGEABLE_FLAG,
--- a/hotspot/src/share/vm/runtime/globals.cpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/runtime/globals.cpp Mon Jun 27 10:00:47 2016 -0700
@@ -58,6 +58,7 @@
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
+ MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_EXPERIMENTAL_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG, \
MATERIALIZE_MANAGEABLE_FLAG, \
@@ -72,6 +73,7 @@
MATERIALIZE_PRODUCT_FLAG, \
MATERIALIZE_PD_PRODUCT_FLAG, \
MATERIALIZE_DIAGNOSTIC_FLAG, \
+ MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
MATERIALIZE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
@@ -650,6 +652,7 @@
#define RUNTIME_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT) },
#define RUNTIME_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
#define RUNTIME_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DIAGNOSTIC) },
+#define RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_DIAGNOSTIC | Flag::KIND_PLATFORM_DEPENDENT) },
#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_EXPERIMENTAL) },
#define RUNTIME_MANAGEABLE_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_MANAGEABLE) },
#define RUNTIME_PRODUCT_RW_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_PRODUCT | Flag::KIND_READ_WRITE) },
@@ -660,6 +663,7 @@
#define JVMCI_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_PRODUCT) },
#define JVMCI_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
#define JVMCI_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DIAGNOSTIC) },
+#define JVMCI_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DIAGNOSTIC | Flag::KIND_PLATFORM_DEPENDENT) },
#define JVMCI_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_EXPERIMENTAL) },
#define JVMCI_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DEVELOP) },
#define JVMCI_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
@@ -674,6 +678,7 @@
#define C1_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_PRODUCT) },
#define C1_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
#define C1_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DIAGNOSTIC) },
+#define C1_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DIAGNOSTIC | Flag::KIND_PLATFORM_DEPENDENT) },
#define C1_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP) },
#define C1_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
#define C1_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_NOT_PRODUCT) },
@@ -681,6 +686,7 @@
#define C2_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT) },
#define C2_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
#define C2_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DIAGNOSTIC) },
+#define C2_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DIAGNOSTIC | Flag::KIND_PLATFORM_DEPENDENT) },
#define C2_EXPERIMENTAL_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_EXPERIMENTAL) },
#define C2_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DEVELOP) },
#define C2_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
@@ -695,6 +701,7 @@
#define SHARK_PRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_PRODUCT) },
#define SHARK_PD_PRODUCT_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
#define SHARK_DIAGNOSTIC_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DIAGNOSTIC) },
+#define SHARK_PD_DIAGNOSTIC_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DIAGNOSTIC | Flag::KIND_PLATFORM_DEPENDENT) },
#define SHARK_DEVELOP_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DEVELOP) },
#define SHARK_PD_DEVELOP_FLAG_STRUCT( type, name, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
#define SHARK_NOTPRODUCT_FLAG_STRUCT( type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_SHARK | Flag::KIND_NOT_PRODUCT) },
@@ -705,6 +712,7 @@
RUNTIME_PRODUCT_FLAG_STRUCT, \
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
+ RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_EXPERIMENTAL_FLAG_STRUCT, \
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
RUNTIME_MANAGEABLE_FLAG_STRUCT, \
@@ -718,6 +726,7 @@
RUNTIME_PRODUCT_FLAG_STRUCT, \
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
+ RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
@@ -728,6 +737,7 @@
RUNTIME_PRODUCT_FLAG_STRUCT, \
RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
+ RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
RUNTIME_EXPERIMENTAL_FLAG_STRUCT, \
RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
RUNTIME_MANAGEABLE_FLAG_STRUCT, \
@@ -742,6 +752,7 @@
JVMCI_PRODUCT_FLAG_STRUCT, \
JVMCI_PD_PRODUCT_FLAG_STRUCT, \
JVMCI_DIAGNOSTIC_FLAG_STRUCT, \
+ JVMCI_PD_DIAGNOSTIC_FLAG_STRUCT, \
JVMCI_EXPERIMENTAL_FLAG_STRUCT, \
JVMCI_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
@@ -754,6 +765,7 @@
C1_PRODUCT_FLAG_STRUCT, \
C1_PD_PRODUCT_FLAG_STRUCT, \
C1_DIAGNOSTIC_FLAG_STRUCT, \
+ C1_PD_DIAGNOSTIC_FLAG_STRUCT, \
C1_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
@@ -765,6 +777,7 @@
C2_PRODUCT_FLAG_STRUCT, \
C2_PD_PRODUCT_FLAG_STRUCT, \
C2_DIAGNOSTIC_FLAG_STRUCT, \
+ C2_PD_DIAGNOSTIC_FLAG_STRUCT, \
C2_EXPERIMENTAL_FLAG_STRUCT, \
C2_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
@@ -777,6 +790,7 @@
SHARK_PRODUCT_FLAG_STRUCT, \
SHARK_PD_PRODUCT_FLAG_STRUCT, \
SHARK_DIAGNOSTIC_FLAG_STRUCT, \
+ SHARK_PD_DIAGNOSTIC_FLAG_STRUCT, \
SHARK_NOTPRODUCT_FLAG_STRUCT, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
--- a/hotspot/src/share/vm/runtime/globals.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -644,6 +644,7 @@
product, \
product_pd, \
diagnostic, \
+ diagnostic_pd, \
experimental, \
notproduct, \
manageable, \
@@ -2529,7 +2530,7 @@
develop(bool, GenerateRangeChecks, true, \
"Generate range checks for array accesses") \
\
- develop_pd(bool, ImplicitNullChecks, \
+ diagnostic_pd(bool, ImplicitNullChecks, \
"Generate code for implicit null checks") \
\
product_pd(bool, TrapBasedNullChecks, \
@@ -3163,7 +3164,7 @@
"Ratio of call site execution to caller method invocation") \
range(0, max_jint) \
\
- develop_pd(intx, InlineFrequencyCount, \
+ diagnostic_pd(intx, InlineFrequencyCount, \
"Count of call site execution necessary to trigger frequent " \
"inlining") \
range(0, max_jint) \
@@ -4144,7 +4145,7 @@
"in the loaded class C. " \
"Check (3) is available only in debug builds.") \
\
- develop_pd(intx, InitArrayShortSize, \
+ diagnostic_pd(intx, InitArrayShortSize, \
"Threshold small size (in bytes) for clearing arrays. " \
"Anything this size or smaller may get converted to discrete " \
"scalar stores.") \
@@ -4168,6 +4169,7 @@
#define DECLARE_PRODUCT_FLAG(type, name, value, doc) extern "C" type name;
#define DECLARE_PD_PRODUCT_FLAG(type, name, doc) extern "C" type name;
#define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc) extern "C" type name;
+#define DECLARE_PD_DIAGNOSTIC_FLAG(type, name, doc) extern "C" type name;
#define DECLARE_EXPERIMENTAL_FLAG(type, name, value, doc) extern "C" type name;
#define DECLARE_MANAGEABLE_FLAG(type, name, value, doc) extern "C" type name;
#define DECLARE_PRODUCT_RW_FLAG(type, name, value, doc) extern "C" type name;
@@ -4191,6 +4193,7 @@
#define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc) type name = pd_##name;
#define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc) type name = value;
+#define MATERIALIZE_PD_DIAGNOSTIC_FLAG(type, name, doc) type name = pd_##name;
#define MATERIALIZE_EXPERIMENTAL_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value;
#define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc) type name = value;
@@ -4221,6 +4224,7 @@
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
+ DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_EXPERIMENTAL_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
DECLARE_MANAGEABLE_FLAG, \
@@ -4235,6 +4239,7 @@
DECLARE_PRODUCT_FLAG, \
DECLARE_PD_PRODUCT_FLAG, \
DECLARE_DIAGNOSTIC_FLAG, \
+ DECLARE_PD_DIAGNOSTIC_FLAG, \
DECLARE_NOTPRODUCT_FLAG, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
--- a/hotspot/src/share/vm/runtime/globals_extension.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/runtime/globals_extension.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -49,6 +49,7 @@
#define RUNTIME_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define RUNTIME_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
+#define RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define RUNTIME_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define RUNTIME_MANAGEABLE_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define RUNTIME_PRODUCT_RW_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
@@ -61,6 +62,7 @@
#define JVMCI_DEVELOP_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define JVMCI_PD_DEVELOP_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define JVMCI_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
+#define JVMCI_PD_DIAGNOSTIC_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define JVMCI_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define JVMCI_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
@@ -73,6 +75,7 @@
#define C1_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define C1_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define C1_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
+#define C1_PD_DIAGNOSTIC_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define C1_DEVELOP_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
@@ -80,6 +83,7 @@
#define C2_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define C2_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define C2_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
+#define C2_PD_DIAGNOSTIC_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
#define C2_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define C2_DEVELOP_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name),
#define C2_PD_DEVELOP_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name),
@@ -97,6 +101,7 @@
RUNTIME_PRODUCT_FLAG_MEMBER, \
RUNTIME_PD_PRODUCT_FLAG_MEMBER, \
RUNTIME_DIAGNOSTIC_FLAG_MEMBER, \
+ RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER, \
RUNTIME_EXPERIMENTAL_FLAG_MEMBER, \
RUNTIME_NOTPRODUCT_FLAG_MEMBER, \
RUNTIME_MANAGEABLE_FLAG_MEMBER, \
@@ -110,6 +115,7 @@
RUNTIME_PRODUCT_FLAG_MEMBER, \
RUNTIME_PD_PRODUCT_FLAG_MEMBER, \
RUNTIME_DIAGNOSTIC_FLAG_MEMBER, \
+ RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER, \
RUNTIME_NOTPRODUCT_FLAG_MEMBER, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
@@ -120,6 +126,7 @@
RUNTIME_PRODUCT_FLAG_MEMBER, \
RUNTIME_PD_PRODUCT_FLAG_MEMBER, \
RUNTIME_DIAGNOSTIC_FLAG_MEMBER, \
+ RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER, \
RUNTIME_EXPERIMENTAL_FLAG_MEMBER, \
RUNTIME_NOTPRODUCT_FLAG_MEMBER, \
RUNTIME_MANAGEABLE_FLAG_MEMBER, \
@@ -134,6 +141,7 @@
JVMCI_PRODUCT_FLAG_MEMBER, \
JVMCI_PD_PRODUCT_FLAG_MEMBER, \
JVMCI_DIAGNOSTIC_FLAG_MEMBER, \
+ JVMCI_PD_DIAGNOSTIC_FLAG_MEMBER, \
JVMCI_EXPERIMENTAL_FLAG_MEMBER, \
JVMCI_NOTPRODUCT_FLAG_MEMBER, \
IGNORE_RANGE, \
@@ -146,6 +154,7 @@
C1_PRODUCT_FLAG_MEMBER, \
C1_PD_PRODUCT_FLAG_MEMBER, \
C1_DIAGNOSTIC_FLAG_MEMBER, \
+ C1_PD_DIAGNOSTIC_FLAG_MEMBER, \
C1_NOTPRODUCT_FLAG_MEMBER, \
IGNORE_RANGE, \
IGNORE_CONSTRAINT, \
@@ -157,6 +166,7 @@
C2_PRODUCT_FLAG_MEMBER, \
C2_PD_PRODUCT_FLAG_MEMBER, \
C2_DIAGNOSTIC_FLAG_MEMBER, \
+ C2_PD_DIAGNOSTIC_FLAG_MEMBER, \
C2_EXPERIMENTAL_FLAG_MEMBER, \
C2_NOTPRODUCT_FLAG_MEMBER, \
IGNORE_RANGE, \
@@ -182,6 +192,7 @@
#define RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
+#define RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
@@ -194,12 +205,14 @@
#define JVMCI_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define JVMCI_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define JVMCI_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
+#define JVMCI_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define JVMCI_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define JVMCI_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C1_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C1_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
+#define C1_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C1_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
@@ -213,6 +226,7 @@
#define C2_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
+#define C2_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C2_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C2_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
#define C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type),
@@ -230,6 +244,7 @@
RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
+ RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE,
RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE,
@@ -243,6 +258,7 @@
RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
+ RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
IGNORE_RANGE,
IGNORE_CONSTRAINT,
@@ -253,6 +269,7 @@
RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
+ RUNTIME_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE,
RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE,
@@ -267,6 +284,7 @@
JVMCI_PRODUCT_FLAG_MEMBER_WITH_TYPE,
JVMCI_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
JVMCI_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
+ JVMCI_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
JVMCI_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE,
JVMCI_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
IGNORE_RANGE,
@@ -279,6 +297,7 @@
C1_PRODUCT_FLAG_MEMBER_WITH_TYPE,
C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
C1_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
+ C1_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
IGNORE_RANGE,
IGNORE_CONSTRAINT,
@@ -290,6 +309,7 @@
C2_PRODUCT_FLAG_MEMBER_WITH_TYPE,
C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
+ C2_PD_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
C2_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE,
C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE,
IGNORE_RANGE,
--- a/hotspot/src/share/vm/shark/shark_globals.hpp Mon Jun 20 06:13:28 2016 -0700
+++ b/hotspot/src/share/vm/shark/shark_globals.hpp Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -31,7 +31,7 @@
# include "shark_globals_zero.hpp"
#endif
-#define SHARK_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
+#define SHARK_FLAGS(develop, develop_pd, product, product_pd, diagnostic, diagnostic_pd, notproduct) \
\
product(intx, MaxNodeLimit, 65000, \
"Maximum number of nodes") \
@@ -69,6 +69,7 @@
"Runs LLVM verify over LLVM IR") \
-SHARK_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
+SHARK_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_PD_DIAGNOSTIC_FLAG,
+ DECLARE_NOTPRODUCT_FLAG)
#endif // SHARE_VM_SHARK_SHARK_GLOBALS_HPP
--- a/jaxp/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/jaxp/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -366,3 +366,4 @@
a265b8116058c56179c321c38618570b780329be jdk-9+121
f8899b1884e2c4a000dbcc5b1a80954245fe462e jdk-9+122
3c19ab8742c196ac267b3d87e1d19ec3472c708d jdk-9+123
+e04a15153cc293f05fcd60bc98236f50e16af46a jdk-9+124
--- a/jaxws/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/jaxws/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -369,3 +369,4 @@
fb771fa3a986ccfcb00d743b1956b98c380d1dd8 jdk-9+121
342705d785ffd9e999991a3d4baae2eca58ea7c3 jdk-9+122
c42decd28bbfa817347112ed6053b5fbd30517a2 jdk-9+123
+1600da1665cd2cc127014e8c002b328ec33a9147 jdk-9+124
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java Mon Jun 27 10:00:47 2016 -0700
@@ -193,7 +193,7 @@
try {
Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class, Map.class);
// any failure in invoking this method would be considered fatal
- Object obj = instantiateProviderIfNecessary(m);
+ Object obj = instantiateProviderIfNecessary(spFactory);
context = m.invoke(obj, contextPath, classLoader, properties);
} catch (NoSuchMethodException ignored) {
// it's not an error for the provider not to have this method.
@@ -203,7 +203,7 @@
// try the old method that doesn't take properties. compatible with 1.0.
// it is an error for an implementation not to have both forms of the createContext method.
Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class);
- Object obj = instantiateProviderIfNecessary(m);
+ Object obj = instantiateProviderIfNecessary(spFactory);
// any failure in invoking this method would be considered fatal
context = m.invoke(obj, contextPath, classLoader);
}
@@ -228,20 +228,20 @@
}
}
- private static Object instantiateProviderIfNecessary(Method m) throws JAXBException {
- Class<?> declaringClass = m.getDeclaringClass();
+ private static Object instantiateProviderIfNecessary(Class<?> implClass) throws JAXBException {
try {
- if (JAXBContextFactory.class.isAssignableFrom(declaringClass)) {
+ if (JAXBContextFactory.class.isAssignableFrom(implClass)) {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
- return declaringClass.newInstance();
+ return implClass.newInstance();
}
});
}
return null;
- } catch (PrivilegedActionException e) {
- throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, declaringClass, e), e);
+ } catch (PrivilegedActionException x) {
+ Throwable e = (x.getCause() == null) ? x : x.getCause();
+ throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, implClass, e), e);
}
}
@@ -271,7 +271,7 @@
try {
Method m = spFactory.getMethod("createContext", Class[].class, Map.class);
- Object obj = instantiateProviderIfNecessary(m);
+ Object obj = instantiateProviderIfNecessary(spFactory);
Object context = m.invoke(obj, classes, properties);
if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message
@@ -392,7 +392,7 @@
/**
- * first factoryId should be the preffered one,
+ * first factoryId should be the preferred one,
* more of those can be provided to support backwards compatibility
*/
private static String classNameFromPackageProperties(ClassLoader classLoader,
--- a/jdk/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -366,3 +366,4 @@
ee29aaab5889555ea56e4c0ed690aabb7613529d jdk-9+121
981ae344923f09c46d8d1d5a3ed9fa71deafe0c6 jdk-9+122
c40c8739bcdc88892ff58ebee3fd8a3f287be94d jdk-9+123
+7ff61c55b5c6c124592f09b18953222009a204a6 jdk-9+124
--- a/jdk/src/java.base/macosx/native/libjava/java_props_macosx.c Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/macosx/native/libjava/java_props_macosx.c Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -23,10 +23,10 @@
* questions.
*/
-#include <dlfcn.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <objc/objc-runtime.h>
#include <Security/AuthSession.h>
#include <CoreFoundation/CoreFoundation.h>
@@ -35,18 +35,6 @@
#include "java_props_macosx.h"
-// need dlopen/dlsym trick to avoid pulling in JavaRuntimeSupport before libjava.dylib is loaded
-static void *getJRSFramework() {
- static void *jrsFwk = NULL;
-#ifndef STATIC_BUILD
-// JavaRuntimeSupport doesn't support static Java runtimes
- if (jrsFwk == NULL) {
- jrsFwk = dlopen("/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/JavaRuntimeSupport", RTLD_LAZY | RTLD_LOCAL);
- }
-#endif
- return jrsFwk;
-}
-
char *getPosixLocale(int cat) {
char *lc = setlocale(cat, NULL);
if ((lc == NULL) || (strcmp(lc, "C") == 0)) {
@@ -61,18 +49,70 @@
switch (cat) {
case LC_MESSAGES:
{
- void *jrsFwk = getJRSFramework();
- if (jrsFwk == NULL) return NULL;
+ // get preferred language code
+ CFArrayRef languages = CFLocaleCopyPreferredLanguages();
+ if (languages == NULL) {
+ return NULL;
+ }
+ if (CFArrayGetCount(languages) <= 0) {
+ CFRelease(languages);
+ return NULL;
+ }
+
+ CFStringRef primaryLanguage = (CFStringRef)CFArrayGetValueAtIndex(languages, 0);
+ if (primaryLanguage == NULL) {
+ CFRelease(languages);
+ return NULL;
+ }
+ char languageString[LOCALEIDLENGTH];
+ if (CFStringGetCString(primaryLanguage, languageString,
+ LOCALEIDLENGTH, CFStringGetSystemEncoding()) == false) {
+ CFRelease(languages);
+ return NULL;
+ }
+ CFRelease(languages);
- char *(*JRSCopyPrimaryLanguage)() = dlsym(jrsFwk, "JRSCopyPrimaryLanguage");
- char *primaryLanguage = JRSCopyPrimaryLanguage ? JRSCopyPrimaryLanguage() : NULL;
- if (primaryLanguage == NULL) return NULL;
+ // Language IDs use the language designators and (optional) region
+ // and script designators of BCP 47. So possible formats are:
+ //
+ // "en" (language designator only)
+ // "haw" (3-letter lanuage designator)
+ // "en-GB" (language with alpha-2 region designator)
+ // "es-419" (language with 3-digit UN M.49 area code)
+ // "zh-Hans" (language with ISO 15924 script designator)
+ //
+ // In the case of region designators (alpha-2 or UN M.49), we convert
+ // to our locale string format by changing '-' to '_'. That is, if
+ // the '-' is followed by fewer than 4 chars.
+ char* scriptOrRegion = strchr(languageString, '-');
+ if (scriptOrRegion != NULL && strlen(scriptOrRegion) < 5) {
+ *scriptOrRegion = '_';
- char *(*JRSCopyCanonicalLanguageForPrimaryLanguage)(char *) = dlsym(jrsFwk, "JRSCopyCanonicalLanguageForPrimaryLanguage");
- char *canonicalLanguage = JRSCopyCanonicalLanguageForPrimaryLanguage ? JRSCopyCanonicalLanguageForPrimaryLanguage(primaryLanguage) : NULL;
- free (primaryLanguage);
+ assert((strlen(scriptOrRegion) == 3 &&
+ // '-' followed by a 2 character region designator
+ isalpha(scriptOrRegion[1]) &&
+ isalpha(scriptOrRegion[2])) ||
+ (strlen(scriptOrRegion) == 4 &&
+ // '-' followed by a 3-digit UN M.49 area code
+ isdigit(scriptOrRegion[1]) &&
+ isdigit(scriptOrRegion[2]) &&
+ isdigit(scriptOrRegion[3])));
+ }
+ const char* retVal = languageString;
- return canonicalLanguage;
+ // Special case for Portuguese in Brazil:
+ // The language code needs the "_BR" region code (to distinguish it
+ // from Portuguese in Portugal), but this is missing when using the
+ // "Portuguese (Brazil)" language.
+ // If language is "pt" and the current locale is pt_BR, return pt_BR.
+ char localeString[LOCALEIDLENGTH];
+ if (strcmp(retVal, "pt") == 0 &&
+ CFStringGetCString(CFLocaleGetIdentifier(CFLocaleCopyCurrent()),
+ localeString, LOCALEIDLENGTH, CFStringGetSystemEncoding()) &&
+ strcmp(localeString, "pt_BR") == 0) {
+ retVal = localeString;
+ }
+ return strdup(retVal);
}
break;
default:
@@ -92,14 +132,6 @@
char *setupMacOSXLocale(int cat) {
char * ret = getMacOSXLocale(cat);
- if (cat == LC_MESSAGES && ret != NULL) {
- void *jrsFwk = getJRSFramework();
- if (jrsFwk != NULL) {
- void (*JRSSetDefaultLocalization)(char *) = dlsym(jrsFwk, "JRSSetDefaultLocalization");
- if (JRSSetDefaultLocalization) JRSSetDefaultLocalization(ret);
- }
- }
-
if (ret == NULL) {
return getPosixLocale(cat);
} else {
@@ -126,22 +158,35 @@
return 0;
}
+// 10.9 SDK does not include the NSOperatingSystemVersion struct.
+// For now, create our own
+typedef struct {
+ NSInteger majorVersion;
+ NSInteger minorVersion;
+ NSInteger patchVersion;
+} OSVerStruct;
+
void setOSNameAndVersion(java_props_t *sprops) {
- /* Don't rely on JRSCopyOSName because there's no guarantee the value will
- * remain the same, or even if the JRS functions will continue to be part of
- * Mac OS X. So hardcode os_name, and fill in os_version if we can.
- */
+ // Hardcode os_name, and fill in os_version
sprops->os_name = strdup("Mac OS X");
- void *jrsFwk = getJRSFramework();
- if (jrsFwk != NULL) {
- char *(*copyOSVersion)() = dlsym(jrsFwk, "JRSCopyOSVersion");
- if (copyOSVersion != NULL) {
- sprops->os_version = copyOSVersion();
- return;
- }
+ char* osVersionCStr = NULL;
+ // Mac OS 10.9 includes the [NSProcessInfo operatingSystemVersion] function,
+ // but it's not in the 10.9 SDK. So, call it via objc_msgSend_stret.
+ if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)]) {
+ OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret;
+ OSVerStruct osVer = procInfoFn([NSProcessInfo processInfo],
+ @selector(operatingSystemVersion));
+ NSString *nsVerStr = [NSString stringWithFormat:@"%ld.%ld.%ld",
+ (long)osVer.majorVersion, (long)osVer.minorVersion, (long)osVer.patchVersion];
+ // Copy out the char*
+ osVersionCStr = strdup([nsVerStr UTF8String]);
}
- sprops->os_version = strdup("Unknown");
+
+ if (osVersionCStr == NULL) {
+ osVersionCStr = strdup("Unknown");
+ }
+ sprops->os_version = osVersionCStr;
}
--- a/jdk/src/java.base/share/classes/java/io/BufferedInputStream.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/io/BufferedInputStream.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -359,10 +359,10 @@
* See the general contract of the <code>skip</code>
* method of <code>InputStream</code>.
*
- * @exception IOException if the stream does not support seek,
- * or if this input stream has been closed by
- * invoking its {@link #close()} method, or an
- * I/O error occurs.
+ * @throws IOException if this input stream has been closed by
+ * invoking its {@link #close()} method,
+ * {@code in.skip(n)} throws an IOException,
+ * or an I/O error occurs.
*/
public synchronized long skip(long n) throws IOException {
getBufIfOpen(); // Check for closed stream
--- a/jdk/src/java.base/share/classes/java/io/FilterInputStream.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/io/FilterInputStream.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -144,8 +144,7 @@
*
* @param n the number of bytes to be skipped.
* @return the actual number of bytes skipped.
- * @exception IOException if the stream does not support seek,
- * or if some other I/O error occurs.
+ * @throws IOException if {@code in.skip(n)} throws an IOException.
*/
public long skip(long n) throws IOException {
return in.skip(n);
--- a/jdk/src/java.base/share/classes/java/io/InputStream.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -325,7 +325,7 @@
* returns 0, and no bytes are skipped. Subclasses may handle the negative
* value differently.
*
- * <p> The <code>skip</code> method of this class creates a
+ * <p> The <code>skip</code> method implementation of this class creates a
* byte array and then repeatedly reads into it until <code>n</code> bytes
* have been read or the end of the stream has been reached. Subclasses are
* encouraged to provide a more efficient implementation of this method.
@@ -333,8 +333,7 @@
*
* @param n the number of bytes to be skipped.
* @return the actual number of bytes skipped.
- * @exception IOException if the stream does not support seek,
- * or if some other I/O error occurs.
+ * @throws IOException if an I/O error occurs.
*/
public long skip(long n) throws IOException {
--- a/jdk/src/java.base/share/classes/java/io/PushbackInputStream.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/io/PushbackInputStream.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -291,10 +291,10 @@
*
* @param n {@inheritDoc}
* @return {@inheritDoc}
- * @exception IOException if the stream does not support seek,
- * or the stream has been closed by
- * invoking its {@link #close()} method,
- * or an I/O error occurs.
+ * @throws IOException if the stream has been closed by
+ * invoking its {@link #close()} method,
+ * {@code in.skip(n)} throws an IOException,
+ * or an I/O error occurs.
* @see java.io.FilterInputStream#in
* @see java.io.InputStream#skip(long n)
* @since 1.2
--- a/jdk/src/java.base/share/classes/java/lang/ApplicationShutdownHooks.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ApplicationShutdownHooks.java Mon Jun 27 10:00:47 2016 -0700
@@ -102,9 +102,13 @@
hook.start();
}
for (Thread hook : threads) {
- try {
- hook.join();
- } catch (InterruptedException x) { }
+ while (true) {
+ try {
+ hook.join();
+ break;
+ } catch (InterruptedException ignored) {
+ }
+ }
}
}
}
--- a/jdk/src/java.base/share/classes/java/lang/StringUTF16.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StringUTF16.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -259,17 +259,7 @@
@HotSpotIntrinsicCandidate
public static int compareToLatin1(byte[] value, byte[] other) {
- int len1 = length(value);
- int len2 = StringLatin1.length(other);
- int lim = Math.min(len1, len2);
- for (int k = 0; k < lim; k++) {
- char c1 = getChar(value, k);
- char c2 = StringLatin1.getChar(other, k);
- if (c1 != c2) {
- return c1 - c2;
- }
- }
- return len1 - len2;
+ return -StringLatin1.compareToUTF16(other, value);
}
public static int compareToCI(byte[] value, byte[] other) {
@@ -295,25 +285,7 @@
}
public static int compareToCI_Latin1(byte[] value, byte[] other) {
- int len1 = length(value);
- int len2 = StringLatin1.length(other);
- int lim = Math.min(len1, len2);
- for (int k = 0; k < lim; k++) {
- char c1 = getChar(value, k);
- char c2 = StringLatin1.getChar(other, k);
- if (c1 != c2) {
- c1 = Character.toUpperCase(c1);
- c2 = Character.toUpperCase(c2);
- if (c1 != c2) {
- c1 = Character.toLowerCase(c1);
- c2 = Character.toLowerCase(c2);
- if (c1 != c2) {
- return c1 - c2;
- }
- }
- }
- }
- return len1 - len2;
+ return -StringLatin1.compareToCI_UTF16(other, value);
}
public static int hashCode(byte[] value) {
@@ -566,24 +538,7 @@
public static boolean regionMatchesCI_Latin1(byte[] value, int toffset,
byte[] other, int ooffset,
int len) {
- int last = toffset + len;
- while (toffset < last) {
- char c1 = getChar(value, toffset++);
- char c2 = (char)(other[ooffset++] & 0xff);
- if (c1 == c2) {
- continue;
- }
- char u1 = Character.toUpperCase(c1);
- char u2 = Character.toUpperCase(c2);
- if (u1 == u2) {
- continue;
- }
- if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) {
- continue;
- }
- return false;
- }
- return true;
+ return StringLatin1.regionMatchesCI_UTF16(other, ooffset, value, toffset, len);
}
public static String toLowerCase(String str, byte[] value, Locale locale) {
--- a/jdk/src/java.base/share/classes/java/net/MulticastSocket.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/MulticastSocket.java Mon Jun 27 10:00:47 2016 -0700
@@ -300,8 +300,9 @@
*
* @param mcastaddr is the multicast address to join
*
- * @exception IOException if there is an error joining
- * or when the address is not a multicast address.
+ * @exception IOException if there is an error joining, or when the address
+ * is not a multicast address, or the platform does not support
+ * multicasting
* @exception SecurityException if a security manager exists and its
* {@code checkMulticast} method doesn't allow the join.
*
@@ -384,8 +385,9 @@
* {@link MulticastSocket#setInterface(InetAddress)} or
* {@link MulticastSocket#setNetworkInterface(NetworkInterface)}
*
- * @exception IOException if there is an error joining
- * or when the address is not a multicast address.
+ * @exception IOException if there is an error joining, or when the address
+ * is not a multicast address, or the platform does not support
+ * multicasting
* @exception SecurityException if a security manager exists and its
* {@code checkMulticast} method doesn't allow the join.
* @throws IllegalArgumentException if mcastaddr is null or is a
--- a/jdk/src/java.base/share/classes/java/net/URLPermission.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/net/URLPermission.java Mon Jun 27 10:00:47 2016 -0700
@@ -265,8 +265,14 @@
URLPermission that = (URLPermission)p;
- if (!this.methods.get(0).equals("*") &&
- Collections.indexOfSubList(this.methods, that.methods) == -1) {
+ if (this.methods.isEmpty() && !that.methods.isEmpty()) {
+ return false;
+ }
+
+ if (!this.methods.isEmpty() &&
+ !this.methods.get(0).equals("*") &&
+ Collections.indexOfSubList(this.methods,
+ that.methods) == -1) {
return false;
}
@@ -455,15 +461,11 @@
}
private String actions() {
- StringBuilder b = new StringBuilder();
- for (String s : methods) {
- b.append(s);
+ String b = String.join(",", methods);
+ if (!requestHeaders.isEmpty()) {
+ b += ":" + String.join(",", requestHeaders);
}
- b.append(":");
- for (String s : requestHeaders) {
- b.append(s);
- }
- return b.toString();
+ return b;
}
/**
--- a/jdk/src/java.base/share/classes/java/nio/channels/MulticastChannel.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/channels/MulticastChannel.java Mon Jun 27 10:00:47 2016 -0700
@@ -40,10 +40,11 @@
* address.
*
* <p> In the case of a channel to an {@link StandardProtocolFamily#INET IPv4} socket,
- * the underlying operating system supports <a href="http://www.ietf.org/rfc/rfc2236.txt">
- * <i>RFC 2236: Internet Group Management Protocol, Version 2 (IGMPv2)</i></a>.
- * It may optionally support source filtering as specified by <a
- * href="http://www.ietf.org/rfc/rfc3376.txt"> <i>RFC 3376: Internet Group
+ * the underlying operating system optionally supports
+ * <a href="http://www.ietf.org/rfc/rfc2236.txt"> <i>RFC 2236: Internet Group
+ * Management Protocol, Version 2 (IGMPv2)</i></a>. When IGMPv2 is supported then
+ * the operating system may additionally support source filtering as specified by
+ * <a href="http://www.ietf.org/rfc/rfc3376.txt"> <i>RFC 3376: Internet Group
* Management Protocol, Version 3 (IGMPv3)</i></a>.
* For channels to an {@link StandardProtocolFamily#INET6 IPv6} socket, the equivalent
* standards are <a href="http://www.ietf.org/rfc/rfc2710.txt"> <i>RFC 2710:
@@ -167,7 +168,8 @@
* If the channel already has source-specific membership of the
* group on the interface
* @throws UnsupportedOperationException
- * If the channel's socket is not an Internet Protocol socket
+ * If the channel's socket is not an Internet Protocol socket, or
+ * the platform does not support multicasting
* @throws ClosedChannelException
* If this channel is closed
* @throws IOException
@@ -214,8 +216,9 @@
* If the channel is currently a member of the group on the given
* interface to receive all datagrams
* @throws UnsupportedOperationException
- * If the channel's socket is not an Internet Protocol socket or
- * source filtering is not supported
+ * If the channel's socket is not an Internet Protocol socket, or
+ * source filtering is not supported, or the platform does not
+ * support multicasting
* @throws ClosedChannelException
* If this channel is closed
* @throws IOException
--- a/jdk/src/java.base/share/classes/java/util/Formatter.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Formatter.java Mon Jun 27 10:00:47 2016 -0700
@@ -3895,8 +3895,7 @@
TimeZone tz = t.getTimeZone();
sb.append(tz.getDisplayName((t.get(Calendar.DST_OFFSET) != 0),
TimeZone.SHORT,
- Objects.requireNonNullElse(l,
- Locale.getDefault(Locale.Category.FORMAT))));
+ Objects.requireNonNullElse(l, Locale.US)));
break;
}
@@ -3904,8 +3903,7 @@
case DateTime.NAME_OF_DAY_ABBREV: // 'a'
case DateTime.NAME_OF_DAY: { // 'A'
int i = t.get(Calendar.DAY_OF_WEEK);
- Locale lt = Objects.requireNonNullElse(l,
- Locale.getDefault(Locale.Category.FORMAT));
+ Locale lt = Objects.requireNonNullElse(l, Locale.US);
DateFormatSymbols dfs = DateFormatSymbols.getInstance(lt);
if (c == DateTime.NAME_OF_DAY)
sb.append(dfs.getWeekdays()[i]);
@@ -3917,8 +3915,7 @@
case DateTime.NAME_OF_MONTH_ABBREV_X: // 'h' -- same b
case DateTime.NAME_OF_MONTH: { // 'B'
int i = t.get(Calendar.MONTH);
- Locale lt = Objects.requireNonNullElse(l,
- Locale.getDefault(Locale.Category.FORMAT));
+ Locale lt = Objects.requireNonNullElse(l, Locale.US);
DateFormatSymbols dfs = DateFormatSymbols.getInstance(lt);
if (c == DateTime.NAME_OF_MONTH)
sb.append(dfs.getMonths()[i]);
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java Mon Jun 27 10:00:47 2016 -0700
@@ -925,7 +925,6 @@
needInput = true;
return null;
}
-
// Must look for next delims. Simply attempting to match the
// pattern at this point may find a match but it might not be
// the first longest match because of missing input, or it might
@@ -941,16 +940,13 @@
foundNextDelim = matcher.find();
}
if (foundNextDelim) {
- // In two rare cases that more input might cause the match to be
- // lost or change.
- // (1) if requireEnd() is true, more input might cause the match
- // to be lost, we must wait for more input.
- // (2) while hitting the end is okay IF the match does not
- // go away AND the beginning of the next delims does not change
- // (we don't care if they potentially extend further). But it's
- // possible that more input could cause the beginning of the
- // delims change, so have to wait for more input as well.
- if ((matcher.requireEnd() || matcher.hitEnd()) && !sourceClosed) {
+ // In the rare case that more input could cause the match
+ // to be lost and there is more input coming we must wait
+ // for more input. Note that hitting the end is okay as long
+ // as the match cannot go away. It is the beginning of the
+ // next delims we want to be sure about, we don't care if
+ // they potentially extend further.
+ if (matcher.requireEnd() && !sourceClosed) {
needInput = true;
return null;
}
--- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,6 +25,7 @@
package jdk.internal.jrtfs;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemException;
@@ -138,6 +139,15 @@
}
return children;
}
+
+ @Override
+ public long size() {
+ try {
+ return isDirectory() ? 0 : Files.size(path);
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
}
@Override
--- a/jdk/src/java.base/share/classes/sun/net/NetworkClient.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/net/NetworkClient.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -165,8 +165,10 @@
// server & port will be the proxy address and port
s = new Socket(Proxy.NO_PROXY);
}
- } else
+ } else {
s = createSocket();
+ }
+
// Instance specific timeouts do have priority, that means
// connectTimeout & readTimeout (-1 means not set)
// Then global default timeouts
@@ -194,7 +196,7 @@
* to create the socket.
*/
protected Socket createSocket() throws IOException {
- return new java.net.Socket();
+ return new java.net.Socket(Proxy.NO_PROXY); // direct connection
}
protected InetAddress getLocalAddress() throws IOException {
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/netdoc/Handler.java Mon Jun 20 06:13:28 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. 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.
- */
-
-/*-
- * netdoc urls point either into the local filesystem or externally
- * through an http url, with network documents being preferred. Useful for
- * FAQs & other documents which are likely to be changing over time at the
- * central site, and where the user will want the most recent edition.
- *
- * @author Steven B. Byrne
- */
-
-package sun.net.www.protocol.netdoc;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.MalformedURLException;
-import java.net.URLStreamHandler;
-import java.io.InputStream;
-import java.io.IOException;
-import sun.security.action.GetPropertyAction;
-
-public class Handler extends URLStreamHandler {
- static URL base;
-
- /*
- * Attempt to find a load the given url using the default (network)
- * documentation location. If that fails, use the local copy
- */
- public synchronized URLConnection openConnection(URL u)
- throws IOException
- {
- URLConnection uc = null;
- URL ru;
-
- boolean localonly = Boolean.parseBoolean(
- GetPropertyAction.privilegedGetProperty("newdoc.localonly"));
-
- String docurl = GetPropertyAction.privilegedGetProperty("doc.url");
-
- String file = u.getFile();
- if (!localonly) {
- try {
- if (base == null) {
- base = new URL(docurl);
- }
- ru = new URL(base, file);
- } catch (MalformedURLException e) {
- ru = null;
- }
- if (ru != null) {
- uc = ru.openConnection();
- }
- }
-
- if (uc == null) {
- try {
- ru = new URL("file", "~", file);
-
- uc = ru.openConnection();
- InputStream is = uc.getInputStream(); // Check for success.
- } catch (MalformedURLException e) {
- uc = null;
- } catch (IOException e) {
- uc = null;
- }
- }
-
- if (uc == null) {
- throw new IOException("Can't find file for URL: "
- +u.toExternalForm());
- }
- return uc;
- }
-}
--- a/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Mon Jun 27 10:00:47 2016 -0700
@@ -354,8 +354,8 @@
// We wait 250milli quanta, so the minimum wait time
// cannot be under 250milli.
int latch = 0;
- long l = System.currentTimeMillis() + 250;
- while (System.currentTimeMillis() < l) {
+ long startTime = System.nanoTime();
+ while (System.nanoTime() - startTime < 250000000) {
synchronized(this){};
latch++;
}
--- a/jdk/src/java.base/share/classes/sun/util/PropertyResourceBundleCharset.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/util/PropertyResourceBundleCharset.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
-import sun.util.logging.PlatformLogger;
/**
* A Charset implementation for reading PropertyResourceBundle, in order
@@ -94,12 +93,11 @@
return cr;
}
+ // Invalid or unmappable UTF-8 sequence detected.
+ // Switching to the ISO 8859-1 decorder.
+ assert cr.isMalformed() || cr.isUnmappable();
in.reset();
out.reset();
-
- PlatformLogger.getLogger(getClass().getCanonicalName()).info(
- "Invalid or unmappable UTF-8 sequence detected. " +
- "Switching encoding from UTF-8 to ISO-8859-1");
cdISO_8859_1 = StandardCharsets.ISO_8859_1.newDecoder();
return cdISO_8859_1.decode(in, out, false);
}
--- a/jdk/src/java.base/unix/native/libjava/locale_str.h Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.base/unix/native/libjava/locale_str.h Mon Jun 27 10:00:47 2016 -0700
@@ -135,6 +135,16 @@
"sr_SP", "sr_YU",
"tchinese", "zh_TW",
#endif
+#ifdef MACOSX
+ "sr-Latn", "sr_CS", // Mappings as done by old Apple JRS code
+ "tk", "tk-Cyrl",
+ "tt-Latn", "tt-Cyrl",
+ "uz", "uz_UZ",
+ "uz-Arab", "uz_UZ",
+ "uz-Latn", "uz_UZ",
+ "zh-Hans", "zh_CN",
+ "zh-Hant", "zh_TW",
+#endif
"", "",
};
--- a/jdk/src/java.httpclient/share/classes/java/net/http/PlainHttpConnection.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/PlainHttpConnection.java Mon Jun 27 10:00:47 2016 -0700
@@ -128,6 +128,7 @@
this.chan = SocketChannel.open();
int bufsize = client.getReceiveBufferSize();
chan.setOption(StandardSocketOptions.SO_RCVBUF, bufsize);
+ chan.setOption(StandardSocketOptions.TCP_NODELAY, true);
} catch (IOException e) {
throw new InternalError(e);
}
--- a/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/Stream.java Mon Jun 27 10:00:47 2016 -0700
@@ -617,6 +617,7 @@
void sendBodyImpl() throws IOException, InterruptedException {
if (requestContentLen == 0) {
// no body
+ requestSent();
return;
}
DataFrame df;
@@ -667,7 +668,7 @@
responseFlowController); // TODO: filter headers
if (body == null) {
receiveData();
- return processor.onResponseComplete();
+ body = processor.onResponseComplete();
} else
receiveDataAsync(processor);
responseReceived();
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WS.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WS.java Mon Jun 27 10:00:47 2016 -0700
@@ -34,7 +34,6 @@
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Supplier;
-import java.util.stream.Stream;
import static java.lang.System.Logger.Level.ERROR;
import static java.lang.System.Logger.Level.WARNING;
@@ -104,15 +103,6 @@
}
@Override
- public CompletableFuture<WebSocket> sendText(Stream<? extends CharSequence> message) {
- requireNonNull(message, "message");
- synchronized (stateLock) {
- checkState();
- return transmitter.sendText(message);
- }
- }
-
- @Override
public CompletableFuture<WebSocket> sendBinary(ByteBuffer message, boolean isLast) {
requireNonNull(message, "message");
synchronized (stateLock) {
@@ -179,11 +169,11 @@
}
@Override
- public long request(long n) {
+ public void request(long n) {
if (n < 0L) {
throw new IllegalArgumentException("The number must not be negative: " + n);
}
- return receiver.request(n);
+ receiver.request(n);
}
@Override
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSBuilder.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSBuilder.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,6 +25,7 @@
package java.net.http;
import java.net.URI;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -59,8 +60,7 @@
private final LinkedHashMap<String, List<String>> headers = new LinkedHashMap<>();
private final WebSocket.Listener listener;
private Collection<String> subprotocols = Collections.emptyList();
- private long timeout;
- private TimeUnit timeUnit;
+ private Duration timeout;
WSBuilder(URI uri, HttpClient client, WebSocket.Listener listener) {
checkURI(requireNonNull(uri, "uri"));
@@ -93,13 +93,8 @@
}
@Override
- public WebSocket.Builder connectTimeout(long timeout, TimeUnit unit) {
- if (timeout < 0) {
- throw new IllegalArgumentException("Negative timeout: " + timeout);
- }
- requireNonNull(unit, "unit");
- this.timeout = timeout;
- this.timeUnit = unit;
+ public WebSocket.Builder connectTimeout(Duration timeout) {
+ this.timeout = requireNonNull(timeout, "timeout");
return this;
}
@@ -139,9 +134,7 @@
return new ArrayList<>(subprotocols);
}
- long getTimeout() { return timeout; }
-
- TimeUnit getTimeUnit() { return timeUnit; }
+ Duration getConnectTimeout() { return timeout; }
private static Collection<String> checkSubprotocols(String mostPreferred,
String... lesserPreferred) {
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSFrameConsumer.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSFrameConsumer.java Mon Jun 27 10:00:47 2016 -0700
@@ -206,7 +206,7 @@
boolean binaryNonEmpty = data.hasRemaining();
WSShared<CharBuffer> textData;
try {
- textData = decoder.decode(data, part.isLast());
+ textData = decoder.decode(data, part == MessagePart.WHOLE || part == MessagePart.LAST);
} catch (CharacterCodingException e) {
throw new WSProtocolException
("5.6.", "Invalid UTF-8 sequence in frame " + opcode, NOT_CONSISTENT, e);
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSMessageSender.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSMessageSender.java Mon Jun 27 10:00:47 2016 -0700
@@ -30,7 +30,6 @@
import java.net.http.WSOutgoingMessage.Close;
import java.net.http.WSOutgoingMessage.Ping;
import java.net.http.WSOutgoingMessage.Pong;
-import java.net.http.WSOutgoingMessage.StreamedText;
import java.net.http.WSOutgoingMessage.Text;
import java.net.http.WSOutgoingMessage.Visitor;
import java.nio.ByteBuffer;
@@ -123,11 +122,6 @@
}
@Override
- public void visit(StreamedText streamedText) {
- throw new IllegalArgumentException("Not yet implemented");
- }
-
- @Override
public void visit(Binary message) {
buffers[1] = message.bytes;
int mask = random.nextInt();
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSOpeningHandshake.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSOpeningHandshake.java Mon Jun 27 10:00:47 2016 -0700
@@ -32,11 +32,14 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -77,8 +80,12 @@
WSOpeningHandshake(WSBuilder b) {
URI httpURI = createHttpUri(b.getUri());
HttpRequest.Builder requestBuilder = b.getClient().request(httpURI);
- if (b.getTimeUnit() != null) {
- requestBuilder.timeout(b.getTimeUnit(), b.getTimeout());
+ Duration connectTimeout = b.getConnectTimeout();
+ if (connectTimeout != null) {
+ requestBuilder.timeout(
+ TimeUnit.of(ChronoUnit.MILLIS),
+ connectTimeout.get(ChronoUnit.MILLIS)
+ );
}
Collection<String> s = b.getSubprotocols();
if (!s.isEmpty()) {
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSOutgoingMessage.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSOutgoingMessage.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,13 +25,11 @@
package java.net.http;
import java.nio.ByteBuffer;
-import java.util.stream.Stream;
abstract class WSOutgoingMessage {
interface Visitor {
void visit(Text message);
- void visit(StreamedText message);
void visit(Binary message);
void visit(Ping message);
void visit(Pong message);
@@ -64,25 +62,6 @@
}
}
- static final class StreamedText extends WSOutgoingMessage {
-
- public final Stream<? extends CharSequence> characters;
-
- StreamedText(Stream<? extends CharSequence> characters) {
- this.characters = characters;
- }
-
- @Override
- void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- @Override
- public String toString() {
- return WSUtils.toStringSimple(this) + "[characters=" + characters + "]";
- }
- }
-
static final class Binary extends WSOutgoingMessage {
public final boolean isLast;
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSReceiver.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSReceiver.java Mon Jun 27 10:00:47 2016 -0700
@@ -101,11 +101,10 @@
}
}
- long request(long n) {
+ void request(long n) {
long newDemand = demand.accumulateAndGet(n, (p, i) -> p + i < 0 ? Long.MAX_VALUE : p + i);
handler.signal();
assert newDemand >= 0 : newDemand;
- return newDemand;
}
private boolean getData() throws IOException {
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WSTransmitter.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WSTransmitter.java Mon Jun 27 10:00:47 2016 -0700
@@ -28,7 +28,6 @@
import java.net.http.WSOutgoingMessage.Close;
import java.net.http.WSOutgoingMessage.Ping;
import java.net.http.WSOutgoingMessage.Pong;
-import java.net.http.WSOutgoingMessage.StreamedText;
import java.net.http.WSOutgoingMessage.Text;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -40,7 +39,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.function.Consumer;
-import java.util.stream.Stream;
import static java.lang.String.format;
import static java.net.http.Pair.pair;
@@ -83,11 +81,6 @@
return acceptMessage(new Text(isLast, message));
}
- CompletableFuture<WebSocket> sendText(Stream<? extends CharSequence> message) {
- checkAndUpdateText(true);
- return acceptMessage(new StreamedText(message));
- }
-
CompletableFuture<WebSocket> sendBinary(ByteBuffer message, boolean isLast) {
checkAndUpdateBinary(isLast);
return acceptMessage(new Binary(isLast, message));
--- a/jdk/src/java.httpclient/share/classes/java/net/http/WebSocket.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/java/net/http/WebSocket.java Mon Jun 27 10:00:47 2016 -0700
@@ -28,13 +28,11 @@
import java.net.ProtocolException;
import java.net.URI;
import java.nio.ByteBuffer;
+import java.time.Duration;
import java.util.Map;
-import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Stream;
/**
* A WebSocket client conforming to RFC 6455.
@@ -47,8 +45,9 @@
* receive messages. When the {@code WebSocket} is no longer
* needed it must be closed: a Close message must both be {@linkplain
* #sendClose() sent} and {@linkplain Listener#onClose(WebSocket, Optional,
- * String) received}. Or to close abruptly, {@link #abort()} is called. Once
- * closed it remains closed, cannot be reopened.
+ * String) received}. Otherwise, invoke {@link #abort() abort} to close abruptly.
+ *
+ * <p> Once closed the {@code WebSocket} remains closed and cannot be reopened.
*
* <p> Messages of type {@code X} are sent through the {@code WebSocket.sendX}
* methods and received through {@link WebSocket.Listener}{@code .onX} methods
@@ -71,10 +70,6 @@
* arranged from the {@code buffer}'s {@link ByteBuffer#position() position} to
* the {@code buffer}'s {@link ByteBuffer#limit() limit}.
*
- * <p> All message exchange is run by the threads belonging to the {@linkplain
- * HttpClient#executorService() executor service} of {@code WebSocket}'s {@link
- * HttpClient}.
- *
* <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method of this type will cause a {@link NullPointerException
* NullPointerException} to be thrown.
@@ -217,22 +212,17 @@
* Sets a timeout for the opening handshake.
*
* <p> If the opening handshake is not finished within the specified
- * timeout then {@link #buildAsync()} completes exceptionally with a
- * {@code HttpTimeoutException}.
+ * amount of time then {@link #buildAsync()} completes exceptionally
+ * with a {@code HttpTimeoutException}.
*
- * <p> If the timeout is not specified then it's deemed infinite.
+ * <p> If this method is not invoked then the timeout is deemed infinite.
*
* @param timeout
- * the maximum time to wait
- * @param unit
- * the time unit of the timeout argument
+ * the timeout
*
* @return this builder
- *
- * @throws IllegalArgumentException
- * if the {@code timeout} is negative
*/
- Builder connectTimeout(long timeout, TimeUnit unit);
+ Builder connectTimeout(Duration timeout);
/**
* Builds a {@code WebSocket}.
@@ -506,7 +496,7 @@
* <p> Once a Close message is received, the server will not send any
* more messages.
*
- * <p> A Close message may consist of a close code and a reason for
+ * <p> A Close message may consist of a status code and a reason for
* closing. The reason will have a UTF-8 representation not longer than
* {@code 123} bytes. The reason may be useful for debugging or passing
* information relevant to the connection but is not necessarily human
@@ -545,12 +535,8 @@
* the time {@code onError} is invoked, no more messages can be sent on
* this {@code WebSocket}.
*
- * @apiNote Errors associated with send operations ({@link
- * WebSocket#sendText(CharSequence, boolean) sendText}, {@link
- * #sendBinary(ByteBuffer, boolean) sendBinary}, {@link
- * #sendPing(ByteBuffer) sendPing}, {@link #sendPong(ByteBuffer)
- * sendPong} and {@link #sendClose(CloseCode, CharSequence) sendClose})
- * are reported to the {@code CompletionStage} operations return.
+ * @apiNote Errors associated with {@code sendX} methods are reported to
+ * the {@code CompletableFuture} these methods return.
*
* @implSpec The default implementation does nothing.
*
@@ -563,8 +549,8 @@
}
/**
- * A marker used by {@link WebSocket.Listener} for partial message
- * receiving.
+ * A marker used by {@link WebSocket.Listener} in cases where a partial
+ * message may be received.
*
* @since 9
*/
@@ -586,19 +572,9 @@
LAST,
/**
- * A whole message. The message consists of a single part.
+ * A whole message consisting of a single part.
*/
- WHOLE;
-
- /**
- * Tells whether a part of a message received with this marker is the
- * last part.
- *
- * @return {@code true} if LAST or WHOLE, {@code false} otherwise
- */
- public boolean isLast() {
- return this == LAST || this == WHOLE;
- }
+ WHOLE
}
/**
@@ -630,7 +606,7 @@
* @param message
* the message
* @param isLast
- * {@code true} if this is the final part of the message,
+ * {@code true} if this is the last part of the message,
* {@code false} otherwise
*
* @return a CompletableFuture with this WebSocket
@@ -679,43 +655,6 @@
}
/**
- * Sends a whole Text message with characters from {@code
- * CharacterSequence}s provided by the given {@code Stream}.
- *
- * <p> This is a convenience method. For the general case use {@link
- * #sendText(CharSequence, boolean)}.
- *
- * <p> Returns a {@code CompletableFuture<WebSocket>} which completes
- * normally when the message has been sent or completes exceptionally if an
- * error occurs.
- *
- * <p> Streamed character sequences should not be modified until the
- * returned {@code CompletableFuture} completes (either normally or
- * exceptionally).
- *
- * <p> The returned {@code CompletableFuture} can complete exceptionally
- * with:
- * <ul>
- * <li> {@link IOException}
- * if an I/O error occurs during this operation
- * <li> {@link IllegalStateException}
- * if the {@code WebSocket} closes while this operation is in progress;
- * or if a Close message has been sent already;
- * or if there is an outstanding send operation;
- * or if a previous Binary message was not sent with {@code isLast == true}
- * </ul>
- *
- * @param message
- * the message
- *
- * @return a CompletableFuture with this WebSocket
- *
- * @throws IllegalArgumentException
- * if {@code message} is a malformed (or an incomplete) UTF-16 sequence
- */
- CompletableFuture<WebSocket> sendText(Stream<? extends CharSequence> message);
-
- /**
* Sends a Binary message with bytes from the given {@code ByteBuffer}.
*
* <p> Returns a {@code CompletableFuture<WebSocket>} which completes
@@ -737,7 +676,7 @@
* @param message
* the message
* @param isLast
- * {@code true} if this is the final part of the message,
+ * {@code true} if this is the last part of the message,
* {@code false} otherwise
*
* @return a CompletableFuture with this WebSocket
@@ -745,43 +684,6 @@
CompletableFuture<WebSocket> sendBinary(ByteBuffer message, boolean isLast);
/**
- * Sends a Binary message with bytes from the given {@code byte[]}.
- *
- * <p> Returns a {@code CompletableFuture<WebSocket>} which completes
- * normally when the message has been sent or completes exceptionally if an
- * error occurs.
- *
- * <p> The returned {@code CompletableFuture} can complete exceptionally
- * with:
- * <ul>
- * <li> {@link IOException}
- * if an I/O error occurs during this operation
- * <li> {@link IllegalStateException}
- * if the {@code WebSocket} closes while this operation is in progress;
- * or if a Close message has been sent already;
- * or if there is an outstanding send operation;
- * or if a previous Text message was not sent with {@code isLast == true}
- * </ul>
- *
- * @implSpec This is equivalent to:
- * <pre>{@code
- * sendBinary(ByteBuffer.wrap(message), isLast)
- * }</pre>
- *
- * @param message
- * the message
- * @param isLast
- * {@code true} if this is the final part of the message,
- * {@code false} otherwise
- *
- * @return a CompletableFuture with this WebSocket
- */
- default CompletableFuture<WebSocket> sendBinary(byte[] message, boolean isLast) {
- Objects.requireNonNull(message, "message");
- return sendBinary(ByteBuffer.wrap(message), isLast);
- }
-
- /**
* Sends a Ping message.
*
* <p> Returns a {@code CompletableFuture<WebSocket>} which completes
@@ -858,10 +760,11 @@
* normally when the message has been sent or completes exceptionally if an
* error occurs.
*
- * <p> A Close message may consist of a close code and a reason for closing.
- * The reason must have a valid UTF-8 representation not longer than {@code
- * 123} bytes. The reason may be useful for debugging or passing information
- * relevant to the connection but is not necessarily human readable.
+ * <p> A Close message may consist of a status code and a reason for
+ * closing. The reason must have a UTF-8 representation not longer than
+ * {@code 123} bytes. The reason may be useful for debugging or passing
+ * information relevant to the connection but is not necessarily human
+ * readable.
*
* <p> The returned {@code CompletableFuture} can complete exceptionally
* with:
@@ -910,24 +813,21 @@
CompletableFuture<WebSocket> sendClose();
/**
- * Requests {@code n} more messages to be received by the {@link Listener
+ * Allows {@code n} more messages to be received by the {@link Listener
* Listener}.
*
- * <p> The actual number might be fewer if either of the endpoints decide to
- * close the connection before that or an error occurs.
+ * <p> The actual number of received messages might be fewer if a Close
+ * message is received, the connection closes or an error occurs.
*
* <p> A {@code WebSocket} that has just been created, hasn't requested
* anything yet. Usually the initial request for messages is done in {@link
* Listener#onOpen(java.net.http.WebSocket) Listener.onOpen}.
*
- * If all requested messages have been received, and the server sends more,
- * then these messages are queued.
- *
* @implNote This implementation does not distinguish between partial and
* whole messages, because it's not known beforehand how a message will be
* received.
*
- * <p> If a server sends more messages than requested, the implementation
+ * <p> If a server sends more messages than requested, this implementation
* queues up these messages on the TCP connection and may eventually force
* the sender to stop sending through TCP flow control.
*
@@ -936,12 +836,8 @@
*
* @throws IllegalArgumentException
* if {@code n < 0}
- *
- * @return resulting unfulfilled demand with this request taken into account
*/
- // TODO return void as it's breaking encapsulation (leaking info when exactly something deemed delivered)
- // or demand behaves after LONG.MAX_VALUE
- long request(long n);
+ void request(long n);
/**
* Returns a {@linkplain Builder#subprotocols(String, String...) subprotocol}
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/DigestClientId.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/DigestClientId.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -60,7 +60,6 @@
final private String[] propvals;
final private int myHash;
- private int pHash = 0;
DigestClientId(int version, String hostname, int port,
String protocol, Control[] bindCtls, OutputStream trace,
@@ -78,12 +77,9 @@
propvals = new String[SASL_PROPS.length];
for (int i = 0; i < SASL_PROPS.length; i++) {
propvals[i] = (String) env.get(SASL_PROPS[i]);
- if (propvals[i] != null) {
- pHash = pHash * 31 + propvals[i].hashCode();
- }
}
}
- myHash = super.hashCode() + pHash;
+ myHash = super.hashCode() ^ Arrays.hashCode(propvals);
}
public boolean equals(Object obj) {
@@ -92,7 +88,6 @@
}
DigestClientId other = (DigestClientId)obj;
return myHash == other.myHash
- && pHash == other.pHash
&& super.equals(obj)
&& Arrays.equals(propvals, other.propvals);
}
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/SimpleClientId.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/SimpleClientId.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -49,21 +49,23 @@
socketFactory);
this.username = username;
+ int pwdHashCode = 0;
if (passwd == null) {
this.passwd = null;
- } else if (passwd instanceof String) {
- this.passwd = passwd;
} else if (passwd instanceof byte[]) {
this.passwd = ((byte[])passwd).clone();
+ pwdHashCode = Arrays.hashCode((byte[])passwd);
} else if (passwd instanceof char[]) {
this.passwd = ((char[])passwd).clone();
+ pwdHashCode = Arrays.hashCode((char[])passwd);
} else {
this.passwd = passwd;
+ pwdHashCode = passwd.hashCode();
}
myHash = super.hashCode()
- + (username != null ? username.hashCode() : 0)
- + (passwd != null ? passwd.hashCode() : 0);
+ ^ (username != null ? username.hashCode() : 0)
+ ^ pwdHashCode;
}
public boolean equals(Object obj) {
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/PKCS11.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/PKCS11.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -54,6 +54,8 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
+import sun.security.util.Debug;
+
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
/**
@@ -85,7 +87,8 @@
return null;
}
});
- initializeLibrary();
+ boolean enableDebug = Debug.getInstance("sunpkcs11") != null;
+ initializeLibrary(enableDebug);
}
public static void loadNative() {
@@ -109,7 +112,7 @@
* @preconditions
* @postconditions
*/
- private static native void initializeLibrary();
+ private static native void initializeLibrary(boolean debug);
// XXX
/**
--- a/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_general.c Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_general.c Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -73,6 +73,8 @@
JavaVM* jvm = NULL;
+jboolean debug = 0;
+
JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved) {
jvm = vm;
return JNI_VERSION_1_4;
@@ -92,7 +94,7 @@
*/
JNIEXPORT void JNICALL
Java_sun_security_pkcs11_wrapper_PKCS11_initializeLibrary
-(JNIEnv *env, jclass thisClass)
+(JNIEnv *env, jclass thisClass, jboolean enableDebug)
{
#ifndef NO_CALLBACKS
if (notifyListLock == NULL) {
@@ -101,6 +103,7 @@
#endif
prefetchFields(env, thisClass);
+ debug = enableDebug;
}
jclass fetchClass(JNIEnv *env, const char *name) {
--- a/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_keymgmt.c Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_keymgmt.c Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -152,6 +152,8 @@
CK_OBJECT_HANDLE_PTR ckpKeyHandles; /* pointer to array with Public and Private Key */
jlongArray jKeyHandles = NULL;
CK_RV rv;
+ int attempts;
+ const int MAX_ATTEMPTS = 3;
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
if (ckpFunctions == NULL) { return NULL; }
@@ -190,10 +192,35 @@
return NULL;
}
- rv = (*ckpFunctions->C_GenerateKeyPair)(ckSessionHandle, &ckMechanism,
- ckpPublicKeyAttributes, ckPublicKeyAttributesLength,
- ckpPrivateKeyAttributes, ckPrivateKeyAttributesLength,
- ckpPublicKeyHandle, ckpPrivateKeyHandle);
+ /*
+ * Workaround for NSS bug 1012786:
+ *
+ * Key generation may fail with CKR_FUNCTION_FAILED error
+ * if there is insufficient entropy to generate a random key.
+ *
+ * PKCS11 spec says the following about CKR_FUNCTION_FAILED error
+ * (see section 11.1.1):
+ *
+ * ... In any event, although the function call failed, the situation
+ * is not necessarily totally hopeless, as it is likely to be
+ * when CKR_GENERAL_ERROR is returned. Depending on what the root cause of
+ * the error actually was, it is possible that an attempt
+ * to make the exact same function call again would succeed.
+ *
+ * Call C_GenerateKeyPair() several times if CKR_FUNCTION_FAILED occurs.
+ */
+ for (attempts = 0; attempts < MAX_ATTEMPTS; attempts++) {
+ rv = (*ckpFunctions->C_GenerateKeyPair)(ckSessionHandle, &ckMechanism,
+ ckpPublicKeyAttributes, ckPublicKeyAttributesLength,
+ ckpPrivateKeyAttributes, ckPrivateKeyAttributesLength,
+ ckpPublicKeyHandle, ckpPrivateKeyHandle);
+ if (rv == CKR_FUNCTION_FAILED) {
+ printDebug("C_1GenerateKeyPair(): C_GenerateKeyPair() failed \
+ with CKR_FUNCTION_FAILED error, try again\n");
+ } else {
+ break;
+ }
+ }
if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) {
jKeyHandles = ckULongArrayToJLongArray(env, ckpKeyHandles, 2);
--- a/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_util.c Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/p11_util.c Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -1143,3 +1143,15 @@
#endif
+// prints a message to stdout if debug output is enabled
+void printDebug(const char *format, ...) {
+ if (debug == JNI_TRUE) {
+ va_list args;
+ fprintf(stdout, "sunpkcs11: ");
+ va_start(args, format);
+ vfprintf(stdout, format, args);
+ va_end(args);
+ fflush(stdout);
+ }
+}
+
--- a/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/pkcs11wrapper.h Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/native/libj2pkcs11/pkcs11wrapper.h Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -159,6 +159,7 @@
#include "pkcs-11v2-20a3.h"
#include <jni.h>
#include <jni_util.h>
+#include <stdarg.h>
#define MAX_STACK_BUFFER_LEN (4 * 1024)
#define MAX_HEAP_BUFFER_LEN (64 * 1024)
@@ -217,6 +218,10 @@
#define TRACE_UNINTEND
#endif
+/* debug output */
+extern jboolean debug;
+void printDebug(const char *format, ...);
+
#define CK_ASSERT_OK 0L
#define CLASS_INFO "sun/security/pkcs11/wrapper/CK_INFO"
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/JImageTask.java Mon Jun 27 10:00:47 2016 -0700
@@ -54,8 +54,8 @@
}, "--dir"),
new Option<JImageTask>(true, (task, option, arg) -> {
- task.options.filters = arg;
- }, "--filter"),
+ task.options.include = arg;
+ }, "--include"),
new Option<JImageTask>(false, (task, option, arg) -> {
task.options.fullVersion = true;
@@ -81,12 +81,12 @@
private static final FileSystem JRT_FILE_SYSTEM = Utils.jrtFileSystem();
private final OptionsValues options;
- private final List<Predicate<String>> filterPredicates;
+ private final List<Predicate<String>> includePredicates;
private PrintWriter log;
JImageTask() {
this.options = new OptionsValues();
- this.filterPredicates = new ArrayList<>();
+ this.includePredicates = new ArrayList<>();
log = null;
}
@@ -98,7 +98,7 @@
static class OptionsValues {
Task task = Task.LIST;
String directory = ".";
- String filters = "";
+ String include = "";
boolean fullVersion;
boolean help;
boolean verbose;
@@ -200,6 +200,8 @@
log.println(TASK_HELPER.getMessage("main.opt." + name));
}
+
+ log.println(TASK_HELPER.getMessage("main.opt.footer"));
} else {
try {
log.println(TASK_HELPER.getMessage("main.usage." +
@@ -219,7 +221,7 @@
}
}
- processFilter(options.filters);
+ processInclude(options.include);
return run() ? EXIT_OK : EXIT_ERROR;
} catch (BadArgs e) {
@@ -239,15 +241,15 @@
}
}
- private void processFilter(String filters) {
- if (filters.isEmpty()) {
+ private void processInclude(String include) {
+ if (include.isEmpty()) {
return;
}
- for (String filter : filters.split(",")) {
+ for (String filter : include.split(",")) {
final PathMatcher matcher = Utils.getPathMatcher(JRT_FILE_SYSTEM, filter);
Predicate<String> predicate = (path) -> matcher.matches(JRT_FILE_SYSTEM.getPath(path));
- filterPredicates.add(predicate);
+ includePredicates.add(predicate);
}
}
@@ -388,9 +390,9 @@
String oldModule = "";
for (String name : entryNames) {
- boolean match = filterPredicates.isEmpty();
+ boolean match = includePredicates.isEmpty();
- for (Predicate<String> predicate : filterPredicates) {
+ for (Predicate<String> predicate : includePredicates) {
if (predicate.test(name)) {
match = true;
break;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties Mon Jun 27 10:00:47 2016 -0700
@@ -62,9 +62,19 @@
main.opt.dir=\
\ --dir Target directory for extract directive
-main.opt.filter=\
-\ --filter Filter entries for list or extract\n\
-\ Ex. /java.base/*, */module-info.class
+main.opt.include=\
+\ --include <pattern-list> Pattern list for filtering list or extract entries.
+
+main.opt.footer=\
+\n\
+\For options requiring a <pattern-list>, the value will be a comma\
+\ separated list of elements each using one the following forms:\n\
+\ <glob-pattern>\n\
+\ glob:<glob-pattern>\n\
+\ regex:<regex-pattern>\n\
+\ @<filename> where filename is the name of a file containing patterns to be\
+\ used, one pattern per line\n\
+
main.opt.fullversion=\
\ --fullversion Print full version information
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/AbstractModuleEntry.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.tools.jlink.internal;
+
+import java.io.InputStream;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ModuleEntry;
+
+/**
+ * A LinkModuleEntry is the elementary unit of data inside an image. It is
+ * generally a file. e.g.: a java class file, a resource file, a shared library,
+ * ...
+ * <br>
+ * A LinkModuleEntry is identified by a path of the form:
+ * <ul>
+ * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
+ * name}</li>
+ * <li>For other files (shared lib, launchers, config, ...):/{module name}/
+ * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
+ * </ul>
+ */
+abstract class AbstractModuleEntry implements ModuleEntry {
+ private final String path;
+ private final String module;
+ private final Type type;
+
+ /**
+ * Create a new AbstractModuleEntry.
+ *
+ * @param module The module name.
+ * @param path The data path identifier.
+ * @param type The data type.
+ */
+ AbstractModuleEntry(String module, String path, Type type) {
+ this.module = Objects.requireNonNull(module);
+ this.path = Objects.requireNonNull(path);
+ this.type = Objects.requireNonNull(type);
+ }
+
+ @Override
+ public final String getModule() {
+ return module;
+ }
+
+ @Override
+ public final String getPath() {
+ return path;
+ }
+
+ @Override
+ public final Type getType() {
+ return type;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 89 * hash + Objects.hashCode(this.path);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof AbstractModuleEntry)) {
+ return false;
+ }
+ AbstractModuleEntry f = (AbstractModuleEntry) other;
+ return f.path.equals(path);
+ }
+
+ @Override
+ public String toString() {
+ return getPath();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ArchiveEntryModuleEntry.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.tools.jlink.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ModuleEntry;
+
+/**
+ * A ModuleEntry backed by a given Archive Entry.
+ */
+final class ArchiveEntryModuleEntry extends AbstractModuleEntry {
+ private final Archive.Entry entry;
+
+ /**
+ * Create a new ArchiveModuleEntry.
+ *
+ * @param module The module name.
+ * @param path The data path identifier.
+ * @param entry The archive Entry.
+ */
+ ArchiveEntryModuleEntry(String module, String path, Archive.Entry entry) {
+ super(module, path, getImageFileType(entry));
+ this.entry = entry;
+ }
+
+ @Override
+ public InputStream stream() {
+ try {
+ return entry.stream();
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
+
+ @Override
+ public long getLength() {
+ return entry.size();
+ }
+
+ private static ModuleEntry.Type getImageFileType(Archive.Entry entry) {
+ Objects.requireNonNull(entry);
+ switch(entry.type()) {
+ case CLASS_OR_RESOURCE:
+ return ModuleEntry.Type.CLASS_OR_RESOURCE;
+ case CONFIG:
+ return ModuleEntry.Type.CONFIG;
+ case NATIVE_CMD:
+ return ModuleEntry.Type.NATIVE_CMD;
+ case NATIVE_LIB:
+ return ModuleEntry.Type.NATIVE_LIB;
+ default:
+ return ModuleEntry.Type.OTHER;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ByteArrayModuleEntry.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.tools.jlink.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ModuleEntry;
+
+/**
+ * A ModuleEntry backed by a given byte[].
+ */
+class ByteArrayModuleEntry extends AbstractModuleEntry {
+ private final byte[] buffer;
+
+ /**
+ * Create a new ByteArrayModuleEntry.
+ *
+ * @param module The module name.
+ * @param path The data path identifier.
+ * @param type The data type.
+ * @param buf The byte buffer.
+ */
+ ByteArrayModuleEntry(String module, String path, Type type, byte[] buffer) {
+ super(module, path, type);
+ this.buffer = Objects.requireNonNull(buffer);
+ }
+
+ @Override
+ public byte[] getBytes() {
+ return buffer.clone();
+ }
+
+ @Override
+ public InputStream stream() {
+ return new ByteArrayInputStream(buffer);
+ }
+
+ @Override
+ public void write(OutputStream out) {
+ try {
+ out.write(buffer);
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
+
+ @Override
+ public long getLength() {
+ return buffer.length;
+ }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Mon Jun 27 10:00:47 2016 -0700
@@ -233,8 +233,7 @@
// write module content
for (ModuleEntry res : content) {
- byte[] buf = res.getBytes();
- out.write(buf, 0, buf.length);
+ res.write(out);
}
tree.addContent(out);
@@ -244,21 +243,6 @@
return resultResources;
}
- private static ModuleEntry.Type mapImageFileType(EntryType type) {
- switch(type) {
- case CONFIG: {
- return ModuleEntry.Type.CONFIG;
- }
- case NATIVE_CMD: {
- return ModuleEntry.Type.NATIVE_CMD;
- }
- case NATIVE_LIB: {
- return ModuleEntry.Type.NATIVE_LIB;
- }
- }
- return null;
- }
-
private static ModulePoolImpl createPools(Set<Archive> archives,
Map<String, List<Entry>> entriesForModule,
ByteOrder byteOrder,
@@ -278,34 +262,22 @@
for (Archive archive : archives) {
String mn = archive.moduleName();
for (Entry entry : entriesForModule.get(mn)) {
-
+ String path;
if (entry.type() == EntryType.CLASS_OR_RESOURCE) {
// Removal of "classes/" radical.
- String path = entry.name();
- try (InputStream stream = entry.stream()) {
- byte[] bytes = readAllBytes(stream);
- if (path.endsWith("module-info.class")) {
- path = "/" + path;
- } else {
- path = "/" + mn + "/" + path;
- }
- try {
- resources.add(ModuleEntry.create(path, bytes));
- } catch (Exception ex) {
- throw new IOException(ex);
- }
+ path = entry.name();
+ if (path.endsWith("module-info.class")) {
+ path = "/" + path;
+ } else {
+ path = "/" + mn + "/" + path;
}
} else {
- try {
- // Entry.path() contains the kind of file native, conf, bin, ...
- // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg
- resources.add(ModuleEntry.create(mn,
- "/" + mn + "/" + entry.path(), mapImageFileType(entry.type()),
- entry.stream(), entry.size()));
- } catch (Exception ex) {
- throw new IOException(ex);
- }
+ // Entry.path() contains the kind of file native, conf, bin, ...
+ // Keep it to avoid naming conflict (eg: native/jvm.cfg and config/jvm.cfg
+ path = "/" + mn + "/" + entry.path();
}
+
+ resources.add(new ArchiveEntryModuleEntry(mn, path, entry));
}
}
return resources;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java Mon Jun 27 10:00:47 2016 -0700
@@ -101,7 +101,7 @@
List<Plugin> orderedPlugins = PluginOrderingGraph.sort(entry.getValue());
Category category = entry.getKey();
for (Plugin p : orderedPlugins) {
- if (Utils.isPostProcessor(category)) {
+ if (category.isPostProcessor()) {
@SuppressWarnings("unchecked")
PostProcessorPlugin pp = (PostProcessorPlugin) p;
postProcessingPlugins.add(pp);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java Mon Jun 27 10:00:47 2016 -0700
@@ -443,9 +443,7 @@
byte[] bytes = decompressor.decompressResource(getByteOrder(),
(int offset) -> pool.getStringTable().getString(offset),
res.getBytes());
- res = ModuleEntry.create(res.getPath(),
- new ByteArrayInputStream(bytes),
- bytes.length);
+ res = res.create(bytes);
} catch (IOException ex) {
throw new PluginException(ex);
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Mon Jun 27 10:00:47 2016 -0700
@@ -39,15 +39,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Date;
-import java.util.Formatter;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
import jdk.internal.module.ConfigurableModuleFinder;
@@ -96,11 +88,9 @@
}, "--help"),
new Option<JlinkTask>(true, (task, opt, arg) -> {
String[] dirs = arg.split(File.pathSeparator);
- task.options.modulePath = new Path[dirs.length];
- int i = 0;
- for (String dir : dirs) {
- task.options.modulePath[i++] = Paths.get(dir);
- }
+ Arrays.stream(dirs)
+ .map(Paths::get)
+ .forEach(task.options.modulePath::add);
}, "--modulepath", "--mp"),
new Option<JlinkTask>(true, (task, opt, arg) -> {
for (String mn : arg.split(",")) {
@@ -176,7 +166,7 @@
String saveoptsfile;
boolean version;
boolean fullVersion;
- Path[] modulePath;
+ List<Path> modulePath = new ArrayList<>();
Set<String> limitMods = new HashSet<>();
Set<String> addMods = new HashSet<>();
Path output;
@@ -186,7 +176,7 @@
int run(String[] args) {
if (log == null) {
- setLog(new PrintWriter(System.err, true));
+ setLog(new PrintWriter(System.out, true));
}
try {
optionsHelper.handleOptions(this, args);
@@ -203,7 +193,7 @@
return EXIT_OK;
}
if (taskHelper.getExistingImage() == null) {
- if (options.modulePath == null || options.modulePath.length == 0) {
+ if (options.modulePath == null || options.modulePath.isEmpty()) {
throw taskHelper.newBadArgs("err.modulepath.must.be.specified").showUsage(true);
}
createImage();
@@ -245,7 +235,7 @@
* Jlink API entry point.
*/
public static void createImage(JlinkConfiguration config,
- PluginsConfiguration plugins)
+ PluginsConfiguration plugins)
throws Exception {
Objects.requireNonNull(config);
Objects.requireNonNull(config.getOutput());
@@ -254,10 +244,9 @@
if (config.getModulepaths().isEmpty()) {
throw new Exception("Empty module paths");
}
- Path[] arr = new Path[config.getModulepaths().size()];
- arr = config.getModulepaths().toArray(arr);
+
ModuleFinder finder
- = newModuleFinder(arr, config.getLimitmods(), config.getModules());
+ = newModuleFinder(config.getModulepaths(), config.getLimitmods(), config.getModules());
// First create the image provider
ImageProvider imageProvider
@@ -332,10 +321,12 @@
return addMods;
}
- private static ModuleFinder newModuleFinder(Path[] paths,
- Set<String> limitMods,
- Set<String> addMods) {
- ModuleFinder finder = ModuleFinder.of(paths);
+ public static ModuleFinder newModuleFinder(List<Path> paths,
+ Set<String> limitMods,
+ Set<String> addMods)
+ {
+
+ ModuleFinder finder = ModuleFinder.of(paths.toArray(new Path[0]));
// jmods are located at link-time
if (finder instanceof ConfigurableModuleFinder) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModuleEntryFactory.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.tools.jlink.internal;
+
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ModuleEntry;
+
+public final class ModuleEntryFactory {
+ private ModuleEntryFactory() {}
+
+ public static ModuleEntry create(String path,
+ ModuleEntry.Type type, byte[] content) {
+ return new ByteArrayModuleEntry(moduleFrom(path), path, type, content);
+ }
+
+ public static ModuleEntry create(String path,
+ ModuleEntry.Type type, Path file) {
+ return new PathModuleEntry(moduleFrom(path), path, type, file);
+ }
+
+ public static ModuleEntry create(ModuleEntry original, byte[] content) {
+ return new ByteArrayModuleEntry(original.getModule(),
+ original.getPath(), original.getType(), content);
+ }
+
+ public static ModuleEntry create(ModuleEntry original, Path file) {
+ return new PathModuleEntry(original.getModule(),
+ original.getPath(), original.getType(), file);
+ }
+
+ private static String moduleFrom(String path) {
+ Objects.requireNonNull(path);
+ if (path.isEmpty() || path.charAt(0) != '/') {
+ throw new IllegalArgumentException(path + " must start with /");
+ }
+ String noRoot = path.substring(1);
+ int idx = noRoot.indexOf('/');
+ if (idx == -1) {
+ throw new IllegalArgumentException("/ missing after module: " + path);
+ }
+ return noRoot.substring(0, idx);
+ }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModuleEntryImpl.java Mon Jun 20 06:13:28 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. 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.tools.jlink.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UncheckedIOException;
-import java.util.Objects;
-import jdk.tools.jlink.plugin.ModuleEntry;
-
-/**
- * A LinkModuleEntry is the elementary unit of data inside an image. It is
- * generally a file. e.g.: a java class file, a resource file, a shared library,
- * ...
- * <br>
- * A LinkModuleEntry is identified by a path of the form:
- * <ul>
- * <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
- * name}</li>
- * <li>For other files (shared lib, launchers, config, ...):/{module name}/
- * {@literal bin|conf|native}/{dir1}>/.../{dirN}/{file name}</li>
- * </ul>
- */
-public class ModuleEntryImpl implements ModuleEntry {
-
- private final Type type;
- private final String path;
- private final String module;
- private final long length;
- private final InputStream stream;
- private byte[] buffer;
-
- /**
- * Create a new LinkModuleEntry.
- *
- * @param module The module name.
- * @param path The data path identifier.
- * @param type The data type.
- * @param stream The data content stream.
- * @param length The stream length.
- */
- public ModuleEntryImpl(String module, String path, Type type, InputStream stream, long length) {
- Objects.requireNonNull(module);
- Objects.requireNonNull(path);
- Objects.requireNonNull(type);
- Objects.requireNonNull(stream);
- this.path = path;
- this.type = type;
- this.module = module;
- this.stream = stream;
- this.length = length;
- }
-
- /**
- * The LinkModuleEntry module name.
- *
- * @return The module name.
- */
- @Override
- public final String getModule() {
- return module;
- }
-
- /**
- * The LinkModuleEntry path.
- *
- * @return The module path.
- */
- @Override
- public final String getPath() {
- return path;
- }
-
- /**
- * The LinkModuleEntry's type.
- *
- * @return The data type.
- */
- @Override
- public final Type getType() {
- return type;
- }
-
- /**
- * The LinkModuleEntry content as an array of byte.
- *
- * @return An Array of bytes.
- */
- @Override
- public byte[] getBytes() {
- if (buffer == null) {
- try (InputStream is = stream) {
- buffer = is.readAllBytes();
- } catch (IOException ex) {
- throw new UncheckedIOException(ex);
- }
- }
- return buffer;
- }
-
- /**
- * The LinkModuleEntry content length.
- *
- * @return The length.
- */
- @Override
- public long getLength() {
- return length;
- }
-
- /**
- * The LinkModuleEntry stream.
- *
- * @return The module data stream.
- */
- @Override
- public InputStream stream() {
- return stream;
- }
-
- @Override
- public int hashCode() {
- int hash = 7;
- hash = 89 * hash + Objects.hashCode(this.path);
- return hash;
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof ModuleEntryImpl)) {
- return false;
- }
- ModuleEntryImpl f = (ModuleEntryImpl) other;
- return f.path.equals(path);
- }
-
- @Override
- public String toString() {
- return getPath();
- }
-}
\ No newline at end of file
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModulePoolImpl.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ModulePoolImpl.java Mon Jun 27 10:00:47 2016 -0700
@@ -95,7 +95,7 @@
@Override
public void add(ModuleEntry data) {
if (isReadOnly()) {
- throw new PluginException("LinkConfiguration is readonly");
+ throw new PluginException("ModulePool is readonly");
}
Objects.requireNonNull(data);
if (!data.getModule().equals(name)) {
@@ -180,7 +180,7 @@
@Override
public void add(ModuleEntry data) {
if (isReadOnly()) {
- throw new PluginException("LinkConfiguration is readonly");
+ throw new PluginException("ModulePool is readonly");
}
Objects.requireNonNull(data);
if (resources.get(data.getPath()) != null) {
@@ -215,7 +215,7 @@
}
/**
- * The stream of modules contained in this LinkConfiguration.
+ * The stream of modules contained in this ModulePool.
*
* @return The stream of modules.
*/
@@ -225,7 +225,7 @@
}
/**
- * Return the number of LinkModule count in this LinkConfiguration.
+ * Return the number of LinkModule count in this ModulePool.
*
* @return the module count.
*/
@@ -235,7 +235,7 @@
}
/**
- * Get all ModuleEntry contained in this LinkConfiguration instance.
+ * Get all ModuleEntry contained in this ModulePool instance.
*
* @return The stream of LinkModuleEntries.
*/
@@ -245,7 +245,7 @@
}
/**
- * Return the number of ModuleEntry count in this LinkConfiguration.
+ * Return the number of ModuleEntry count in this ModulePool.
*
* @return the entry count.
*/
@@ -267,7 +267,7 @@
}
/**
- * Check if the LinkConfiguration contains the given ModuleEntry.
+ * Check if the ModulePool contains the given ModuleEntry.
*
* @param data The module data to check existence for.
* @return The module data or null if not found.
@@ -279,7 +279,7 @@
}
/**
- * Check if the LinkConfiguration contains some content at all.
+ * Check if the ModulePool contains some content at all.
*
* @return True, no content, false otherwise.
*/
@@ -289,16 +289,16 @@
}
/**
- * Visit each ModuleEntry in this LinkConfiguration to transform it and
- * copy the transformed ModuleEntry to the output LinkConfiguration.
+ * Visit each ModuleEntry in this ModulePool to transform it and
+ * copy the transformed ModuleEntry to the output ModulePool.
*
* @param transform The function called for each ModuleEntry found in
- * the LinkConfiguration. The transform function should return a
+ * the ModulePool. The transform function should return a
* ModuleEntry instance which will be added to the output or it should
* return null if the passed ModuleEntry is to be ignored for the
* output.
*
- * @param output The LinkConfiguration to be filled with Visitor returned
+ * @param output The ModulePool to be filled with Visitor returned
* ModuleEntry.
*/
@Override
@@ -351,14 +351,13 @@
/**
* A resource that has been compressed.
*/
- public static final class CompressedModuleData extends ModuleEntryImpl {
+ public static final class CompressedModuleData extends ByteArrayModuleEntry {
final long uncompressed_size;
private CompressedModuleData(String module, String path,
- InputStream stream, long size,
- long uncompressed_size) {
- super(module, path, ModuleEntry.Type.CLASS_OR_RESOURCE, stream, size);
+ byte[] content, long uncompressed_size) {
+ super(module, path, ModuleEntry.Type.CLASS_OR_RESOURCE, content);
this.uncompressed_size = uncompressed_size;
}
@@ -413,8 +412,7 @@
CompressedModuleData compressedResource
= new CompressedModuleData(original.getModule(), original.getPath(),
- new ByteArrayInputStream(contentWithHeader),
- contentWithHeader.length, uncompressed_size);
+ contentWithHeader, uncompressed_size);
return compressedResource;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PathModuleEntry.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classfile" 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.tools.jlink.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Objects;
+import jdk.tools.jlink.plugin.ModuleEntry;
+
+/**
+ * A ModuleEntry backed by a given nio Path.
+ */
+public class PathModuleEntry extends AbstractModuleEntry {
+ private final Path file;
+
+ /**
+ * Create a new PathModuleEntry.
+ *
+ * @param module The module name.
+ * @param file The data file identifier.
+ * @param type The data type.
+ * @param file The Path for the resource content.
+ */
+ public PathModuleEntry(String module, String path, Type type, Path file) {
+ super(module, path, type);
+ this.file = Objects.requireNonNull(file);
+ if (!Files.isRegularFile(file)) {
+ throw new IllegalArgumentException(file + " not a file");
+ }
+ }
+
+ @Override
+ public final InputStream stream() {
+ try {
+ return Files.newInputStream(file);
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
+
+ @Override
+ public final long getLength() {
+ try {
+ return Files.size(file);
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Mon Jun 27 10:00:47 2016 -0700
@@ -584,6 +584,8 @@
showPlugin(plugin, log, showsImageBuilder);
}
}
+
+ log.println("\n" + bundleHelper.getMessage("main.extended.help.footer"));
}
private void showPlugin(Plugin plugin, PrintWriter log, boolean showsImageBuilder) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java Mon Jun 27 10:00:47 2016 -0700
@@ -35,7 +35,6 @@
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
-import java.util.Set;
import java.util.stream.Collectors;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.Plugin.Category;
@@ -57,46 +56,16 @@
.collect(Collectors.toList());
}
- public static boolean isPostProcessor(Category category) {
- return category.equals(Category.VERIFIER)
- || category.equals(Category.PROCESSOR)
- || category.equals(Category.PACKAGER);
- }
-
- public static boolean isPreProcessor(Category category) {
- return category.equals(Category.COMPRESSOR)
- || category.equals(Category.FILTER)
- || category.equals(Category.MODULEINFO_TRANSFORMER)
- || category.equals(Category.SORTER)
- || category.equals(Category.TRANSFORMER)
- || category.equals(Category.METAINFO_ADDER);
- }
-
public static boolean isPostProcessor(Plugin provider) {
- Set<Category> types = provider.getType();
- Objects.requireNonNull(types);
- for (Category pt : types) {
- return isPostProcessor(pt);
- }
- return false;
+ return provider.getType().isPostProcessor();
}
public static boolean isPreProcessor(Plugin provider) {
- Set<Category> types = provider.getType();
- Objects.requireNonNull(types);
- for (Category pt : types) {
- return isPreProcessor(pt);
- }
- return false;
+ return !isPostProcessor(provider);
}
public static Category getCategory(Plugin provider) {
- Set<Category> types = provider.getType();
- Objects.requireNonNull(types);
- for (Category t : types) {
- return t;
- }
- return null;
+ return provider.getType();
}
public static List<Plugin> getPreProcessors(List<Plugin> plugins) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/packager/AppRuntimeImageBuilder.java Mon Jun 27 10:00:47 2016 -0700
@@ -27,36 +27,19 @@
import jdk.tools.jlink.Jlink;
-import jdk.tools.jlink.builder.ImageBuilder;
+import jdk.tools.jlink.builder.DefaultImageBuilder;
+import jdk.tools.jlink.internal.JlinkTask;
import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.builder.*;
-import jdk.tools.jlink.plugin.ModulePool;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringReader;
+import java.lang.module.ModuleFinder;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
-import java.util.ResourceBundle;
import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.TreeSet;
-import java.util.stream.Collectors;
/**
* AppRuntimeImageBuilder is a private API used only by the Java Packager to generate
@@ -143,4 +126,14 @@
Jlink jlink = new Jlink();
jlink.build(jlinkConfig, pluginConfig);
}
+
+ /**
+ * Returns a ModuleFinder that limits observability to the given root
+ * modules, their transitive dependences, plus a set of other modules.
+ */
+ public static ModuleFinder moduleFinder(List<Path> modulepaths,
+ Set<String> roots,
+ Set<String> otherModules) {
+ return JlinkTask.newModuleFinder(modulepaths, roots, otherModules);
+ }
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,9 +25,7 @@
package jdk.tools.jlink.internal.plugins;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.plugin.ModulePool;
@@ -77,10 +75,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.COMPRESSOR);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.COMPRESSOR;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -26,9 +26,7 @@
import java.io.UncheckedIOException;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.function.Predicate;
import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.plugin.ModulePool;
@@ -60,10 +58,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.FILTER);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.FILTER;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,9 +25,7 @@
package jdk.tools.jlink.internal.plugins;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.function.Predicate;
import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
@@ -73,10 +71,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.FILTER);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.FILTER;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -32,10 +32,8 @@
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.TreeSet;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -159,10 +157,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.FILTER);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.FILTER;
}
@Override
@@ -248,10 +244,7 @@
byte[] content = builder.toString().getBytes(StandardCharsets.UTF_8);
- return ModuleEntry.create(orig.getModule(),
- orig.getPath(),
- orig.getType(),
- new ByteArrayInputStream(content), content.length);
+ return orig.create(content);
}
private static String jvmlib() {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -36,12 +36,10 @@
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
-import jdk.tools.jlink.internal.ModuleEntryImpl;
+import jdk.tools.jlink.internal.PathModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -68,13 +66,13 @@
/**
* Symbolic link to another path.
*/
- public static abstract class SymImageFile extends ModuleEntryImpl {
+ public static abstract class SymImageFile extends PathModuleEntry {
private final String targetPath;
public SymImageFile(String targetPath, String module, String path,
- ModuleEntry.Type type, InputStream stream, long size) {
- super(module, path, type, stream, size);
+ ModuleEntry.Type type, Path file) {
+ super(module, path, type, file);
this.targetPath = targetPath;
}
@@ -87,23 +85,7 @@
public SymImageFileImpl(String targetPath, Path file, String module,
String path, ModuleEntry.Type type) {
- super(targetPath, module, path, type, newStream(file), length(file));
- }
- }
-
- private static long length(Path file) {
- try {
- return Files.size(file);
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private static InputStream newStream(Path file) {
- try {
- return Files.newInputStream(file);
- } catch (IOException ex) {
- throw new UncheckedIOException(ex);
+ super(targetPath, module, path, type, file);
}
}
@@ -177,9 +159,9 @@
Objects.requireNonNull(pool);
Objects.requireNonNull(file);
Objects.requireNonNull(path);
- ModuleEntry impl = ModuleEntry.create(FAKE_MODULE,
+ ModuleEntry impl = ModuleEntry.create(
"/" + FAKE_MODULE + "/other/" + path,
- ModuleEntry.Type.OTHER, newStream(file), length(file));
+ ModuleEntry.Type.OTHER, file);
try {
pool.add(impl);
} catch (Exception ex) {
@@ -188,13 +170,6 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public void configure(Map<String, String> config) {
List<String> arguments = Utils.parseList(config.get(NAME));
if (arguments.isEmpty()) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -61,11 +61,6 @@
}
@Override
- public Set<Category> getType() {
- return Collections.singleton(Category.TRANSFORMER);
- }
-
- @Override
public String getName() {
return NAME;
}
@@ -176,10 +171,9 @@
byte[] bytes = result.getValue();
// Add class to pool
- ModuleEntry ndata = ModuleEntry.create(data.getModule(),
+ ModuleEntry ndata = ModuleEntry.create(
"/java.base/" + className + ".class",
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(bytes), bytes.length);
+ bytes);
if (!out.contains(ndata)) {
out.add(ndata);
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,9 +25,9 @@
package jdk.tools.jlink.internal.plugins;
import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
import java.util.IllformedLocaleException;
import java.util.Locale;
import java.util.List;
@@ -82,15 +82,15 @@
"sun.util.resources.ext",
"sun.util.resources.provider");
private static final String METAINFONAME = "LocaleDataMetaInfo";
- private static final String META_FILES =
- "*module-info.class," +
- "*LocaleDataProvider.class," +
- "*" + METAINFONAME + ".class,";
- private static final String INCLUDE_LOCALE_FILES =
- "*sun/text/resources/ext/[^\\/]+_%%.class," +
- "*sun/util/resources/ext/[^\\/]+_%%.class," +
- "*sun/text/resources/cldr/ext/[^\\/]+_%%.class," +
- "*sun/util/resources/cldr/ext/[^\\/]+_%%.class,";
+ private static final List<String> META_FILES = List.of(
+ ".+module-info.class",
+ ".+LocaleDataProvider.class",
+ ".+" + METAINFONAME + ".class");
+ private static final List<String> INCLUDE_LOCALE_FILES = List.of(
+ ".+sun/text/resources/ext/[^_]+_",
+ ".+sun/util/resources/ext/[^_]+_",
+ ".+sun/text/resources/cldr/ext/[^_]+_",
+ ".+sun/util/resources/cldr/ext/[^_]+_");
private Predicate<String> predicate;
private String userParam;
private List<Locale.LanguageRange> priorityList;
@@ -123,9 +123,7 @@
if (Arrays.stream(cr.getInterfaces())
.anyMatch(i -> i.contains(METAINFONAME)) &&
stripUnsupportedLocales(bytes, cr)) {
- resource = ModuleEntry.create(MODULENAME, path,
- resource.getType(),
- new ByteArrayInputStream(bytes), bytes.length);
+ resource = resource.create(bytes);
}
}
}
@@ -134,10 +132,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.FILTER);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.FILTER;
}
@Override
@@ -206,15 +202,17 @@
String.format(PluginsResourceBundle.getMessage(NAME + ".nomatchinglocales"), userParam));
}
- String value = META_FILES + filtered.stream()
- .map(s -> includeLocaleFilePatterns(s))
- .collect(Collectors.joining(","));
+ List<String> value = Stream.concat(
+ META_FILES.stream(),
+ filtered.stream().flatMap(s -> includeLocaleFilePatterns(s).stream()))
+ .map(s -> "regex:" + s)
+ .collect(Collectors.toList());
predicate = ResourceFilter.includeFilter(value);
}
- private String includeLocaleFilePatterns(String tag) {
+ private List<String> includeLocaleFilePatterns(String tag) {
+ List<String> files = new ArrayList<>();
String pTag = tag.replaceAll("-", "_");
- String files = "";
int lastDelimiter = tag.length();
String isoSpecial = pTag.matches("^(he|yi|id).*") ?
pTag.replaceFirst("he", "iw")
@@ -224,11 +222,11 @@
// Add tag patterns including parents
while (true) {
pTag = pTag.substring(0, lastDelimiter);
- files += INCLUDE_LOCALE_FILES.replaceAll("%%", pTag);
+ files.addAll(includeLocaleFiles(pTag));
if (!isoSpecial.isEmpty()) {
isoSpecial = isoSpecial.substring(0, lastDelimiter);
- files += INCLUDE_LOCALE_FILES.replaceAll("%%", isoSpecial);
+ files.addAll(includeLocaleFiles(isoSpecial));
}
lastDelimiter = pTag.lastIndexOf('_');
@@ -240,31 +238,37 @@
final String lang = pTag;
// Add possible special locales of the COMPAT provider
- files += Set.of(jaJPJPTag, noNONYTag, thTHTHTag).stream()
+ Set.of(jaJPJPTag, noNONYTag, thTHTHTag).stream()
.filter(stag -> lang.equals(stag.substring(0,2)))
- .map(t -> INCLUDE_LOCALE_FILES.replaceAll("%%", t.replaceAll("-", "_")))
- .collect(Collectors.joining(","));
+ .map(t -> includeLocaleFiles(t.replaceAll("-", "_")))
+ .forEach(files::addAll);
// Add possible UN.M49 files (unconditional for now) for each language
- files += INCLUDE_LOCALE_FILES.replaceAll("%%", lang + "_[0-9]{3}");
+ files.addAll(includeLocaleFiles(lang + "_[0-9]{3}"));
if (!isoSpecial.isEmpty()) {
- files += INCLUDE_LOCALE_FILES.replaceAll("%%", isoSpecial + "_[0-9]{3}");
+ files.addAll(includeLocaleFiles(isoSpecial + "_[0-9]{3}"));
}
// Add Thai BreakIterator related data files
if (lang.equals("th")) {
- files += "*sun/text/resources/thai_dict," +
- "*sun/text/resources/[^\\/]+BreakIteratorData_th,";
+ files.add(".+sun/text/resources/thai_dict");
+ files.add(".+sun/text/resources/[^_]+BreakIteratorData_th");
}
// Add Taiwan resource bundles for Hong Kong
if (tag.startsWith("zh-HK")) {
- files += INCLUDE_LOCALE_FILES.replaceAll("%%", "zh_TW");
+ files.addAll(includeLocaleFiles("zh_TW"));
}
return files;
}
+ private List<String> includeLocaleFiles(String localeStr) {
+ return INCLUDE_LOCALE_FILES.stream()
+ .map(s -> s + localeStr + ".class")
+ .collect(Collectors.toList());
+ }
+
private boolean stripUnsupportedLocales(byte[] bytes, ClassReader cr) {
char[] buf = new char[cr.getMaxStringLength()];
boolean[] modified = new boolean[1];
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OptimizationPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -31,7 +31,6 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -284,11 +283,4 @@
}
}
}
-
- @Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -32,7 +32,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -143,11 +142,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.SORTER);
-
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.SORTER;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -49,8 +49,8 @@
private final Map<String, String> release = new HashMap<>();
@Override
- public Set<Category> getType() {
- return Collections.singleton(Category.METAINFO_ADDER);
+ public Category getType() {
+ return Category.METAINFO_ADDER;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -343,10 +343,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.COMPRESSOR);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.COMPRESSOR;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -27,8 +27,6 @@
import java.io.ByteArrayInputStream;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
import java.util.function.Predicate;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassWriter;
@@ -58,13 +56,6 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public String getDescription() {
return PluginsResourceBundle.getDescription(NAME);
}
@@ -84,7 +75,7 @@
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
reader.accept(writer, ClassReader.SKIP_DEBUG);
byte[] content = writer.toByteArray();
- res = ModuleEntry.create(path, new ByteArrayInputStream(content), content.length);
+ res = resource.create(content);
}
}
} else if (predicate.test(res.getPath())) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -25,8 +25,6 @@
package jdk.tools.jlink.internal.plugins;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.TransformerPlugin;
@@ -45,10 +43,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.FILTER);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.FILTER;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -83,11 +83,6 @@
}
@Override
- public Set<Category> getType() {
- return Collections.singleton(Category.TRANSFORMER);
- }
-
- @Override
public String getName() {
return NAME;
}
@@ -144,11 +139,7 @@
ModuleInfoRewriter minfoWriter =
new ModuleInfoRewriter(bain, mbuilder.conceals());
// replace with the overridden version
- data = ModuleEntry.create(data.getModule(),
- data.getPath(),
- data.getType(),
- minfoWriter.stream(),
- minfoWriter.size());
+ data = data.create(minfoWriter.getBytes());
}
out.add(data);
} catch (IOException e) {
@@ -163,12 +154,7 @@
return;
if (builder.isOverriddenClass(data.getPath())) {
byte[] bytes = cwriter.toByteArray();
- ModuleEntry ndata =
- ModuleEntry.create(data.getModule(),
- data.getPath(),
- data.getType(),
- new ByteArrayInputStream(bytes),
- bytes.length);
+ ModuleEntry ndata = data.create(bytes);
out.add(ndata);
} else {
out.add(data);
@@ -188,8 +174,8 @@
this.extender.write(this);
}
- InputStream stream() {
- return new ByteArrayInputStream(buf);
+ byte[] getBytes() {
+ return buf;
}
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -29,9 +29,7 @@
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.function.Predicate;
import java.util.zip.Deflater;
import jdk.tools.jlink.internal.ModulePoolImpl;
@@ -66,10 +64,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.COMPRESSOR);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.COMPRESSOR;
}
@Override
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPoolImpl.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPoolImpl.java Mon Jun 27 10:00:47 2016 -0700
@@ -93,8 +93,7 @@
}
byte[] content = writer.toByteArray();
- ModuleEntry res = ModuleEntry.create(path,
- new ByteArrayInputStream(content), content.length);
+ ModuleEntry res = ModuleEntry.create(path, content);
transformedClasses.put(className, res);
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ModuleEntry.java Mon Jun 27 10:00:47 2016 -0700
@@ -26,16 +26,18 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.util.Objects;
-import jdk.tools.jlink.internal.ImageFileCreator;
-import jdk.tools.jlink.internal.ModuleEntryImpl;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import jdk.tools.jlink.internal.ModuleEntryFactory;
/**
- * A LinkModuleEntry is the elementary unit of data inside an image. It is
- * generally a file. e.g.: a java class file, a resource file, a shared library,
- * ...
+ * A ModuleEntry is the elementary unit of data inside an image. It is
+ * generally a file. e.g.: a java class file, a resource file, a shared library.
* <br>
- * A LinkModuleEntry is identified by a path of the form:
+ * A ModuleEntry is identified by a path of the form:
* <ul>
* <li>For jimage content: /{module name}/{package1}/.../{packageN}/{file
* name}</li>
@@ -63,93 +65,133 @@
OTHER
}
/**
- * The LinkModuleEntry module name.
+ * The ModuleEntry module name.
*
* @return The module name.
*/
public String getModule();
/**
- * The LinkModuleEntry path.
+ * The ModuleEntry path.
*
* @return The module path.
*/
public String getPath();
/**
- * The LinkModuleEntry's type.
+ * The ModuleEntry's type.
*
* @return The data type.
*/
public Type getType();
/**
- * The LinkModuleEntry content as an array of byte.
+ * The ModuleEntry content as an array of bytes.
*
* @return An Array of bytes.
*/
- public byte[] getBytes();
+ public default byte[] getBytes() {
+ try (InputStream is = stream()) {
+ return is.readAllBytes();
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
/**
- * The LinkModuleEntry content length.
+ * The ModuleEntry content length.
*
* @return The length.
*/
public long getLength();
/**
- * The LinkModuleEntry stream.
+ * The ModuleEntry stream.
*
* @return The module data stream.
*/
public InputStream stream();
+ /**
+ * Write the content of this ModuleEntry to stream.
+ *
+ * @param out the output stream
+ */
+ public default void write(OutputStream out) {
+ try {
+ out.write(getBytes());
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ }
/**
- * Create a LinkModuleEntry located inside a jimage file. Such
- * LinkModuleEntry has a Type being equals to CLASS_OR_RESOURCE.
+ * Create a ModuleEntry with new content but other information
+ * copied from this ModuleEntry.
*
- * @param path The complete resource path (contains the module radical).
- * @param content The resource content.
- * @param size The content size.
- * @return A new LinkModuleEntry.
+ * @param content The new resource content.
+ * @return A new ModuleEntry.
*/
- public static ModuleEntry create(String path, InputStream content, long size) {
- Objects.requireNonNull(path);
- Objects.requireNonNull(content);
- String[] split = ImageFileCreator.splitPath(path);
- String module = split[0];
- return new ModuleEntryImpl(module, path, Type.CLASS_OR_RESOURCE, content, size);
+ public default ModuleEntry create(byte[] content) {
+ return ModuleEntryFactory.create(this, content);
}
/**
- * Create a LinkModuleEntry for a file that will be located inside a jimage
- * file.
+ * Create a ModuleEntry with new content but other information
+ * copied from this ModuleEntry.
+ *
+ * @param file The new resource content.
+ * @return A new ModuleEntry.
+ */
+ public default ModuleEntry create(Path file) {
+ return ModuleEntryFactory.create(this, file);
+ }
+
+ /**
+ * Create a ModuleEntry for a resource of the given type.
+ *
+ * @param path The resource path.
+ * @param type The ModuleEntry type.
+ * @param content The resource content.
+ * @return A new ModuleEntry.
+ */
+ public static ModuleEntry create(String path,
+ ModuleEntry.Type type, byte[] content) {
+ return ModuleEntryFactory.create(path, type, content);
+ }
+
+ /**
+ * Create a ModuleEntry for a resource of type {@link Type#CLASS_OR_RESOURCE}.
*
* @param path The resource path.
* @param content The resource content.
- * @return A new LinkModuleEntry.
+ * @return A new ModuleEntry.
*/
public static ModuleEntry create(String path, byte[] content) {
- return create(path, new ByteArrayInputStream(content),
- content.length);
+ return create(path, Type.CLASS_OR_RESOURCE, content);
}
/**
- * Create a LinkModuleEntry for a file that will be located outside a jimage
- * file.
+ * Create a ModuleEntry for a resource of the given type.
*
- * @param module The module in which this files is located.
- * @param path The file path locator (doesn't contain the module name).
- * @param type The LinkModuleEntry type.
- * @param content The file content.
- * @param size The content size.
- * @return A new LinkModuleEntry.
+ * @param path The resource path.
+ * @param type The ModuleEntry type.
+ * @param file The resource file.
+ * @return A new ModuleEntry.
*/
- public static ModuleEntry create(String module, String path, ModuleEntry.Type type,
- InputStream content, long size) {
- Objects.requireNonNull(path);
- Objects.requireNonNull(content);
- return new ModuleEntryImpl(module, path, type, content, size);
+ public static ModuleEntry create(String path,
+ ModuleEntry.Type type, Path file) {
+ return ModuleEntryFactory.create(path, type, file);
+ }
+
+ /**
+ * Create a ModuleEntry for a resource of type {@link Type#CLASS_OR_RESOURCE}.
+ *
+ * @param path The resource path.
+ * @param file The resource file.
+ * @return A new ModuleEntry.
+ */
+ public static ModuleEntry create(String path, Path file) {
+ return create(path, Type.CLASS_OR_RESOURCE, file);
}
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -57,19 +57,29 @@
SORTER("SORTER"),
COMPRESSOR("COMPRESSOR"),
METAINFO_ADDER("METAINFO_ADDER"),
- VERIFIER("VERIFIER"),
- PROCESSOR("PROCESSOR"),
- PACKAGER("PACKAGER");
+ VERIFIER("VERIFIER", true),
+ PROCESSOR("PROCESSOR", true),
+ PACKAGER("PACKAGER", true);
private final String name;
+ private final boolean postProcessor;
+
+ Category(String name, boolean postProcessor) {
+ this.name = name;
+ this.postProcessor = postProcessor;
+ }
Category(String name) {
- this.name = name;
+ this(name, false);
}
public String getName() {
return name;
}
+
+ public boolean isPostProcessor() {
+ return postProcessor;
+ }
}
/**
@@ -90,11 +100,12 @@
}
/**
- * The Plugin set of types.
- * @return The set of types.
+ * The type of this plugin.
+ *
+ * @return The type of this plugin
*/
- public default Set<Category> getType() {
- return Collections.emptySet();
+ public default Category getType() {
+ return Category.TRANSFORMER;
}
/**
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties Mon Jun 27 10:00:47 2016 -0700
@@ -29,7 +29,7 @@
main.usage=\
Usage: {0} <options> --modulepath <modulepath> --addmods <mods> --output <path>\n\
-Possible options include:
+\Possible options include:
error.prefix=Error:
warn.prefix=Warning:
@@ -68,7 +68,18 @@
Include your program and the following diagnostic in your report. Thank you.
main.extended.help=\
-List of available plugins:
+\List of available plugins:
+
+main.extended.help.footer=\
+\For options requiring a <pattern-list>, the value will be a comma\
+\ separated list of elements each using one the following forms:\n\
+\ <glob-pattern>\n\
+\ glob:<glob-pattern>\n\
+\ regex:<regex-pattern>\n\
+\ @<filename> where filename is the name of a file containing patterns to be\
+\ used, one pattern per line\n\
+\n\
+
err.unknown.byte.order:unknown byte order {0}
err.output.must.be.specified:--output must be specified
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Mon Jun 27 10:00:47 2016 -0700
@@ -37,15 +37,16 @@
Class optimization. Warning: This plugin is experimental.\n\
An optional <log file> can be specified to log applied optimizations.
-compress.argument=<0|1|2>[:filter=<pattern>]
+compress.argument=<0|1|2>[:filter=<pattern-list>]
compress.description=\
Compress all resources in the output image.\n\
Level 0: constant string sharing\n\
Level 1: ZIP\n\
Level 2: both.\n\
-An optional filter can be specified to list the pattern of files to be filtered.\n\
-Use ^ for negation. e.g.: *Exception.class,*Error.class,^/java.base/java/lang/*
+An optional <pattern-list> filter can be specified to list the pattern of\n\
+files to be included.
+
compact-cp.argument=<resource paths>
@@ -59,15 +60,15 @@
If files to copy are not absolute path, JDK home dir is used.\n\
e.g.: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewehere/conf.txt
-exclude-files.argument=<files to exclude | files of excluded files>
+exclude-files.argument=<pattern-list> of files to exclude
exclude-files.description=\
-Specify files to exclude. e.g.: *.diz, /java.base/native/client/*
+Specify files to exclude. e.g.: **.java,glob:/java.base/native/client/**
-exclude-resources.argument=<resources to exclude | file of excluded resources>
+exclude-resources.argument=<pattern-list> resources to exclude
exclude-resources.description=\
-Specify resources to exclude. e.g.: *.jcov, */META-INF/*
+Specify resources to exclude. e.g.: **.jcov,glob:**/META-INF/**
generate-jli-classes.argument=<bmh[:bmh-species=LL,L3,...]>
@@ -78,10 +79,11 @@
onoff.argument=<on|off>
-order-resources.argument=<paths in priority order | file with resource paths>
+order-resources.argument=<pattern-list> of paths in priority order. If a @file\n\
+is specified, then each line should be an exact match for the path to be ordered
order-resources.description=\
-Order resources. e.g.: */module-info.class,/java.base/java/lang/*
+Order resources. e.g.: **/module-info.class,@classlist,/java.base/java/lang/**
strip-debug.description=\
Strip debug information from the output image
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Mon Jun 27 10:00:47 2016 -0700
@@ -1085,7 +1085,7 @@
@Override public Class<Pattern> valueType() { return Pattern.class; }
- @Override public String valuePattern() { return "pattern"; }
+ @Override public String valuePattern() { return "regex-pattern"; }
}
static class PathMatcherConverter implements ValueConverter<PathMatcher> {
@@ -1100,7 +1100,7 @@
@Override public Class<PathMatcher> valueType() { return PathMatcher.class; }
- @Override public String valuePattern() { return "pattern"; }
+ @Override public String valuePattern() { return "pattern-list"; }
}
/* Support for @<file> in jmod help */
@@ -1145,7 +1145,7 @@
String content = super.format(all);
StringBuilder builder = new StringBuilder();
- builder.append("\n").append(" Main operation modes:\n ");
+ builder.append(getMessage("main.opt.mode")).append("\n ");
builder.append(getMessage("main.opt.mode.create")).append("\n ");
builder.append(getMessage("main.opt.mode.list")).append("\n ");
builder.append(getMessage("main.opt.mode.describe")).append("\n ");
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod.properties Mon Jun 27 10:00:47 2016 -0700
@@ -28,11 +28,13 @@
use --help for a list of possible options
main.usage=\
-Usage: {0} (create|list|describe|hash) <OPTIONS> <jmod-file>
+Usage: {0} (create|list|describe|hash) <OPTIONS> <jmod-file>\n\
error.prefix=Error:
warn.prefix=Warning:
+main.opt.mode=\
+\Main operation modes:
main.opt.mode.create=\
\create - Creates a new jmod archive
main.opt.mode.list=\
@@ -49,7 +51,9 @@
main.opt.cmds=Location of native commands
main.opt.config=Location of user-editable config files
main.opt.dry-run=Dry run of hash mode
-main.opt.exclude=Exclude files, given as a PATTERN
+main.opt.exclude=Exclude files matching the supplied comma separated pattern\
+\ list, each element using one the following forms: <glob-pattern>,\
+\ glob:<glob-pattern> or regex:<regex-pattern>
main.opt.module-version= Module version
main.opt.main-class=Main class
main.opt.main-class.arg=class-name
@@ -61,7 +65,7 @@
main.opt.os-version.arg=os-version
main.opt.modulepath=Module path
main.opt.hash-modules=Compute and record hashes to tie a packaged module\
-\ with modules matching the given pattern and depending upon it directly\
+\ with modules matching the given <regex-pattern> and depending upon it directly\
\ or indirectly. The hashes are recorded in the JMOD file being created, or\
\ a JMOD file or modular JAR on the module path specified the jmod hash command.
--- a/jdk/test/ProblemList.txt Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/ProblemList.txt Mon Jun 27 10:00:47 2016 -0700
@@ -272,8 +272,6 @@
sun/security/pkcs11/tls/TestPRF.java 8077138,8023434 windows-all
sun/security/pkcs11/tls/TestPremaster.java 8077138,8023434 windows-all
-sun/security/pkcs11/rsa/TestKeyPairGenerator.java 8074580 generic-all
-
sun/security/krb5/auto/HttpNegotiateServer.java 8038079 generic-all
sun/security/tools/keytool/autotest.sh 8130302 generic-all
@@ -338,9 +336,6 @@
# jdk_time
-java/time/test/java/time/TestClock_System.java 8158128 solaris-all
-
-
############################################################################
# jdk_util
@@ -387,8 +382,6 @@
# core_tools
-tools/jlink/plugins/IncludeLocalesPluginTest.java 8159781 generic-all
-
tools/jlink/JLinkOptimTest.java 8159264 generic-all
############################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jndi/ldap/SimpleClientIdHashCode.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8158802
+ * @summary com.sun.jndi.ldap.SimpleClientId produces wrong hash code
+ * @modules java.naming/com.sun.jndi.ldap
+ */
+
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import javax.naming.ldap.Control;
+
+
+public class SimpleClientIdHashCode {
+ public static void main(String[] args) throws Throwable {
+ Class<?> simpleClientIdClass
+ = Class.forName("com.sun.jndi.ldap.SimpleClientId");
+ Constructor<?> init = simpleClientIdClass.getDeclaredConstructor(
+ int.class, String.class, int.class, String.class,
+ Control[].class, OutputStream.class, String.class,
+ String.class, Object.class);
+ init.setAccessible(true);
+
+ Object p1 = new byte[]{66,77};
+ Object p2 = new char[]{'w','d'};
+ Object p3 = "word";
+
+ test(init, new byte[]{65}, new byte[]{65});
+ test(init, new char[]{'p'}, new char[]{'p'});
+ test(init, "pass", "pass");
+ test(init, p1, p1);
+ test(init, p2, p2);
+ test(init, p3, p3);
+ test(init, null, null);
+ }
+
+ private static void test(Constructor<?> init, Object pass1, Object pass2)
+ throws Throwable {
+
+ Object o1 = init.newInstance(1, "host", 3, "", null, System.out,
+ null, null, pass1);
+ Object o2 = init.newInstance(1, "host", 3, "", null, System.out,
+ null, null, pass2);
+
+ if (!o1.equals(o2))
+ throw new RuntimeException("Objects not equal");
+
+ if (o1.hashCode() != o2.hashCode())
+ throw new RuntimeException("Inconsistent hash codes");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/Runtime/shutdown/ShutdownInterruptedMain.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8154017
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @summary Shutdown hooks are racing against shutdown sequence,
+ if System.exit()-calling thread is interrupted
+ * @run main ShutdownInterruptedMain exec
+ */
+
+import jdk.testlibrary.OutputAnalyzer;
+import static jdk.testlibrary.ProcessTools.createJavaProcessBuilder;
+import static jdk.testlibrary.ProcessTools.executeProcess;
+
+public class ShutdownInterruptedMain {
+
+ public static void main(String[] args) throws Exception {
+ if (args.length > 0) {
+ ProcessBuilder pb = createJavaProcessBuilder(true, "ShutdownInterruptedMain");
+ OutputAnalyzer output = executeProcess(pb);
+ output.shouldContain("Shutdown Hook");
+ output.shouldHaveExitValue(0);
+ return;
+ }
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ // Wait for the race to unfold:
+ try {
+ Thread.sleep(5_000);
+ } catch (InterruptedException e) {}
+ System.out.println("Shutdown Hook");
+ System.out.flush();
+ }
+ });
+ Thread.currentThread().interrupt();
+ System.exit(0);
+ }
+}
--- a/jdk/test/java/lang/module/ConfigurationTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/java/lang/module/ConfigurationTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -157,7 +157,7 @@
*
* The test consists of three configurations:
* - Configuration cf1: m1, m2 requires public m1
- * - Configuration cf2: m3 requires m1
+ * - Configuration cf2: m3 requires m2
*/
public void testRequiresPublic2() {
@@ -219,7 +219,7 @@
*
* The test consists of three configurations:
* - Configuration cf1: m1
- * - Configuration cf2: m2 requires public m3, m3 requires m2
+ * - Configuration cf2: m2 requires public m1, m3 requires m2
*/
public void testRequiresPublic3() {
@@ -283,7 +283,7 @@
* The test consists of three configurations:
* - Configuration cf1: m1
* - Configuration cf2: m2 requires public m1
- * - Configuraiton cf3: m3 requires m3
+ * - Configuraiton cf3: m3 requires m2
*/
public void testRequiresPublic4() {
@@ -657,8 +657,8 @@
* Basic test of binding services with configurations.
*
* Configuration cf1: p@1.0 provides p.S
+ * Test configuration cf2: m1 uses p.S, p@2.0 provides p.S
* Test configuration cf2: m1 uses p.S
- * Test configuration cf2: m1 uses p.S, p@2.0 uses p.S
*/
public void testServiceBindingWithConfigurations3() {
@@ -896,7 +896,7 @@
Configuration cf2 = resolveRequires(cf1, finder, "m1");
assertTrue(cf2.modules().size() == 1);
- assertTrue(cf1.findModule("m1").isPresent());
+ assertTrue(cf2.findModule("m1").isPresent());
}
@@ -1305,7 +1305,7 @@
/**
- * Test "provides p.S" where p is not local
+ * Test "provides p.S with q.T" where q.T is not local
*/
@Test(expectedExceptions = { ResolutionException.class })
public void testProviderPackageNotLocal() {
--- a/jdk/test/java/lang/module/ModuleReferenceTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/java/lang/module/ModuleReferenceTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -110,7 +110,7 @@
ModuleReference mref3 = new ModuleReference(descriptor1, null, supplier);
assertTrue(mref1.equals(mref1));
- assertTrue(mref1.equals(mref1));
+ assertTrue(mref1.equals(mref2));
assertTrue(mref2.equals(mref1));
assertTrue(mref1.hashCode() == mref2.hashCode());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/HttpURLConnection/NoProxyTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @bug 8144008
+ * @summary Setting NO_PROXY on HTTP URL connections does not stop proxying
+ * @run main/othervm NoProxyTest
+ */
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+public class NoProxyTest {
+
+ static class NoProxyTestSelector extends ProxySelector {
+ @Override
+ public List<Proxy> select(URI uri) {
+ throw new RuntimeException("Should not reach here as proxy==Proxy.NO_PROXY");
+ }
+ @Override
+ public void connectFailed(URI u, SocketAddress s, IOException e) { }
+ }
+
+ public static void main(String args[]) throws MalformedURLException {
+ ProxySelector.setDefault(new NoProxyTestSelector());
+
+ URL url = URI.create("http://127.0.0.1/").toURL();
+ URLConnection connection;
+ try {
+ connection = url.openConnection(Proxy.NO_PROXY);
+ connection.connect();
+ } catch (IOException ignore) {
+ //ignore
+ }
+ }
+}
--- a/jdk/test/java/net/URLPermission/URLPermissionTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/java/net/URLPermission/URLPermissionTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
/**
* @test
- * @bug 8010464 8027570 8027687 8029354
+ * @bug 8010464 8027570 8027687 8029354 8114860 8071660
*/
public class URLPermissionTest {
@@ -110,6 +110,8 @@
static class ActionImpliesTest extends Test {
String arg1, arg2;
+ String url1 = "http://www.foo.com/-";
+ String url2 = "http://www.foo.com/a/b";
ActionImpliesTest(String arg1, String arg2, boolean expected) {
this.arg1 = arg1;
@@ -117,10 +119,17 @@
this.expected = expected;
}
+ ActionImpliesTest(String ur11, String url2, String arg1, String arg2,
+ boolean expected) {
+ this.url1 = ur11;
+ this.url2 = url2;
+ this.arg1 = arg1;
+ this.arg2 = arg2;
+ this.expected = expected;
+ }
+
@Override
boolean execute() {
- String url1 = "http://www.foo.com/-";
- String url2 = "http://www.foo.com/a/b";
URLPermission p1 = new URLPermission(url1, arg1);
URLPermission p2 = new URLPermission(url2, arg2);
boolean result = p1.implies(p2);
@@ -129,10 +138,37 @@
}
}
+ static ActionsStringTest actionstest(String arg, String expectedActions) {
+ return new ActionsStringTest(arg, expectedActions);
+ }
+
+ static class ActionsStringTest extends Test {
+
+ String expectedActions;
+ String arg;
+
+ public ActionsStringTest(String arg, String expectedActions) {
+ this.arg = arg;
+ this.expectedActions = expectedActions;
+ }
+
+ @Override
+ boolean execute() {
+ String url = "http://www.foo.com/";
+ URLPermission urlp = new URLPermission(url, arg);
+ return (expectedActions.equals(urlp.getActions()));
+ }
+ }
+
static ActionImpliesTest actest(String arg1, String arg2, boolean expected) {
return new ActionImpliesTest(arg1, arg2, expected);
}
+ static ActionImpliesTest actest(String url1, String url2, String arg1,
+ String arg2, boolean expected) {
+ return new ActionImpliesTest(url1, url2, arg1, arg2, expected);
+ }
+
static class HashCodeTest extends Test {
String arg1, arg2;
int hash;
@@ -292,6 +328,9 @@
imtest("https:*", "http:*", false)
};
+ static final String FOO_URL = "http://www.foo.com/";
+ static final String BAR_URL = "http://www.bar.com/";
+
static Test[] actionImplies = {
actest("GET", "GET", true),
actest("GET", "POST", false),
@@ -305,7 +344,28 @@
actest("GET:X-Foo,X-Bar", "GET:x-bar,x-foo", true),
actest("GET:X-Bar,X-Foo,X-Bar,Y-Foo", "GET:x-bar,x-foo", true),
actest("GET:*", "GET:x-bar,x-foo", true),
- actest("*:*", "GET:x-bar,x-foo", true)
+ actest("*:*", "GET:x-bar,x-foo", true),
+ actest("", "GET:x-bar,x-foo", false),
+ actest("GET:x-bar,x-foo", "", true),
+ actest("", "", true),
+ actest("GET,DELETE", "GET,DELETE:x-foo", false),
+ actest(FOO_URL, BAR_URL, "", "GET:x-bar,x-foo", false),
+ actest(FOO_URL, BAR_URL, "GET:x-bar,x-foo", "", false),
+ actest(FOO_URL, BAR_URL, "", "", false)
+ };
+
+ static Test[] actionsStringTest = {
+ actionstest("", ""),
+ actionstest(":X-Bar", ":X-Bar"),
+ actionstest("GET", "GET"),
+ actionstest("get", "GET"),
+ actionstest("GET,POST", "GET,POST"),
+ actionstest("GET,post", "GET,POST"),
+ actionstest("get,post", "GET,POST"),
+ actionstest("get,post,DELETE", "DELETE,GET,POST"),
+ actionstest("GET,POST:", "GET,POST"),
+ actionstest("GET:X-Foo,X-bar", "GET:X-Bar,X-Foo"),
+ actionstest("GET,POST,DELETE:X-Bar,X-Foo,X-Bar,Y-Foo", "DELETE,GET,POST:X-Bar,X-Bar,X-Foo,Y-Foo")
};
static Test[] equalityTests = {
@@ -449,6 +509,23 @@
System.out.println ("action test " + i + " OK");
}
+ for (int i = 0; i < actionsStringTest.length; i++) {
+ ActionsStringTest test = (ActionsStringTest) actionsStringTest[i];
+ Exception caught = null;
+ boolean result = false;
+ try {
+ result = test.execute();
+ } catch (Exception e) {
+ caught = e;
+ }
+ if (!result) {
+ failed = true;
+ System.out.println("test failed: " + test.arg + ": "
+ + test.expectedActions + " Exception: " + caught);
+ }
+ System.out.println("Actions String test " + i + " OK");
+ }
+
serializationTest("http://www.foo.com/-", "GET,DELETE:*");
serializationTest("https://www.foo.com/-", "POST:X-Foo");
serializationTest("https:*", "*:*");
--- a/jdk/test/java/net/httpclient/BasicWebSocketAPITest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/java/net/httpclient/BasicWebSocketAPITest.java Mon Jun 27 10:00:47 2016 -0700
@@ -32,10 +32,9 @@
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.SocketChannel;
+import java.time.Duration;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
-import java.util.stream.Stream;
/*
* @test
@@ -83,13 +82,7 @@
(ws) ->
TestKit.assertThrows(NullPointerException.class,
"message",
- () -> ws.sendBinary((byte[]) null, true))
- );
- checkAndClose(
- (ws) ->
- TestKit.assertThrows(NullPointerException.class,
- "message",
- () -> ws.sendBinary((ByteBuffer) null, true))
+ () -> ws.sendBinary(null, true))
);
checkAndClose(
(ws) ->
@@ -125,13 +118,7 @@
(ws) ->
TestKit.assertThrows(NullPointerException.class,
"message",
- () -> ws.sendText((CharSequence) null))
- );
- checkAndClose(
- (ws) ->
- TestKit.assertThrows(NullPointerException.class,
- "message",
- () -> ws.sendText((Stream<? extends CharSequence>) null))
+ () -> ws.sendText(null))
);
checkAndClose(
(ws) ->
@@ -214,17 +201,7 @@
// FIXME: check timeout works
// (i.e. it directly influences the time WebSocket waits for connection + opening handshake)
TestKit.assertNotThrows(
- () -> WebSocket.newBuilder(ws, defaultListener()).connectTimeout(1, TimeUnit.SECONDS)
- );
- WebSocket.Builder builder = WebSocket.newBuilder(ws, defaultListener());
- TestKit.assertThrows(IllegalArgumentException.class,
- "(?i).*\\bnegative\\b.*",
- () -> builder.connectTimeout(-1, TimeUnit.SECONDS)
- );
- WebSocket.Builder builder1 = WebSocket.newBuilder(ws, defaultListener());
- TestKit.assertThrows(NullPointerException.class,
- "unit",
- () -> builder1.connectTimeout(1, null)
+ () -> WebSocket.newBuilder(ws, defaultListener()).connectTimeout(Duration.ofSeconds(1))
);
// FIXME: check these headers are actually received by the server
TestKit.assertNotThrows(
--- a/jdk/test/java/util/Formatter/FormatLocale.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/java/util/Formatter/FormatLocale.java Mon Jun 27 10:00:47 2016 -0700
@@ -23,17 +23,22 @@
/**
* @test
- * @bug 8146156
+ * @bug 8146156 8159548
* @summary test whether uppercasing follows Locale.Category.FORMAT locale.
* @run main/othervm FormatLocale
*/
import java.time.LocalDate;
+import java.time.ZonedDateTime;
+import java.time.ZoneId;
import java.time.Month;
+import java.util.Calendar;
import java.util.Formatter;
+import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Locale.Category;
+import java.util.TimeZone;
import java.util.stream.IntStream;
public class FormatLocale {
@@ -61,7 +66,7 @@
"N\u0130SAN",
"1,00000E+08");
- public static void main(String [] args) {
+ static void formatLocaleTest() {
StringBuilder sb = new StringBuilder();
IntStream.range(0, src.size()).forEach(i -> {
@@ -79,4 +84,44 @@
}
});
}
+
+ static void nullLocaleTest() {
+ String fmt = "%1$ta %1$tA %1$th %1$tB %1tZ";
+ String expected = "Fri Friday Jan January PST";
+ StringBuilder sb = new StringBuilder();
+ Locale orig = Locale.getDefault();
+
+ try {
+ Locale.setDefault(Locale.JAPAN);
+ Formatter f = new Formatter(sb, (Locale)null);
+ ZoneId zid = ZoneId.of("America/Los_Angeles");
+ Calendar c = new GregorianCalendar(TimeZone.getTimeZone(zid), Locale.US);
+ c.set(2016, 0, 1, 0, 0, 0);
+ f.format(fmt, c);
+ if (!sb.toString().equals(expected)) {
+ throw new RuntimeException(
+ "Localized text returned with null locale.\n" +
+ " expected: " + expected + "\n" +
+ " returned: " + sb.toString());
+ }
+
+ sb.setLength(0);
+ ZonedDateTime zdt = ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, zid);
+ f.format(fmt, zdt);
+
+ if (!sb.toString().equals(expected)) {
+ throw new RuntimeException(
+ "Localized text returned with null locale.\n" +
+ " expected: " + expected + "\n" +
+ " returned: " + sb.toString());
+ }
+ } finally {
+ Locale.setDefault(orig);
+ }
+ }
+
+ public static void main(String [] args) {
+ formatLocaleTest();
+ nullLocaleTest();
+ }
}
--- a/jdk/test/java/util/Scanner/ScanTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/java/util/Scanner/ScanTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -24,7 +24,7 @@
/**
* @test
* @bug 4313885 4926319 4927634 5032610 5032622 5049968 5059533 6223711 6277261 6269946 6288823
- * 8072722 8072582 8139414
+ * 8072722 8139414
* @summary Basic tests of java.util.Scanner methods
* @key randomness
* @modules jdk.localedata
@@ -512,27 +512,9 @@
}
public static void boundaryDelimTest() throws Exception {
- // 8072582
- StringBuilder sb = new StringBuilder();
- append(sb, 'a', 228); sb.append(",");
- append(sb, 'b', 293); sb.append("#,#");
- append(sb, 'c', 308); sb.append(",");
- append(sb, 'd', 188); sb.append("#,#");
- append(sb, 'e', 2);
- try (Scanner scanner = new Scanner(sb.toString())) {
- scanner.useDelimiter("(#,#)|(,)");
- while(scanner.hasNext()){
- String next = scanner.next();
- if(next.contains("#")){
- System.out.printf("[%s]%n", next);
- failCount++;
- }
- }
- }
-
// 8139414
int i = 1019;
- sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
sb.append("--;");
for (int j = 0; j < 1019; ++j) {
sb.append(j%10);
--- a/jdk/test/javax/net/ssl/DTLS/WeakCipherSuite.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/net/ssl/DTLS/WeakCipherSuite.java Mon Jun 27 10:00:47 2016 -0700
@@ -27,7 +27,6 @@
/*
* @test
* @bug 8043758
- * @key intermittent
* @summary Datagram Transport Layer Security (DTLS)
* @modules java.base/sun.security.util
* @build DTLSOverDatagram
--- a/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -73,6 +73,7 @@
private static final List<TestParameters> TESTS = new ArrayList<>(3);
private static final List<Exception> EXCEPTIONS
= Collections.synchronizedList(new ArrayList<>(1));
+
private static final String CLIENT_PUBLIC_KEY
= "-----BEGIN CERTIFICATE-----\n"
+ "MIICtTCCAh4CCQDkYJ46DMcGRjANBgkqhkiG9w0BAQUFADCBnDELMAkGA1UEBhMC\n"
@@ -191,7 +192,7 @@
private final X509TrustManager clientTrustManager;
private final X509TrustManager serverTrustManager;
- static abstract class Server implements Runnable {
+ static abstract class Server implements Runnable, AutoCloseable {
final CipherTestUtils cipherTest;
@@ -240,12 +241,11 @@
public static class TestParameters {
- String cipherSuite;
- String protocol;
- String clientAuth;
+ final String cipherSuite;
+ final String protocol;
+ final String clientAuth;
- TestParameters(String cipherSuite, String protocol,
- String clientAuth) {
+ TestParameters(String cipherSuite, String protocol, String clientAuth) {
this.cipherSuite = cipherSuite;
this.protocol = protocol;
this.clientAuth = clientAuth;
@@ -267,10 +267,7 @@
private static volatile CipherTestUtils instance = null;
- public static CipherTestUtils getInstance() throws IOException,
- FileNotFoundException, KeyStoreException,
- NoSuchAlgorithmException, CertificateException,
- UnrecoverableKeyException, InvalidKeySpecException {
+ public static CipherTestUtils getInstance() throws Exception {
if (instance == null) {
synchronized (CipherTestUtils.class) {
if (instance == null) {
@@ -281,21 +278,10 @@
return instance;
}
- public static void setTestedArguments(String testedProtocol,
- String testedCipherSuite) {
-
- TestParameters testedParams;
-
- String cipherSuite = testedCipherSuite.trim();
- if (cipherSuite.startsWith("SSL_")) {
- testedParams =
- new TestParameters(cipherSuite, testedProtocol, null);
- TESTS.add(testedParams);
-
- } else {
- System.out.println("Your input Cipher suites is not correct, "
- + "please try another one .");
- }
+ public static void setTestedArguments(String protocol, String ciphersuite) {
+ ciphersuite = ciphersuite.trim();
+ TestParameters params = new TestParameters(ciphersuite, protocol, null);
+ TESTS.add(params);
}
public X509ExtendedKeyManager getClientKeyManager() {
@@ -318,10 +304,7 @@
EXCEPTIONS.add(e);
}
- private CipherTestUtils()
- throws IOException, FileNotFoundException, KeyStoreException,
- NoSuchAlgorithmException, CertificateException,
- UnrecoverableKeyException, InvalidKeySpecException {
+ private CipherTestUtils() throws Exception {
factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
KeyStore serverKeyStore = createServerKeyStore(SERVER_PUBLIC_KEY,
SERVER_PRIVATE_KEY);
@@ -329,12 +312,11 @@
CA_PRIVATE_KEY);
if (serverKeyStore != null) {
- KeyManagerFactory keyFactory1
- = KeyManagerFactory.getInstance(
+ KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
- keyFactory1.init(serverKeyStore, PASSWORD);
- serverKeyManager = (X509ExtendedKeyManager) keyFactory1.
- getKeyManagers()[0];
+ keyFactory.init(serverKeyStore, PASSWORD);
+ serverKeyManager = (X509ExtendedKeyManager)
+ keyFactory.getKeyManagers()[0];
} else {
serverKeyManager = null;
}
@@ -346,12 +328,11 @@
clientKeyStore =
createServerKeyStore(CLIENT_PUBLIC_KEY,CLIENT_PRIVATE_KEY);
if (clientKeyStore != null) {
- KeyManagerFactory keyFactory
- = KeyManagerFactory.getInstance(
+ KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
keyFactory.init(clientKeyStore, PASSWORD);
- clientKeyManager = (X509ExtendedKeyManager) keyFactory.
- getKeyManagers()[0];
+ clientKeyManager = (X509ExtendedKeyManager)
+ keyFactory.getKeyManagers()[0];
} else {
clientKeyManager = null;
}
@@ -395,8 +376,8 @@
this.cipherTest = cipherTest;
}
- Client(CipherTestUtils cipherTest,
- String testedCipherSuite) throws Exception {
+ Client(CipherTestUtils cipherTest, String testedCipherSuite)
+ throws Exception {
this.cipherTest = cipherTest;
}
@@ -417,7 +398,7 @@
CipherTestUtils.addFailure(e);
System.out.println("** Failed " + params
+ "**, got exception:");
- e.printStackTrace(System.err);
+ e.printStackTrace(System.out);
}
});
}
@@ -448,11 +429,7 @@
}
public static void printStringArray(String[] stringArray) {
- System.out.print(stringArray.length + " : ");
- for (String stringArray1 : stringArray) {
- System.out.print(stringArray1);
- System.out.print(",");
- }
+ System.out.println(Arrays.toString(stringArray));
System.out.println();
}
@@ -496,15 +473,15 @@
System.out.println("-----------------------");
}
- private static KeyStore createServerKeyStore(String publicKeyStr,
+ private static KeyStore createServerKeyStore(String publicKey,
String keySpecStr) throws KeyStoreException, IOException,
NoSuchAlgorithmException, CertificateException,
InvalidKeySpecException {
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(null, null);
- if (publicKeyStr == null || keySpecStr == null) {
- throw new IllegalArgumentException("publicKeyStr or "
+ if (publicKey == null || keySpecStr == null) {
+ throw new IllegalArgumentException("publicKey or "
+ "keySpecStr cannot be null");
}
String strippedPrivateKey = keySpecStr.substring(
@@ -518,8 +495,7 @@
= (RSAPrivateKey) kf.generatePrivate(priKeySpec);
// generate certificate chain
- try (InputStream is =
- new ByteArrayInputStream(publicKeyStr.getBytes())) {
+ try (InputStream is = new ByteArrayInputStream(publicKey.getBytes())) {
// generate certificate from cert string
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate keyCert = cf.generateCertificate(is);
@@ -530,10 +506,9 @@
return ks;
}
- public static int mainServer(PeerFactory peerFactory,
+ public static Server mainServer(PeerFactory peerFactory,
String expectedException) throws Exception {
- long time = System.currentTimeMillis();
setTestedArguments(peerFactory.getTestedProtocol(),
peerFactory.getTestedCipher());
@@ -542,14 +517,11 @@
secureRandom.nextInt();
CipherTestUtils cipherTest = CipherTestUtils.getInstance();
- Server server = peerFactory.newServer(cipherTest, PeerFactory.FREE_PORT);
- Thread serverThread = new Thread(server, "Server");
+ Server srv = peerFactory.newServer(cipherTest, PeerFactory.FREE_PORT);
+ Thread serverThread = new Thread(srv, "Server");
serverThread.start();
- time = System.currentTimeMillis() - time;
- System.out.println("Elapsed time " + time);
-
- return server.getPort();
+ return srv;
}
public static void mainClient(PeerFactory peerFactory, int port,
@@ -566,7 +538,6 @@
CipherTestUtils cipherTest = CipherTestUtils.getInstance();
peerFactory.newClient(cipherTest, port).run();
cipherTest.checkResult(expectedException);
- JSSEServer.closeServer = true;
time = System.currentTimeMillis() - time;
System.out.println("Elapsed time " + time);
@@ -582,9 +553,11 @@
abstract String getTestedCipher();
- abstract Client newClient(CipherTestUtils cipherTest, int testPort) throws Exception;
+ abstract Client newClient(CipherTestUtils cipherTest, int testPort)
+ throws Exception;
- abstract Server newServer(CipherTestUtils cipherTest, int testPort) throws Exception;
+ abstract Server newServer(CipherTestUtils cipherTest, int testPort)
+ throws Exception;
boolean isSupported(String cipherSuite) {
return true;
@@ -618,7 +591,7 @@
try {
trustManager.checkClientTrusted(chain, authType);
} catch (CertificateException excep) {
- System.out.println("ERROR in client trust manager");
+ System.out.println("ERROR in client trust manager: " + excep);
}
}
@@ -628,7 +601,7 @@
try {
trustManager.checkServerTrusted(chain, authType);
} catch (CertificateException excep) {
- System.out.println("ERROR in server Trust manger");
+ System.out.println("ERROR in server trust manager: " + excep);
}
}
--- a/jdk/test/javax/net/ssl/TLS/JSSEClient.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/net/ssl/TLS/JSSEClient.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+/*
+ * Copyright (c) 2010, 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
@@ -35,39 +35,37 @@
private static final String DEFAULT = "DEFAULT";
private static final String TLS = "TLS";
- private final SSLContext sslContext;
+ private final SSLContext context;
private final MyX509KeyManager keyManager;
- private final int serverPort;
- private final String serverHost;
- private final String testedProtocol;
+ private final int port;
+ private final String host;
+ private final String protocol;
- JSSEClient(CipherTestUtils cipherTest, String serverHost, int serverPort,
- String testedProtocols, String testedCipherSuite) throws Exception {
- super(cipherTest, testedCipherSuite);
- this.serverHost = serverHost;
- this.serverPort = serverPort;
- this.testedProtocol = testedProtocols;
- this.keyManager =
- new MyX509KeyManager(cipherTest.getClientKeyManager());
- sslContext = SSLContext.getInstance(TLS);
+ JSSEClient(CipherTestUtils cipherTest, String host, int port,
+ String protocols, String ciphersuite) throws Exception {
+ super(cipherTest, ciphersuite);
+ this.host = host;
+ this.port = port;
+ this.protocol = protocols;
+ this.keyManager = new MyX509KeyManager(
+ cipherTest.getClientKeyManager());
+ context = SSLContext.getInstance(TLS);
}
@Override
void runTest(CipherTestUtils.TestParameters params) throws Exception {
- SSLSocket socket = null;
- try {
- System.out.println("Connecting to server...");
- keyManager.setAuthType(params.clientAuth);
- sslContext.init(new KeyManager[]{keyManager},
- new TrustManager[]{cipherTest.getClientTrustManager()},
- CipherTestUtils.secureRandom);
- SSLSocketFactory factory = (SSLSocketFactory) sslContext.
- getSocketFactory();
- socket = (SSLSocket) factory.createSocket(serverHost,
- serverPort);
+ keyManager.setAuthType(params.clientAuth);
+ context.init(
+ new KeyManager[]{ keyManager },
+ new TrustManager[]{ cipherTest.getClientTrustManager() },
+ CipherTestUtils.secureRandom);
+ SSLSocketFactory factory = (SSLSocketFactory)context.getSocketFactory();
+
+ System.out.println("Connecting to server...");
+ try (SSLSocket socket = (SSLSocket) factory.createSocket(host, port)) {
socket.setSoTimeout(CipherTestUtils.TIMEOUT);
socket.setEnabledCipherSuites(params.cipherSuite.split(","));
- if (params.protocol != null && !params.protocol.trim().equals("")
+ if (params.protocol != null && !params.protocol.trim().isEmpty()
&& !params.protocol.trim().equals(DEFAULT)) {
socket.setEnabledProtocols(params.protocol.split(","));
}
@@ -105,16 +103,11 @@
if ("EC".equals(keyAlg)) {
keyAlg = "ECDSA";
}
- if (params.clientAuth == null ? keyAlg != null
- : !params.clientAuth.equals(keyAlg)) {
+ if (!params.clientAuth.equals(keyAlg)) {
throw new RuntimeException("Certificate type mismatch: "
+ keyAlg + " != " + params.clientAuth);
}
}
- } finally {
- if (socket != null) {
- socket.close();
- }
}
}
}
--- a/jdk/test/javax/net/ssl/TLS/JSSEServer.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/net/ssl/TLS/JSSEServer.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -33,13 +33,11 @@
public class JSSEServer extends CipherTestUtils.Server {
private final SSLServerSocket serverSocket;
- private final int serverPort;
- static volatile boolean closeServer = false;
+ private static volatile boolean closeServer = false;
JSSEServer(CipherTestUtils cipherTest, int serverPort,
String protocol, String cipherSuite) throws Exception {
super(cipherTest);
- this.serverPort = serverPort;
SSLContext serverContext = SSLContext.getInstance("TLS");
serverContext.init(new KeyManager[]{cipherTest.getServerKeyManager()},
new TrustManager[]{cipherTest.getServerTrustManager()},
@@ -56,7 +54,7 @@
@Override
public void run() {
- System.out.println("JSSE Server listening on port " + serverPort);
+ System.out.println("JSSE Server listening on port " + getPort());
while (!closeServer) {
try (final SSLSocket socket = (SSLSocket) serverSocket.accept()) {
socket.setSoTimeout(CipherTestUtils.TIMEOUT);
@@ -68,12 +66,12 @@
} catch (IOException e) {
CipherTestUtils.addFailure(e);
System.out.println("Got IOException:");
- e.printStackTrace(System.err);
+ e.printStackTrace(System.out);
}
} catch (Exception e) {
CipherTestUtils.addFailure(e);
System.out.println("Exception:");
- e.printStackTrace(System.err);
+ e.printStackTrace(System.out);
}
}
}
@@ -81,4 +79,12 @@
int getPort() {
return serverSocket.getLocalPort();
}
+
+ @Override
+ public void close() throws IOException {
+ closeServer = true;
+ if (serverSocket != null && !serverSocket.isClosed()) {
+ serverSocket.close();
+ }
+ }
}
--- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -20,59 +20,9 @@
* questions.
*/
-import static java.lang.System.out;
import java.security.Provider;
import java.security.Security;
-/**
- * @test
- * @bug 8049429
- * @modules java.management
- * jdk.crypto.ec/sun.security.ec
- * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
- * @summary Test that all cipher suites work in all versions and all client
- * authentication types. The way this is setup the server is stateless and
- * all checking is done on the client side.
- * @run main/othervm -DSERVER_PROTOCOL=SSLv3
- * -DCLIENT_PROTOCOL=SSLv3
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=TLSv1
- * -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=TLSv1.1
- * -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=TLSv1.2
- * -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv3,TLSv1
- * -DCLIENT_PROTOCOL=TLSv1 -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv3,TLSv1,TLSv1.1
- * -DCLIENT_PROTOCOL=TLSv1.1 -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv3
- * -DCLIENT_PROTOCOL=TLSv1.1,TLSv1.2
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
- * TestJSSE javax.net.ssl.SSLHandshakeException
- * @run main/othervm -DSERVER_PROTOCOL=TLSv1
- * -DCLIENT_PROTOCOL=TLSv1.1,TLSv1.2
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
- * TestJSSE javax.net.ssl.SSLHandshakeException
- * @run main/othervm -DSERVER_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
- * -DCLIENT_PROTOCOL=TLSv1.2 -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1
- * -DCLIENT_PROTOCOL=DEFAULT -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
- * -DCLIENT_PROTOCOL=DEFAULT -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
- * -DCLIENT_PROTOCOL=DEFAULT -Djdk.tls.client.protocols=TLSv1
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5 TestJSSE
- * @run main/othervm -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1
- * -DCLIENT_PROTOCOL=DEFAULT -Djdk.tls.client.protocols=TLSv1.2
- * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
- * TestJSSE javax.net.ssl.SSLHandshakeException
- *
- */
-
public class TestJSSE {
private static final String LOCAL_IP = "127.0.0.1";
@@ -82,72 +32,64 @@
// and keys used in this test are not disabled.
Security.setProperty("jdk.tls.disabledAlgorithms", "");
- String serverProtocol = System.getProperty("SERVER_PROTOCOL");
- String clientProtocol = System.getProperty("CLIENT_PROTOCOL");
- String cipher = System.getProperty("CIPHER");
- if (serverProtocol == null
- || clientProtocol == null
- || cipher == null) {
- throw new IllegalArgumentException("SERVER_PROTOCOL "
- + "or CLIENT_PROTOCOL or CIPHER is missing");
- }
- out.println("ServerProtocol =" + serverProtocol);
- out.println("ClientProtocol =" + clientProtocol);
- out.println("Cipher =" + cipher);
- int port = server(serverProtocol, cipher, args);
- client(port, clientProtocol, cipher, args);
+ // enable debug output
+ System.setProperty("javax.net.debug", "ssl,record");
- }
+ String srvProtocol = System.getProperty("SERVER_PROTOCOL");
+ String clnProtocol = System.getProperty("CLIENT_PROTOCOL");
+ String cipher = System.getProperty("CIPHER");
+ if (srvProtocol == null || clnProtocol == null || cipher == null) {
+ throw new IllegalArgumentException("Incorrect parameters");
+ }
- public static void client(int testPort,
- String testProtocols, String testCipher,
- String... exception) throws Exception {
- String expectedException = exception.length >= 1
- ? exception[0] : null;
- out.println("=========================================");
- out.println(" Testing - https://" + LOCAL_IP + ":" + testPort);
- out.println(" Testing - Protocol : " + testProtocols);
- out.println(" Testing - Cipher : " + testCipher);
- try {
- CipherTestUtils.mainClient(new JSSEFactory(LOCAL_IP, testProtocols,
- testCipher, "Client JSSE"),
- testPort, expectedException);
- } catch (Exception e) {
- throw new RuntimeException(e);
+ System.out.println("ServerProtocol = " + srvProtocol);
+ System.out.println("ClientProtocol = " + clnProtocol);
+ System.out.println("Cipher = " + cipher);
+
+ try (CipherTestUtils.Server srv = server(srvProtocol, cipher, args)) {
+ client(srv.getPort(), clnProtocol, cipher, args);
}
}
- public static int server(String testProtocol, String testCipher,
- String... exception) throws Exception {
+ public static void client(int port, String protocols, String cipher,
+ String... exceptions) throws Exception {
- String expectedException = exception.length >= 1
- ? exception[0] : null;
- out.println(" This is Server");
- out.println(" Testing Protocol: " + testProtocol);
- out.println(" Testing Cipher: " + testCipher);
+ String expectedExcp = exceptions.length >= 1 ? exceptions[0] : null;
+
+ System.out.println("This is client");
+ System.out.println("Testing protocol: " + protocols);
+ System.out.println("Testing cipher : " + cipher);
- try {
- int port = CipherTestUtils.mainServer(new JSSEFactory(
- null, testProtocol, testCipher, "Server JSSE"),
- expectedException);
+ CipherTestUtils.mainClient(
+ new JSSEFactory(LOCAL_IP, protocols, cipher, "Client JSSE"),
+ port, expectedExcp);
+ }
+
+ public static CipherTestUtils.Server server(String protocol,
+ String cipher, String... exceptions) throws Exception {
- out.println(" Testing Port: " + port);
- return port;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ String expectedExcp = exceptions.length >= 1 ? exceptions[0] : null;
+
+ System.out.println("This is server");
+ System.out.println("Testing protocol: " + protocol);
+ System.out.println("Testing cipher : " + cipher);
+
+ return CipherTestUtils.mainServer(
+ new JSSEFactory(null, protocol, cipher, "Server JSSE"),
+ expectedExcp);
}
private static class JSSEFactory extends CipherTestUtils.PeerFactory {
- final String testedCipherSuite, testedProtocol, testHost;
- final String name;
+ private final String cipher;
+ private final String protocol;
+ private final String host;
+ private final String name;
- JSSEFactory(String testHost, String testedProtocol,
- String testedCipherSuite, String name) {
- this.testedCipherSuite = testedCipherSuite;
- this.testedProtocol = testedProtocol;
- this.testHost = testHost;
+ JSSEFactory(String host, String protocol, String cipher, String name) {
+ this.cipher = cipher;
+ this.protocol = protocol;
+ this.host = host;
this.name = name;
}
@@ -158,26 +100,24 @@
@Override
String getTestedCipher() {
- return testedCipherSuite;
+ return cipher;
}
@Override
String getTestedProtocol() {
- return testedProtocol;
+ return protocol;
}
@Override
- CipherTestUtils.Client newClient(CipherTestUtils cipherTest, int testPort)
+ CipherTestUtils.Client newClient(CipherTestUtils cipherTest, int port)
throws Exception {
- return new JSSEClient(cipherTest, testHost, testPort,
- testedProtocol, testedCipherSuite);
+ return new JSSEClient(cipherTest, host, port, protocol, cipher);
}
@Override
- CipherTestUtils.Server newServer(CipherTestUtils cipherTest, int testPort)
+ CipherTestUtils.Server newServer(CipherTestUtils cipherTest, int port)
throws Exception {
- return new JSSEServer(cipherTest, testPort,
- testedProtocol, testedCipherSuite);
+ return new JSSEServer(cipherTest, port, protocol, cipher);
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEClientDefaultProtocol.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 only, as published by
+ * the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
+ * details (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version 2
+ * along with this work; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
+ * visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049429
+ * @modules java.management
+ * jdk.crypto.ec/sun.security.ec
+ * @summary Test that all cipher suites work in all versions and all client
+ * authentication types. The way this is setup the server is stateless
+ * and all checking is done on the client side.
+ * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1
+ * -DCLIENT_PROTOCOL=DEFAULT
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ * -DCLIENT_PROTOCOL=DEFAULT
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ * -DCLIENT_PROTOCOL=DEFAULT
+ * -Djdk.tls.client.protocols=TLSv1
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1
+ * -DCLIENT_PROTOCOL=DEFAULT
+ * -Djdk.tls.client.protocols=TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE javax.net.ssl.SSLHandshakeException
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 only, as published by
+ * the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
+ * details (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version 2
+ * along with this work; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
+ * visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049429
+ * @modules java.management
+ * jdk.crypto.ec/sun.security.ec
+ * @summary Test that all cipher suites work in all versions and all client
+ * authentication types. The way this is setup the server is stateless
+ * and all checking is done on the client side.
+ * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv3
+ * -DCLIENT_PROTOCOL=SSLv3
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv3,TLSv1
+ * -DCLIENT_PROTOCOL=TLSv1
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv3,TLSv1,TLSv1.1
+ * -DCLIENT_PROTOCOL=TLSv1.1
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ * -DCLIENT_PROTOCOL=TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSENoCommonProtocols.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 only, as published by
+ * the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
+ * details (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version 2
+ * along with this work; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
+ * visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049429
+ * @modules java.management
+ * jdk.crypto.ec/sun.security.ec
+ * @summary Test that all cipher suites work in all versions and all client
+ * authentication types. The way this is setup the server is stateless
+ * and all checking is done on the client side.
+ * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=TLSv1
+ * -DCLIENT_PROTOCOL=TLSv1.1,TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE javax.net.ssl.SSLHandshakeException
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEServerProtocol.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 only, as published by
+ * the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
+ * details (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version 2
+ * along with this work; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
+ * visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049429
+ * @modules java.management
+ * jdk.crypto.ec/sun.security.ec
+ * @summary Test that all cipher suites work in all versions and all client
+ * authentication types. The way this is setup the server is stateless
+ * and all checking is done on the client side.
+ * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=SSLv3
+ * -DCLIENT_PROTOCOL=TLSv1.1,TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE javax.net.ssl.SSLHandshakeException
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=TLSv1
+ * -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=TLSv1.1
+ * -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ * @run main/othervm
+ * -DSERVER_PROTOCOL=TLSv1.2
+ * -DCLIENT_PROTOCOL=SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ * -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ * TestJSSE
+ */
--- a/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Mon Jun 27 10:00:47 2016 -0700
@@ -178,8 +178,11 @@
char[] passphrase = "passphrase".toCharArray();
- ks.load(new FileInputStream(keyFilename), passphrase);
- ts.load(new FileInputStream(trustFilename), passphrase);
+ try (FileInputStream keyFile = new FileInputStream(keyFilename);
+ FileInputStream trustFile = new FileInputStream(trustFilename)) {
+ ks.load(keyFile, passphrase);
+ ts.load(trustFile, passphrase);
+ }
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, passphrase);
@@ -310,6 +313,7 @@
if (retry &&
serverIn.remaining() < clientMsg.length) {
log("Need to read more from client");
+ serverIn.compact();
retry = false;
continue;
} else {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloClient.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+
+import javax.naming.InitialContext;
+import javax.naming.Context;
+import javax.naming.NameNotFoundException;
+
+import javax.rmi.PortableRemoteObject;
+
+
+
+public class HelloClient implements Runnable {
+ static final int MAX_RETRY = 10;
+ static final int ONE_SECOND = 1000;
+ private static boolean responseReceived;
+
+ public static void main(String args[]) throws Exception {
+ executeRmiClientCall();
+ }
+
+ @Override
+ public void run() {
+ try {
+ executeRmiClientCall();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ public static boolean isResponseReceived () {
+ return responseReceived;
+ }
+
+ public static void executeRmiClientCall() throws Exception {
+ Context ic;
+ Object objref;
+ HelloInterface helloSvc;
+ String response;
+ Object testResponse;
+ int retryCount = 0;
+
+ ArrayList<Test> listParam = new ArrayList<Test>();
+ listParam.add(null);
+ System.out.println("HelloClient.main: enter ...");
+ while (retryCount < MAX_RETRY) {
+ try {
+ ic = new InitialContext();
+ System.out.println("HelloClient.main: HelloService lookup ...");
+ // STEP 1: Get the Object reference from the Name Service
+ // using JNDI call.
+ objref = ic.lookup("HelloService");
+ System.out.println("HelloClient: Obtained a ref. to Hello server.");
+
+ // STEP 2: Narrow the object reference to the concrete type and
+ // invoke the method.
+ helloSvc = (HelloInterface) PortableRemoteObject.narrow(objref,
+ HelloInterface.class);
+
+ Test3 test3 = new Test3(listParam);
+ Test3 test3Response = helloSvc.sayHelloWithTest3(test3);
+ System.out.println("Server says: Test3 response == " + test3Response);
+
+ Test3 test3WithNullList = new Test3(null);
+ test3Response = helloSvc.sayHelloWithTest3(test3WithNullList);
+ System.out.println("Server says: Test3 response == "
+ + test3Response);
+
+ Test4 test4 = new Test4(listParam);
+ Test3 test4Response = helloSvc.sayHelloWithTest3(test4);
+ System.out.println("Server says: Test4 response == " + test4Response);
+
+ responseReceived = true;
+ break;
+ } catch (NameNotFoundException nnfEx) {
+ System.err.println("NameNotFoundException Caught .... try again");
+ retryCount++;
+ try {
+ Thread.sleep(ONE_SECOND);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ continue;
+ } catch (Throwable t) {
+ System.err.println("Exception " + t + "Caught");
+ t.printStackTrace();
+ throw new RuntimeException(t);
+ }
+ }
+ System.err.println("HelloClient terminating ");
+ try {
+ Thread.sleep(ONE_SECOND);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloImpl.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.rmi.RemoteException;
+import javax.rmi.PortableRemoteObject;
+
+public class HelloImpl extends PortableRemoteObject implements HelloInterface {
+
+ public HelloImpl() throws java.rmi.RemoteException {
+ super(); // invoke rmi linking and remote object initialization
+ }
+
+
+ @Override
+ public Test3 sayHelloWithTest3(Test3 test) throws RemoteException {
+ System.out.println("sayHelloToTest3: ENTER " );
+
+ return test;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloInterface.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.rmi.Remote;
+
+public interface HelloInterface extends Remote {
+ public Test3 sayHelloWithTest3( Test3 test ) throws java.rmi.RemoteException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloServer.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+public class HelloServer {
+
+ static final int MAX_RETRY = 10;
+ static final int ONE_SECOND = 1000;
+
+ public static void main(String[] args) {
+ int retryCount = 0;
+ while (retryCount < MAX_RETRY) {
+ try {
+ // Step 1: Instantiate the Hello servant
+ HelloImpl helloRef = new HelloImpl();
+
+ // Step 2: Publish the reference in the Naming Service
+ // using JNDI API
+ Context initialNamingContext = new InitialContext();
+ initialNamingContext.rebind("HelloService", helloRef);
+
+ System.out.println("Hello Server: Ready...");
+ break;
+ } catch (Exception e) {
+ System.out.println("Server initialization problem: " + e);
+ e.printStackTrace();
+ retryCount++;
+ try {
+ Thread.sleep(ONE_SECOND);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8146975
+ * @summary test RMI-IIOP with value object return
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @compile -addmods java.corba Test.java Test3.java Test4.java
+ * HelloInterface.java HelloServer.java
+ * HelloClient.java HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java
+ * RmiIiopReturnValueTest.java
+ * @run main/othervm -addmods java.corba
+ * -Djava.naming.provider.url=iiop://localhost:5050
+ * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+ * RmiIiopReturnValueTest -port 5049
+ * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy
+ * -addmods java.corba -Djava.naming.provider.url=iiop://localhost:5050
+ * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+ * RmiIiopReturnValueTest -port 5049
+ */
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import jdk.testlibrary.JDKToolFinder;
+import jdk.testlibrary.JDKToolLauncher;
+
+public class RmiIiopReturnValueTest {
+
+ static final String ORBD = JDKToolFinder.getTestJDKTool("orbd");
+ static final String JAVA = JDKToolFinder.getTestJDKTool("java");
+ static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd");
+ static final String CLASSPATH = System.getProperty("java.class.path");
+ static final int FIVE_SECONDS = 5000;
+
+ private static Throwable clientException;
+ private static boolean exceptionInClient;
+ private static Process orbdProcess;
+ private static Process rmiServerProcess;
+
+ public static void main(String[] args) throws Exception {
+ startTestComponents();
+ stopTestComponents();
+ System.err.println("Test completed OK ");
+ }
+
+ static void startTestComponents () throws Exception {
+ startOrbd();
+ Thread.sleep(FIVE_SECONDS);
+ startRmiIiopServer();
+ Thread.sleep(FIVE_SECONDS);
+ executeRmiIiopClient();
+ }
+
+ private static void stopTestComponents() throws Exception {
+ stopRmiIiopServer();
+ stopOrbd();
+ if (exceptionInClient) {
+ throw new RuntimeException(clientException);
+ } else if (!isResponseReceived()) {
+ throw new RuntimeException("Expected Response not received");
+ }
+ }
+
+ static void startOrbd() throws Exception {
+ System.out.println("\nStarting orbd with NS port 5050 and activation port 5049 ");
+
+ //orbd -ORBInitialHost localhost -ORBInitialPort 5050 -port 5049
+ orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost")
+ .addToolArg("-ORBInitialPort").addToolArg("5050")
+ .addToolArg("-port").addToolArg("5049");
+
+ System.out.println("RmiIiopReturnValueTest: Executing: " + Arrays.asList(orbdLauncher.getCommand()));
+ ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand());
+ pb.redirectError(ProcessBuilder.Redirect.INHERIT);
+ orbdProcess = pb.start();
+ }
+
+
+ static void startRmiIiopServer() throws Exception {
+ System.out.println("\nStarting RmiIiopServer");
+ // java -addmods java.corba -cp .
+ // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
+ // -Djava.naming.provider.url=iiop://localhost:5050 HelloServer -port 5049
+ List<String> commands = new ArrayList<>();
+ commands.add(RmiIiopReturnValueTest.JAVA);
+ commands.add("-addmods");
+ commands.add("java.corba");
+ commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory");
+ commands.add("-Djava.naming.provider.url=iiop://localhost:5050");
+ commands.add("-cp");
+ commands.add(RmiIiopReturnValueTest.CLASSPATH);
+ commands.add("HelloServer");
+ commands.add("-port");
+ commands.add("5049");
+
+ System.out.println("RmiIiopReturnValueTest: Executing: " + commands);
+ ProcessBuilder pb = new ProcessBuilder(commands);
+ pb.redirectError(ProcessBuilder.Redirect.INHERIT);
+ rmiServerProcess = pb.start();
+ }
+
+ static boolean isResponseReceived() {
+ return HelloClient.isResponseReceived();
+ }
+
+ static void stopRmiIiopServer() throws Exception {
+ if (rmiServerProcess != null) {
+ System.out.println("RmiIiopReturnValueTest.stopRmiIiopServer: destroy rmiServerProcess");
+ rmiServerProcess.destroyForcibly();
+ rmiServerProcess.waitFor();
+ System.out.println("serverProcess exitCode:"
+ + rmiServerProcess.exitValue());
+ }
+ }
+
+ static void stopOrbd() throws Exception {
+ System.out.println("RmiIiopReturnValueTest.stopOrbd: destroy orbdProcess ");
+ orbdProcess.destroyForcibly();
+ orbdProcess.waitFor();
+ System.out.println("orbd exitCode:"
+ + orbdProcess.exitValue());
+ }
+
+ static void executeRmiIiopClient() throws Exception {
+ System.out.println("RmiIiopReturnValueTest.executeRmiIiopClient: HelloClient.executeRmiClientCall");
+ try {
+ HelloClient.executeRmiClientCall();
+ } catch (Throwable t) {
+ clientException = t;
+ exceptionInClient = true;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.Serializable;
+
+
+public class Test implements Serializable {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test3.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.Serializable;
+import java.util.List;
+
+
+public class Test3 implements Serializable {
+
+ private List<Test> list;
+
+ public Test3(List<Test> list) {
+ this.list = list;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test4.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.List;
+
+
+public class Test4 extends Test3 {
+
+ private int aNumber = 1;
+
+ public Test4(List<Test> list) {
+ super(list);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloImpl_Tie.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Tie class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+
+
+public class _HelloImpl_Tie extends ObjectImpl implements Tie {
+
+ volatile private HelloImpl target = null;
+
+ private static final String[] _type_ids = {
+ "RMI:HelloInterface:0000000000000000"
+ };
+
+ public void setTarget(Remote target) {
+ this.target = (HelloImpl) target;
+ }
+
+ public Remote getTarget() {
+ return target;
+ }
+
+ public org.omg.CORBA.Object thisObject() {
+ return this;
+ }
+
+ public void deactivate() {
+ _orb().disconnect(this);
+ _set_delegate(null);
+ target = null;
+ }
+
+ public ORB orb() {
+ return _orb();
+ }
+
+ public void orb(ORB orb) {
+ orb.connect(this);
+ }
+
+ public String[] _ids() {
+ return (String[]) _type_ids.clone();
+ }
+
+ public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
+ try {
+ HelloImpl target = this.target;
+ if (target == null) {
+ throw new java.io.IOException();
+ }
+ org.omg.CORBA_2_3.portable.InputStream in =
+ (org.omg.CORBA_2_3.portable.InputStream) _in;
+ if (method.equals("sayHelloWithTest3")) {
+ Test3 arg0 = (Test3) in.read_value(Test3.class);
+ Test3 result = target.sayHelloWithTest3(arg0);
+ org.omg.CORBA_2_3.portable.OutputStream out =
+ (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
+ out.write_value(result,Test3.class);
+ return out;
+ }
+ throw new BAD_OPERATION();
+ } catch (SystemException ex) {
+ throw ex;
+ } catch (Throwable ex) {
+ throw new UnknownException(ex);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloInterface_Stub.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.ServantObject;
+
+
+public class _HelloInterface_Stub extends Stub implements HelloInterface {
+
+ private static final String[] _type_ids = {
+ "RMI:HelloInterface:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return (String[]) _type_ids.clone();
+ }
+
+ public Test3 sayHelloWithTest3(Test3 arg0) throws java.rmi.RemoteException {
+ if (!Util.isLocal(this)) {
+ try {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ org.omg.CORBA_2_3.portable.OutputStream out =
+ (org.omg.CORBA_2_3.portable.OutputStream)
+ _request("sayHelloWithTest3", true);
+ out.write_value(arg0,Test3.class);
+ in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
+ return (Test3) in.read_value(Test3.class);
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+ String $_id = in.read_string();
+ throw new UnexpectedException($_id);
+ } catch (RemarshalException ex) {
+ return sayHelloWithTest3(arg0);
+ } finally {
+ _releaseReply(in);
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("sayHelloWithTest3",HelloInterface.class);
+ if (so == null) {
+ return sayHelloWithTest3(arg0);
+ }
+ try {
+ Test3 arg0Copy = (Test3) Util.copyObject(arg0,_orb());
+ Test3 result = ((HelloInterface)so.servant).sayHelloWithTest3(arg0Copy);
+ return (Test3)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+grant codeBase "jrt:/java.corba" {
+ permission java.security.AllPermission;
+};
+
+
+
+grant {
+ permission java.io.FilePermission "./-", "read,write,execute";
+ permission java.io.FilePermission "*", "read";
+ permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve";
+ permission java.util.PropertyPermission "*", "read, write";
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ permission java.io.SerializablePermission "enableSubclassImplementation";
+ permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc";
+ permission java.lang.RuntimePermission "accessClassInPackage.sun.corba";
+ permission java.lang.RuntimePermission "defineClassInPackage.sun.corba";
+ permission java.lang.RuntimePermission "reflectionFactoryAccess";
+ permission sun.corba.BridgePermission "getBridge";
+ permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect";
+ permission java.util.PropertyPermission "*", "read, write";
+ permission java.io.FilePermission "<<ALL FILES>>", "read,write,execute";
+};
--- a/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -31,17 +31,16 @@
* HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java ConcurrentHashMapTest.java
* @run main/othervm -addmods java.corba -Djava.naming.provider.url=iiop://localhost:1050
* -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest
+ * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy
+ * -addmods java.corba -Djava.naming.provider.url=iiop://localhost:1050
+ * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest
* @key intermittent
*/
-import java.io.DataInputStream;
-import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.CountDownLatch;
import jdk.testlibrary.JDKToolFinder;
import jdk.testlibrary.JDKToolLauncher;
@@ -83,7 +82,7 @@
}
static void startOrbd() throws Exception {
- System.out.println("\nStarting orbd on port 1050 ");
+ System.out.println("\nStarting orbd with NS port 1050 ");
//orbd -ORBInitialHost localhost -ORBInitialPort 1050
orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost")
@@ -98,7 +97,7 @@
static void startRmiIiopServer() throws Exception {
System.out.println("\nStarting RmiServer");
- // java -cp .
+ // java -cp . -addmods java.corba
// -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
// -Djava.naming.provider.url=iiop://localhost:1050 HelloServer
List<String> commands = new ArrayList<>();
@@ -122,17 +121,15 @@
}
static void stopRmiIiopServer() throws Exception {
- rmiServerProcess.destroy();
+ rmiServerProcess.destroyForcibly();
rmiServerProcess.waitFor();
- //rmiServerProcess.waitFor(30, TimeUnit.SECONDS);
System.out.println("serverProcess exitCode:"
+ rmiServerProcess.exitValue());
}
static void stopOrbd() throws Exception {
- orbdProcess.destroy();
+ orbdProcess.destroyForcibly();
orbdProcess.waitFor();
- //orbdProcess.waitFor(30, TimeUnit.SECONDS);
System.out.println("orbd exitCode:"
+ orbdProcess.exitValue());
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+grant codeBase "jrt:/java.corba" {
+ permission java.security.AllPermission;
+};
+
+grant {
+ permission java.io.FilePermission "./-", "read,write,execute";
+ permission java.io.FilePermission "*", "read";
+ permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve";
+ permission java.util.PropertyPermission "*", "read, write";
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ permission java.io.SerializablePermission "enableSubclassImplementation";
+ permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc";
+ permission java.lang.RuntimePermission "accessClassInPackage.sun.corba";
+ permission java.lang.RuntimePermission "defineClassInPackage.sun.corba";
+ permission java.lang.RuntimePermission "reflectionFactoryAccess";
+ permission sun.corba.BridgePermission "getBridge";
+ permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect";
+ permission java.util.PropertyPermission "*", "read, write";
+ permission java.io.FilePermission "<<ALL FILES>>", "read,write,execute";
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/bind/JAXBContext/JAXBContextWithAbstractFactory.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Map;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBContextFactory;
+import javax.xml.bind.JAXBException;
+
+/**
+ * @test
+ * @bug 8150173
+ * @summary Verifies that a factory which inherit its createContext method
+ * from an abstract subclass of JAXBContextFactory can be instantiated.
+ * @compile -addmods java.xml.bind JAXBContextWithAbstractFactory.java
+ * @run main/othervm -addmods java.xml.bind JAXBContextWithAbstractFactory
+ */
+public class JAXBContextWithAbstractFactory {
+ private static JAXBContext tmp;
+
+ public static abstract class FactoryBase implements JAXBContextFactory {
+ @Override
+ public JAXBContext createContext(Class<?>[] classesToBeBound,
+ Map<String, ?> properties) throws JAXBException {
+ return tmp;
+ }
+
+ @Override
+ public JAXBContext createContext(String contextPath,
+ ClassLoader classLoader, Map<String, ?> properties)
+ throws JAXBException {
+ return tmp;
+ }
+ }
+
+ public static class Factory extends FactoryBase {}
+
+ // test both without and then with a security manager as the code path
+ // can be different when System.getSecurityManager() != null;
+ public static void main(String[] args) throws JAXBException {
+ System.out.println("\nWithout security manager\n");
+ test();
+
+ System.out.println("\nWith security manager\n");
+ Policy.setPolicy(new Policy() {
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ return true; // allow all
+ }
+ });
+ System.setSecurityManager(new SecurityManager());
+ test();
+ }
+
+ public static void test() throws JAXBException {
+ System.clearProperty(JAXBContext.JAXB_CONTEXT_FACTORY);
+ System.out.println(JAXBContext.JAXB_CONTEXT_FACTORY + " = "
+ + System.getProperty(JAXBContext.JAXB_CONTEXT_FACTORY, ""));
+ System.out.println("Calling "
+ + "JAXBContext.newInstance(JAXBContextWithAbstractFactory.class)");
+ tmp = JAXBContext.newInstance(JAXBContextWithAbstractFactory.class);
+ System.setProperty(JAXBContext.JAXB_CONTEXT_FACTORY,
+ "JAXBContextWithAbstractFactory$Factory");
+ System.out.println(JAXBContext.JAXB_CONTEXT_FACTORY + " = "
+ + System.getProperty(JAXBContext.JAXB_CONTEXT_FACTORY));
+ System.out.println("Calling "
+ + "JAXBContext.newInstance(JAXBContextWithAbstractFactory.class)");
+ JAXBContext ctxt = JAXBContext.newInstance(JAXBContextWithAbstractFactory.class);
+ System.out.println("Successfully loaded JAXBcontext: " +
+ System.identityHashCode(ctxt) + "@" + ctxt.getClass().getName());
+ if (ctxt != tmp) {
+ throw new RuntimeException("Wrong JAXBContext instance"
+ + "\n\texpected: "
+ + System.identityHashCode(tmp) + "@" + tmp.getClass().getName()
+ + "\n\tactual: "
+ + System.identityHashCode(ctxt) + "@" + ctxt.getClass().getName());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/bind/JAXBContext/JAXBContextWithLegacyFactory.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Map;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Validator;
+
+/**
+ * @test
+ * @bug 8150173
+ * @summary Verifies that a JAXBContext can be created with a legacy
+ * factory class that has static createContext methods.
+ * @compile -addmods java.xml.bind JAXBContextWithLegacyFactory.java
+ * @run main/othervm -addmods java.xml.bind JAXBContextWithLegacyFactory
+ */
+public class JAXBContextWithLegacyFactory {
+ private static JAXBContext tmp;
+
+ public static class JAXBContextImpl extends JAXBContext {
+ public final Class<?> creator;
+ JAXBContextImpl(Class<?> creator) {
+ this.creator = creator;
+ }
+
+ @Override
+ public Unmarshaller createUnmarshaller() throws JAXBException {
+ return tmp.createUnmarshaller();
+ }
+
+ @Override
+ public Marshaller createMarshaller() throws JAXBException {
+ return tmp.createMarshaller();
+ }
+
+ @Override
+ public Validator createValidator() throws JAXBException {
+ return tmp.createValidator();
+ }
+ }
+
+ public static abstract class FactoryBase {
+ public static JAXBContext createContext(Class<?>[] classesToBeBound,
+ Map<String, ?> properties) throws JAXBException {
+ return new JAXBContextImpl(FactoryBase.class);
+ }
+
+ public static JAXBContext createContext(String contextPath,
+ ClassLoader classLoader, Map<String, ?> properties)
+ throws JAXBException {
+ return new JAXBContextImpl(FactoryBase.class);
+ }
+ }
+
+ public static class Factory1 extends FactoryBase {}
+
+ public static class Factory2 extends FactoryBase {
+ public static JAXBContext createContext(Class<?>[] classesToBeBound,
+ Map<String, ?> properties) throws JAXBException {
+ return new JAXBContextImpl(Factory2.class);
+ }
+
+ public static JAXBContext createContext(String contextPath,
+ ClassLoader classLoader, Map<String, ?> properties)
+ throws JAXBException {
+ return new JAXBContextImpl(Factory2.class);
+ }
+ }
+
+ // test both without and then with a security manager as the code path
+ // can be different when System.getSecurityManager() != null;
+ public static void main(String[] args) throws JAXBException {
+ System.out.println("\nWithout security manager\n");
+ test(FactoryBase.class, FactoryBase.class);
+ test(Factory1.class, FactoryBase.class);
+ test(Factory2.class, Factory2.class);
+
+ System.out.println("\nWith security manager\n");
+ Policy.setPolicy(new Policy() {
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ return true; // allow all
+ }
+ });
+ System.setSecurityManager(new SecurityManager());
+ test(FactoryBase.class, FactoryBase.class);
+ test(Factory1.class, FactoryBase.class);
+ test(Factory2.class, Factory2.class);
+ }
+
+ public static void test(Class<?> factoryClass, Class<?> creatorClass) throws JAXBException {
+ System.clearProperty(JAXBContext.JAXB_CONTEXT_FACTORY);
+ System.out.println("** Testing with Factory Class: " + factoryClass.getName());
+ System.out.println(JAXBContext.JAXB_CONTEXT_FACTORY + " = "
+ + System.getProperty(JAXBContext.JAXB_CONTEXT_FACTORY, ""));
+ System.out.println("Calling "
+ + "JAXBContext.newInstance(JAXBContextWithLegacyFactory.class)");
+ tmp = JAXBContext.newInstance(JAXBContextWithLegacyFactory.class);
+ System.setProperty(JAXBContext.JAXB_CONTEXT_FACTORY,
+ factoryClass.getName());
+ System.out.println(JAXBContext.JAXB_CONTEXT_FACTORY + " = "
+ + System.getProperty(JAXBContext.JAXB_CONTEXT_FACTORY));
+ System.out.println("Calling "
+ + "JAXBContext.newInstance(JAXBContextWithLegacyFactory.class)");
+ JAXBContext ctxt = JAXBContext.newInstance(JAXBContextWithLegacyFactory.class);
+ System.out.println("Successfully loaded JAXBcontext: " +
+ System.identityHashCode(ctxt) + "@" + ctxt.getClass().getName());
+ if (ctxt.getClass() != JAXBContextImpl.class) {
+ throw new RuntimeException("Wrong JAXBContext class"
+ + "\n\texpected: "
+ + System.identityHashCode(tmp) + "@" + JAXBContextImpl.class.getName()
+ + "\n\tactual: "
+ + System.identityHashCode(ctxt) + "@" + ctxt.getClass().getName());
+ }
+ if (((JAXBContextImpl)ctxt).creator != creatorClass) {
+ throw new RuntimeException("Wrong Factory class"
+ + "\n\texpected: "
+ + System.identityHashCode(tmp) + "@" + creatorClass.getName()
+ + "\n\tactual: "
+ + System.identityHashCode(ctxt) + "@" + ((JAXBContextImpl)ctxt).creator.getName());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/bind/JAXBContext/JAXBContextWithSubclassedFactory.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.security.Permission;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Map;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBContextFactory;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Validator;
+
+/**
+ * @test
+ * @bug 8150173
+ * @summary Verifies that a factory which inherit its createContext method
+ * from a concrete subclass of JAXBContextFactory is be instantiated.
+ * @compile -addmods java.xml.bind JAXBContextWithSubclassedFactory.java
+ * @run main/othervm -addmods java.xml.bind JAXBContextWithSubclassedFactory
+ */
+public class JAXBContextWithSubclassedFactory {
+ static JAXBContext tmp;
+
+ public static class JAXBContextImpl extends JAXBContext {
+ public final Class<?> creator;
+ JAXBContextImpl(Class<?> creator) {
+ this.creator = creator;
+ }
+
+ @Override
+ public Unmarshaller createUnmarshaller() throws JAXBException {
+ return tmp.createUnmarshaller();
+ }
+
+ @Override
+ public Marshaller createMarshaller() throws JAXBException {
+ return tmp.createMarshaller();
+ }
+
+ @Override
+ public Validator createValidator() throws JAXBException {
+ return tmp.createValidator();
+ }
+ }
+
+ public static class FactoryBase implements JAXBContextFactory {
+
+ @Override
+ public JAXBContext createContext(Class<?>[] classesToBeBound,
+ Map<String, ?> properties) throws JAXBException {
+ return new JAXBContextImpl(this.getClass());
+ }
+
+ @Override
+ public JAXBContext createContext(String contextPath,
+ ClassLoader classLoader, Map<String, ?> properties)
+ throws JAXBException {
+ return new JAXBContextImpl(this.getClass());
+ }
+ }
+
+ public static class NonFactoryBase {
+
+ public JAXBContext createContext(Class<?>[] classesToBeBound,
+ Map<String, ?> properties) throws JAXBException {
+ return new JAXBContextImpl(this.getClass());
+ }
+
+ public JAXBContext createContext(String contextPath,
+ ClassLoader classLoader, Map<String, ?> properties)
+ throws JAXBException {
+ return new JAXBContextImpl(this.getClass());
+ }
+ }
+
+ public static class Factory1 extends FactoryBase {}
+ public static class Factory2 extends NonFactoryBase implements JAXBContextFactory {}
+
+ // test both without and then with a security manager as the code path
+ // can be different when System.getSecurityManager() != null;
+ public static void main(String[] args) throws JAXBException {
+ System.out.println("\nWithout security manager\n");
+ test(FactoryBase.class);
+ test(Factory1.class);
+ test(Factory2.class);
+
+ System.out.println("\nWith security manager\n");
+ Policy.setPolicy(new Policy() {
+ @Override
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ return true; // allow all
+ }
+ });
+ System.setSecurityManager(new SecurityManager());
+ test(FactoryBase.class);
+ test(Factory1.class);
+ test(Factory2.class);
+ }
+
+ public static void test(Class<?> factoryClass) throws JAXBException {
+ System.clearProperty(JAXBContext.JAXB_CONTEXT_FACTORY);
+ System.out.println("** Testing with Factory Class: " + factoryClass.getName());
+ System.out.println(JAXBContext.JAXB_CONTEXT_FACTORY + " = "
+ + System.getProperty(JAXBContext.JAXB_CONTEXT_FACTORY, ""));
+ System.out.println("Calling "
+ + "JAXBContext.newInstance(JAXBContextWithSubclassedFactory.class)");
+ tmp = JAXBContext.newInstance(JAXBContextWithSubclassedFactory.class);
+ System.setProperty(JAXBContext.JAXB_CONTEXT_FACTORY,
+ factoryClass.getName());
+ System.out.println(JAXBContext.JAXB_CONTEXT_FACTORY + " = "
+ + System.getProperty(JAXBContext.JAXB_CONTEXT_FACTORY));
+ System.out.println("Calling "
+ + "JAXBContext.newInstance(JAXBContextWithSubclassedFactory.class)");
+ JAXBContext ctxt = JAXBContext.newInstance(JAXBContextWithSubclassedFactory.class);
+ System.out.println("Successfully loaded JAXBcontext: " +
+ System.identityHashCode(ctxt) + "@" + ctxt.getClass().getName());
+ if (ctxt.getClass() != JAXBContextImpl.class) {
+ throw new RuntimeException("Wrong JAXBContext class"
+ + "\n\texpected: "
+ + System.identityHashCode(tmp) + "@" + JAXBContextImpl.class.getName()
+ + "\n\tactual: "
+ + System.identityHashCode(ctxt) + "@" + ctxt.getClass().getName());
+ }
+ if (((JAXBContextImpl)ctxt).creator != factoryClass) {
+ throw new RuntimeException("Wrong Factory class"
+ + "\n\texpected: "
+ + System.identityHashCode(tmp) + "@" + factoryClass.getName()
+ + "\n\tactual: "
+ + System.identityHashCode(ctxt) + "@" + ((JAXBContextImpl)ctxt).creator.getName());
+ }
+ }
+}
--- a/jdk/test/jdk/internal/jrtfs/Basic.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/jdk/internal/jrtfs/Basic.java Mon Jun 27 10:00:47 2016 -0700
@@ -715,5 +715,14 @@
assertTrue(childCount != 0);
assertEquals(dirPrefixOkayCount, childCount);
}
+
+ @Test
+ public void objectClassSizeTest() throws Exception {
+ String path = "/modules/java.base/java/lang/Object.class";
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ Path classFile = fs.getPath(path);
+
+ assertTrue(Files.size(classFile) > 0L);
+ }
}
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java Mon Jun 27 10:00:47 2016 -0700
@@ -29,8 +29,9 @@
* @library ..
* @library /lib/testlibrary
* @build jdk.testlibrary.*
- * @run main/othervm TestKeyPairGenerator
- * @run main/othervm TestKeyPairGenerator sm TestKeyPairGenerator.policy
+ * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
+ * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
+ * sm TestKeyPairGenerator.policy
* @key intermittent randomness
*/
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -39,6 +39,7 @@
import java.util.Calendar;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.Locale;
import sun.security.pkcs.ContentInfo;
import sun.security.pkcs.PKCS7;
@@ -371,7 +372,7 @@
static void jarsigner(String cmd, int path, boolean expected)
throws Exception {
System.err.println("Test " + path);
- Process p = Runtime.getRuntime().exec(String.format(cmd, path, path));
+ Process p = Runtime.getRuntime().exec(String.format(Locale.ROOT,cmd, path, path));
BufferedReader reader = new BufferedReader(
new InputStreamReader(p.getErrorStream()));
while (true) {
--- a/jdk/test/tools/jlink/DefaultProviderTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/DefaultProviderTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -26,7 +26,6 @@
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -65,13 +64,6 @@
private boolean enabled = true;
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public Set<State> getState() {
return enabled ? EnumSet.of(State.AUTO_ENABLED, State.FUNCTIONAL)
: EnumSet.of(State.DISABLED);
--- a/jdk/test/tools/jlink/ImageFilePoolTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/ImageFilePoolTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -33,7 +33,7 @@
import java.io.ByteArrayInputStream;
import java.util.Optional;
import java.util.function.Function;
-import jdk.tools.jlink.internal.ModuleEntryImpl;
+import jdk.tools.jlink.internal.ModuleEntryFactory;
import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -54,7 +54,7 @@
ModulePool input = new ModulePoolImpl();
for (int i = 0; i < 1000; ++i) {
String module = "module" + (i / 100);
- input.add(new InMemoryImageFile(module, "/" + module + "/java/class" + i,
+ input.add(newInMemoryImageFile("/" + module + "/java/class" + i,
ModuleEntry.Type.CONFIG, "class" + i));
}
if (input.getEntryCount() != 1000) {
@@ -94,11 +94,11 @@
switch (index) {
case 0:
++amountAfter;
- return new InMemoryImageFile(file.getModule(), file.getPath() + SUFFIX,
+ return newInMemoryImageFile(file.getPath() + SUFFIX,
file.getType(), file.getPath());
case 1:
++amountAfter;
- return new InMemoryImageFile(file.getModule(), file.getPath(),
+ return newInMemoryImageFile(file.getPath(),
file.getType(), file.getPath());
}
return null;
@@ -130,28 +130,27 @@
if (input.findEntry("unknown").isPresent()) {
throw new AssertionError("ImageFileModulePool does not return null for unknown file");
}
- if (input.contains(new InMemoryImageFile("", "unknown", ModuleEntry.Type.CONFIG, "unknown"))) {
- throw new AssertionError("'contain' returns true for unknown file");
+ if (input.contains(newInMemoryImageFile("/unknown/foo", ModuleEntry.Type.CONFIG, "unknown"))) {
+ throw new AssertionError("'contain' returns true for /unknown/foo file");
}
- input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
+ input.add(newInMemoryImageFile("/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
try {
- input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
+ input.add(newInMemoryImageFile("/aaa/bbb", ModuleEntry.Type.CONFIG, ""));
throw new AssertionError("Exception expected");
} catch (Exception e) {
// expected
}
input.setReadOnly();
try {
- input.add(new InMemoryImageFile("", "/aaa/ccc", ModuleEntry.Type.CONFIG, ""));
+ input.add(newInMemoryImageFile("/aaa/ccc", ModuleEntry.Type.CONFIG, ""));
throw new AssertionError("Exception expected");
} catch (Exception e) {
// expected
}
}
- private static class InMemoryImageFile extends ModuleEntryImpl {
- public InMemoryImageFile(String module, String path, ModuleEntry.Type type, String content) {
- super(module, path, type, new ByteArrayInputStream(content.getBytes()), content.getBytes().length);
- }
+ private static ModuleEntry newInMemoryImageFile(String path,
+ ModuleEntry.Type type, String content) {
+ return ModuleEntryFactory.create(path, type, content.getBytes());
}
}
--- a/jdk/test/tools/jlink/IntegrationTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/IntegrationTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -90,10 +90,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.PROCESSOR);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.PROCESSOR;
}
@Override
@@ -139,13 +137,6 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public String getDescription() {
return null;
}
--- a/jdk/test/tools/jlink/JLinkOptimTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkOptimTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -9,11 +9,9 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.stream.Stream;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.Opcodes;
@@ -132,13 +130,6 @@
public String getName() {
return NAME;
}
-
- @Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
}
private static void testForName() throws Exception {
--- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -26,10 +26,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import jdk.tools.jlink.internal.PluginRepository;
import jdk.tools.jlink.plugin.ExecutableImage;
@@ -75,10 +73,8 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.PROCESSOR);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.PROCESSOR;
}
@Override
--- a/jdk/test/tools/jlink/JLinkTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -24,6 +24,7 @@
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;
@@ -34,6 +35,7 @@
import java.util.stream.Stream;
import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.internal.PluginRepository;
import tests.Helper;
import tests.JImageGenerator;
@@ -54,6 +56,13 @@
* @run main/othervm -verbose:gc -Xmx1g JLinkTest
*/
public class JLinkTest {
+ // number of built-in plugins from jdk.jlink module
+ private static int getNumJlinkPlugins() {
+ ModuleDescriptor desc = Plugin.class.getModule().getDescriptor();
+ return desc.provides().
+ get(TransformerPlugin.class.getName()).
+ providers().size();
+ }
public static void main(String[] args) throws Exception {
@@ -63,7 +72,7 @@
return;
}
helper.generateDefaultModules();
- int numPlugins = 13;
+ int numPlugins = getNumJlinkPlugins();
{
// number of built-in plugins
List<Plugin> builtInPlugins = new ArrayList<>();
@@ -72,7 +81,9 @@
p.getState();
p.getType();
}
- if (builtInPlugins.size() != numPlugins) {
+ // Note: other boot layer modules may provide jlink plugins.
+ // We should at least see the builtin plugins from jdk.jlink.
+ if (builtInPlugins.size() < numPlugins) {
throw new AssertionError("Found plugins doesn't match expected number : " +
numPlugins + "\n" + builtInPlugins);
}
--- a/jdk/test/tools/jlink/ResourcePoolTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/ResourcePoolTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -66,9 +66,7 @@
String module = "/module" + (i / 10);
String resourcePath = module + "/java/package" + i;
byte[] bytes = resourcePath.getBytes();
- input.add(ModuleEntry.create(module, resourcePath,
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(bytes), bytes.length));
+ input.add(ModuleEntry.create(resourcePath, bytes));
}
ModulePool output = new ModulePoolImpl();
ResourceVisitor visitor = new ResourceVisitor();
@@ -103,12 +101,11 @@
switch (index) {
case 0:
++amountAfter;
- return ModuleEntry.create(resource.getModule(), resource.getPath() + SUFFIX,
- resource.getType(), resource.stream(), resource.getLength());
+ return ModuleEntry.create(resource.getPath() + SUFFIX,
+ resource.getType(), resource.getBytes());
case 1:
++amountAfter;
- return ModuleEntry.create(resource.getModule(), resource.getPath(),
- resource.getType(), resource.stream(), resource.getLength());
+ return resource.create(resource.getBytes());
}
return null;
}
@@ -132,9 +129,7 @@
samples.add("javax/management/ObjectName");
test(samples, (resources, module, path) -> {
try {
- resources.add(ModuleEntry.create(module, path,
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(new byte[0]), 0));
+ resources.add(ModuleEntry.create(path, new byte[0]));
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -142,9 +137,7 @@
test(samples, (resources, module, path) -> {
try {
resources.add(ModulePoolImpl.
- newCompressedResource(ModuleEntry.create(module, path,
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(new byte[0]), 0),
+ newCompressedResource(ModuleEntry.create(path, new byte[0]),
ByteBuffer.allocate(99), "bitcruncher", null,
((ModulePoolImpl)resources).getStringTable(), ByteOrder.nativeOrder()));
} catch (Exception ex) {
@@ -203,20 +196,14 @@
private void checkResourcesAfterCompression() throws Exception {
ModulePoolImpl resources1 = new ModulePoolImpl();
- ModuleEntry res1 = ModuleEntry.create("module1", "/module1/toto1",
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(new byte[0]), 0);
- ModuleEntry res2 = ModuleEntry.create("module2", "/module2/toto1",
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(new byte[0]), 0);
+ ModuleEntry res1 = ModuleEntry.create("/module1/toto1", new byte[0]);
+ ModuleEntry res2 = ModuleEntry.create("/module2/toto1", new byte[0]);
resources1.add(res1);
resources1.add(res2);
checkResources(resources1, res1, res2);
ModulePool resources2 = new ModulePoolImpl();
- ModuleEntry res3 = ModuleEntry.create("module2", "/module2/toto1",
- ModuleEntry.Type.CLASS_OR_RESOURCE,
- new ByteArrayInputStream(new byte[7]), 7);
+ ModuleEntry res3 = ModuleEntry.create("/module2/toto1", new byte[7]);
resources2.add(res3);
resources2.add(ModulePoolImpl.newCompressedResource(res1,
ByteBuffer.allocate(7), "zip", null, resources1.getStringTable(),
@@ -260,8 +247,7 @@
((ModulePoolImpl) resources).setReadOnly();
try {
- resources.add(ModuleEntry.create("module2", "/module2/toto1",
- ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0));
+ resources.add(ModuleEntry.create("/module2/toto1", new byte[0]));
throw new AssertionError("ModulePool is read-only, but an exception is not thrown");
} catch (Exception ex) {
// Expected
--- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -23,9 +23,7 @@
package plugin;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.function.Function;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -58,9 +56,7 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.PROCESSOR);
- return Collections.unmodifiableSet(set);
+ public Category getType() {
+ return Category.PROCESSOR;
}
}
--- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java Mon Jun 27 10:00:47 2016 -0700
@@ -26,9 +26,7 @@
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.TransformerPlugin;
@@ -63,13 +61,6 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public String getDescription() {
return NAME + "-description";
}
--- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -74,8 +74,8 @@
fplug.configure(prop);
ModulePoolImpl files = new ModulePoolImpl();
ModulePoolImpl fresult = new ModulePoolImpl();
- ModuleEntry f = ModuleEntry.create(module, "/" + module + "/" + sample,
- ModuleEntry.Type.CONFIG, new ByteArrayInputStream(new byte[0]), 0);
+ ModuleEntry f = ModuleEntry.create("/" + module + "/" + sample,
+ ModuleEntry.Type.CONFIG, new byte[0]);
files.add(f);
fplug.visit(files, fresult);
--- a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -48,16 +48,16 @@
public void test() throws Exception {
check("**.jcov", "/num/toto.jcov", true);
- check("**.jcov", "//toto.jcov", true);
+ check("**.jcov", "/toto.jcov/", true);
check("**.jcov", "/toto.jcov/tutu/tata", false);
check("/java.base/*.jcov", "/java.base/toto.jcov", true);
- check("/java.base/toto.jcov", "t/java.base/iti.jcov", false);
+ check("/java.base/toto.jcov", "/tjava.base/iti.jcov", false);
check("/java.base/*/toto.jcov", "/java.base/toto.jcov", false);
check("/java.base/*/toto.jcov", "/java.base/tutu/toto.jcov", true);
check("**/java.base/*/toto.jcov", "/tutu/java.base/tutu/toto.jcov", true);
check("/META-INF/**", "/META-INF/services/ MyProvider ", true);
check("/META-INF/**", "/META-INF/services/MyProvider", true);
- check("**/META-INF", " /META-INF/services/MyProvider", false);
+ check("**/META-INF", "/ META-INF/services/MyProvider", false);
check("**/META-INF/**", "/java.base//META-INF/services/MyProvider", true);
check("/java.base/*/Toto$Titi.class", "/java.base/tutu/Toto$Titi.class", true);
check("/**$**.class", "/java.base/tutu/Toto$Titi.class", true);
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -165,11 +165,11 @@
// Create a pool with jvm.cfg and the input paths.
byte[] jvmcfgContent = jvmcfg.getBytes();
ModulePool pool = new ModulePoolImpl();
- pool.add(ModuleEntry.create("java.base", "/java.base/native/jvm.cfg",
- ModuleEntry.Type.NATIVE_LIB, new ByteArrayInputStream(jvmcfgContent), jvmcfgContent.length));
+ pool.add(ModuleEntry.create("/java.base/native/jvm.cfg",
+ ModuleEntry.Type.NATIVE_LIB, jvmcfgContent));
for (String in : input) {
- pool.add(ModuleEntry.create("java.base", in,
- ModuleEntry.Type.NATIVE_LIB, new ByteArrayInputStream(new byte[0]), 0));
+ pool.add(ModuleEntry.create(in,
+ ModuleEntry.Type.NATIVE_LIB, new byte[0]));
}
ModulePool out = new ModulePoolImpl();
--- a/jdk/test/tools/jlink/plugins/LastSorterTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -33,10 +33,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import jdk.tools.jlink.internal.ImagePluginConfiguration;
import jdk.tools.jlink.internal.PluginRepository;
@@ -200,13 +198,6 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public void configure(Map<String, String> config) {
String arguments = config.get(name);
this.starts = arguments;
--- a/jdk/test/tools/jlink/plugins/PluginOrderTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PluginOrderTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -260,8 +260,8 @@
}
@Override
- public Set<Category> getType() {
- return Collections.singleton(category);
+ public Category getType() {
+ return category;
}
@Override
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -32,10 +32,8 @@
import java.lang.reflect.Layer;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import jdk.tools.jlink.internal.ImagePluginConfiguration;
import jdk.tools.jlink.internal.PluginRepository;
@@ -138,13 +136,6 @@
}
@Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
-
- @Override
public String getDescription() {
return null;
}
--- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -34,11 +34,9 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.stream.Collectors;
import jdk.tools.jlink.internal.ImagePluginConfiguration;
@@ -160,12 +158,5 @@
}
});
}
-
- @Override
- public Set<Category> getType() {
- Set<Category> set = new HashSet<>();
- set.add(Category.TRANSFORMER);
- return Collections.unmodifiableSet(set);
- }
}
}
--- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -106,6 +106,9 @@
byte[] content = Files.readAllBytes(p);
String path = p.toString().replace('\\', '/');
path = path.substring("/modules".length());
+ if (path.charAt(0) != '/') {
+ path = "/" + path;
+ }
ModuleEntry res = ModuleEntry.create(path, content);
resources.add(res);
} catch (Exception ex) {
--- a/langtools/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -366,3 +366,4 @@
095bd53bdd1ef211a473553a95ee625fcfbc3f59 jdk-9+121
203a9e1b82b6cc7918f96a92e5a7eb28eafcdd18 jdk-9+122
d0c742ddfb01ebe427720798c4c8335023ae20f8 jdk-9+123
+26aa3caa778eab1c931910149c414783ee83bce7 jdk-9+124
--- a/langtools/make/build.xml Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/make/build.xml Mon Jun 27 10:00:47 2016 -0700
@@ -235,7 +235,10 @@
<target name="idea" depends="-check-langtools.jdk.home">
<mkdir dir=".idea"/>
<copy todir=".idea" >
- <fileset dir="make/intellij" excludes="**/src/**"/>
+ <fileset dir="make/intellij">
+ <exclude name="**/src/**"/>
+ <exclude name="**/utils/**"/>
+ </fileset>
</copy>
<condition property="idea.jtreg.home" value="${jtreg.home}" else = "[jtreg.home]">
<isset property="jtreg.home"/>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/diags-examples.xml Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ ~ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ ~
+ ~ This code is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU General Public License version 2 only, as
+ ~ published by the Free Software Foundation. Oracle designates this
+ ~ particular file as subject to the "Classpath" exception as provided
+ ~ by Oracle in the LICENSE file that accompanied this code.
+ ~
+ ~ This code is distributed in the hope that it will be useful, but WITHOUT
+ ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ ~ version 2 for more details (a copy is included in the LICENSE file that
+ ~ accompanied this code).
+ ~
+ ~ You should have received a copy of the GNU General Public License version
+ ~ 2 along with this work; if not, write to the Free Software Foundation,
+ ~ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ ~
+ ~ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ ~ or visit www.oracle.com if you need additional information or have any
+ ~ questions.
+ -->
+
+<!--
+This is an extension to the langtools make/build.xml file,
+that provides targets to run the examples that generate
+example diagnostics in different locales.
+
+Usage:
+ ant -f langtools/make/run-examples.xml -Dlangtools.jdk.home=<JDK>
+
+By default, the reports will be generated in langtools/build/diags-examples/report/.
+-->
+
+<project name="diags-examples" default="diags-examples" basedir="..">
+ <import file="build.xml"/>
+
+ <!-- specify working directory for the tool -->
+ <property name="diags.examples.dir" location="${build.dir}/diag-examples"/>
+
+ <!-- compiled classes for the tool -->
+ <property name="diags.examples.classes" location="${diags.examples.dir}/classes}"/>
+
+ <!-- directory for generated reports -->
+ <property name="diags.examples.report" location="${diags.examples.dir}/report"/>
+
+ <!-- default target, generates reports for all available locales -->
+ <target name="diags-examples" depends="run-en_US,run-ja,run-zh_CN"/>
+
+ <!-- generate report for US English locale -->
+ <target name="run-en_US" depends="-build-runner,-def-runner">
+ <mkdir dir="${diags.examples.report}"/>
+ <runner lang="en" country="US" outfile="${diags.examples.report}/en_US.html"/>
+ </target>
+
+ <!-- generate report for Japanese locale -->
+ <target name="run-ja" depends="-build-runner,-def-runner">
+ <mkdir dir="${diags.examples.report}"/>
+ <runner lang="ja" outfile="${diags.examples.report}/ja.html"/>
+ </target>
+
+ <!-- generate report for Mandarin Chinese locale -->
+ <target name="run-zh_CN" depends="-build-runner,-def-runner">
+ <mkdir dir="${diags.examples.report}"/>
+ <runner lang="zh" country="CN" outfile="${diags.examples.report}/zh_CN.html"/>
+ </target>
+
+ <!-- compile the tool that runs the examples -->
+ <target name="-build-runner" depends="build">
+ <mkdir dir="${diags.examples.classes}"/>
+ <javac fork="true"
+ executable="${build.bin}/javac"
+ srcdir="test/tools/javac/diags"
+ destdir="${diags.examples.classes}"
+ includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
+ sourcepath=""
+ includeAntRuntime="no"
+ debug="${javac.debug}"
+ debuglevel="${javac.debuglevel}">
+ <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
+ <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
+ <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
+ <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+ <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
+ <compilerarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
+ </javac>
+ </target>
+
+ <!-- define a task to run the tool that runs the examples -->
+ <target name="-def-runner">
+ <macrodef name="runner">
+ <attribute name="lang"/>
+ <attribute name="country" default=""/>
+ <attribute name="outfile"/>
+ <sequential>
+ <java fork="true"
+ jvm="${langtools.jdk.home}/bin/java"
+ dir="test/tools/javac/diags"
+ classpath="${diags.examples.classes};${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
+ classname="RunExamples">
+ <jvmarg value="-Duser.language=@{lang}"/>
+ <jvmarg value="-Duser.country=@{country}"/>
+ <jvmarg value="-Dtest.classes=${diags.examples.classes}"/>
+ <arg value="-examples"/>
+ <arg value="examples"/>
+ <arg value="-o"/>
+ <arg file="@{outfile}"/>
+ <arg value="-showFiles"/>
+ <arg value="-title"/>
+ <arg value="Examples of javac diagnostics"/>
+ <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
+ <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"/>
+ <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED"/>
+ <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED"/>
+ <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"/>
+ <jvmarg line="-XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/intellij/utils/jtreg-live-templates.xml Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,25 @@
+<!--
+The following live template declarations allow for automatic generation of jtreg test headers.
+Unfortunately, live templates cannot be shared on a per project base, but they can be easily imported
+by cutting and paste the following lines inside IntelliJ LiveTemplate settings (this will need to be done only once).
+-->
+
+<template name="@test" value="@test * @bug $BUG_ID$ * @summary $BUG_SUMMARY$ * $JTREG_ACTION$ $FILE_NAME$" description="jtreg header (positive test)" toReformat="false" toShortenFQNames="true">
+ <variable name="BUG_ID" expression="groovyScript("_1 ==~ /T\\d{7}/ ? _1.substring(1).take(7) : 'NNNNNNN'", fileNameWithoutExtension())" defaultValue="" alwaysStopAt="true" />
+ <variable name="BUG_SUMMARY" expression=""Bug summary"" defaultValue="" alwaysStopAt="true" />
+ <variable name="JTREG_ACTION" expression=""@compile"" defaultValue="" alwaysStopAt="true" />
+ <variable name="FILE_NAME" expression="fileName()" defaultValue="" alwaysStopAt="true" />
+ <context>
+ <option name="JAVA_COMMENT" value="true" />
+ </context>
+</template>
+<template name="@test /nodynamiccopyright/" value="@test * @bug $BUG_ID$ * @summary $BUG_SUMMARY$ * $JTREG_ACTION$/fail/ref=$GOLDEN_NAME$ -XDrawDiagnostics $FILE_NAME$" description="jtreg header (negative test)" toReformat="false" toShortenFQNames="true">
+ <variable name="BUG_ID" expression="groovyScript("_1 ==~ /T\\d{7}/ ? _1.substring(1).take(7) : 'NNNNNNN'", fileNameWithoutExtension())" defaultValue="NNNNNNN" alwaysStopAt="true" />
+ <variable name="BUG_SUMMARY" expression=""Bug summary"" defaultValue="" alwaysStopAt="true" />
+ <variable name="JTREG_ACTION" expression=""@compile"" defaultValue="" alwaysStopAt="true" />
+ <variable name="GOLDEN_NAME" expression="groovyScript("_1 + '.out'", fileNameWithoutExtension())" defaultValue="out.txt" alwaysStopAt="true" />
+ <variable name="FILE_NAME" expression="fileName()" defaultValue="" alwaysStopAt="true" />
+ <context>
+ <option name="JAVA_COMMENT" value="true" />
+ </context>
+</template>
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Jun 27 10:00:47 2016 -0700
@@ -1039,7 +1039,8 @@
if (start_pc == 0) {
// ensure array large enough
if (register >= parameterNameIndices.length) {
- int newSize = Math.max(register, parameterNameIndices.length + 8);
+ int newSize =
+ Math.max(register + 1, parameterNameIndices.length + 8);
parameterNameIndices =
Arrays.copyOf(parameterNameIndices, newSize);
}
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java Mon Jun 27 10:00:47 2016 -0700
@@ -28,6 +28,11 @@
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.*;
+/**
+ * This doclet generates HTML-formatted documentation for the specified packages and types.
+ * @deprecated The doclet has been superseded by its replacement,
+ * {@code jdk.javadoc.doclets.StandardDoclet}.
+ */
@Deprecated
public class Standard {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclets/StandardDoclet.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.javadoc.doclets;
+
+import java.util.Locale;
+import java.util.Set;
+
+import javax.lang.model.SourceVersion;
+
+import jdk.javadoc.doclet.Doclet;
+import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.doclet.Reporter;
+import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
+
+/**
+ * This doclet generates HTML-formatted documentation for the specified modules, packages and types.
+ */
+public class StandardDoclet implements Doclet {
+
+ private final HtmlDoclet htmlDoclet;
+
+ public StandardDoclet() {
+ htmlDoclet = new HtmlDoclet();
+ }
+
+ public void init(Locale locale, Reporter reporter) {
+ htmlDoclet.init(locale, reporter);
+ }
+
+ public String getName() {
+ return "Standard";
+ }
+
+ public Set<Doclet.Option> getSupportedOptions() {
+ return htmlDoclet.getSupportedOptions();
+ }
+
+ public SourceVersion getSupportedSourceVersion() {
+ return htmlDoclet.sourceVersion();
+ }
+
+ public boolean run(DocletEnvironment root) {
+ return htmlDoclet.run(root);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclets/package-info.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This package contains standard, supported doclets.
+ */
+package jdk.javadoc.doclets;
+
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java Mon Jun 27 10:00:47 2016 -0700
@@ -547,7 +547,7 @@
@Override
public Set<Doclet.Option> getSupportedOptions() {
Doclet.Option[] options = {
- new Option(this, "bottom", 1) {
+ new Option(this, "-bottom", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -555,7 +555,7 @@
return true;
}
},
- new Option(this, "charset", 1) {
+ new Option(this, "-charset", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -563,7 +563,7 @@
return true;
}
},
- new Option(this, "doctitle", 1) {
+ new Option(this, "-doctitle", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -571,7 +571,7 @@
return true;
}
},
- new Option(this, "footer", 1) {
+ new Option(this, "-footer", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -579,7 +579,7 @@
return true;
}
},
- new Option(this, "header", 1) {
+ new Option(this, "-header", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -587,7 +587,7 @@
return true;
}
},
- new Option(this, "helpfile", 1) {
+ new Option(this, "-helpfile", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -595,7 +595,7 @@
return true;
}
},
- new Option(this, "html4") {
+ new Option(this, "-html4") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -603,7 +603,7 @@
return true;
}
},
- new Option(this, "html5") {
+ new Option(this, "-html5") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -611,7 +611,7 @@
return true;
}
},
- new Option(this, "nohelp") {
+ new Option(this, "-nohelp") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -619,7 +619,7 @@
return true;
}
},
- new Option(this, "nodeprecatedlist") {
+ new Option(this, "-nodeprecatedlist") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -627,7 +627,7 @@
return true;
}
},
- new Option(this, "noindex") {
+ new Option(this, "-noindex") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -635,7 +635,7 @@
return true;
}
},
- new Option(this, "nonavbar") {
+ new Option(this, "-nonavbar") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -643,7 +643,7 @@
return true;
}
},
- new Hidden(this, "nooverview") {
+ new Hidden(this, "-nooverview") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -651,7 +651,7 @@
return true;
}
},
- new Option(this, "notree") {
+ new Option(this, "-notree") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -659,7 +659,7 @@
return true;
}
},
- new Hidden(this, "overview", 1) {
+ new Hidden(this, "-overview", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -667,7 +667,7 @@
return true;
}
},
- new Hidden(this, "packagesheader", 1) {
+ new Hidden(this, "-packagesheader", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -675,7 +675,7 @@
return true;
}
},
- new Option(this, "splitindex") {
+ new Option(this, "-splitindex") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -683,7 +683,7 @@
return true;
}
},
- new Option(this, "stylesheetfile", 1) {
+ new Option(this, "-stylesheetfile", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -691,7 +691,7 @@
return true;
}
},
- new Option(this, "top", 1) {
+ new Option(this, "-top", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -699,7 +699,7 @@
return true;
}
},
- new Option(this, "use") {
+ new Option(this, "-use") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -707,7 +707,7 @@
return true;
}
},
- new Option(this, "windowtitle", 1) {
+ new Option(this, "-windowtitle", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -715,7 +715,7 @@
return true;
}
},
- new XOption(this, "xdoclint") {
+ new XOption(this, "-Xdoclint") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -723,7 +723,7 @@
return true;
}
},
- new XOption(this, "Xdocrootparent", 1) {
+ new XOption(this, "-Xdocrootparent", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -731,11 +731,10 @@
return true;
}
},
- new XOption(this, "doclet.xusage.xdoclint-extended.", "Xdoclint:", 0) {
+ new XOption(this, "doclet.xusage.xdoclint-extended.", "-Xdoclint:", 0) {
@Override
public boolean matches(String option) {
- String opt = option.startsWith("-") ? option.substring(1) : option;
- return opt.toLowerCase().startsWith(getName().toLowerCase());
+ return option.toLowerCase().startsWith(getName().toLowerCase());
}
@Override
@@ -745,11 +744,10 @@
return true;
}
},
- new XOption(this, "doclet.xusage.xdoclint-package.", "Xdoclint/package:", 0) {
+ new XOption(this, "doclet.xusage.xdoclint-package.", "-Xdoclint/package:", 0) {
@Override
public boolean matches(String option) {
- String opt = option.startsWith("-") ? option.substring(1) : option;
- return opt.toLowerCase().startsWith(getName().toLowerCase());
+ return option.toLowerCase().startsWith(getName().toLowerCase());
}
@Override
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Jun 27 10:00:47 2016 -0700
@@ -185,6 +185,7 @@
doclet.Same_package_name_used=Package name format used twice: {0}
doclet.exception_encountered=Exception encountered while processing {1}\n{0}
+# option specifiers
doclet.usage.d.name=d
doclet.usage.d.parameters=<directory>
doclet.usage.d.description=Destination directory for output files
@@ -240,18 +241,23 @@
doclet.usage.linkoffline.name=linkoffline
doclet.usage.linkoffline.parameters=<url1> <url2>
-doclet.usage.linkoffline.description=Link to docs at <url1> using package list at <url2>
+doclet.usage.linkoffline.description=Link to docs at <url1> using package list\n\
+\ at <url2>
doclet.usage.excludedocfilessubdir.name=excludedocfilessubdir
doclet.usage.excludedocfilessubdir.parameters=<name>:..
-doclet.usage.excludedocfilessubdir.description=Exclude any doc-files subdirectories with given name
+doclet.usage.excludedocfilessubdir.description=\n\
+\ Exclude any doc-files subdirectories with\n\
+\ given name
doclet.usage.group.name=group
doclet.usage.group.parameters=<name> <p1>:<p2>..
-doclet.usage.group.description=Group specified packages together in overview page
+doclet.usage.group.description=Group specified packages together\n\
+\ in overview page
doclet.usage.nocomment.name=nocomment
-doclet.usage.nocomment.description=Suppress description and tags, generate only declarations
+doclet.usage.nocomment.description=Suppress description and tags, generate\n\
+\ only declarations
doclet.usage.nodeprecated.name=nodeprecated
doclet.usage.nodeprecated.description=Do not include @deprecated information
@@ -289,7 +295,8 @@
doclet.usage.tag.name=tag
doclet.usage.tag.parameters=<name>:<locations>:<header>
-doclet.usage.tag.description=Specify single argument custom tags
+doclet.usage.tag.description=\n\
+\ Specify single argument custom tags
doclet.usage.taglet.name=taglet
doclet.usage.taglet.description=The fully qualified name of Taglet to register
@@ -299,7 +306,8 @@
doclet.usage.charset.name=charset
doclet.usage.charset.parameters=<charset>
-doclet.usage.charset.description=Charset for cross-platform viewing of generated documentation
+doclet.usage.charset.description=Charset for cross-platform viewing of\n\
+\ generated documentation
doclet.usage.helpfile.name=helpfile
doclet.usage.helpfile.parameters=<file>
@@ -310,14 +318,17 @@
doclet.usage.sourcetab.name=sourcetab
doclet.usage.sourcetab.parameters=<tab length>
-doclet.usage.sourcetab.description=Specify the number of spaces each tab takes up in the source
+doclet.usage.sourcetab.description=Specify the number of spaces each tab\n\
+\ takes up in the source
doclet.usage.keywords.name=keywords
-doclet.usage.keywords.description=Include HTML meta tags with package, class and member info
+doclet.usage.keywords.description=Include HTML meta tags with package,\n\
+\ class and member info
doclet.usage.stylesheetfile.name=stylesheetfile
doclet.usage.stylesheetfile.parameters=<path>
-doclet.usage.stylesheetfile.description=File to change style of the generated documentation
+doclet.usage.stylesheetfile.description=File to change style of the generated\n\
+\ documentation
doclet.usage.docencoding.name=docencoding
doclet.usage.docencoding.parameters=<name>
@@ -325,23 +336,30 @@
doclet.xusage.xdocrootparent.name=Xdocrootparent
doclet.xusage.xdocrootparent.parameters=<url>
-doclet.xusage.xdocrootparent.description=Replaces all @docRoot followed by /.. in doc comments with <url>
+doclet.xusage.xdocrootparent.description=Replaces all @docRoot followed by /..\n\
+\ in doc comments with <url>
doclet.xusage.xdoclint.name=Xdoclint
-doclet.xusage.xdoclint.description=Enable recommended checks for problems in javadoc comments
+doclet.xusage.xdoclint.description=Enable recommended checks for problems in\n\
+\ javadoc comments
doclet.xusage.xdoclint-extended.name=Xdoclint:
doclet.xusage.xdoclint-extended.parameters=(all|none|[-]<group>)
# L10N: do not localize these words: all none accessibility html missing reference syntax
-doclet.xusage.xdoclint-extended.description=Enable or disable specific checks for problems in javadoc comments,\n\
-\ Enable or disable specific checks for problems in javadoc comments,\n\
-\ where <group> is one of accessibility, html, missing, reference, or syntax.\n
+doclet.xusage.xdoclint-extended.description=Enable or disable specific checks\n\
+\ for problems in javadoc comments, where \n\
+\ <group> is one of accessibility, html,\n\
+\ missing, reference, or syntax.\n
doclet.xusage.xdoclint-package.name=Xdoclint/package:
doclet.xusage.xdoclint-package.parameters=([-]<packages>)
doclet.xusage.xdoclint-package.description=\n\
-\ Enable or disable checks in specific packages. <packages> is a comma separated\n\
-\ list of package specifiers. Package specifier is either a qualified name of a package\n\
-\ or a package name prefix followed by .*, which expands to all sub-packages of\n\
-\ the given package. Prefix the package specifier with - to disable checks for\n\
-\ the specified packages.\n
+\ Enable or disable checks in specific\n\
+\ packages. <packages> is a comma separated\n\
+\ list of package specifiers. Package\n\
+\ specifier is either a qualified name of a\n\
+\ package or a package name prefix followed\n\
+\ by .*, which expands to all sub-packages\n\
+\ of the given package. Prefix the package\n\
+\ specifier with - to disable checks for\n\
+\ the specified packages.\n
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/standard/Standard.java Mon Jun 20 06:13:28 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. 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.javadoc.internal.doclets.standard;
-
-import java.util.Locale;
-import java.util.Set;
-
-import javax.lang.model.SourceVersion;
-
-import jdk.javadoc.doclet.Doclet;
-import jdk.javadoc.doclet.DocletEnvironment;
-import jdk.javadoc.doclet.Reporter;
-import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
-
-public class Standard implements Doclet {
-
- private final HtmlDoclet htmlDoclet;
-
- public Standard() {
- htmlDoclet = new HtmlDoclet();
- }
-
- public void init(Locale locale, Reporter reporter) {
- htmlDoclet.init(locale, reporter);
- }
-
- public String getName() {
- return "Standard";
- }
-
- public Set<Doclet.Option> getSupportedOptions() {
- return htmlDoclet.getSupportedOptions();
- }
-
- public SourceVersion getSupportedSourceVersion() {
- return htmlDoclet.sourceVersion();
- }
-
- public boolean run(DocletEnvironment root) {
- return htmlDoclet.run(root);
- }
-}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java Mon Jun 27 10:00:47 2016 -0700
@@ -411,7 +411,7 @@
public Set<Doclet.Option> getSupportedOptions() {
Doclet.Option[] options = {
- new Option(this, "author") {
+ new Option(this, "-author") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -419,7 +419,7 @@
return true;
}
},
- new Option(this, "d", 1) {
+ new Option(this, "-d", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -427,7 +427,7 @@
return true;
}
},
- new Option(this, "docencoding", 1) {
+ new Option(this, "-docencoding", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -435,7 +435,7 @@
return true;
}
},
- new Option(this, "docfilessubdirs") {
+ new Option(this, "-docfilessubdirs") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -443,7 +443,7 @@
return true;
}
},
- new Hidden(this, "encoding", 1) {
+ new Hidden(this, "-encoding", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -451,7 +451,7 @@
return true;
}
},
- new Option(this, "excludedocfilessubdir", 1) {
+ new Option(this, "-excludedocfilessubdir", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -459,7 +459,7 @@
return true;
}
},
- new Option(this, "group", 2) {
+ new Option(this, "-group", 2) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -467,7 +467,7 @@
return true;
}
},
- new Hidden(this, "javafx") {
+ new Hidden(this, "-javafx") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -475,7 +475,7 @@
return true;
}
},
- new Option(this, "keywords") {
+ new Option(this, "-keywords") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -483,7 +483,7 @@
return true;
}
},
- new Option(this, "link", 1) {
+ new Option(this, "-link", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -492,7 +492,7 @@
return true;
}
},
- new Option(this, "linksource") {
+ new Option(this, "-linksource") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -500,7 +500,7 @@
return true;
}
},
- new Option(this, "linkoffline", 2) {
+ new Option(this, "-linkoffline", 2) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -509,7 +509,7 @@
return true;
}
},
- new Option(this, "nocomment") {
+ new Option(this, "-nocomment") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -517,7 +517,7 @@
return true;
}
},
- new Option(this, "nodeprecated") {
+ new Option(this, "-nodeprecated") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -525,7 +525,7 @@
return true;
}
},
- new Option(this, "nosince") {
+ new Option(this, "-nosince") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -533,7 +533,7 @@
return true;
}
},
- new Option(this, "notimestamp") {
+ new Option(this, "-notimestamp") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -541,7 +541,7 @@
return true;
}
},
- new Option(this, "noqualifier", 1) {
+ new Option(this, "-noqualifier", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -549,7 +549,7 @@
return true;
}
},
- new Hidden(this, "quiet") {
+ new Hidden(this, "-quiet") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -557,7 +557,7 @@
return true;
}
},
- new Option(this, "serialwarn") {
+ new Option(this, "-serialwarn") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -565,7 +565,7 @@
return true;
}
},
- new Option(this, "sourcetab", 1) {
+ new Option(this, "-sourcetab", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -584,7 +584,7 @@
return true;
}
},
- new Option(this, "tag", 1) {
+ new Option(this, "-tag", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -595,7 +595,7 @@
return true;
}
},
- new Option(this, "taglet", 1) {
+ new Option(this, "-taglet", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -606,7 +606,7 @@
return true;
}
},
- new Option(this, "tagletpath", 1) {
+ new Option(this, "-tagletpath", 1) {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -614,7 +614,7 @@
return true;
}
},
- new Option(this, "version") {
+ new Option(this, "-version") {
@Override
public boolean process(String opt, ListIterator<String> args) {
optionsProcessed.add(this);
@@ -1083,14 +1083,13 @@
protected Option(Configuration config, String keyName, String name, int argCount) {
c = config;
+ this.name = name;
String key = keyName + "name";
String oname = getOptionsMessage(key);
if (oname.isEmpty()) {
- this.name = name;
this.parameters = "<MISSING KEY>";
this.description = "<MISSING KEY>";
} else {
- this.name = oname;
this.parameters = getOptionsMessage(keyName + "parameters");
this.description = getOptionsMessage(keyName + "description");
}
@@ -1098,7 +1097,7 @@
}
protected Option(String prefix, Configuration config, String name, int argCount) {
- this(config, prefix + name.toLowerCase() + ".", name, argCount);
+ this(config, prefix + name.toLowerCase().replaceAll("^-*", "") + ".", name, argCount);
}
protected Option(Configuration config, String name, int argCount) {
@@ -1146,7 +1145,7 @@
String opt = name + (name.endsWith(":") ? "" : " ") + parameters;
int optlen = opt.length();
int spaces = 32 - optlen;
- StringBuffer sb = new StringBuffer(" -").append(opt);
+ StringBuffer sb = new StringBuffer(" ").append(opt);
for (int i = 0; i < spaces; i++) {
sb.append(" ");
}
@@ -1161,8 +1160,7 @@
@Override
public boolean matches(String option) {
- String arg = option.startsWith("-") ? option.substring(1) : option;
- return name.toLowerCase().equals(arg.toLowerCase());
+ return name.toLowerCase().equals(option.toLowerCase());
}
@Override
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Mon Jun 27 10:00:47 2016 -0700
@@ -86,7 +86,7 @@
com.sun.tools.doclets.standard.Standard.class;
private static final Class<?> StdDoclet =
- jdk.javadoc.internal.doclets.standard.Standard.class;
+ jdk.javadoc.doclets.StandardDoclet.class;
/** Context for this invocation. */
private final Context context;
--- a/langtools/src/jdk.javadoc/share/classes/module-info.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/module-info.java Mon Jun 27 10:00:47 2016 -0700
@@ -30,9 +30,12 @@
exports com.sun.javadoc;
exports com.sun.tools.doclets;
+ exports com.sun.tools.doclets.standard;
exports com.sun.tools.javadoc;
+
exports jdk.javadoc.doclet;
exports jdk.javadoc.doclet.taglet;
+ exports jdk.javadoc.doclets;
provides javax.tools.DocumentationTool
with jdk.javadoc.internal.api.JavadocTool;
--- a/langtools/test/jdk/javadoc/tool/EnsureNewOldDoclet.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/EnsureNewOldDoclet.java Mon Jun 27 10:00:47 2016 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8035473 8154482
+ * @bug 8035473 8154482 8154399 8159096
* @summary make sure the javadoc tool responds correctly to Xold,
* old doclets and taglets.
* @library /tools/lib
@@ -87,7 +87,7 @@
CLASS_NAME + "\\$OldTaglet.*");
final static String OLD_STDDOCLET = "com.sun.tools.doclets.standard.Standard";
- final static String NEW_STDDOCLET = "jdk.javadoc.internal.doclets.standard.Standard";
+ final static String NEW_STDDOCLET = "jdk.javadoc.doclets.StandardDoclet";
public EnsureNewOldDoclet() throws Exception {
--- a/langtools/test/jdk/jshell/ComputeFQNsTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/test/jdk/jshell/ComputeFQNsTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -76,8 +76,8 @@
assertInferredFQNs("class X { ArrayList", "ArrayList".length(), false, "java.util.ArrayList");
}
- @Test(enabled = false) //JDK-8150860
- public void testSuspendIndexing() throws Exception {
+ @Test
+ public void testSuspendIndexing() throws Throwable {
compiler.compile(outDir, "package test; public class FQNTest { }");
String jarName = "test.jar";
compiler.jar(outDir, jarName, "test/FQNTest.class");
@@ -90,15 +90,35 @@
getState().sourceCodeAnalysis();
+ Throwable[] evalException = new Throwable[1];
+
new Thread() {
@Override public void run() {
- assertEval("{new java.io.FileOutputStream(\"" + runMarkFile.toAbsolutePath().toString() + "\").close();" +
- " while (java.nio.file.Files.exists(java.nio.file.Paths.get(\"" + continueMarkFile.toString() + "\"))) Thread.sleep(100); }");
+ try {
+ assertEval("{new java.io.FileOutputStream(\"" + runMarkFile.toAbsolutePath().toString().replace("\\", "\\\\") + "\").close();" +
+ " while (java.nio.file.Files.exists(java.nio.file.Paths.get(\"" + continueMarkFile.toAbsolutePath().toString().replace("\\", "\\\\") + "\"))) Thread.sleep(100); }");
+ } catch (Throwable t) {
+ evalException[0] = t;
+ }
}
}.start();
- while (!Files.exists(runMarkFile))
- Thread.sleep(100);
+ while (true) {
+ if (Files.exists(runMarkFile))
+ break;
+ try {
+ Thread.sleep(100);
+ } catch (Throwable t) {
+ if (evalException[0] != null) {
+ evalException[0].addSuppressed(t);
+ } else {
+ throw t;
+ }
+ }
+ if (evalException[0] != null) {
+ throw evalException[0];
+ }
+ }
addToClasspath(compiler.getPath(outDir).resolve(jarName));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/T8136453/T.jcod Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+class T {
+ 0xCAFEBABE;
+ 0; // minor version
+ 52; // version
+ [] { // Constant Pool
+ ; // first element is empty
+ Method #3 #15; // #1
+ class #16; // #2
+ class #17; // #3
+ Utf8 "<init>"; // #4
+ Utf8 "()V"; // #5
+ Utf8 "Code"; // #6
+ Utf8 "LocalVariableTable"; // #7
+ Utf8 "this"; // #8
+ Utf8 "LT;"; // #9
+ Utf8 "test"; // #10
+ Utf8 "(I)I"; // #11
+ Utf8 "p"; // #12
+ Utf8 "I"; // #13
+ Utf8 "l1"; // #14
+ NameAndType #4 #5; // #15
+ Utf8 "T"; // #16
+ Utf8 "java/lang/Object"; // #17
+ } // Constant Pool
+
+ 0x0021; // access
+ #2;// this_cpx
+ #3;// super_cpx
+
+ [] { // Interfaces
+ } // Interfaces
+
+ [] { // fields
+ } // fields
+
+ [] { // methods
+ { // Member
+ 0x0001; // access
+ #4; // name_cpx
+ #5; // sig_cpx
+ [] { // Attributes
+ Attr(#6) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x2AB70001B1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#7) { // LocalVariableTable
+ [] { // LocalVariableTable
+ 0 5 8 9 0;
+ }
+ } // end LocalVariableTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0001; // access
+ #10; // name_cpx
+ #11; // sig_cpx
+ [] { // Attributes
+ Attr(#6) { // Code
+ 1; // max_stack
+ 3; // max_locals
+ Bytes[]{
+ 0x033D1CAC;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#7) { // LocalVariableTable
+ [] { // LocalVariableTable
+ 0 4 8 9 0;
+ 0 4 12 13 1;
+ 0 4 14 13 20;
+ }
+ } // end LocalVariableTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ } // methods
+
+ [] { // Attributes
+ } // Attributes
+} // end class T
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/T8136453/T8136453.java Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8136453
+ * @summary Checking that javac's ClassReader expands its parameterNameIndices array properly.
+ * @modules jdk.compiler
+ * @build T T8136453
+ * @run main T8136453
+ */
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.util.ElementFilter;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+
+public class T8136453 {
+ public static void main(String... args) {
+ new T8136453().run();
+ }
+
+ void run() {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ List<String> opts = Arrays.asList("-XDsave-parameter-names");
+ JavacTask task = (JavacTask) compiler.getTask(null, null, null, opts, null, null);
+ TypeElement t = task.getElements().getTypeElement("T");
+ ExecutableElement testMethod = ElementFilter.methodsIn(t.getEnclosedElements()).get(0);
+ VariableElement param = testMethod.getParameters().get(0);
+ Name paramName = param.getSimpleName();
+
+ if (!paramName.contentEquals("p")) {
+ throw new AssertionError("Wrong parameter name: " + paramName);
+ }
+ }
+}
--- a/langtools/test/tools/javac/diags/HTMLWriter.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/test/tools/javac/diags/HTMLWriter.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -40,7 +40,7 @@
* @throws IOException if there is a problem writing to the underlying stream
*/
public HTMLWriter(Writer out) throws IOException {
- this(out, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">");
+ this(out, "<!DOCTYPE html\">");
}
/**
@@ -328,7 +328,7 @@
*/
public void writeLink(File file, String body) throws IOException {
startTag(A);
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
String path = file.getPath().replace(File.separatorChar, '/');
if (file.isAbsolute() && !path.startsWith("/"))
sb.append('/');
@@ -472,13 +472,15 @@
public static final String BORDER = "border";
/** The HTML "br" tag. */
public static final String BR = "br";
+ /** The HTML "charset" attribute. */
+ public static final String CHARSET = "charset";
/** The HTML "class" attribute. */
public static final String CLASS = "class";
/** The HTML "classid" attribute. */
public static final String CLASSID = "classid";
/** The HTML "code" tag. */
public static final String CODE = "code";
- /** The HTML "color" attribte. */
+ /** The HTML "color" attribute. */
public static final String COLOR = "color";
/** The HTML "col" attribute value. */
public static final String COL = "col";
@@ -522,6 +524,8 @@
public static final String LI = "li";
/** The HTML "link" tag. */
public static final String LINK = "link";
+ /** The HTML "meta" attribute. */
+ public static final String META = "meta";
/** The HTML "name" attribute. */
public static final String NAME = "name";
/** The HTML "object" tag. */
--- a/langtools/test/tools/javac/diags/RunExamples.java Mon Jun 20 06:13:28 2016 -0700
+++ b/langtools/test/tools/javac/diags/RunExamples.java Mon Jun 27 10:00:47 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -354,7 +354,10 @@
html.write(title);
html.endTag(HTMLWriter.TITLE);
}
+ html.startTag(HTMLWriter.META);
+ html.writeAttr(HTMLWriter.CHARSET, "UTF-8");
html.startTag(HTMLWriter.STYLE);
+ html.write(null); // revert to body text
html.newLine();
html.writeLine("div.file { background-color:#e0ffe0; margin-left:30px; margin-right:30px;\n"
+ " padding: 3px; border: thin solid silver; }");
--- a/make/Bundles.gmk Mon Jun 20 06:13:28 2016 -0700
+++ b/make/Bundles.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -52,7 +52,7 @@
SetupBundleFile = $(NamedParamsMacroTemplate)
define SetupBundleFileBody
- $1_RELATIVE_FILES := $$(patsubst $$($1_BASE_DIR)/%, ./%, $$($1_FILES))
+ $1_RELATIVE_FILES := $$(patsubst $$($1_BASE_DIR)/%, %, $$($1_FILES))
ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
$1_TYPE := tar.gz
@@ -71,7 +71,7 @@
$$(call MakeDir, $$(@D))
ifneq ($$($1_SPECIAL_INCLUDES), )
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
- ($(CD) $$($1_BASE_DIR) && $(FIND) ./$$i \
+ ($(CD) $$($1_BASE_DIR) && $(FIND) $$i \
>> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; )
endif
ifneq ($$($1_SUBDIR), )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/CreateHgtipFiles.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+define SetupCreateHgtip
+
+ $$(strip $1)/$(HGTIP_FILENAME): FRC
+ $(HG) tip --repository $$(strip $1) --template '{node|short}\n' > $$@.tmp
+ if [ ! -f $$@ ] || [ "`$(CAT) $$@`" != "`$(CAT) $$@.tmp`" ]; then \
+ $(MV) $$@.tmp $$@ ; \
+ else \
+ $(RM) $$@.tmp ; \
+ fi
+
+ TARGETS += $$(strip $1)/$(HGTIP_FILENAME)
+
+endef
+
+# Only try to create the tips if finding an actual hg repository. This will be
+# false if building from a source bundle.
+$(foreach r, $(call FindAllReposAbs), \
+ $(if $(wildcard $r/.hg), $(eval $(call SetupCreateHgtip, $r))) \
+)
+
+all: $(TARGETS)
+
+FRC:
+
+.PHONY: all
--- a/make/GensrcModuleInfo.gmk Mon Jun 20 06:13:28 2016 -0700
+++ b/make/GensrcModuleInfo.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -95,6 +95,7 @@
$(strip $(wildcard $(addsuffix $(subst .,/,/$(strip $1)), \
$(MODULE_CLASSES_DIRS) \
$(addsuffix /$(MODULE), $(IMPORT_MODULES_CLASSES)) \
+ $(JDK_OUTPUTDIR)/modules/$(MODULE) \
)))
# Convert the modification lines into arguments for the modification tool.
--- a/make/Javadoc.gmk Mon Jun 20 06:13:28 2016 -0700
+++ b/make/Javadoc.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -463,7 +463,7 @@
DOCLETAPI_HEADER := <strong>Doclet API</strong>
DOCLETAPI_BOTTOM := $(call CommonTrademarkBottom,$(DOCLETAPI_FIRST_COPYRIGHT_YEAR))
DOCLETAPI_GROUPNAME := Packages
-DOCLETAPI_REGEXP := jdk.javadoc.doclet.*
+DOCLETAPI_REGEXP := jdk.javadoc.doclet*
# DOCLETAPI_PKGS is located in NON_CORE_PKGS.gmk
# The index.html, options, and packages files
--- a/make/Main.gmk Mon Jun 20 06:13:28 2016 -0700
+++ b/make/Main.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -301,13 +301,16 @@
################################################################################
# Images targets
-# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
-# used to track the exact sources used to build that image.
+# Stores the tips for each repository. This file is be used when constructing
+# the jdk image and can be used to track the exact sources used to build that
+# image.
source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
$(SUPPORT_OUTPUTDIR)/source_tips: FRC
$(call MakeDir, $(@D))
- @$(RM) $@
- @$(call GetSourceTips)
+ $(call GetSourceTips)
+
+create-hgtip-files:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CreateHgtipFiles.gmk)
BOOTCYCLE_TARGET := product-images
bootcycle-images:
@@ -337,8 +340,8 @@
mac-bundles-jdk:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
-ALL_TARGETS += source-tips bootcycle-images zip-security zip-source \
- jrtfs-jar jimages profiles mac-bundles-jdk
+ALL_TARGETS += source-tips create-hgtip-files bootcycle-images zip-security \
+ zip-source jrtfs-jar jimages profiles mac-bundles-jdk
################################################################################
# Docs targets
--- a/make/common/MakeBase.gmk Mon Jun 20 06:13:28 2016 -0700
+++ b/make/common/MakeBase.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -335,25 +335,27 @@
################################################################################
# The source tips can come from the Mercurial repository, or in the files
# $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
-# directory as the original $(HGDIR) directory.
-# These should not be := assignments, only used from the root Makefile.
-HG_VERSION = $(shell $(HG) version 2> /dev/null)
-HG_DIRECTORY=.hg
-HGTIP_FILENAME=.hgtip
-HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO
-REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \
- $(shell $(CD) $(SRC_ROOT) ; \
- $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) \
- $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) \
- 2> /dev/null)))))
+# directory as the original .hg directory. The hgtip files are created in
+# CreateHgtipFiles.gmk.
+HGTIP_FILENAME := .hgtip
+FindAllReposAbs = \
+ $(strip $(sort $(dir $(filter-out $(SRC_ROOT)/build/%, $(wildcard \
+ $(addprefix $(SRC_ROOT)/, \
+ .hg */.hg */*/.hg */*/.hg */*/*/.hg \
+ .hgtip */.hgtip */*/.hgtip */*/.hgtip */*/*/.hgtip \
+ ) \
+ )))))
+
+FindAllReposRel = \
+ $(strip $(subst $(SRC_ROOT)/,.,$(patsubst $(SRC_ROOT)/%/, %, $(FindAllReposAbs))))
# Emit the repo:tip pairs to $@, but only if they changed since last time
define GetSourceTips
$(CD) $(SRC_ROOT) ; \
- for i in $(REPO_LIST) IGNORE ; do \
+ for i in $(FindAllReposRel) IGNORE ; do \
if [ "$${i}" = "IGNORE" ] ; then \
continue; \
- elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \
+ elif [ -d $${i}/.hg -a "$(HG)" != "" ] ; then \
$(PRINTF) " %s:%s" \
"$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \
elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \
@@ -369,12 +371,6 @@
fi
endef
-# Create the HGTIP_FILENAME file. Called from closed/make/SourceBundles.gmk
-define CreateHgTip
- $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME); \
- $(ECHO) $1/$(HGTIP_FILENAME)
-endef
-
################################################################################
define SetupLogging
--- a/make/common/NON_CORE_PKGS.gmk Mon Jun 20 06:13:28 2016 -0700
+++ b/make/common/NON_CORE_PKGS.gmk Mon Jun 27 10:00:47 2016 -0700
@@ -69,7 +69,8 @@
OLD_DOCLETAPI_PKGS = com.sun.javadoc
DOCLETAPI_PKGS = jdk.javadoc.doclet \
- jdk.javadoc.doclet.taglet
+ jdk.javadoc.doclet.taglet \
+ jdk.javadoc.doclets
TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java
--- a/nashorn/.hgtags Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/.hgtags Mon Jun 27 10:00:47 2016 -0700
@@ -357,3 +357,4 @@
5992041b0794fa5f25518673d63e8f35bcc89360 jdk-9+121
b1de131a3fed6845c78bdda358ee127532f16a3f jdk-9+122
9ed859b4faaf9ff7cd35f9e7f51c7e630303067a jdk-9+123
+5d68f5155dded7efec7d5aca5d631caa7ee1042b jdk-9+124
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java Mon Jun 27 10:00:47 2016 -0700
@@ -280,12 +280,11 @@
addField(cv, name, OBJECT_DESC);
}
- @SuppressWarnings("deprecation")
static void newFunction(final MethodGenerator mi, final String objName, final String className, final MemberInfo memInfo, final List<MemberInfo> specs) {
final boolean arityFound = (memInfo.getArity() != MemberInfo.DEFAULT_ARITY);
loadFunctionName(mi, memInfo.getName());
- mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className, memInfo.getJavaName(), memInfo.getJavaDesc()));
+ mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className, memInfo.getJavaName(), memInfo.getJavaDesc(), false));
assert specs != null;
if (!specs.isEmpty()) {
@@ -306,7 +305,6 @@
mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETDOCUMENTATIONKEY, SCRIPTFUNCTION_SETDOCUMENTATIONKEY_DESC);
}
- @SuppressWarnings("deprecation")
static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) {
final String propertyName = memInfo.getName();
// stack: Collection
@@ -319,13 +317,13 @@
mi.push(memInfo.getAttributes());
// setup getter method handle
String javaName = GETTER_PREFIX + memInfo.getJavaName();
- mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, getterDesc(memInfo)));
+ mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, getterDesc(memInfo), false));
// setup setter method handle
if (memInfo.isFinal()) {
mi.pushNull();
} else {
javaName = SETTER_PREFIX + memInfo.getJavaName();
- mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo)));
+ mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo), false));
}
// property = AccessorProperty.create(key, flags, getter, setter);
mi.invokeStatic(ACCESSORPROPERTY_TYPE, ACCESSORPROPERTY_CREATE, ACCESSORPROPERTY_CREATE_DESC);
@@ -336,7 +334,6 @@
// stack: Collection
}
- @SuppressWarnings("deprecation")
static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo getter, final MemberInfo setter) {
final String propertyName = getter.getName();
// stack: Collection
@@ -349,13 +346,13 @@
mi.push(getter.getAttributes());
// setup getter method handle
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className,
- getter.getJavaName(), getter.getJavaDesc()));
+ getter.getJavaName(), getter.getJavaDesc(), false));
// setup setter method handle
if (setter == null) {
mi.pushNull();
} else {
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className,
- setter.getJavaName(), setter.getJavaDesc()));
+ setter.getJavaName(), setter.getJavaDesc(), false));
}
// property = AccessorProperty.create(key, flags, getter, setter);
mi.invokeStatic(ACCESSORPROPERTY_TYPE, ACCESSORPROPERTY_CREATE, ACCESSORPROPERTY_CREATE_DESC);
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java Mon Jun 27 10:00:47 2016 -0700
@@ -178,7 +178,6 @@
}
}
- @SuppressWarnings("deprecation")
private void callSuper(final MethodGenerator mi) {
String superClass, superDesc;
mi.loadThis();
@@ -192,7 +191,7 @@
superClass = SCRIPTFUNCTION_TYPE;
superDesc = (memberCount > 0) ? SCRIPTFUNCTION_INIT_DESC4 : SCRIPTFUNCTION_INIT_DESC3;
mi.loadLiteral(constructor.getName());
- mi.visitLdcInsn(new Handle(H_INVOKESTATIC, scriptClassInfo.getJavaName(), constructor.getJavaName(), constructor.getJavaDesc()));
+ mi.visitLdcInsn(new Handle(H_INVOKESTATIC, scriptClassInfo.getJavaName(), constructor.getJavaName(), constructor.getJavaDesc(), false));
loadMap(mi);
mi.memberInfoArray(scriptClassInfo.getJavaName(), specs); //pushes null if specs empty
}
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java Mon Jun 27 10:00:47 2016 -0700
@@ -390,7 +390,6 @@
return EMPTY_LINK_LOGIC_TYPE.equals(type);
}
- @SuppressWarnings("deprecation")
void memberInfoArray(final String className, final List<MemberInfo> mis) {
if (mis.isEmpty()) {
pushNull();
@@ -405,7 +404,7 @@
push(pos++);
visitTypeInsn(NEW, SPECIALIZATION_TYPE);
dup();
- visitLdcInsn(new Handle(H_INVOKESTATIC, className, mi.getJavaName(), mi.getJavaDesc()));
+ visitLdcInsn(new Handle(H_INVOKESTATIC, className, mi.getJavaName(), mi.getJavaDesc(), false));
final Type linkLogicClass = mi.getLinkLogicClass();
final boolean linkLogic = !linkLogicIsEmpty(linkLogicClass);
final String ctor = linkLogic ? SPECIALIZATION_INIT3 : SPECIALIZATION_INIT2;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/checknames.js Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Simple Java identifier name pattern checker. You can check
+// class, method and variable names in java sources to confirm
+// to specified patterns. Default check functions just check for
+// 'too short' names. You can customize checkXYZName functions to
+// have arbitrary name pattern checks.
+
+// Usage: jjs checknames.js -- <directory>
+
+if (arguments.length == 0) {
+ print("Usage: jjs checknames.js -- <directory>");
+ exit(1);
+}
+
+// Java types used
+var File = Java.type("java.io.File");
+var Files = Java.type("java.nio.file.Files");
+var StringArray = Java.type("java.lang.String[]");
+var ToolProvider = Java.type("javax.tools.ToolProvider");
+var Tree = Java.type("com.sun.source.tree.Tree");
+var Trees = Java.type("com.sun.source.util.Trees");
+var TreeScanner = Java.type("com.sun.source.util.TreeScanner");
+
+// replace these checkXYZ functions with checks you want!
+function checkClassName(name) {
+ return name.length < 3;
+}
+
+function checkMethodName(name) {
+ return name.length < 3;
+}
+
+function checkVarName(name) {
+ return name.length < 3;
+}
+
+function checkNames() {
+ // get the system compiler tool
+ var compiler = ToolProvider.systemJavaCompiler;
+ // get standard file manager
+ var fileMgr = compiler.getStandardFileManager(null, null, null);
+ // Using Java.to convert script array (arguments) to a Java String[]
+ var compUnits = fileMgr.getJavaFileObjects(Java.to(arguments, StringArray));
+ // create a new compilation task
+ var task = compiler.getTask(null, fileMgr, null, null, null, compUnits);
+ var sourcePositions = Trees.instance(task).sourcePositions;
+ // subclass SimpleTreeVisitor
+ var NameChecker = Java.extend(TreeScanner);
+
+ var visitor = new NameChecker() {
+ report: function(node) {
+ var pos = sourcePositions.getStartPosition(this.compUnit, node);
+ var line = this.lineMap.getLineNumber(pos);
+ var col = this.lineMap.getColumnNumber(pos);
+ print("Too short name: " + node.name + " @ " + this.fileName + ":" + line + ":" + col);
+ },
+
+ // override to capture information on current compilation unit
+ visitCompilationUnit: function(compUnit, p) {
+ this.compUnit = compUnit;
+ this.lineMap = compUnit.lineMap;
+ this.fileName = compUnit.sourceFile.name;
+
+ return Java.super(visitor).visitCompilationUnit(compUnit, p);
+ },
+
+ // override to check class name
+ visitClass: function(node, p) {
+ if (checkClassName(node.simpleName.toString())) {
+ this.report(node);
+ }
+
+ return Java.super(visitor).visitClass(node, p);
+ },
+
+ // override to check method name
+ visitMethod: function(node, p) {
+ if (checkMethodName(node.name.toString())) {
+ this.report(node);
+ }
+
+ return Java.super(visitor).visitMethod(node, p);
+ },
+
+ // override to check variable name
+ visitVariable: function(node, p) {
+ if (checkVarName(node.name.toString())) {
+ this.report(node);
+ }
+
+ return Java.super(visitor).visitVariable(node, p);
+ }
+ }
+
+ for each (var cu in task.parse()) {
+ cu.accept(visitor, null);
+ }
+}
+
+// for each ".java" file in directory (recursively).
+function main(dir) {
+ var totalCount = 0;
+ Files.walk(dir.toPath()).
+ forEach(function(p) {
+ var name = p.toFile().absolutePath;
+ if (name.endsWith(".java")) {
+ checkNames(p);
+ }
+ });
+}
+
+main(new File(arguments[0]));
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/AssertsEnabled.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/AssertsEnabled.java Mon Jun 27 10:00:47 2016 -0700
@@ -28,7 +28,6 @@
/**
* Class that exposes the current state of asserts.
*/
-@SuppressWarnings("all")
public final class AssertsEnabled {
private static boolean assertsEnabled = false;
static {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java Mon Jun 27 10:00:47 2016 -0700
@@ -32,6 +32,7 @@
import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
import static jdk.internal.org.objectweb.asm.Opcodes.GOTO;
import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKEINTERFACE;
import static jdk.internal.org.objectweb.asm.Opcodes.IFEQ;
import static jdk.internal.org.objectweb.asm.Opcodes.IFGE;
import static jdk.internal.org.objectweb.asm.Opcodes.IFGT;
@@ -170,12 +171,10 @@
}
/** Bootstrap for normal indy:s */
- @SuppressWarnings("deprecation")
- private static final Handle LINKERBOOTSTRAP = new Handle(H_INVOKESTATIC, Bootstrap.BOOTSTRAP.className(), Bootstrap.BOOTSTRAP.name(), Bootstrap.BOOTSTRAP.descriptor());
+ private static final Handle LINKERBOOTSTRAP = new Handle(H_INVOKESTATIC, Bootstrap.BOOTSTRAP.className(), Bootstrap.BOOTSTRAP.name(), Bootstrap.BOOTSTRAP.descriptor(), false);
/** Bootstrap for array populators */
- @SuppressWarnings("deprecation")
- private static final Handle POPULATE_ARRAY_BOOTSTRAP = new Handle(H_INVOKESTATIC, RewriteException.BOOTSTRAP.className(), RewriteException.BOOTSTRAP.name(), RewriteException.BOOTSTRAP.descriptor());
+ private static final Handle POPULATE_ARRAY_BOOTSTRAP = new Handle(H_INVOKESTATIC, RewriteException.BOOTSTRAP.className(), RewriteException.BOOTSTRAP.name(), RewriteException.BOOTSTRAP.descriptor(), false);
/**
* Constructor - internal use from ClassEmitter only
@@ -1007,10 +1006,10 @@
*
* @return the method emitter
*/
- @SuppressWarnings("deprecation")
MethodEmitter loadHandle(final String className, final String methodName, final String descName, final EnumSet<Flag> flags) {
+ final int flag = Flag.getValue(flags);
debug("load handle ");
- pushType(Type.OBJECT.ldc(method, new Handle(Flag.getValue(flags), className, methodName, descName)));
+ pushType(Type.OBJECT.ldc(method, new Handle(flag, className, methodName, descName, flag == H_INVOKEINTERFACE)));
return this;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Mon Jun 27 10:00:47 2016 -0700
@@ -2474,14 +2474,14 @@
}
@Override
- protected FindProperty findProperty(final Object key, final boolean deep, final ScriptObject start) {
- if (lexicalScope != null && start != this && start.isScope()) {
+ protected FindProperty findProperty(final Object key, final boolean deep, boolean isScope, final ScriptObject start) {
+ if (lexicalScope != null && isScope) {
final FindProperty find = lexicalScope.findProperty(key, false);
if (find != null) {
return find;
}
}
- return super.findProperty(key, deep, start);
+ return super.findProperty(key, deep, isScope, start);
}
@Override
@@ -2854,8 +2854,7 @@
sb.append("$Constructor");
final Class<?> funcClass = Class.forName(sb.toString());
- @SuppressWarnings("deprecation")
- final T res = clazz.cast(funcClass.newInstance());
+ final T res = clazz.cast(funcClass.getDeclaredConstructor().newInstance());
if (res instanceof ScriptFunction) {
// All global constructor prototypes are not-writable,
@@ -2871,8 +2870,12 @@
res.setIsBuiltin();
return res;
- } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
- throw new RuntimeException(e);
+ } catch (final Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException)e;
+ } else {
+ throw new RuntimeException(e);
+ }
}
}
@@ -2882,14 +2885,17 @@
final String className = PACKAGE_PREFIX + name + "$Prototype";
final Class<?> funcClass = Class.forName(className);
- @SuppressWarnings("deprecation")
- final ScriptObject res = (ScriptObject) funcClass.newInstance();
+ final ScriptObject res = (ScriptObject) funcClass.getDeclaredConstructor().newInstance();
res.setIsBuiltin();
res.setInitialProto(prototype);
return res;
- } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
- throw new RuntimeException(e);
+ } catch (final Exception e) {
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException)e;
+ } else {
+ throw new RuntimeException(e);
+ }
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java Mon Jun 27 10:00:47 2016 -0700
@@ -609,6 +609,9 @@
if (stream.get(stream.last()) != token) {
return false;
}
+
+ // Record current position in case multiple heredocs start on this line - see JDK-8073653
+ final State state = saveState();
// Rewind to token start position
reset(Token.descPosition(token));
@@ -616,7 +619,7 @@
return scanRegEx();
} else if (ch0 == '<') {
if (ch1 == '<') {
- return scanHereString(lir);
+ return scanHereString(lir, state);
} else if (Character.isJavaIdentifierStart(ch1)) {
return scanXMLLiteral();
}
@@ -1539,7 +1542,7 @@
*
* @return TRUE if is a here string.
*/
- private boolean scanHereString(final LineInfoReceiver lir) {
+ private boolean scanHereString(final LineInfoReceiver lir, final State oldState) {
assert ch0 == '<' && ch1 == '<';
if (scripting) {
// Record beginning of here string.
@@ -1589,6 +1592,11 @@
int lastLinePosition = position;
restState.setLimit(position);
+ if (oldState.position > position) {
+ restoreState(oldState);
+ skipLine(false);
+ }
+
// Record beginning of string.
final State stringState = saveState();
int stringEnd = position;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Mon Jun 27 10:00:47 2016 -0700
@@ -775,7 +775,7 @@
* @return FindPropertyData or null if not found.
*/
public final FindProperty findProperty(final Object key, final boolean deep) {
- return findProperty(key, deep, this);
+ return findProperty(key, deep, false, this);
}
/**
@@ -791,12 +791,12 @@
* @see jdk.nashorn.internal.objects.NativeArray
*
* @param key Property key.
- * @param deep Whether the search should look up proto chain.
+ * @param deep true if the search should look up proto chain
+ * @param isScope true if this is a scope access
* @param start the object on which the lookup was originally initiated
- *
* @return FindPropertyData or null if not found.
*/
- protected FindProperty findProperty(final Object key, final boolean deep, final ScriptObject start) {
+ protected FindProperty findProperty(final Object key, final boolean deep, boolean isScope, final ScriptObject start) {
final PropertyMap selfMap = getMap();
final Property property = selfMap.findProperty(key);
@@ -807,7 +807,7 @@
if (deep) {
final ScriptObject myProto = getProto();
- final FindProperty find = myProto == null ? null : myProto.findProperty(key, true, start);
+ final FindProperty find = myProto == null ? null : myProto.findProperty(key, true, isScope, start);
// checkSharedProtoMap must be invoked after myProto.checkSharedProtoMap to propagate
// shared proto invalidation up the prototype chain. It also must be invoked when prototype is null.
checkSharedProtoMap();
@@ -1977,7 +1977,7 @@
return findMegaMorphicGetMethod(desc, name, operation == StandardOperation.GET_METHOD);
}
- final FindProperty find = findProperty(name, true);
+ final FindProperty find = findProperty(name, true, NashornCallSiteDescriptor.isScope(desc), this);
MethodHandle mh;
if (find == null) {
@@ -2035,7 +2035,7 @@
}
private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name, final boolean isMethod) {
- Context.getContextTrusted().getLogger(ObjectClassGenerator.class).warning("Megamorphic getter: " + desc + " " + name + " " +isMethod);
+ Context.getContextTrusted().getLogger(ObjectClassGenerator.class).warning("Megamorphic getter: ", desc, " ", name + " ", isMethod);
final MethodHandle invoker = MH.insertArguments(MEGAMORPHIC_GET, 1, name, isMethod, NashornCallSiteDescriptor.isScope(desc));
final MethodHandle guard = getScriptObjectGuard(desc.getMethodType(), true);
return new GuardedInvocation(invoker, guard);
@@ -2043,7 +2043,7 @@
@SuppressWarnings("unused")
private Object megamorphicGet(final String key, final boolean isMethod, final boolean isScope) {
- final FindProperty find = findProperty(key, true);
+ final FindProperty find = findProperty(key, true, isScope, this);
if (find != null) {
return find.getObjectValue();
}
@@ -2181,7 +2181,7 @@
*
* toString = function() { print("global toString"); } // don't affect Object.prototype.toString
*/
- FindProperty find = findProperty(name, true, this);
+ FindProperty find = findProperty(name, true, NashornCallSiteDescriptor.isScope(desc), this);
// If it's not a scope search, then we don't want any inherited properties except those with user defined accessors.
if (find != null && find.isInherited() && !find.getProperty().isAccessorProperty()) {
@@ -2258,6 +2258,7 @@
}
private GuardedInvocation findMegaMorphicSetMethod(final CallSiteDescriptor desc, final String name) {
+ Context.getContextTrusted().getLogger(ObjectClassGenerator.class).warning("Megamorphic setter: ", desc, " ", name);
final MethodType type = desc.getMethodType().insertParameterTypes(1, Object.class);
//never bother with ClassCastExceptionGuard for megamorphic callsites
final GuardedInvocation inv = findSetIndexMethod(getClass(), desc, false, type);
@@ -2734,7 +2735,7 @@
if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
if (object.getMap().containsArrayKeys()) {
- final FindProperty find = object.findProperty(key, false, this);
+ final FindProperty find = object.findProperty(key, false);
if (find != null) {
return getIntValue(find, programPoint);
@@ -2805,7 +2806,7 @@
if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
if (object.getMap().containsArrayKeys()) {
- final FindProperty find = object.findProperty(key, false, this);
+ final FindProperty find = object.findProperty(key, false);
if (find != null) {
return getDoubleValue(find, programPoint);
}
@@ -2875,7 +2876,7 @@
if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
if (object.getMap().containsArrayKeys()) {
- final FindProperty find = object.findProperty(key, false, this);
+ final FindProperty find = object.findProperty(key, false);
if (find != null) {
return find.getObjectValue();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java Mon Jun 27 10:00:47 2016 -0700
@@ -704,7 +704,17 @@
if (property != null) {
if (obj instanceof ScriptObject) {
- obj = ((ScriptObject)obj).get(property);
+ // this is a scope identifier
+ assert property instanceof String;
+ final ScriptObject sobj = (ScriptObject) obj;
+
+ final FindProperty find = sobj.findProperty(property, true, true, sobj);
+ if (find != null) {
+ obj = find.getObjectValue();
+ } else {
+ obj = sobj.invokeNoSuchProperty(property, false, UnwarrantedOptimismException.INVALID_PROGRAM_POINT);
+ }
+
if(Global.isLocationPropertyPlaceholder(obj)) {
if(CompilerConstants.__LINE__.name().equals(property)) {
obj = 0;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Mon Jun 27 10:00:47 2016 -0700
@@ -193,20 +193,20 @@
*
* @param key Property key.
* @param deep Whether the search should look up proto chain.
+ * @param isScope true if is this a scope access
* @param start the object on which the lookup was originally initiated
- *
* @return FindPropertyData or null if not found.
*/
@Override
- protected FindProperty findProperty(final Object key, final boolean deep, final ScriptObject start) {
+ protected FindProperty findProperty(final Object key, final boolean deep, boolean isScope, final ScriptObject start) {
// We call findProperty on 'expression' with 'expression' itself as start parameter.
// This way in ScriptObject.setObject we can tell the property is from a 'with' expression
// (as opposed from another non-scope object in the proto chain such as Object.prototype).
- final FindProperty exprProperty = expression.findProperty(key, true, expression);
+ final FindProperty exprProperty = expression.findProperty(key, true, false, expression);
if (exprProperty != null) {
return exprProperty;
}
- return super.findProperty(key, deep, start);
+ return super.findProperty(key, deep, isScope, start);
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Mon Jun 27 10:00:47 2016 -0700
@@ -191,18 +191,16 @@
private static final Call RUN = interfaceCallNoLookup(Runnable.class, "run", void.class);
// ASM handle to the bootstrap method
- @SuppressWarnings("deprecation")
private static final Handle BOOTSTRAP_HANDLE = new Handle(H_INVOKESTATIC,
Type.getInternalName(JavaAdapterServices.class), "bootstrap",
MethodType.methodType(CallSite.class, Lookup.class, String.class,
- MethodType.class, int.class).toMethodDescriptorString());
+ MethodType.class, int.class).toMethodDescriptorString(), false);
// ASM handle to the bootstrap method for array populator
- @SuppressWarnings("deprecation")
private static final Handle CREATE_ARRAY_BOOTSTRAP_HANDLE = new Handle(H_INVOKESTATIC,
Type.getInternalName(JavaAdapterServices.class), "createArrayBootstrap",
MethodType.methodType(CallSite.class, Lookup.class, String.class,
- MethodType.class).toMethodDescriptorString());
+ MethodType.class).toMethodDescriptorString(), false);
// Field type names used in the generated bytecode
private static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor();
@@ -1061,13 +1059,12 @@
endMethod(mv);
}
- @SuppressWarnings("deprecation")
private void generateFinalizerOverride() {
final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_PUBLIC, "finalize",
VOID_METHOD_DESCRIPTOR, null, null));
// Overridden finalizer will take a MethodHandle to the finalizer delegating method, ...
mv.aconst(new Handle(Opcodes.H_INVOKESTATIC, generatedClassName, FINALIZER_DELEGATE_NAME,
- FINALIZER_DELEGATE_METHOD_DESCRIPTOR));
+ FINALIZER_DELEGATE_METHOD_DESCRIPTOR, false));
mv.visitVarInsn(ALOAD, 0);
// ...and invoke it through JavaAdapterServices.invokeNoPermissions
INVOKE_NO_PERMISSIONS.invoke(mv);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpScanner.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpScanner.java Mon Jun 27 10:00:47 2016 -0700
@@ -80,8 +80,17 @@
this.negLookaheadLevel = negLookaheadLevel;
}
- boolean isContained(final int group, final int level) {
- return group == this.negLookaheadGroup && level >= this.negLookaheadLevel;
+ /**
+ * Returns true if this Capture can be referenced from the position specified by the
+ * group and level parameters. This is the case if either the group is not within
+ * a negative lookahead, or the position of the referrer is in the same negative lookahead.
+ *
+ * @param group current negative lookahead group
+ * @param level current negative lokahead level
+ * @return true if this capture group can be referenced from the given position
+ */
+ boolean canBeReferencedFrom(final int group, final int level) {
+ return this.negLookaheadLevel == 0 || (group == this.negLookaheadGroup && level >= this.negLookaheadLevel);
}
}
@@ -671,8 +680,9 @@
} else if (decimalValue <= caps.size()) {
// Captures inside a negative lookahead are undefined when referenced from the outside.
- if (!caps.get(decimalValue - 1).isContained(negLookaheadGroup, negLookaheadLevel)) {
- // Reference to capture in negative lookahead, omit from output buffer.
+ final Capture capture = caps.get(decimalValue - 1);
+ if (!capture.canBeReferencedFrom(negLookaheadGroup, negLookaheadLevel)) {
+ // Outside reference to capture in negative lookahead, omit from output buffer.
sb.setLength(sb.length() - 1);
} else {
// Append backreference to output buffer.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8073653.js Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8073653: Secondary heredoc eating wrong lines.
+ *
+ * @test
+ * @run
+ * @option -scripting
+ */
+
+
+print(<<EOD1); print(<<EOD2.toUpperCase()); var a = <<EOD3, b = <<EOD4.toLowerCase(), c = [<<EOD5, <<EOD6];
+This is line 1.
+This is line 2.
+EOD1
+This is line 3.
+This is line 4.
+EOD2
+This is line 5.
+This is line 6.
+EOD3
+This is line 7.
+This is line 8.
+EOD4
+This is line 9.
+This is line 10.
+EOD5
+This is line 11.
+This is line 12.
+EOD6
+
+print(a);
+print(b);
+for (var i in c) {
+ print(c[i]);
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8073653.js.EXPECTED Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,12 @@
+This is line 1.
+This is line 2.
+THIS IS LINE 3.
+THIS IS LINE 4.
+This is line 5.
+This is line 6.
+this is line 7.
+this is line 8.
+This is line 9.
+This is line 10.
+This is line 11.
+This is line 12.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8137240.js Mon Jun 27 10:00:47 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8137240: Negative lookahead in RegEx breaks backreference
+ *
+ * @test
+ * @run
+ */
+
+
+Assert.assertEquals('aa'.replace(/(a)(?!b)\1/gm, 'c'), 'c');
+
+var result = 'aa'.match(/(a)(?!b)\1/);
+Assert.assertTrue(result.length === 2);
+Assert.assertTrue(result[0] === 'aa');
+Assert.assertTrue(result[1] === 'a');
+
+result = 'aa'.match(/(a)(?!(b))\2(a)/);
+Assert.assertTrue(result.length === 4);
+Assert.assertTrue(result[0] === 'aa');
+Assert.assertTrue(result[1] === 'a');
+Assert.assertTrue(result[2] === undefined);
+Assert.assertTrue(result[3] === 'a');
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java Mon Jun 20 06:13:28 2016 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java Mon Jun 27 10:00:47 2016 -0700
@@ -46,8 +46,8 @@
public class LexicalBindingTest {
final static String LANGUAGE_ES6 = "--language=es6";
- final static int NUMBER_OF_CONTEXTS = 20;
- final static int MEGAMORPHIC_LOOP_COUNT = 20;
+ final static int NUMBER_OF_CONTEXTS = 40;
+ final static int MEGAMORPHIC_LOOP_COUNT = 40;
/**
* Test access to global var-declared variables for shared script classes with multiple globals.
@@ -57,19 +57,21 @@
final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
final ScriptEngine e = factory.getScriptEngine();
final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
- final String sharedScript = "foo";
+ final String sharedScript1 = "foo";
+ final String sharedScript2 = "bar = foo; bar";
for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
final ScriptContext context = contexts[i] = new SimpleScriptContext();
final Bindings b = e.createBindings();
context.setBindings(b, ScriptContext.ENGINE_SCOPE);
- assertEquals(e.eval("var foo = '" + i + "';", context), null);
+ assertEquals(e.eval("var foo = '" + i + "'; var bar;", context), null);
}
for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
final ScriptContext context = contexts[i];
- assertEquals(e.eval(sharedScript, context), String.valueOf(i));
+ assertEquals(e.eval(sharedScript1, context), String.valueOf(i));
+ assertEquals(e.eval(sharedScript2, context), String.valueOf(i));
}
}
@@ -81,19 +83,21 @@
final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
- final String sharedScript = "foo";
+ final String sharedScript1 = "foo";
+ final String sharedScript2 = "bar = foo; bar";
for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
final ScriptContext context = contexts[i] = new SimpleScriptContext();
final Bindings b = e.createBindings();
context.setBindings(b, ScriptContext.ENGINE_SCOPE);
- assertEquals(e.eval("let foo = '" + i + "';", context), null);
+ assertEquals(e.eval("let foo = '" + i + "'; let bar; ", context), null);
}
for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
final ScriptContext context = contexts[i];
- assertEquals(e.eval(sharedScript, context), String.valueOf(i));
+ assertEquals(e.eval(sharedScript1, context), String.valueOf(i));
+ assertEquals(e.eval(sharedScript2, context), String.valueOf(i));
}
}
@@ -182,6 +186,27 @@
assertEquals(e.eval(sharedScript, newCtxt), "newer context");
}
+ /**
+ * Make sure lexically defined variables are accessible in other scripts.
+ */
+ @Test
+ public void lexicalScopeTest() throws ScriptException {
+ final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+ final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+
+ e.eval("let x; const y = 'world';");
+
+ assertEquals(e.eval("x = 'hello'"), "hello");
+ assertEquals(e.eval("typeof x"), "string");
+ assertEquals(e.eval("typeof y"), "string");
+ assertEquals(e.eval("x"), "hello");
+ assertEquals(e.eval("y"), "world");
+ assertEquals(e.eval("typeof this.x"), "undefined");
+ assertEquals(e.eval("typeof this.y"), "undefined");
+ assertEquals(e.eval("this.x"), null);
+ assertEquals(e.eval("this.y"), null);
+ }
+
private static class ScriptRunner implements Runnable {
final ScriptEngine engine;