- * timezone
+ * timezone
* {@link #getTimezone()}
* Number of minutes or {@link DatatypeConstants#FIELD_UNDEFINED}.
* Value range from -14 hours (-14 * 60 minutes) to 14 hours (14 * 60 minutes).
@@ -748,26 +744,22 @@ public abstract class XMLGregorianCalendar
* Return the name of the XML Schema date/time type that this instance
* maps to. Type is computed based on fields that are set.
*
- *
+ *
+ * Required fields for XML Schema 1.0 Date/Time Datatypes.
+ * (timezone is optional for all date/time datatypes)
*
*
- *
- * Required fields for XML Schema 1.0 Date/Time Datatypes.
- * (timezone is optional for all date/time datatypes)
- *
+ * Datatype
+ * year
+ * month
+ * day
+ * hour
+ * minute
+ * second
*
*
*
*
- * Datatype
- * year
- * month
- * day
- * hour
- * minute
- * second
- *
- *
* {@link DatatypeConstants#DATETIME}
* X
* X
@@ -911,21 +903,17 @@ public abstract class XMLGregorianCalendar
* instance, see
* {@link #toGregorianCalendar(TimeZone, Locale, XMLGregorianCalendar)}.
*
- *
+ *
+ * Field by Field Conversion from this class to
+ * {@code java.util.GregorianCalendar}
*
*
- *
- * Field by Field Conversion from this class to
- * {@code java.util.GregorianCalendar}
- *
+ * {@code java.util.GregorianCalendar} field
+ * {@code javax.xml.datatype.XMLGregorianCalendar} field
*
*
*
*
- * {@code java.util.GregorianCalendar} field
- * {@code javax.xml.datatype.XMLGregorianCalendar} field
- *
- *
* {@code ERA}
* {@link #getEonAndYear()}{@code .signum() < 0 ? GregorianCalendar.BC : GregorianCalendar.AD}
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html b/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html
index de065acc664..d564f6af5c0 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/package.html
@@ -1,6 +1,6 @@
-
+
-
-
+
javax.xml.xpath
@@ -50,9 +49,10 @@ questions.
XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration
-
+
-
+
+ W3C XML Schema/Java Type Mappings
W3C XML Schema Data Type
@@ -101,10 +101,11 @@ questions.
-
+
-
+
+ XQuery and XPath/Java Type Mappings
XQuery 1.0 and XPath 2.0 Data Model
@@ -124,7 +125,7 @@ questions.
-
+
W3C XML Schema data types that have a "natural " mapping to Java types are defined by
@@ -151,7 +152,7 @@ questions.
xs:unsignedShort
-
+
@@ -162,7 +163,7 @@ questions.
Since 1.5
-
+
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java b/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
index 09e46e7dfbf..1ad999acb14 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,17 +88,12 @@ public interface NamespaceContext {
* table describes the returned Namespace URI value for all
* possible prefix values:
*
- *
+ *
+ * Return value for specified prefixes
*
*
- *
- * {@code getNamespaceURI(prefix)}
- * return value for specified prefixes
- *
- *
- *
- * prefix parameter
- * Namespace URI return value
+ * prefix parameter
+ * Namespace URI return value
*
*
*
@@ -158,15 +153,10 @@ public interface NamespaceContext {
* table describes the returned prefix value for all Namespace URI
* values:
*
- *
+ *
+ * Return value for specified Namespace URIs
*
*
- *
- * {@code getPrefix(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
- *
* Namespace URI parameter
* prefix value returned
*
@@ -230,14 +220,10 @@ public interface NamespaceContext {
* table describes the returned prefixes value for all Namespace
* URI values:
*
- *
+ *
+ * Return value for specified Namespace URIs
*
*
- * {@code
- * getPrefixes(namespaceURI)} return value for
- * specified Namespace URIs
- *
- *
* Namespace URI parameter
* prefixes value returned
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
index e94feaec309..0df399bb5d0 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,21 +64,17 @@ public interface XMLEventWriter extends XMLEventConsumer {
* Add an event to the output stream
* Adding a START_ELEMENT will open a new namespace scope that
* will be closed when the corresponding END_ELEMENT is written.
- *
+ *
+ * Required and optional fields for events added to the writer
*
*
- *
- * Required and optional fields for events added to the writer
- *
- *
- *
- *
- *
* Event Type
* Required Fields
* Optional Fields
* Required Behavior
*
+ *
+ *
*
* START_ELEMENT
* QName name
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
index ce03fc9bdc1..4a25f8fc33e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,22 +36,18 @@ import javax.xml.transform.Source;
* Each property varies in the level of support required by each implementation.
* The level of support required is described in the 'Required' column.
*
- *
+ *
+ * Configuration Parameters
*
*
- *
- * Configuration parameters
- *
- *
- *
- *
- *
* Property Name
* Behavior
* Return type
* Default Value
* Required
*
+ *
+ *
* javax.xml.stream.isValidating Turns on/off implementation specific DTD validation Boolean False No
* javax.xml.stream.isNamespaceAware Turns on/off namespace processing for XML 1.0 support Boolean True True (required) / False (optional)
* javax.xml.stream.isCoalescing Requires the processor to coalesce adjacent character data Boolean False Yes
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
index 17d1945de3e..0203273256c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,22 +36,18 @@ import javax.xml.transform.Result;
* Each property varies in the level of support required by each implementation.
* The level of support required is described in the 'Required' column.
*
- *
+ *
+ * Configuration Parameters
*
*
- *
- * Configuration parameters
- *
- *
- *
- *
- *
* Property Name
* Behavior
* Return type
* Default Value
* Required
*
+ *
+ *
* javax.xml.stream.isRepairingNamespaces defaults prefixes
* on the output side Boolean False Yes
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
index 23322b995db..06c44f9b532 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,19 +71,15 @@ import javax.xml.namespace.QName;
* If a method is called in an invalid state the method will throw a
* java.lang.IllegalStateException.
*
- *
+ *
+ * Valid methods for each state
*
*
- *
- * Valid methods for each state
- *
- *
- *
- *
- *
* Event Type
* Valid Methods
*
+ *
+ *
*
* All States
* getProperty(), hasNext(), require(), close(),
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
index 6fc1722c9a0..1f0a3c34577 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,12 +38,10 @@ import javax.xml.namespace.NamespaceContext;
* Each NAMESPACE
* and ATTRIBUTE must be individually written.
*
- *
+ *
+ * XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour
*
- *
- * XML Namespaces, {@code javax.xml.stream.isRepairingNamespaces} and write method behaviour
- *
- *
+ *
* Method
* {@code isRepairingNamespaces} == true
* {@code isRepairingNamespaces} == false
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html
index 45c2d78faf4..2355a5ad1d8 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/package.html
@@ -1,6 +1,6 @@
-
+
-
-
-
+
javax.xml.transform
@@ -97,7 +93,7 @@ if (tfactory.getFeature(DOMSource.FEATURE) && tfactory.getFeature(Stream
Namespaces
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
index 2bcc73e1be1..aafa5cd844b 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@ import org.xml.sax.SAXParseException;
* may not attempt to recursively invoke the {@code newSchema} method,
* even from the same thread.
*
- *
Schema Language
+ * Schema Language
*
* This spec uses a namespace URI to designate a schema language.
* The following table shows the values defined by this specification.
@@ -84,7 +84,8 @@ import org.xml.sax.SAXParseException;
* validation implemented on this interface necessarily deviate from
* the XML DTD semantics as defined in the XML 1.0.
*
- *
+ *
+ * URIs for Supported Schema languages
*
*
* value
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
index f617d99ae51..051d496415b 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@ public abstract class SchemaFactoryLoader {
* the list of available schema languages.
*
* @throws NullPointerException
- * If the schemaLanguage parameter is null.
+ * If the schemaLanguage parameter is null.
*
* @return null if the callee fails to create one.
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
index bd746b40e84..b71319c8023 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/Validator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -131,12 +131,10 @@ public abstract class Validator {
* This method places the following restrictions on the types of
* the {@link Source}/{@link Result} accepted.
*
- *
+ *
+ * {@code Source} / {@code Result} Accepted
*
*
- * {@code Source} / {@code Result} Accepted
- *
- *
*
* {@link javax.xml.transform.stream.StreamSource}
* {@link javax.xml.transform.sax.SAXSource}
@@ -144,7 +142,7 @@ public abstract class Validator {
* {@link javax.xml.transform.stax.StAXSource}
*
*
- *
+ *
*
* {@code null}
* OK
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html b/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html
index 2dd06b3175e..e50c8334559 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/package.html
@@ -1,6 +1,6 @@
-
+
-
-
-
+
javax.xml.validation
@@ -86,7 +82,7 @@ questions.
process simple (see example below).
- Usage example . The following example demonstrates validating
+ Usage example . The following example demonstrates validating
an XML document with the Validation API (for readability, some exception handling is not shown):
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java
index d7c0a44bf95..8270231254c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,14 +31,18 @@ import org.xml.sax.InputSource;
/**
* {@code XPath} provides access to the XPath evaluation environment and expressions.
+ * The XPath evaluation is affected by the factors described in the following table.
*
- *
- *
+ *
+ *
+ * Evaluation of XPath Expressions
*
*
- * Evaluation of XPath Expressions.
+ * Factor
+ * Behavior
*
*
+ *
*
* context
*
@@ -84,6 +88,7 @@ import org.xml.sax.InputSource;
* Conversion to the return type follows XPath conversion rules.
*
*
+ *
*
*
* An XPath object is not thread-safe and not reentrant.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
index 697745e92d5..b6616685231 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,14 +30,18 @@ import org.xml.sax.InputSource;
/**
* {@code XPathExpression} provides access to compiled XPath expressions.
+ * The XPath evaluation is affected by the factors described in the following table.
*
- *
- *
+ *
+ *
+ * Evaluation of XPath Expressions
*
*
- * Evaluation of XPath Expressions.
+ * Factor
+ * Behavior
*
*
+ *
*
* context
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html
index 585160a726e..839557fde12 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/package.html
@@ -1,8 +1,8 @@
-
+
-
+
This package provides an object-model neutral API for the
evaluation of XPath expressions and access to the evaluation
@@ -36,7 +36,7 @@ environment.
The XPath API supports
XML Path Language (XPath) Version 1.0
-
+
-
+
1. XPath Overview
The XPath language provides a simple, concise syntax for selecting
@@ -69,7 +69,7 @@ stand-alone language, as a single XPath expression can be used to
replace many lines of DOM API code.
-
+
2. XPath Expressions
An XPath expression is composed of a location
@@ -139,11 +139,15 @@ attribute nodes, text nodes, comment nodes, and processing instruction
nodes. The following table gives examples of location paths for each
of these node types:
-
+
+Examples of Location Path
+
-Location Path
-Description
+Location Path
+Description
+
+
/foo/bar/@id
@@ -171,6 +175,7 @@ distinction is made between escaped and non-escaped character data.
<bar> element.
+
Predicates allow for refining the nodes selected by an XPath
@@ -194,7 +199,7 @@ expression, such as:
-
+
3. XPath Data Types
While XPath expressions select nodes in the XML document, the XPath
@@ -207,7 +212,7 @@ following data types:
String
-
+
3.1 QName types
The XPath API defines the following {@link javax.xml.namespace.QName} types to
represent return types of an XPath evaluation:
@@ -236,7 +241,7 @@ of the child text nodes is returned.
The Number return type attempts to coalesce the text
of a node to a double data type.
-
+
3.2 Class types
In addition to the QName types, the XPath API supports the use of Class types
through the XPathExpression.evaluteExpression(...) or
@@ -254,14 +259,14 @@ The XPath data types are mapped to Class types as follows:
Of the subtypes of Number, only Double, Integer and Long are supported.
-
+
3.3 Enum types
Enum types are defined in {@link javax.xml.xpath.XPathEvaluationResult.XPathResultType}
that provide mappings between the QName and Class types above. The result of
evaluating an expression using the XPathExpression.evaluteExpression(...)
or XPath.evaluateExpression(...) methods will be of one of these types.
-
+
4. XPath Context
XPath location paths may be relative to a particular node in the
@@ -278,7 +283,7 @@ document, known as the context. A context consists of:
It is an XML document tree represented as a hierarchy of nodes, a
{@link org.w3c.dom.Node} for example, in the JDK implementation.
-
+
5. Using the XPath API
Consider the following XML document:
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
index 8db99e9a6a1..7b125dedb8e 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Attr.java
@@ -111,7 +111,9 @@ package org.w3c.dom;
* The following table gives some examples of the relations between the
* attribute value in the original document (parsed attribute), the value as
* exposed in the DOM, and the serialization of the value:
- *
+ *
+ * Examples of the Original, Normalized and Serialized Values
+ *
*
* Examples
* Parsed
@@ -119,6 +121,8 @@ package org.w3c.dom;
* Initial Attr.value
* Serialized attribute value
*
+ *
+ *
*
*
* Character reference
@@ -126,7 +130,7 @@ package org.w3c.dom;
* "x²=5"
*
*
- * "x\u00b2=5"
+ * "x²=5"
*
*
* "x²=5"
@@ -180,6 +184,7 @@ package org.w3c.dom;
* Dependent on Implementation and Load Options
* Dependent on Implementation and Load/Save Options
*
+ *
*
* See also the Document Object Model (DOM) Level 3 Core Specification .
*/
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
index ab2d6e4f17e..c489fade718 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Document.java
@@ -353,37 +353,42 @@ public interface Document extends Node {
* instantiate.
* @return A new Element object with the following
* attributes:
- *
+ *
+ * Attributes of the {@code Element} object
+ *
*
* Attribute
* Value
*
+ *
+ *
*
- * Node.nodeName
- *
+ * Node.nodeName
+ *
* qualifiedName
*
*
- * Node.namespaceURI
- *
+ * Node.namespaceURI
+ *
* namespaceURI
*
*
- * Node.prefix
- * prefix, extracted
+ * Node.prefix
+ * prefix, extracted
* from qualifiedName, or null if there is
* no prefix
*
*
- * Node.localName
- * local name, extracted from
+ * Node.localName
+ * local name, extracted from
* qualifiedName
*
*
- * Element.tagName
- *
+ * Element.tagName
+ *
* qualifiedName
*
+ *
*
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
@@ -417,43 +422,48 @@ public interface Document extends Node {
* @param qualifiedName The qualified name of the attribute to
* instantiate.
* @return A new Attr object with the following attributes:
- *
+ *
+ * Attributes of the {@code Attr} object
+ *
*
*
* Attribute
* Value
*
+ *
+ *
*
- * Node.nodeName
- * qualifiedName
+ * Node.nodeName
+ * qualifiedName
*
*
- *
+ *
* Node.namespaceURI
- * namespaceURI
+ * namespaceURI
*
*
- *
+ *
* Node.prefix
- * prefix, extracted from
+ * prefix, extracted from
* qualifiedName, or null if there is no
* prefix
*
*
- * Node.localName
- * local name, extracted from
+ * Node.localName
+ * local name, extracted from
* qualifiedName
*
*
- * Attr.name
- *
+ * Attr.name
+ *
* qualifiedName
*
*
- * Node.nodeValue
- * the empty
+ * Node.nodeValue
+ * the empty
* string
*
+ *
*
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java b/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
index a62ad94d91e..79cbada7935 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/Node.java
@@ -61,104 +61,109 @@ package org.w3c.dom;
* The values of nodeName,
* nodeValue, and attributes vary according to the
* node type as follows:
- *
+ *
+ * Interface table
+ *
*
* Interface
* nodeName
* nodeValue
* attributes
*
+ *
+ *
*
- *
+ *
* Attr
- * same as Attr.name
- * same as
+ * same as Attr.name
+ * same as
* Attr.value
- * null
+ * null
*
*
- * CDATASection
- *
+ * CDATASection
+ *
* "#cdata-section"
- * same as CharacterData.data, the
+ * same as CharacterData.data, the
* content of the CDATA Section
- * null
+ * null
*
*
- * Comment
- *
+ * Comment
+ *
* "#comment"
- * same as CharacterData.data, the
+ * same as CharacterData.data, the
* content of the comment
- * null
+ * null
*
*
- * Document
- *
+ * Document
+ *
* "#document"
- * null
- * null
+ * null
+ * null
*
*
- *
+ *
* DocumentFragment
- * "#document-fragment"
- *
+ * "#document-fragment"
+ *
* null
- * null
+ * null
*
*
- * DocumentType
- * same as
+ * DocumentType
+ * same as
* DocumentType.name
- * null
- * null
+ * null
+ * null
*
*
- *
+ *
* Element
- * same as Element.tagName
- * null
- *
+ * same as Element.tagName
+ * null
+ *
* NamedNodeMap
*
*
- * Entity
- * entity name
- * null
- *
+ * Entity
+ * entity name
+ * null
+ *
* null
*
*
- * EntityReference
- * name of entity referenced
- *
+ * EntityReference
+ * name of entity referenced
+ *
* null
- * null
+ * null
*
*
- * Notation
- * notation name
- *
+ * Notation
+ * notation name
+ *
* null
- * null
+ * null
*
*
- * ProcessingInstruction
- * same
+ * ProcessingInstruction
+ * same
* as ProcessingInstruction.target
- * same as
+ * same as
* ProcessingInstruction.data
- * null
+ * null
*
*
- * Text
- *
+ * Text
+ *
* "#text"
- * same as CharacterData.data, the content
+ * same as CharacterData.data, the content
* of the text node
- * null
+ * null
*
+ *
*
* See also the Document Object Model (DOM) Level 3 Core Specification .
*/
@@ -687,30 +692,35 @@ public interface Node {
* textual content.
* The string returned is made of the text content of this node
* depending on its type, as defined below:
- *
+ *
+ * Node/Content table
+ *
*
* Node type
* Content
*
+ *
+ *
*
- *
+ *
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE
- * concatenation of the textContent
+ * concatenation of the textContent
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.
*
*
- * TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+ * TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE
- * nodeValue
+ * nodeValue
*
*
- * DOCUMENT_NODE,
+ * DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE
- * null
+ * null
*
+ *
*
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
@@ -737,30 +747,35 @@ public interface Node {
* textual content.
* The string returned is made of the text content of this node
* depending on its type, as defined below:
- *
+ *
+ * Node/Content table
+ *
*
* Node type
* Content
*
+ *
+ *
*
- *
+ *
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE
- * concatenation of the textContent
+ * concatenation of the textContent
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.
*
*
- * TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
+ * TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE
- * nodeValue
+ * nodeValue
*
*
- * DOCUMENT_NODE,
+ * DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE
- * null
+ * null
*
+ *
*
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
diff --git a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html
index 83a1a986ae5..c2a59387ee8 100644
--- a/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html
+++ b/jaxp/src/java.xml/share/classes/org/w3c/dom/ranges/package.html
@@ -2,7 +2,7 @@
W3C IPR SOFTWARE NOTICE
-
+
Document Object Model Level 2 Traversal and Range is a
platform and language-neutral interfaces that allow programs
@@ -20,14 +20,14 @@
W3C IPR SOFTWARE NOTICE
-
+
The DOM bindings are published under the W3C Software Copyright Notice
and License. The software license requires "Notice of any changes or
@@ -42,14 +42,14 @@
and License could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720
-
+
Copyright © 1994-2000 World Wide Web
Consortium , (Massachusetts
Institute of Technology , Institut
National de Recherche en Informatique et en Automatique , Keio University ). All Rights
Reserved. http://www.w3.org/Consortium/Legal/
-
+
This W3C work (including software, documents, or other related items) is
being provided by the copyright holders under the following license. By
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/package.html b/jaxp/src/java.xml/share/classes/org/xml/sax/package.html
index 2af5e4cd47d..2c16b87f34c 100644
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/package.html
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/package.html
@@ -24,14 +24,18 @@ Currently defined standard feature URIs have the prefix
setFeature . Those standard identifiers are:
-
-
+
+ SAX2 Standard Features
+
+
Feature ID
Access
Default
Description
-
+
+
+
external-general-entities
read/write
@@ -208,7 +212,7 @@ Currently defined standard feature URIs have the prefix
Returns "false" if the parser supports only XML 1.0.
-
+
Support for the default values of the
@@ -236,11 +240,15 @@ the standard property URIs have the prefix
dom-node. Manage those properties using
setProperty() . Those identifiers are:
-
-
+
+SAX2 Standard Properties
+
+
Property ID
Description
+
+
declaration-handler
@@ -287,7 +295,7 @@ the standard property URIs have the prefix
Readable only during a parser callback, this exposes a TBS
chunk of characters responsible for the current event.
-
+
All of these standard properties are optional;
From 4dbd43322dd2544b2cd9740fe432e628a8b92c9a Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Tue, 16 May 2017 18:23:21 -0700
Subject: [PATCH 04/62] 8180452: Mark ClipCloseLoss.java as failing
intermittently
Reviewed-by: serb
---
jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java
index 24226ddd125..56b046163b0 100644
--- a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java
+++ b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java
@@ -36,6 +36,7 @@ import javax.sound.sampled.Mixer;
* @bug 4946913
* @summary DirectClip doesn't kill the thread correctly, sometimes
* @run main/othervm ClipCloseLoss
+ * @key intermittent
*/
public class ClipCloseLoss {
static int frameCount = 441000; // lets say 10 seconds
From b870098ffdf02af90f7ca66dd408663fe514fb4d Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 17 May 2017 12:42:58 +0200
Subject: [PATCH 05/62] 8180472: Pandoc should generate html5 from markdown
Reviewed-by: erikj
---
common/doc/building.html | 238 ++++++++++++++++----------------
common/doc/testing.html | 23 +--
make/common/ProcessMarkdown.gmk | 4 +-
3 files changed, 135 insertions(+), 130 deletions(-)
diff --git a/common/doc/building.html b/common/doc/building.html
index 9a086783f02..624c3e8e853 100644
--- a/common/doc/building.html
+++ b/common/doc/building.html
@@ -1,21 +1,23 @@
-
-
+
+
-
-
-
+
+
+
OpenJDK Build README
-
+
+
-
-
+
+
+OpenJDK
+
Introduction
This README file contains build instructions for the OpenJDK . Building the source code for the OpenJDK requires a certain degree of technical expertise.
@@ -149,50 +151,50 @@
-developer/solarisstudio-124/backend
-12.4-1.0.6.0
+developer/solarisstudio-124/backend
+12.4-1.0.6.0
-developer/solarisstudio-124/c++
-12.4-1.0.10.0
+developer/solarisstudio-124/c++
+12.4-1.0.10.0
-developer/solarisstudio-124/cc
-12.4-1.0.4.0
+developer/solarisstudio-124/cc
+12.4-1.0.4.0
-developer/solarisstudio-124/library/c++-libs
-12.4-1.0.10.0
+developer/solarisstudio-124/library/c++-libs
+12.4-1.0.10.0
-developer/solarisstudio-124/library/math-libs
-12.4-1.0.0.1
+developer/solarisstudio-124/library/math-libs
+12.4-1.0.0.1
-developer/solarisstudio-124/library/studio-gccrt
-12.4-1.0.0.1
+developer/solarisstudio-124/library/studio-gccrt
+12.4-1.0.0.1
-developer/solarisstudio-124/studio-common
-12.4-1.0.0.1
+developer/solarisstudio-124/studio-common
+12.4-1.0.0.1
-developer/solarisstudio-124/studio-ja
-12.4-1.0.0.1
+developer/solarisstudio-124/studio-ja
+12.4-1.0.0.1
-developer/solarisstudio-124/studio-legal
-12.4-1.0.0.1
+developer/solarisstudio-124/studio-legal
+12.4-1.0.0.1
-developer/solarisstudio-124/studio-zhCN
-12.4-1.0.0.1
+developer/solarisstudio-124/studio-zhCN
+12.4-1.0.0.1
@@ -211,66 +213,66 @@
-ar.exe
-Devel
-binutils
-The GNU assembler, linker and binary utilities
+ar.exe
+Devel
+binutils
+The GNU assembler, linker and binary utilities
-make.exe
-Devel
-make
-The GNU version of the 'make' utility built for CYGWIN
+make.exe
+Devel
+make
+The GNU version of the 'make' utility built for CYGWIN
-m4.exe
-Interpreters
-m4
-GNU implementation of the traditional Unix macro processor
+m4.exe
+Interpreters
+m4
+GNU implementation of the traditional Unix macro processor
-cpio.exe
-Utils
-cpio
-A program to manage archives of files
+cpio.exe
+Utils
+cpio
+A program to manage archives of files
-gawk.exe
-Utils
-awk
-Pattern-directed scanning and processing language
+gawk.exe
+Utils
+awk
+Pattern-directed scanning and processing language
-file.exe
-Utils
-file
-Determines file type using 'magic' numbers
+file.exe
+Utils
+file
+Determines file type using 'magic' numbers
-zip.exe
-Archive
-zip
-Package and compress (archive) files
+zip.exe
+Archive
+zip
+Package and compress (archive) files
-unzip.exe
-Archive
-unzip
-Extract compressed files in a ZIP archive
+unzip.exe
+Archive
+unzip
+Extract compressed files in a ZIP archive
-free.exe
-System
-procps
-Display amount of free and used memory in the system
+free.exe
+System
+procps
+Display amount of free and used memory in the system
@@ -561,14 +563,14 @@ This is caused by a missing libstdc++.a library. This is installed as part of a
This is probably an issue with SELinux (See SELinux on Wikipedia ). Parts of the VM is built without the -fPIC for performance reasons.
To completely disable SELinux:
-
+
$ su root
# system-config-securitylevel
In the window that appears, select the SELinux tab
Disable SELinux
Alternatively, instead of completely disabling it you could disable just this one check.
-
+
Select System->Administration->SELinux Management
In the SELinux Management Tool which appears, select "Boolean" from the menu on the left
Expand the "Memory Protection" group
@@ -616,62 +618,62 @@ Try rebooting the system, or there could be some kind of issue with the disk or
-Linux X86 (32-bit) and X64 (64-bit)
-Oracle Enterprise Linux 6.4
-gcc 4.9.2
-2 or more
-1 GB
-6 GB
+Linux X86 (32-bit) and X64 (64-bit)
+Oracle Enterprise Linux 6.4
+gcc 4.9.2
+2 or more
+1 GB
+6 GB
-Solaris SPARCV9 (64-bit)
-Solaris 11 Update 1
-Studio 12 Update 4 + patches
-4 or more
-4 GB
-8 GB
+Solaris SPARCV9 (64-bit)
+Solaris 11 Update 1
+Studio 12 Update 4 + patches
+4 or more
+4 GB
+8 GB
-Solaris X64 (64-bit)
-Solaris 11 Update 1
-Studio 12 Update 4 + patches
-4 or more
-4 GB
-8 GB
+Solaris X64 (64-bit)
+Solaris 11 Update 1
+Studio 12 Update 4 + patches
+4 or more
+4 GB
+8 GB
-Windows X86 (32-bit)
-Windows Server 2012 R2 x64
-Microsoft Visual Studio C++ 2013 Professional Edition
-2 or more
-2 GB
-6 GB
+Windows X86 (32-bit)
+Windows Server 2012 R2 x64
+Microsoft Visual Studio C++ 2013 Professional Edition
+2 or more
+2 GB
+6 GB
-Windows X64 (64-bit)
-Windows Server 2012 R2 x64
-Microsoft Visual Studio C++ 2013 Professional Edition
-2 or more
-2 GB
-6 GB
+Windows X64 (64-bit)
+Windows Server 2012 R2 x64
+Microsoft Visual Studio C++ 2013 Professional Edition
+2 or more
+2 GB
+6 GB
-Mac OS X X64 (64-bit)
-Mac OS X 10.9 "Mavericks"
-Xcode 6.3 or newer
-2 or more
-4 GB
-6 GB
+Mac OS X X64 (64-bit)
+Mac OS X 10.9 "Mavericks"
+Xcode 6.3 or newer
+2 or more
+4 GB
+6 GB
diff --git a/common/doc/testing.html b/common/doc/testing.html
index 265be8b9e8a..64f635d2306 100644
--- a/common/doc/testing.html
+++ b/common/doc/testing.html
@@ -1,19 +1,22 @@
-
-
+
+
-
-
-
+
+
+
Testing OpenJDK
-
+
+
-
-
+
Using the run-test framework
This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.
Some example command-lines:
diff --git a/make/common/ProcessMarkdown.gmk b/make/common/ProcessMarkdown.gmk
index eec4d0cf060..fe4d30e75cf 100644
--- a/make/common/ProcessMarkdown.gmk
+++ b/make/common/ProcessMarkdown.gmk
@@ -36,7 +36,7 @@ define ProcessMarkdown
ifneq ($$(findstring http:/, $$($1_CSS)), )
$1_$2_CSS_OPTION := --css '$$($1_CSS)'
else
- $1_$2_CSS := $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR))
+ $1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
$1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
endif
endif
@@ -51,7 +51,7 @@ $$($1_$2_OUTPUT_FILE): $$($1_SRC)/$2 $$($1_$2_VARDEPS_FILE)
$$(call LogInfo, Converting $2 to html)
$$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown)
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
- $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \
+ $$(PANDOC) $$($1_OPTIONS) -f markdown -t html5 --standalone \
$$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@')
ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
From daf44b840b27c77c4c3821172292db914298abf2 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 17 May 2017 12:44:12 +0200
Subject: [PATCH 06/62] 8180318: Enable HTML 5 checking at compile time
Reviewed-by: erikj
---
make/CompileJavaModules.gmk | 6 ++++--
make/common/SetupJavaCompilers.gmk | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk
index 73c6a40c822..76bdf22b950 100644
--- a/make/CompileJavaModules.gmk
+++ b/make/CompileJavaModules.gmk
@@ -42,7 +42,8 @@ java.activation_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
################################################################################
-java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline
+java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline \
+ --doclint-format html4
java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
java.base_CLEAN := intrinsic.properties
@@ -95,7 +96,8 @@ java.datatransfer_COPY := flavormap.properties
################################################################################
java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \
- '-Xdoclint/package:java.*,javax.*' -Xlint:exports
+ '-Xdoclint/package:java.*,javax.*' -Xlint:exports \
+ --doclint-format html4
java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
java.desktop_CLEAN := iio-plugin.properties cursors.properties
diff --git a/make/common/SetupJavaCompilers.gmk b/make/common/SetupJavaCompilers.gmk
index 1a80d47fddc..4e7c8eebf19 100644
--- a/make/common/SetupJavaCompilers.gmk
+++ b/make/common/SetupJavaCompilers.gmk
@@ -69,7 +69,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 9 -target 9 \
+ FLAGS := -source 9 -target 9 --doclint-format html5 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
From a99fc645d64cf4f16db2fd690c6d78504e2cd38f Mon Sep 17 00:00:00 2001
From: Sean Mullan
Date: Wed, 17 May 2017 08:51:46 -0400
Subject: [PATCH 07/62] 8180307: Update JDK 9 Required Cipher Algorithms
Reviewed-by: valeriep
---
jdk/src/java.base/share/classes/javax/crypto/Cipher.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
index cf288f5f1da..4068483470c 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
@@ -137,6 +137,7 @@ import sun.security.jca.*;
* {@code AES/CBC/PKCS5Padding} (128)
* {@code AES/ECB/NoPadding} (128)
* {@code AES/ECB/PKCS5Padding} (128)
+ * {@code AES/GCM/NoPadding} (128)
* {@code DES/CBC/NoPadding} (56)
* {@code DES/CBC/PKCS5Padding} (56)
* {@code DES/ECB/NoPadding} (56)
From 374e7bae7a7f22b04e0e093e355ac685be849bef Mon Sep 17 00:00:00 2001
From: Brian Burkhalter
Date: Wed, 17 May 2017 14:29:26 -0700
Subject: [PATCH 08/62] 7086489: File.lastModified should accuracy as well as
resolution
Add an @apiNote indicating that the last-modified time might be of coarser than millisecond granularity.
Reviewed-by: smarks
---
jdk/src/java.base/share/classes/java/io/File.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/jdk/src/java.base/share/classes/java/io/File.java b/jdk/src/java.base/share/classes/java/io/File.java
index 6e77026c6c1..e9959b59acd 100644
--- a/jdk/src/java.base/share/classes/java/io/File.java
+++ b/jdk/src/java.base/share/classes/java/io/File.java
@@ -923,6 +923,12 @@ public class File
* java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
* Files.readAttributes} method may be used.
*
+ * @apiNote
+ * While the unit of time of the return value is milliseconds,
+ * the granularity of the value depends on the underlying
+ * file system and may be larger. For example, some
+ * file systems use time stamps in units of seconds.
+ *
* @return A long value representing the time the file was
* last modified, measured in milliseconds since the epoch
* (00:00:00 GMT, January 1, 1970), or 0L if the
From ca94b73222f5eac7f29ab32923cf19a248d7a727 Mon Sep 17 00:00:00 2001
From: Henry Jen
Date: Wed, 17 May 2017 16:26:23 -0700
Subject: [PATCH 09/62] 8180447: Trailing space in JDK_JAVA_OPTIONS causes an
application fail to launch
Reviewed-by: alanb, mchung, ksrini
---
jdk/src/java.base/share/native/libjli/args.c | 5 +++++
.../java.base/share/native/libjli/emessages.h | 2 +-
jdk/test/tools/launcher/ArgsEnvVar.java | 18 ++++++++++++++++--
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/jdk/src/java.base/share/native/libjli/args.c b/jdk/src/java.base/share/native/libjli/args.c
index adbff674bf9..9eb2317de6c 100644
--- a/jdk/src/java.base/share/native/libjli/args.c
+++ b/jdk/src/java.base/share/native/libjli/args.c
@@ -456,6 +456,11 @@ jboolean JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name) {
env++;
}
+ // Trailing space
+ if (*env == '\0') {
+ break;
+ }
+
arg = p;
while (*env != '\0' && !isspace(*env)) {
if (*env == '"' || *env == '\'') {
diff --git a/jdk/src/java.base/share/native/libjli/emessages.h b/jdk/src/java.base/share/native/libjli/emessages.h
index c5ae8d74b5e..2f94a60bce8 100644
--- a/jdk/src/java.base/share/native/libjli/emessages.h
+++ b/jdk/src/java.base/share/native/libjli/emessages.h
@@ -36,7 +36,7 @@
#define JNI_ERROR "Error: A JNI error has occurred, please check your installation and try again"
#define JNI_ERROR1 "Error: can't find JNI interfaces in: %s"
-#define ARG_INFO_ENVVAR "NOTE: Picked up the following options via %s:\n %s"
+#define ARG_INFO_ENVVAR "NOTE: Picked up %s: %s"
#define ARG_WARN "Warning: %s option is no longer supported."
#define ARG_ERROR1 "Error: %s requires class path specification"
diff --git a/jdk/test/tools/launcher/ArgsEnvVar.java b/jdk/test/tools/launcher/ArgsEnvVar.java
index fe18e1d256c..5dd63c84cb4 100644
--- a/jdk/test/tools/launcher/ArgsEnvVar.java
+++ b/jdk/test/tools/launcher/ArgsEnvVar.java
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8170832
+ * @bug 8170832 8180447
* @summary Arguments passed in environment variable
* @build TestHelper
* @run main ArgsEnvVar
@@ -224,6 +224,21 @@ public class ArgsEnvVar extends TestHelper {
verifyOptions(List.of("-p", "?", "-jar", "test.jar", "one", "two"), tr);
}
+ @Test
+ public void testTrailingSpaces() {
+ env.put(JDK_JAVA_OPTIONS, "--add-exports java.base/jdk.internal.misc=ALL-UNNAMED ");
+ TestResult tr = doExec(env, javaCmd, "-jar", "test.jar");
+ verifyOptions(List.of("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-jar", "test.jar"), tr);
+
+ env.put(JDK_JAVA_OPTIONS, "--class-path ' '");
+ tr = doExec(env, javaCmd, "-jar", "test.jar");
+ verifyOptions(List.of("--class-path", " ", "-jar", "test.jar"), tr);
+
+ env.put(JDK_JAVA_OPTIONS, " --add-exports java.base/jdk.internal.misc=ALL-UNNAMED ");
+ tr = doExec(env, javaCmd, "-jar", "test.jar");
+ verifyOptions(List.of("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED", "-jar", "test.jar"), tr);
+ }
+
public static void main(String... args) throws Exception {
init();
ArgsEnvVar a = new ArgsEnvVar();
@@ -236,4 +251,3 @@ public class ArgsEnvVar extends TestHelper {
}
}
}
-
From c46c14c39b68d6b0bb019443f2802f5d57d6ea66 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Thu, 18 May 2017 09:23:44 +0200
Subject: [PATCH 10/62] 8180426: Use standard css file for new docs bundle
index.html page
Reviewed-by: mchung, erikj
---
.../{specs => }/resources/jdk-default.css | 4 +-
.../build/tools/docs/docs-bundle-page.html | 48 ++++---------------
2 files changed, 11 insertions(+), 41 deletions(-)
rename jdk/make/data/docs-resources/{specs => }/resources/jdk-default.css (95%)
diff --git a/jdk/make/data/docs-resources/specs/resources/jdk-default.css b/jdk/make/data/docs-resources/resources/jdk-default.css
similarity index 95%
rename from jdk/make/data/docs-resources/specs/resources/jdk-default.css
rename to jdk/make/data/docs-resources/resources/jdk-default.css
index eea78ea539d..ee742adeb22 100644
--- a/jdk/make/data/docs-resources/specs/resources/jdk-default.css
+++ b/jdk/make/data/docs-resources/resources/jdk-default.css
@@ -116,11 +116,11 @@ caption {
margin-bottom:10px;
}
-tr:nth-child(even) {
+tr:nth-child(even), tr:nth-child(even) th[scope=row] {
background: #DDD;
}
-tr:nth-child(odd) {
+tr:nth-child(odd), tr:nth-child(odd) th[scope=row] {
background: #FFF;
}
diff --git a/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html b/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html
index 374716bcfde..e309840951d 100644
--- a/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html
+++ b/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html
@@ -27,42 +27,12 @@ questions.
+
+ caption {
+ text-align: center;
+ }
+
@HEADER_TITLE@
@@ -127,10 +97,10 @@ caption {
@JAVA_EE_MODULES@
-
- Outside Java SE
- JDK
- JavaFX
+
+ Outside Java SE
+ JDK
+ JavaFX
Others
From 671a3b797beae8b5497d4da43b03b4bfb2b1c9ab Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Thu, 18 May 2017 09:23:55 +0200
Subject: [PATCH 11/62] 8180426: Use standard css file for new docs bundle
index.html page
Reviewed-by: mchung, erikj
---
make/Docs.gmk | 35 +++++++++++++++++++----------------
make/Main.gmk | 3 ++-
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/make/Docs.gmk b/make/Docs.gmk
index f95a57d376f..077750bec36 100644
--- a/make/Docs.gmk
+++ b/make/Docs.gmk
@@ -163,7 +163,7 @@ JAVASE_JAVADOC_DOC_TITLE := Java™ Platform, Standard Edition \
################################################################################
-JDK_DOCS_INDEX_HTML_TITLE := Java™ Platform, Standard Edition Development Kit \
+JDK_INDEX_TITLE := Java™ Platform, Standard Edition Development Kit \
(JDK™) $(VERSION_SPECIFICATION) Specification $(DRAFT_MARKER_TITLE)
################################################################################
@@ -356,15 +356,27 @@ $(eval $(call SetupApiDocsGeneration, JAVASE_API, \
################################################################################
-JDK_DOCS_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
+JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html
+JDK_INDEX_TOOLS_DIR := $(TOOLS_CLASSES_DIR)/build/tools/docs
-$(JDK_DOCS_INDEX_HTML): $(BUILD_JIGSAW_TOOLS)
+$(JDK_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) \
+ $(JDK_INDEX_TOOLS_DIR)/docs-bundle-page.html \
+ $(JDK_INDEX_TOOLS_DIR)/docs-module-groups.properties
$(call LogInfo, Generating docs bundle index page)
$(MKDIR) -p $(@D)
- $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_DOCS_INDEX_HTML_TITLE)' \
+ $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_INDEX_TITLE)' \
--output $@
-JDK_DOCS_INDEX_HTML_TARGETS := $(JDK_DOCS_INDEX_HTML)
+JDK_INDEX_TARGETS := $(JDK_INDEX_HTML)
+
+# Copy the global resources
+GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/
+$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
+ SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
+ FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
+ DEST := $(DOCS_OUTPUTDIR), \
+))
+JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES)
################################################################################
# Copy JDK specs files
@@ -389,20 +401,11 @@ $(foreach m, $(ALL_MODULES), \
) \
)
-# Copy the global resources
-GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs
-$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \
- SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \
- FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \
- DEST := $(DOCS_OUTPUTDIR)/specs/, \
-))
-JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES)
-
ifeq ($(ENABLE_FULL_DOCS), true)
# For all markdown files in $module/share/specs directories, convert them to
# html.
- GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/specs/resources/jdk-default.css
+ GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css
$(foreach m, $(ALL_MODULES), \
$(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \
@@ -464,7 +467,7 @@ docs-javase-api-modulegraph: $(JAVASE_API_MODULEGRAPH_TARGETS)
docs-jdk-specs: $(JDK_SPECS_TARGETS)
-docs-jdk-index: $(JDK_DOCS_INDEX_HTML_TARGETS)
+docs-jdk-index: $(JDK_INDEX_TARGETS)
docs-zip: $(ZIP_TARGETS)
diff --git a/make/Main.gmk b/make/Main.gmk
index ab6eb7d2e2b..a5e1d8625ce 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -798,7 +798,8 @@ else
docs-javase-api-modulegraph: exploded-image buildtools-modules
# The gensrc steps for hotspot and jdk.jdi create html spec files.
- docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc
+ docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \
+ docs-jdk-index
docs-jdk-index: exploded-image buildtools-modules
From e9c673ae1c084beb2643fd034c7526c77f02045a Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Thu, 18 May 2017 12:00:46 +0200
Subject: [PATCH 12/62] 8180486: extLink taglet needs escaped "&"
Reviewed-by: dholmes
---
jdk/make/src/classes/build/tools/taglet/ExtLink.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/make/src/classes/build/tools/taglet/ExtLink.java b/jdk/make/src/classes/build/tools/taglet/ExtLink.java
index ad042160756..34eaed59f28 100644
--- a/jdk/make/src/classes/build/tools/taglet/ExtLink.java
+++ b/jdk/make/src/classes/build/tools/taglet/ExtLink.java
@@ -56,7 +56,7 @@ public class ExtLink implements Taglet {
static final String TAG_NAME = "extLink";
- static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=";
+ static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase9&id=";
static final Pattern TAG_PATTERN = Pattern.compile("(\\s*)(?\\w+)(\\s+)(?.*)");
From bd4cbecc4bbcd2c694ff30993ee7bf733d959d29 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Thu, 18 May 2017 10:31:46 -0700
Subject: [PATCH 13/62] 8180540: Add pandoc build fix for windows
Reviewed-by: wetmore
---
common/autoconf/spec.gmk.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 247b15070e5..9946fa2b679 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -650,7 +650,7 @@ MKDIR:=@MKDIR@
MV:=@MV@
NAWK:=@NAWK@
NICE:=@NICE@
-PANDOC:=@PANDOC@
+PANDOC:=@FIXPATH@ @PANDOC@
PATCH:=@PATCH@
PRINTF:=@PRINTF@
RM:=@RM@
From 5b681813526ee252bb594015b1c08921b50e0ea2 Mon Sep 17 00:00:00 2001
From: Christian Thalinger
Date: Thu, 18 May 2017 16:39:19 -0700
Subject: [PATCH 14/62] 8180453: [JVMCI] mx eclipseinit doesn't pick up
generated sources
Reviewed-by: kvn
---
hotspot/.mx.jvmci/mx_jvmci.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/hotspot/.mx.jvmci/mx_jvmci.py b/hotspot/.mx.jvmci/mx_jvmci.py
index b87bab712a2..37a9baff97e 100644
--- a/hotspot/.mx.jvmci/mx_jvmci.py
+++ b/hotspot/.mx.jvmci/mx_jvmci.py
@@ -303,9 +303,9 @@ class HotSpotProject(mx.NativeProject):
out.close('link')
out.open('link')
- out.element('name', data='generated')
+ out.element('name', data='gensrc')
out.element('type', data='2')
- generated = join(_get_hotspot_build_dir(jvmVariant, debugLevel), 'generated')
+ generated = join(_get_hotspot_build_dir(jvmVariant, debugLevel), 'gensrc')
out.element('locationURI', data=mx.get_eclipse_project_rel_locationURI(generated, eclProjectDir))
out.close('link')
@@ -620,18 +620,12 @@ _jvmci_bootclasspath_prepends = []
def _get_hotspot_build_dir(jvmVariant=None, debugLevel=None):
"""
Gets the directory in which a particular HotSpot configuration is built
- (e.g., /build/macosx-x86_64-normal-server-release/hotspot/bsd_amd64_compiler2)
+ (e.g., /build/macosx-x86_64-normal-server-release/hotspot/variant-)
"""
if jvmVariant is None:
jvmVariant = _vm.jvmVariant
- os = mx.get_os()
- if os == 'darwin':
- os = 'bsd'
- arch = mx.get_arch()
- buildname = {'client': 'compiler1', 'server': 'compiler2'}.get(jvmVariant, jvmVariant)
-
- name = '{}_{}_{}'.format(os, arch, buildname)
+ name = 'variant-{}'.format(jvmVariant)
return join(_get_jdk_build_dir(debugLevel=debugLevel), 'hotspot', name)
class JVMCI9JDKConfig(mx.JDKConfig):
From 8ff6b30d2826b888927e9afe83929c686cfc20da Mon Sep 17 00:00:00 2001
From: Ujwal Vangapally
Date: Fri, 19 May 2017 15:27:25 +0530
Subject: [PATCH 15/62] 8175845: Provide javadoc descriptions for
jdk.hotspot.agent module
Added description for jdk.hotspot.agent module
Reviewed-by: mchung
---
make/common/Modules.gmk | 1 +
1 file changed, 1 insertion(+)
diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk
index 7477013efd5..8158d7166d2 100644
--- a/make/common/Modules.gmk
+++ b/make/common/Modules.gmk
@@ -151,6 +151,7 @@ DOCS_MODULES += \
jdk.crypto.ec \
jdk.dynalink \
jdk.editpad \
+ jdk.hotspot.agent \
jdk.httpserver \
jdk.incubator.httpclient \
jdk.jartool \
From 85e6ed587846e1b58a006f099572757ca016f866 Mon Sep 17 00:00:00 2001
From: Ujwal Vangapally
Date: Fri, 19 May 2017 15:32:17 +0530
Subject: [PATCH 16/62] 8175845: Provide javadoc descriptions for
jdk.hotspot.agent module
Added description for jdk.hotspot.agent module
Reviewed-by: mchung
---
.../src/jdk.hotspot.agent/share/classes/module-info.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
index dbf9587b307..a5308d46ea2 100644
--- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,12 @@
* questions.
*/
+/**
+ * Defines the implementation of the HotSpot Serviceability Agent.
+ *
+ * @moduleGraph
+ * @since 9
+ */
module jdk.hotspot.agent {
requires java.datatransfer;
requires java.desktop;
From 3e4d9a51329609523027880f235003b3d9cf268a Mon Sep 17 00:00:00 2001
From: Brent Christian
Date: Fri, 19 May 2017 09:41:28 -0700
Subject: [PATCH 17/62] 8180633: Remove intermittent key from
java/lang/ClassLoader/Assert.java
Reviewed-by: darcy, mchung
---
jdk/test/java/lang/ClassLoader/Assert.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/test/java/lang/ClassLoader/Assert.java b/jdk/test/java/lang/ClassLoader/Assert.java
index 57b6febedb2..fb2376d45d4 100644
--- a/jdk/test/java/lang/ClassLoader/Assert.java
+++ b/jdk/test/java/lang/ClassLoader/Assert.java
@@ -28,7 +28,7 @@
* @run main/othervm Assert
* @summary Test the assertion facility
* @author Mike McCloskey
- * @key randomness intermittent
+ * @key randomness
*/
import package1.*;
From 448c3c6d9abcb4d65f586822adc940536f545ca2 Mon Sep 17 00:00:00 2001
From: Thomas Stuefe
Date: Sun, 21 May 2017 10:52:36 +0200
Subject: [PATCH 18/62] 8180424: Another build issue on AIX after 8034174
Reviewed-by: clanger, vtewari
---
jdk/src/java.base/aix/native/libnet/aix_close.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/jdk/src/java.base/aix/native/libnet/aix_close.c b/jdk/src/java.base/aix/native/libnet/aix_close.c
index 1588d485640..51bf81f1d21 100644
--- a/jdk/src/java.base/aix/native/libnet/aix_close.c
+++ b/jdk/src/java.base/aix/native/libnet/aix_close.c
@@ -419,10 +419,8 @@ int NET_ReadV(int s, const struct iovec * vector, int count) {
}
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
- struct sockaddr *from, int *fromlen) {
- socklen_t socklen = *fromlen;
- BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, &socklen) );
- *fromlen = socklen;
+ struct sockaddr *from, socklen_t *fromlen) {
+ BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) );
}
int NET_Send(int s, void *msg, int len, unsigned int flags) {
@@ -438,10 +436,8 @@ int NET_SendTo(int s, const void *msg, int len, unsigned int
BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) );
}
-int NET_Accept(int s, struct sockaddr *addr, int *addrlen) {
- socklen_t socklen = *addrlen;
- BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen) );
- *addrlen = socklen;
+int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen) {
+ BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) );
}
int NET_Connect(int s, struct sockaddr *addr, int addrlen) {
From bbe61a3c5d126a534f68855f7df8d77616070669 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann
Date: Mon, 22 May 2017 09:14:10 +0200
Subject: [PATCH 19/62] 8180565: Null pointer dereferences of
ConstMethod::method()
We need to check ConstMethod::method() for NULL before dereferencing.
Reviewed-by: kvn, iignatyev
---
hotspot/src/share/vm/oops/constMethod.cpp | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp
index 34fe9f9e8be..c26fe2d0904 100644
--- a/hotspot/src/share/vm/oops/constMethod.cpp
+++ b/hotspot/src/share/vm/oops/constMethod.cpp
@@ -407,8 +407,12 @@ void ConstMethod::print_on(outputStream* st) const {
ResourceMark rm;
assert(is_constMethod(), "must be constMethod");
st->print_cr("%s", internal_name());
- st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method()));
- method()->print_value_on(st); st->cr();
+ Method* m = method();
+ st->print(" - method: " INTPTR_FORMAT " ", p2i((address)m));
+ if (m != NULL) {
+ m->print_value_on(st);
+ }
+ st->cr();
if (has_stackmap_table()) {
st->print(" - stackmap data: ");
stackmap_data()->print_value_on(st);
@@ -421,7 +425,12 @@ void ConstMethod::print_on(outputStream* st) const {
void ConstMethod::print_value_on(outputStream* st) const {
assert(is_constMethod(), "must be constMethod");
st->print(" const part of method " );
- method()->print_value_on(st);
+ Method* m = method();
+ if (m != NULL) {
+ m->print_value_on(st);
+ } else {
+ st->print("NULL");
+ }
}
#if INCLUDE_SERVICES
@@ -461,7 +470,7 @@ void ConstMethod::verify_on(outputStream* st) {
// Verification can occur during oop construction before the method or
// other fields have been initialized.
- guarantee(method()->is_method(), "should be method");
+ guarantee(method() != NULL && method()->is_method(), "should be method");
address m_end = (address)((intptr_t) this + size());
address compressed_table_start = code_end();
From 66fb50e7a242833b6f15f43e97989d3267384827 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann
Date: Mon, 22 May 2017 09:16:46 +0200
Subject: [PATCH 20/62] 8180617: Null pointer dereference in
InitializeNode::complete_stores
Fixed a missing null check on the return value of InitializeNode::allocation() found by Parfait.
Reviewed-by: zmajo
---
hotspot/src/share/vm/opto/memnode.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index ca1405f0e51..a797bdf6370 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -3947,9 +3947,10 @@ Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
// if it is the last unused 4 bytes of an instance, forget about it
intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
if (zeroes_done + BytesPerLong >= size_limit) {
- assert(allocation() != NULL, "");
- if (allocation()->Opcode() == Op_Allocate) {
- Node* klass_node = allocation()->in(AllocateNode::KlassNode);
+ AllocateNode* alloc = allocation();
+ assert(alloc != NULL, "must be present");
+ if (alloc != NULL && alloc->Opcode() == Op_Allocate) {
+ Node* klass_node = alloc->in(AllocateNode::KlassNode);
ciKlass* k = phase->type(klass_node)->is_klassptr()->klass();
if (zeroes_done == k->layout_helper())
zeroes_done = size_limit;
From 1d1141fbdf6224717c7737ce3b2c103aac1332cf Mon Sep 17 00:00:00 2001
From: Tobias Hartmann
Date: Mon, 22 May 2017 09:17:32 +0200
Subject: [PATCH 21/62] 8180511: Null pointer dereference in
Matcher::ReduceInst()
Fixed a missing null check on the return value of MachNodeGenerator() found by Parfait.
Reviewed-by: kvn
---
hotspot/src/share/vm/opto/matcher.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp
index 698b0bae068..ee66e901cae 100644
--- a/hotspot/src/share/vm/opto/matcher.cpp
+++ b/hotspot/src/share/vm/opto/matcher.cpp
@@ -1645,6 +1645,7 @@ MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
// Build the object to represent this state & prepare for recursive calls
MachNode *mach = s->MachNodeGenerator(rule);
+ guarantee(mach != NULL, "Missing MachNode");
mach->_opnds[0] = s->MachOperGenerator(_reduceOp[rule]);
assert( mach->_opnds[0] != NULL, "Missing result operand" );
Node *leaf = s->_leaf;
From 4b93f117389dc3fd9a1970f74bcfecb69dff92e5 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann
Date: Mon, 22 May 2017 09:18:12 +0200
Subject: [PATCH 22/62] 8180576: Null pointer dereference in Matcher::xform()
Fixed a missing null check on n->in(0) found by Parfait.
Reviewed-by: kvn
---
hotspot/src/share/vm/opto/matcher.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp
index ee66e901cae..f58bc97cfc9 100644
--- a/hotspot/src/share/vm/opto/matcher.cpp
+++ b/hotspot/src/share/vm/opto/matcher.cpp
@@ -1000,7 +1000,7 @@ Node *Matcher::xform( Node *n, int max_stack ) {
if (C->failing()) return NULL;
if (m == NULL) { Matcher::soft_match_failure(); return NULL; }
} else { // Nothing the matcher cares about
- if( n->is_Proj() && n->in(0)->is_Multi()) { // Projections?
+ if (n->is_Proj() && n->in(0) != NULL && n->in(0)->is_Multi()) { // Projections?
// Convert to machine-dependent projection
m = n->in(0)->as_Multi()->match( n->as_Proj(), this );
#ifdef ASSERT
From d3baf3411822afdecc381f9d5a5f3031d0aac5b8 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann
Date: Mon, 22 May 2017 09:23:59 +0200
Subject: [PATCH 23/62] 8180575: Null pointer dereference in
LoadNode::Identity()
Fixed a missing null check on the return value of AddPNode::Ideal_base_and_offset() found by Parfait.
Reviewed-by: kvn
---
hotspot/src/share/vm/opto/memnode.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index a797bdf6370..f028f3f14e8 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -1123,6 +1123,9 @@ Node* LoadNode::Identity(PhaseGVN* phase) {
// Use _idx of address base (could be Phi node) for boxed values.
intptr_t ignore = 0;
Node* base = AddPNode::Ideal_base_and_offset(in(Address), phase, ignore);
+ if (base == NULL) {
+ return this;
+ }
this_iid = base->_idx;
}
const Type* this_type = bottom_type();
From 1d389cce1ce483de88558158cc08381ba7c2134b Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Mon, 22 May 2017 09:47:31 +0200
Subject: [PATCH 24/62] 8180480: Use "requires transitive" relationship when
determining modules for javadoc
Reviewed-by: mchung, erikj
---
make/Docs.gmk | 12 +++++------
make/common/Modules.gmk | 46 +++++++++++++++++++++++++++++++++++------
2 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/make/Docs.gmk b/make/Docs.gmk
index 077750bec36..06237cbba63 100644
--- a/make/Docs.gmk
+++ b/make/Docs.gmk
@@ -55,7 +55,6 @@ COPYRIGHT_URL := {@docroot}/../legal/cpyr.html
LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html
REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html
-
# In order to get a specific ordering it's necessary to specify the total
# ordering of tags as the tags are otherwise ordered in order of definition.
JAVADOC_TAGS := \
@@ -211,10 +210,10 @@ endef
SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
define SetupApiDocsGenerationBody
- # Figure out all modules, both specified and transitive, that will be processed
- # by javadoc.
- $1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES))
- $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES))
+ # Figure out all modules, both specified and transitive indirect exports, that
+ # will be processed by javadoc.
+ $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES))
+ $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS))
ifeq ($$(ENABLE_FULL_DOCS), true)
# Tell the ModuleGraph taglet to generate html links to soon-to-be-created
@@ -334,7 +333,8 @@ $(eval $(call SetupApiDocsGeneration, JDK_API, \
################################################################################
# Setup generation of the Java SE API documentation (javadoc + modulegraph)
-# The Java SE module scope is just java.se.ee and it's transitive modules.
+# The Java SE module scope is just java.se.ee and it's transitive indirect
+# exports.
JAVASE_JAVADOC_MODULES := java.se.ee
JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk
index 8158d7166d2..d65adcd6aef 100644
--- a/make/common/Modules.gmk
+++ b/make/common/Modules.gmk
@@ -299,7 +299,8 @@ GetModuleSrcPath = \
$(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS))))
################################################################################
-# Extract module dependencies from module-info.java files.
+# Extract module dependencies from module-info.java files, both normal
+# dependencies ("requires"), and indirect exports ("requires transitive").
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
@@ -321,17 +322,31 @@ $(MODULE_DEPS_MAKEFILE): $(MODULE_INFOS) \
gsub(/^ +\*.*/, ""); \
gsub(/ /, ""); \
printf(" %s", $$0) } \
+ END { printf("\n") }' $m && \
+ $(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \
+ $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\
+ BEGIN { if (MODULE != "java.base") printf(" java.base"); } \
+ /^ *requires *transitive/ { \
+ sub(/;/, ""); \
+ sub(/requires/, ""); \
+ sub(/transitive/, ""); \
+ sub(/\/\/.*/, ""); \
+ sub(/\/\*.*\*\//, ""); \
+ gsub(/^ +\*.*/, ""); \
+ gsub(/ /, ""); \
+ printf(" %s", $$0) } \
END { printf("\n") }' $m \
) >> $@ $(NEWLINE))
-include $(MODULE_DEPS_MAKEFILE)
-# Param 1: Module to find deps for
+# Find dependencies ("requires") for a given module.
+# Param 1: Module to find dependencies for.
FindDepsForModule = \
$(DEPS_$(strip $1))
-# Finds transitive dependencies in 3 levels.
-# Param 1: Module to find transitive deps for
+# Find dependencies ("requires") transitively in 3 levels for a given module.
+# Param 1: Module to find dependencies for.
FindTransitiveDepsForModule = \
$(sort $(call FindDepsForModule, $1) \
$(foreach m, $(call FindDepsForModule, $1), \
@@ -339,11 +354,30 @@ FindTransitiveDepsForModule = \
$(foreach n, $(call FindDepsForModule, $m), \
$(call FindDepsForModule, $n))))
-# Finds transitive dependencies in 3 levels for a set of modules.
-# Param 1: List of modules to find transitive deps for
+# Find dependencies ("requires") transitively in 3 levels for a set of modules.
+# Param 1: List of modules to find dependencies for.
FindTransitiveDepsForModules = \
$(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m)))
+# Find indirect exported modules ("requires transitive") for a given module .
+# Param 1: Module to find indirect exported modules for.
+FindIndirectExportsForModule = \
+ $(TRANSITIVE_MODULES_$(strip $1))
+
+# Finds indirect exported modules transitively in 3 levels for a given module.
+# Param 1: Module to find indirect exported modules for.
+FindTransitiveIndirectDepsForModule = \
+ $(sort $(call FindIndirectExportsForModule, $1) \
+ $(foreach m, $(call FindIndirectExportsForModule, $1), \
+ $(call FindIndirectExportsForModule, $m) \
+ $(foreach n, $(call FindIndirectExportsForModule, $m), \
+ $(call FindIndirectExportsForModule, $n))))
+
+# Finds indirect exported modules transitively in 3 levels for a set of modules.
+# Param 1: List of modules to find indirect exported modules for.
+FindTransitiveIndirectDepsForModules = \
+ $(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m)))
+
# Upgradeable modules are those that are either defined as upgradeable or that
# require an upradeable module.
FindAllUpgradeableModules = \
From 92ce20762887f4b55fed33f38773315c07e0d84b Mon Sep 17 00:00:00 2001
From: Michael McMahon
Date: Mon, 22 May 2017 17:31:07 +0100
Subject: [PATCH 25/62] 8180498: Remove httpclient internal APIs which supply
ByteBuffers to read calls
Reviewed-by: chegar, dfuchs
---
.../incubator/http/AsyncSSLConnection.java | 7 +----
.../classes/jdk/incubator/http/Exchange.java | 15 ----------
.../jdk/incubator/http/Http1Exchange.java | 12 +++++---
.../jdk/incubator/http/Http1Response.java | 30 +++++++++++--------
.../jdk/incubator/http/HttpConnection.java | 12 ++------
.../incubator/http/PlainHttpConnection.java | 3 +-
.../http/PlainTunnelingConnection.java | 5 ----
.../jdk/incubator/http/ResponseContent.java | 21 +++----------
.../jdk/incubator/http/ResponseHeaders.java | 20 +++++++++----
.../jdk/incubator/http/SSLConnection.java | 22 ++++----------
.../jdk/incubator/http/SSLDelegate.java | 6 ++--
.../incubator/http/SSLTunnelConnection.java | 15 ++--------
.../incubator/http/ResponseHeadersTest.java | 6 +---
13 files changed, 60 insertions(+), 114 deletions(-)
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java
index 03defd78868..9b7b3875f69 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/AsyncSSLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -189,11 +189,6 @@ class AsyncSSLConnection extends HttpConnection
throw new UnsupportedOperationException("Not supported.");
}
- @Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- throw new UnsupportedOperationException("Not supported.");
- }
-
@Override
CompletableFuture whenReceivingResponse() {
throw new UnsupportedOperationException("Not supported.");
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java
index dc1eece9534..f998c3a4127 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Exchange.java
@@ -33,7 +33,6 @@ import java.net.SocketPermission;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLPermission;
-import java.nio.ByteBuffer;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -76,9 +75,6 @@ final class Exchange {
boolean upgrading; // to HTTP/2
final PushGroup,T> pushGroup;
- // buffer for receiving response headers
- private volatile ByteBuffer rxBuffer;
-
Exchange(HttpRequestImpl request, MultiExchange,T> multi) {
this.request = request;
this.upgrading = false;
@@ -121,17 +117,6 @@ final class Exchange {
return client;
}
- ByteBuffer getBuffer() {
- if(rxBuffer == null) {
- synchronized (this) {
- if(rxBuffer == null) {
- rxBuffer = Utils.getExchangeBuffer();
- }
- }
- }
- return rxBuffer;
- }
-
public Response response() throws IOException, InterruptedException {
return responseImpl(null);
}
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java
index a1c20b35399..8057596bed3 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Exchange.java
@@ -55,7 +55,7 @@ class Http1Exchange extends ExchangeImpl {
final HttpConnection connection;
final HttpClientImpl client;
final Executor executor;
- final ByteBuffer buffer; // used for receiving
+ volatile ByteBuffer buffer; // used for receiving
@Override
public String toString() {
@@ -74,7 +74,7 @@ class Http1Exchange extends ExchangeImpl {
this.client = exchange.client();
this.executor = exchange.executor();
this.operations = new LinkedList<>();
- this.buffer = exchange.getBuffer();
+ this.buffer = Utils.EMPTY_BYTEBUFFER;
if (connection != null) {
this.connection = connection;
} else {
@@ -157,7 +157,9 @@ class Http1Exchange extends ExchangeImpl {
try {
response = new Http1Response<>(connection, this);
response.readHeaders();
- return response.response();
+ Response r = response.response();
+ buffer = response.getBuffer();
+ return r;
} catch (Throwable t) {
connection.close();
throw t;
@@ -213,7 +215,9 @@ class Http1Exchange extends ExchangeImpl {
return MinimalFuture.supply( () -> {
response = new Http1Response<>(connection, Http1Exchange.this);
response.readHeaders();
- return response.response();
+ Response r = response.response();
+ buffer = response.getBuffer();
+ return r;
}, executor);
}
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java
index ea36bb7a723..92ce50c28bf 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/Http1Response.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@ class Http1Response {
private final HttpConnection connection;
private ResponseHeaders headers;
private int responseCode;
- private final ByteBuffer buffer; // same buffer used for reading status line and headers
+ private ByteBuffer buffer;
private final Http1Exchange exchange;
private final boolean redirecting; // redirecting
private boolean return2Cache; // return connection to cache when finished
@@ -96,6 +96,10 @@ class Http1Response {
return finished;
}
+ ByteBuffer getBuffer() {
+ return buffer;
+ }
+
int fixupContentLen(int clen) {
if (request.method().equalsIgnoreCase("HEAD")) {
return 0;
@@ -194,12 +198,15 @@ class Http1Response {
static final char CR = '\r';
static final char LF = '\n';
- private int getBuffer() throws IOException {
+ private int obtainBuffer() throws IOException {
int n = buffer.remaining();
if (n == 0) {
- buffer.clear();
- return connection.read(buffer);
+ buffer = connection.read();
+ if (buffer == null) {
+ return -1;
+ }
+ n = buffer.remaining();
}
return n;
}
@@ -207,18 +214,17 @@ class Http1Response {
String readStatusLine() throws IOException {
boolean cr = false;
StringBuilder statusLine = new StringBuilder(128);
- ByteBuffer b = buffer;
- while (getBuffer() != -1) {
- byte[] buf = b.array();
- int offset = b.position();
- int len = b.limit() - offset;
+ while ((obtainBuffer()) != -1) {
+ byte[] buf = buffer.array();
+ int offset = buffer.position();
+ int len = buffer.limit() - offset;
for (int i = 0; i < len; i++) {
char c = (char) buf[i+offset];
if (cr) {
if (c == LF) {
- b.position(i + 1 + offset);
+ buffer.position(i + 1 + offset);
return statusLine.toString();
} else {
throw new IOException("invalid status line");
@@ -231,7 +237,7 @@ class Http1Response {
}
}
// unlikely, but possible, that multiple reads required
- b.position(b.limit());
+ buffer.position(buffer.limit());
}
return null;
}
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java
index 2e9b3d9c34e..96bd67f969e 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -323,12 +323,9 @@ abstract class HttpConnection implements Closeable {
}
}
- final int read(ByteBuffer buffer) throws IOException {
- return readImpl(buffer);
- }
-
final ByteBuffer read() throws IOException {
- return readImpl();
+ ByteBuffer b = readImpl();
+ return b;
}
/*
@@ -337,9 +334,6 @@ abstract class HttpConnection implements Closeable {
*/
protected abstract ByteBuffer readImpl() throws IOException;
- /** Reads as much as possible into given buffer and returns amount read. */
- protected abstract int readImpl(ByteBuffer buffer) throws IOException;
-
@Override
public String toString() {
return "HttpConnection: " + channel().toString();
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java
index 3527d993970..7bb69850c83 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainHttpConnection.java
@@ -311,8 +311,7 @@ class PlainHttpConnection extends HttpConnection implements AsyncConnection {
}
}
- @Override
- protected int readImpl(ByteBuffer buf) throws IOException {
+ private int readImpl(ByteBuffer buf) throws IOException {
int mark = buf.position();
int n;
// FIXME: this hack works in conjunction with the corresponding change
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java
index 10549315a3d..d133df1e250 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PlainTunnelingConnection.java
@@ -156,11 +156,6 @@ class PlainTunnelingConnection extends HttpConnection {
return delegate.readImpl();
}
- @Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- return delegate.readImpl(buffer);
- }
-
@Override
boolean isSecure() {
return false;
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java
index e6a364add48..7641dcc3134 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -148,11 +148,7 @@ class ResponseContent {
// make sure we have at least 1 byte to look at
private void getHunk() throws IOException {
if (chunkbuf == null || !chunkbuf.hasRemaining()) {
- if (chunkbuf == null) {
- chunkbuf = Utils.getBuffer();
- }
- chunkbuf.clear();
- connection.read(chunkbuf);
+ chunkbuf = connection.read();
}
}
@@ -256,7 +252,6 @@ class ResponseContent {
private void pushBodyFixed(ByteBuffer b) throws IOException {
int remaining = contentLength;
- //lastBufferUsed = b;
while (b.hasRemaining() && remaining > 0) {
ByteBuffer buffer = Utils.getBuffer();
int amount = Math.min(b.remaining(), remaining);
@@ -265,22 +260,14 @@ class ResponseContent {
buffer.flip();
dataConsumer.accept(Optional.of(buffer));
}
- //client.returnBuffer(b);
while (remaining > 0) {
- ByteBuffer buffer = Utils.getBuffer();
- int xx = connection.read(buffer);
- if (xx == -1)
+ ByteBuffer buffer = connection.read();
+ if (buffer == null)
throw new IOException("connection closed");
int bytesread = buffer.remaining();
// assume for now that pipelining not implemented
if (bytesread > remaining) {
- System.err.println("xx = " + xx);
- System.err.println("bytesread = " + bytesread);
- System.err.println("remaining = " + remaining);
- for (int i=0; i> map) {
+ map.forEach((k,v) -> {
+ System.out.print (k + ": ");
+ for (String val : v) {
+ System.out.print(val + ", ");
+ }
+ System.out.println("");
+ });
+ }
+
private Map> parse(InputStreamWrapper input)
throws IOException
{
@@ -114,7 +123,6 @@ final class ResponseHeaders implements HttpHeaders {
// finds is CR. This only happens if there are no headers, and
// only one byte will be consumed from the buffer. In this case
// the next byte MUST be LF
- //System.err.println("Last character read is: " + (byte)lastRead);
if (input.read() != LF) {
throw new IOException("Unexpected byte sequence when no headers: "
+ ((int)CR) + " " + input.lastRead
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java
index 2a5be4f2b85..3af29097cdd 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -162,10 +162,11 @@ class SSLConnection extends HttpConnection {
@Override
protected ByteBuffer readImpl() throws IOException {
- ByteBuffer dst = ByteBuffer.allocate(8192);
- int n = readImpl(dst);
+ WrapperResult r = sslDelegate.recvData(ByteBuffer.allocate(8192));
+ // TODO: check for closure
+ int n = r.result.bytesProduced();
if (n > 0) {
- return dst;
+ return r.buf;
} else if (n == 0) {
return Utils.EMPTY_BYTEBUFFER;
} else {
@@ -173,19 +174,6 @@ class SSLConnection extends HttpConnection {
}
}
- @Override
- protected int readImpl(ByteBuffer buf) throws IOException {
- // TODO: need to ensure that buf is big enough for application data
- WrapperResult r = sslDelegate.recvData(buf);
- // TODO: check for closure
- String s = "Receive) ";
- //debugPrint(s, r.buf);
- if (r.result.bytesProduced() > 0) {
- assert buf == r.buf;
- }
- return r.result.bytesProduced();
- }
-
@Override
boolean connected() {
return delegate.connected();
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java
index 019e80deab2..ec0f4d0e00f 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLDelegate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -104,9 +104,7 @@ class SSLDelegate {
}
SSLEngineResult result;
- /* if passed in buffer was not big enough then the a reallocated buffer
- * is returned here */
- ByteBuffer buf;
+ ByteBuffer buf; // buffer containing result data
}
int app_buf_size;
diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java
index 456cf7a2acb..511aa2aa12f 100644
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/SSLTunnelConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -164,19 +164,10 @@ class SSLTunnelConnection extends HttpConnection {
@Override
protected ByteBuffer readImpl() throws IOException {
- return sslDelegate.recvData(Utils.EMPTY_BYTEBUFFER).buf; // fix this, make the read normal
- }
+ ByteBuffer buf = Utils.getBuffer();
- @Override
- protected int readImpl(ByteBuffer buf) throws IOException {
WrapperResult r = sslDelegate.recvData(buf);
- // TODO: check for closure
- String s = "Receive) ";
- //debugPrint(s, r.buf);
- if (r.result.bytesProduced() > 0) {
- assert buf == r.buf;
- }
- return r.result.bytesProduced();
+ return r.buf;
}
@Override
diff --git a/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ResponseHeadersTest.java b/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ResponseHeadersTest.java
index 91a05f91d73..bf2c6d751e6 100644
--- a/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ResponseHeadersTest.java
+++ b/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ResponseHeadersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -214,10 +214,6 @@ public class ResponseHeadersTest {
protected ByteBuffer readImpl() throws IOException {
throw new AssertionError("Bad test assumption: should not have reached here!");
}
- @Override
- protected int readImpl(ByteBuffer buffer) throws IOException {
- throw new AssertionError("Bad test assumption: should not have reached here!");
- }
}
public static HttpHeaders createResponseHeaders(ByteBuffer buffer)
From 20eec3c5a86934dba30318befcbfdcb96b1c22c2 Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Mon, 22 May 2017 11:08:26 -0700
Subject: [PATCH 26/62] 8180717: Upgrade the docs bundle index page
Reviewed-by: jjg, ihse
---
.../build/tools/docs/GenDocsBundlePage.java | 149 ++++++++++++------
.../build/tools/docs/docs-bundle-page.html | 139 +++++++++++-----
.../tools/docs/docs-module-groups.properties | 83 +++++-----
3 files changed, 249 insertions(+), 122 deletions(-)
diff --git a/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java b/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java
index 3b73067568f..ef1eb433279 100644
--- a/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java
+++ b/jdk/make/src/classes/build/tools/docs/GenDocsBundlePage.java
@@ -31,18 +31,23 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
+import java.lang.module.ModuleReference;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.stream.Collectors;
+import java.util.function.Predicate;
import java.util.stream.Stream;
+import static java.util.stream.Collectors.*;
/**
* Build tool to generate the docs bundle index page.
@@ -104,59 +109,33 @@ public class GenDocsBundlePage {
}
private static final String HEADER_TITLE = "@HEADER_TITLE@";
+
+
final Path outputfile;
final String title;
- final Map moduleGroups;
-
+ final Map> moduleGroups = new HashMap<>();
GenDocsBundlePage(String title, Path outputfile) throws IOException
{
this.outputfile = outputfile;
this.title = title;
- this.moduleGroups = moduleGroups();
- }
- static Map moduleGroups() throws IOException {
+ // read module groups
ModuleFinder finder = ModuleFinder.ofSystem();
- Map groups = new HashMap<>();
try (InputStream in = GenDocsBundlePage.class.getResourceAsStream(MODULE_GROUPS_PROPS)) {
Properties props = new Properties();
props.load(in);
for (String key: props.stringPropertyNames()) {
- Set mods = Stream.of(props.getProperty(key).split("\\s+"))
- .filter(mn -> finder.find(mn).isPresent())
- .map(String::trim)
- .collect(Collectors.toSet());
+ Set mods =
+ Stream.of(props.getProperty(key).split("\\s+"))
+ .map(String::trim)
+ .flatMap(mn -> finder.find(mn).stream())
+ .map(ModuleReference::descriptor)
+ .collect(toSet());
- // divide into 3 columns: Java SE, JDK, JavaFX
- StringBuilder sb = new StringBuilder();
- sb.append(mods.stream()
- .filter(mn -> mn.startsWith("java."))
- .sorted()
- .map(GenDocsBundlePage::toHRef)
- .collect(Collectors.joining("\n")));
- sb.append("\n")
- .append(mods.stream()
- .filter(mn -> mn.startsWith("jdk."))
- .sorted()
- .map(GenDocsBundlePage::toHRef)
- .collect(Collectors.joining("\n")));
- sb.append(" \n");
- if (mods.stream().anyMatch(mn -> mn.startsWith("javafx."))) {
- sb.append(mods.stream()
- .filter(mn -> mn.startsWith("javafx."))
- .sorted()
- .map(GenDocsBundlePage::toHRef)
- .collect(Collectors.joining("\n")));
- }
String name = "@" + key.toUpperCase(Locale.ENGLISH) + "@";
- groups.put(name, sb.toString());
- }
+ moduleGroups.put(name, mods);
+ };
}
- return groups;
- }
-
- static String toHRef(String mn) {
- return String.format("%s ", mn, mn);
}
void run(BufferedReader reader) throws IOException {
@@ -174,13 +153,95 @@ public class GenDocsBundlePage {
if (line.contains(HEADER_TITLE)) {
line = line.replace(HEADER_TITLE, title);
}
- if (line.contains("@")) {
- for (Map.Entry e: moduleGroups.entrySet()) {
- if (line.contains(e.getKey())) {
- line = line.replace(e.getKey(), e.getValue());
- }
+ int i = line.indexOf('@');
+ int j = line.indexOf('@', i+1);
+ if (i >= 0 && i < j) {
+ String name = line.substring(i, j+1);
+ if (moduleGroups.containsKey(name)) {
+ line = line.replace(name, formatModuleGroup(name));
}
}
return line;
}
+
+ String toHRef(ModuleDescriptor md) {
+ String mn = md.name();
+ String formattedName;
+ if (hasExportedAPIs(md)) {
+ // has exported APIs
+ formattedName = mn;
+ } else if (!md.provides().isEmpty()) {
+ // a provider
+ formattedName = "" + mn + " ";
+ } else {
+ // a tool
+ formattedName = "" + mn + " ";
+ }
+ return String.format("%s ",
+ mn, formattedName);
+ }
+
+ String formatModuleGroup(String groupName) {
+ StringBuilder sb = new StringBuilder();
+ // organize in Java SE, JDK, JavaFX, JCP groups
+ Set modules = moduleGroups.get(groupName);
+ Arrays.stream(ModuleGroup.values())
+ .forEach(g -> {
+ Set mods = modules.stream()
+ .filter(md -> g.predicate.test(md.name()))
+ .collect(toSet());
+ if (!mods.isEmpty()) {
+ sb.append("\n");
+ // modules with exported API
+ mods.stream()
+ .filter(this::hasExportedAPIs)
+ .sorted(Comparator.comparing(ModuleDescriptor::name))
+ .map(this::toHRef)
+ .forEach(m -> sb.append(m).append("\n"));
+
+ // tools and providers
+ mods.stream()
+ .filter(md -> !hasExportedAPIs(md))
+ .sorted(Comparator.comparing(ModuleDescriptor::name))
+ .map(this::toHRef)
+ .forEach(m -> sb.append(m).append("\n"));
+ sb.append("
");
+ }
+ });
+ return sb.toString();
+ }
+
+ private boolean hasExportedAPIs(ModuleDescriptor md) {
+ if (md.exports().stream().anyMatch(e -> !e.isQualified())) {
+ return true;
+ }
+ // this should check if any indirect exports
+ // checking requires transitive would be sufficient for JDK modules
+ if (md.requires().stream()
+ .map(ModuleDescriptor.Requires::modifiers)
+ .anyMatch(mods -> mods.contains(ModuleDescriptor.Requires.Modifier.TRANSITIVE))) {
+ return true;
+ }
+ return false;
+ }
+
+ private static final Set NON_JAVA_SE_MODULES =
+ Set.of("java.jnlp", "java.smartcardio");
+
+ /**
+ * CSS class names are defined in docs-bundle-page.html
+ */
+ enum ModuleGroup {
+ JAVA_SE("javase", mn -> mn.startsWith("java.") && !NON_JAVA_SE_MODULES.contains(mn)),
+ JDK("jdk", mn -> mn.startsWith("jdk.")),
+ JAVAFX("javafx", mn -> mn.startsWith("javafx.")),
+ NON_JAVA_SE("jcp", NON_JAVA_SE_MODULES::contains);
+
+ final String cssClass;
+ final Predicate predicate;
+ ModuleGroup(String cssClass, Predicate predicate) {
+ this.cssClass = cssClass;
+ this.predicate = predicate;
+ }
+ }
}
diff --git a/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html b/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html
index e309840951d..9a4f5cf0fc4 100644
--- a/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html
+++ b/jdk/make/src/classes/build/tools/docs/docs-bundle-page.html
@@ -26,91 +26,146 @@ questions.
-
-
-
@HEADER_TITLE@
+
+
+
+
-
@HEADER_TITLE@
+
-Modules
+JDK Modules
Group
- Java SE
- JDK
- JavaFX
+ Modules
Foundation
- @CORE_MODULES@
+ @JAVA_BASE@
-Security
- @SECURITY_MODULES@
-
-
-Instrumentation and Management
- @INSTRUMENT_MGMT_MODULES@
-
-
-Integration
+ Integration
@INTEGRATION_MODULES@
User Interface
- @UI_TOOLKITS_MODULES@
+ @UI_MODULES@
- Compiler and Scripting
- @COMPILER_SCRIPTING_MODULES@
+ Compilation
+ @COMPILER_MODULES@
- Debugging
- @DEBUG_MODULES@
+ Scripting
+ @SCRIPTING_MODULES@
- Tools and Tool APIs
- @TOOL_MODULES@
+ Security
+ @SECURITY_MODULES@
- Incubating Features
+ Management
+ @MANAGEMENT_MODULES@
+
+
+ Instrumentation
+ @INSTRUMENT_MODULES@
+
+
+ Serviceability
+ @SVC_MODULES@
+
+
+ Packaging
+ @PACKAGING_MODULES@
+
+
+ Incubator
@INCUBATOR_MODULES@
+
+ Non-Java SE
+ @OTHER_MODULES@
+
Java EE
@JAVA_EE_MODULES@
-
- Outside Java SE
- JDK
- JavaFX
-
-
- Others
- @OTHER_MODULES@
+ Aggregator
+ @AGGREGATOR_MODULES@
+Key:
+
+ Java SE
+ JDK
+ JavaFX
+ Non-Java SE
+italic No Exported API (e.g. a tool or provider)
+
+
-
-Copyright © 1993, 2017, Oracle and/or its affiliates. All rights reserved.
+
+Copyright © 1993, 2017, Oracle and/or its affiliates. All rights reserved.
+
+
+
diff --git a/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties b/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties
index 0e7d0c8aed1..98a34b91e2e 100644
--- a/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties
+++ b/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties
@@ -1,13 +1,8 @@
# Module Grouping for the docs bundle page
#
-core_modules=\
-java.base \
-jdk.charsets \
-jdk.localedata \
-jdk.net \
-jdk.sctp \
-jdk.zipfs
+java_base=\
+java.base
java_ee_modules=\
java.activation \
@@ -17,6 +12,10 @@ java.xml.bind \
java.xml.ws \
java.xml.ws.annotation
+aggregator_modules=\
+java.se \
+java.se.ee
+
security_modules=\
java.security.jgss \
java.security.sasl \
@@ -26,18 +25,22 @@ jdk.security.jgss \
jdk.crypto.cryptoki \
jdk.crypto.ec \
jdk.crypto.mscapi \
-jdk.crypto.ucrypto
+jdk.crypto.ucrypto \
+jdk.policytool
-instrument_mgmt_modules=\
-java.instrument \
+instrument_modules=\
+java.instrument
+
+management_modules=\
java.management \
java.management.rmi \
-jdk.jfr \
jdk.management \
jdk.management.agent \
jdk.management.cmm \
jdk.management.jfr \
jdk.management.resource \
+jdk.snmp \
+jdk.jconsole
integration_modules=\
java.logging \
@@ -47,11 +50,18 @@ java.rmi \
java.sql \
java.sql.rowset \
java.xml \
+jdk.charsets \
+jdk.localedata \
+jdk.net \
+jdk.sctp \
+jdk.jsobject \
jdk.httpserver \
jdk.naming.dns \
-jdk.naming.rmi
+jdk.naming.rmi \
+jdk.xml.dom \
+jdk.zipfs
-ui_toolkits_modules=\
+ui_modules=\
java.datatransfer \
java.desktop \
javafx.base \
@@ -63,39 +73,40 @@ javafx.swing \
javafx.web \
jdk.accessibility
-other_modules=\
-java.jnlp \
-java.smartcardio \
-jdk.jsobject \
-jdk.xml.dom
-
-debug_modules=\
-jdk.jdi \
-jdk.jdwp.agent
-
-tool_modules=\
+svc_modules=\
+jdk.jfr \
jdk.attach \
-jdk.editpad \
-jdk.jartool \
-jdk.javadoc \
jdk.jcmd \
-jdk.jconsole \
-jdk.jdeps \
-jdk.jlink \
-jdk.jshell \
+jdk.jdi \
+jdk.jdwp.agent \
jdk.jstatd \
+jdk.hotspot.agent
+
+packaging_modules=\
+jdk.jartool \
+jdk.jlink \
jdk.pack \
-jdk.policytool \
-jdk.packager.services \
+jdk.packager.services
+
+compiler_modules=\
+java.compiler \
+jdk.compiler \
+jdk.javadoc \
+jdk.jdeps \
+jdk.editpad \
+jdk.jshell \
jdk.rmic
-compiler_scripting_modules=\
-java.compiler \
+scripting_modules=\
java.scripting \
-jdk.compiler \
jdk.dynalink \
jdk.scripting.nashorn \
jdk.scripting.nashorn.shell
+other_modules=\
+java.jnlp \
+java.smartcardio
+
incubator_modules=\
jdk.incubator.httpclient
+
From 48dfdfc6330d3c3a3d4e12cf0ca294cf81f93783 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Mon, 22 May 2017 15:27:20 -0700
Subject: [PATCH 27/62] 8180793: move jdk.test.lib.wrappers.* to jdk.test.lib
package
Reviewed-by: mchung
---
.../test/compiler/codecache/stress/CodeCacheStressRunner.java | 2 +-
hotspot/test/compiler/codecache/stress/Helper.java | 2 +-
.../test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java | 2 +-
hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
index 9f34a8681de..24ec37b89d4 100644
--- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
+++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
@@ -23,7 +23,7 @@
package compiler.codecache.stress;
-import jdk.test.lib.wrappers.TimeLimitedRunner;
+import jdk.test.lib.TimeLimitedRunner;
import jdk.test.lib.Utils;
public class CodeCacheStressRunner {
diff --git a/hotspot/test/compiler/codecache/stress/Helper.java b/hotspot/test/compiler/codecache/stress/Helper.java
index d9fb8d3a843..e759378ffda 100644
--- a/hotspot/test/compiler/codecache/stress/Helper.java
+++ b/hotspot/test/compiler/codecache/stress/Helper.java
@@ -25,7 +25,7 @@ package compiler.codecache.stress;
import jdk.test.lib.Asserts;
import jdk.test.lib.ByteCodeLoader;
-import jdk.test.lib.wrappers.InfiniteLoop;
+import jdk.test.lib.InfiniteLoop;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
diff --git a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
index 30baaed7684..cfd9e1c4bb0 100644
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java
@@ -29,7 +29,7 @@ import compiler.compilercontrol.share.method.MethodDescriptor;
import compiler.compilercontrol.share.pool.PoolHelper;
import compiler.compilercontrol.share.scenario.Executor;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.wrappers.TimeLimitedRunner;
+import jdk.test.lib.TimeLimitedRunner;
import jdk.test.lib.Utils;
import java.util.ArrayList;
diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
index 0f323a8c52e..80d89d33de7 100644
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
@@ -44,7 +44,7 @@
package compiler.whitebox;
import jdk.test.lib.Asserts;
-import jdk.test.lib.wrappers.InfiniteLoop;
+import jdk.test.lib.InfiniteLoop;
import sun.hotspot.WhiteBox;
import sun.hotspot.code.BlobType;
From 7d97ce96ddbddd34b777d68d64ce098fa26d436a Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Mon, 22 May 2017 15:28:12 -0700
Subject: [PATCH 28/62] 8180721: clean up ProblemList
Reviewed-by: sspitsyn, gtriantafill
---
hotspot/test/ProblemList.txt | 4 ++--
hotspot/test/serviceability/jdwp/AllModulesCommandTest.java | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/hotspot/test/ProblemList.txt b/hotspot/test/ProblemList.txt
index 2c657d33705..8101e62a587 100644
--- a/hotspot/test/ProblemList.txt
+++ b/hotspot/test/ProblemList.txt
@@ -64,14 +64,14 @@ gc/g1/logging/TestG1LoggingFailure.java 8169634 generic-all
runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
# This test is disabled since it will stress NMT and timeout during normal testing
runtime/NMT/MallocStressTest.java 8166548 generic-all
-runtime/SharedArchiveFile/BootAppendTests.java 8150683 generic-all
+runtime/SharedArchiveFile/BootAppendTests.java 8179103 generic-all
runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
#############################################################################
# :hotspot_serviceability
-serviceability/jdwp/AllModulesCommandTest.java 8168478 generic-all
+serviceability/jdwp/AllModulesCommandTest.java 8170541 generic-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java 8173936 generic-all
diff --git a/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java b/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java
index 92a2aa4e003..76a6aa4a3e3 100644
--- a/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java
+++ b/hotspot/test/serviceability/jdwp/AllModulesCommandTest.java
@@ -32,7 +32,6 @@ import static jdk.test.lib.Asserts.assertTrue;
* @test
* @summary Tests the modules-related JDWP commands
* @library /test/lib
- * @ignore 8170541
* @modules jdk.jdwp.agent
* @modules java.base/jdk.internal.misc
* @compile AllModulesCommandTestDebuggee.java
From f6eceb7756eeb661355a6a4ad708479e8677f873 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Mon, 22 May 2017 15:28:29 -0700
Subject: [PATCH 29/62] 8180793: move jdk.test.lib.wrappers.* to jdk.test.lib
package
Reviewed-by: mchung
---
test/lib/jdk/test/lib/{wrappers => }/InfiniteLoop.java | 2 +-
test/lib/jdk/test/lib/{wrappers => }/TimeLimitedRunner.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
rename test/lib/jdk/test/lib/{wrappers => }/InfiniteLoop.java (98%)
rename test/lib/jdk/test/lib/{wrappers => }/TimeLimitedRunner.java (99%)
diff --git a/test/lib/jdk/test/lib/wrappers/InfiniteLoop.java b/test/lib/jdk/test/lib/InfiniteLoop.java
similarity index 98%
rename from test/lib/jdk/test/lib/wrappers/InfiniteLoop.java
rename to test/lib/jdk/test/lib/InfiniteLoop.java
index dbee901f8c0..15097b66ff5 100644
--- a/test/lib/jdk/test/lib/wrappers/InfiniteLoop.java
+++ b/test/lib/jdk/test/lib/InfiniteLoop.java
@@ -21,7 +21,7 @@
* questions.
*/
-package jdk.test.lib.wrappers;
+package jdk.test.lib;
import java.util.Objects;
diff --git a/test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java b/test/lib/jdk/test/lib/TimeLimitedRunner.java
similarity index 99%
rename from test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java
rename to test/lib/jdk/test/lib/TimeLimitedRunner.java
index 73d53b43b12..cea92f34405 100644
--- a/test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java
+++ b/test/lib/jdk/test/lib/TimeLimitedRunner.java
@@ -21,7 +21,7 @@
* questions.
*/
-package jdk.test.lib.wrappers;
+package jdk.test.lib;
import java.util.Objects;
import java.util.concurrent.Callable;
From f8caf63858a4ad26bbc63423e0c5ac07040aa3a1 Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Fri, 26 May 2017 08:06:22 +0800
Subject: [PATCH 30/62] 8178794: krb5 client should ignore sname in incoming
tickets
Reviewed-by: mullan
---
.../classes/sun/security/krb5/KrbAsRep.java | 2 +-
.../classes/sun/security/krb5/KrbTgsRep.java | 2 +-
jdk/test/sun/security/krb5/auto/KDC.java | 4 +-
.../sun/security/krb5/auto/TicketSName.java | 58 +++++++++++++++++++
4 files changed, 63 insertions(+), 3 deletions(-)
create mode 100644 jdk/test/sun/security/krb5/auto/TicketSName.java
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java
index bf7a562eb4f..1d5febdf41d 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsRep.java
@@ -160,7 +160,7 @@ class KrbAsRep extends KrbKdcRep {
creds = new Credentials(
rep.ticket,
req.reqBody.cname,
- rep.ticket.sname,
+ enc_part.sname,
enc_part.key,
enc_part.flags,
enc_part.authtime,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java
index 6fc6cebaa70..c0e6ef8f0fe 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsRep.java
@@ -88,7 +88,7 @@ public class KrbTgsRep extends KrbKdcRep {
this.creds = new Credentials(rep.ticket,
rep.cname,
- rep.ticket.sname,
+ enc_part.sname,
enc_part.key,
enc_part.flags,
enc_part.authtime,
diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java
index e47c3e9e5c1..633d0d05f1e 100644
--- a/jdk/test/sun/security/krb5/auto/KDC.java
+++ b/jdk/test/sun/security/krb5/auto/KDC.java
@@ -828,7 +828,9 @@ public class KDC {
throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO
}
Ticket t = new Ticket(
- service,
+ System.getProperty("test.kdc.diff.sname") != null ?
+ new PrincipalName("xx" + service.toString()) :
+ service,
new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET)
);
EncTGSRepPart enc_part = new EncTGSRepPart(
diff --git a/jdk/test/sun/security/krb5/auto/TicketSName.java b/jdk/test/sun/security/krb5/auto/TicketSName.java
new file mode 100644
index 00000000000..458d478af14
--- /dev/null
+++ b/jdk/test/sun/security/krb5/auto/TicketSName.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8178794
+ * @summary krb5 client should ignore sname in incoming tickets
+ * @compile -XDignore.symbol.file TicketSName.java
+ * @run main/othervm -Dtest.kdc.diff.sname TicketSName
+ */
+
+import sun.security.jgss.GSSUtil;
+import javax.security.auth.kerberos.KerberosTicket;
+
+public class TicketSName {
+
+ public static void main(String[] args) throws Exception {
+
+ new OneKDC(null).writeJAASConf();
+
+ Context c, s;
+ c = Context.fromJAAS("client");
+ s = Context.fromJAAS("server");
+
+ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+
+ Context.handshake(c, s);
+
+ String expected = OneKDC.SERVER + "@" + OneKDC.REALM;
+ if (!c.s().getPrivateCredentials(KerberosTicket.class)
+ .stream()
+ .anyMatch(t -> t.getServer().toString().equals(expected))) {
+ c.status();
+ throw new Exception("no " + expected);
+ }
+ }
+}
From db214b049ecbdfea4ca2294eb8dcb8ee1e5e7cf3 Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 00:29:11 +0000
Subject: [PATCH 31/62] Added tag jdk-9+171 for changeset 562ad59ed4e7
---
.hgtags-top-repo | 1 +
1 file changed, 1 insertion(+)
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 1aa95fe45fa..942f685a939 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -413,3 +413,4 @@ ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168
b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169
4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170
+4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171
From 34ea5bd9792a6aecb76b6330299dbd4d1f4f1c79 Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 00:29:12 +0000
Subject: [PATCH 32/62] Added tag jdk-9+171 for changeset e4eadf80c436
---
corba/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/corba/.hgtags b/corba/.hgtags
index 1a96c62ac8c..efcbc58d91b 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -413,3 +413,4 @@ a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168
b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169
8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170
+c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171
From df177f41502c2faaa3f20fbf9e5a20826fb49d3a Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 00:29:12 +0000
Subject: [PATCH 33/62] Added tag jdk-9+171 for changeset 9e1b29faefa9
---
hotspot/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 3f07e474bf8..8cfbb1efb58 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -573,3 +573,4 @@ c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169
38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170
+d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171
From 7f348b3547ae41de92014da2aec85779f3fc90e4 Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 00:29:13 +0000
Subject: [PATCH 34/62] Added tag jdk-9+171 for changeset 14e43572d5f5
---
jaxp/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 3de43d927d2..c2b4f4f3c75 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -413,3 +413,4 @@ d02b6fbcab06c59a5f5a4a6736bd4ec6d2567855 jdk-9+162
23a87f409371fb8ce7b764cccb3a74c3f6b29900 jdk-9+168
5d9d2a65fb26aa183019346c11d9314819621665 jdk-9+169
6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170
+c27321c889cf4c8e465a61b84572c00ef7ee6004 jdk-9+171
From aa6e6a104ab5924e9bd9c374d22320a44a81e8fa Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 00:29:13 +0000
Subject: [PATCH 35/62] Added tag jdk-9+171 for changeset e09145bcfcc5
---
jdk/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 94fd9c26006..4cede3d5e81 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -413,3 +413,4 @@ a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165
e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168
177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169
ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170
+29bbedd4cce8e14742bdb22118c057b877c02f0f jdk-9+171
From 5a9513dfcaf6e66d66836ead6a0089b542be0cfb Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 00:29:15 +0000
Subject: [PATCH 36/62] Added tag jdk-9+171 for changeset e04bdb41c10a
---
nashorn/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 842a6874e19..fbb0b34290a 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -404,3 +404,4 @@ e118c818dbf84d15191414c453b77c089116fdc0 jdk-9+167
0f81cde5a1f75786f381dbfb59b9afbab70174c7 jdk-9+168
131e250080158e57ce45130560f5f987b92642b5 jdk-9+169
550bfc15779f8f339610793867fdc251125811b5 jdk-9+170
+fc416270a776409b74006262dd0a9f5f5ff31555 jdk-9+171
From 83e1ea4eeb5e1a4f08ba2c3a9fc2fc46cd2298f4 Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 01:00:32 +0000
Subject: [PATCH 37/62] Added tag jdk-10+9 for changeset 72bd5e8aab2f
---
.hgtags-top-repo | 1 +
1 file changed, 1 insertion(+)
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index bf64ef1712e..f1447c76afb 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -423,3 +423,4 @@ b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169
aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7
df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8
+b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9
From 8a6f32488e210b71fb873965b276c5f3189b8bda Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 01:00:32 +0000
Subject: [PATCH 38/62] Added tag jdk-10+9 for changeset a220a944d643
---
hotspot/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 368f851bf14..aed7d6ae6ab 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -582,3 +582,4 @@ fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170
9d4746eca95aec3e5a344bf2520745dcc1d17eed jdk-10+7
f5ded0cf954c770deeecb80f2ba1ba6a05cd979b jdk-10+8
+233647e3d3800e76d7612014b745b37a88098f63 jdk-10+9
From 1db2e2256724b8f9207bf933dfb54301d32c07ed Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 01:00:36 +0000
Subject: [PATCH 39/62] Added tag jdk-10+9 for changeset a4c62ccf8688
---
jdk/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 3a58536ca86..eac0cdff70d 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -422,3 +422,4 @@ e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168
ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170
cbd65760a005766610583949b3b5c9ace92e74b3 jdk-10+7
f0adc10ed8316e6cf316e3208c5ecf6835d22bc4 jdk-10+8
+b9409a7daa6c793dd631e52fe6ef79d08a3b337a jdk-10+9
From 1d36c7fc4a2cd6371e574b542d9bdf8b8a7e65df Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 01:00:41 +0000
Subject: [PATCH 40/62] Added tag jdk-10+9 for changeset 1eb6d5bd7b92
---
nashorn/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index ef877223386..83e5ad2c0ef 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -413,3 +413,4 @@ e118c818dbf84d15191414c453b77c089116fdc0 jdk-9+167
550bfc15779f8f339610793867fdc251125811b5 jdk-9+170
7e9cb37e6d6edbe56fdf4d510e5110f797823f09 jdk-10+7
edb825e2dfb140c8e57a61b5d45de19edebccccf jdk-10+8
+d7d69c89088aec56d13bbff81a6f0a8b68ca75f4 jdk-10+9
From 8cb730c1c726b4c744733f1fe1d3a0e46c71b466 Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 01:00:41 +0000
Subject: [PATCH 41/62] Added tag jdk-10+9 for changeset 1ea125d1caf7
---
jaxp/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 45875ae185d..043790a44e9 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -422,3 +422,4 @@ ac697b2bdf486ef18caad2092bd24036e14946ac jdk-10+5
6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170
09cae4c36242734f5450de739b8264523a030809 jdk-10+7
856998840907b67b7e1fc49259f785ac085a189b jdk-10+8
+3c75f07b2a49cb0a4f4eb5df8bbcbc64dda3153f jdk-10+9
From 315a79902eea5bf633fbadb7d533c82a5a754b47 Mon Sep 17 00:00:00 2001
From: Lana Steuck
Date: Fri, 26 May 2017 01:00:42 +0000
Subject: [PATCH 42/62] Added tag jdk-10+9 for changeset 5db9fa12a86d
---
corba/.hgtags | 1 +
1 file changed, 1 insertion(+)
diff --git a/corba/.hgtags b/corba/.hgtags
index 0fe545af082..5dc7f003fba 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -422,3 +422,4 @@ b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169
8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170
aed5a4edc8275c1c50195503756ff92bfe0197f5 jdk-10+7
648b0a00824eb29e71936bc3258d309a25e3b8c0 jdk-10+8
+54c6621f7b34cc6ce6c0882d047f61fe0962c257 jdk-10+9
From 56f5f73f1e9e3f3b980903e1c3d4af35c8ab9405 Mon Sep 17 00:00:00 2001
From: Hamlin Li
Date: Thu, 25 May 2017 18:16:01 -0700
Subject: [PATCH 43/62] 8180732: add test to check temp file permission
Reviewed-by: rriggs, bchristi
---
.../io/File/createTempFile/SecurityTest.java | 47 +++++++++++++++++++
.../java/io/File/createTempFile/java.policy | 2 +
2 files changed, 49 insertions(+)
create mode 100644 jdk/test/java/io/File/createTempFile/SecurityTest.java
create mode 100644 jdk/test/java/io/File/createTempFile/java.policy
diff --git a/jdk/test/java/io/File/createTempFile/SecurityTest.java b/jdk/test/java/io/File/createTempFile/SecurityTest.java
new file mode 100644
index 00000000000..f3985da88a9
--- /dev/null
+++ b/jdk/test/java/io/File/createTempFile/SecurityTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 4138064
+ * @build SecurityTest
+ * @run main/othervm/policy=java.policy SecurityTest
+ */
+
+import java.io.File;
+
+public class SecurityTest {
+
+ public static void main(String[] args) throws Exception {
+ try {
+ File f = File.createTempFile("foo", null);
+ } catch (java.security.AccessControlException x) {
+ throw x;
+ } catch (SecurityException x) {
+ if (x.getMessage().equals("Unable to create temporary file")) {
+ return;
+ }
+ throw x;
+ }
+ throw new Exception("SecurityException not thrown");
+ }
+}
diff --git a/jdk/test/java/io/File/createTempFile/java.policy b/jdk/test/java/io/File/createTempFile/java.policy
new file mode 100644
index 00000000000..e89913b9f24
--- /dev/null
+++ b/jdk/test/java/io/File/createTempFile/java.policy
@@ -0,0 +1,2 @@
+grant {
+};
From 2fc00fbdb19a24596a3e1875b08e79c68a317029 Mon Sep 17 00:00:00 2001
From: Amy Lu
Date: Fri, 26 May 2017 17:36:22 +0800
Subject: [PATCH 44/62] 8173905: Test tools/jar/multiRelease/RuntimeTest.java
fails under JDK 10
Reviewed-by: psandoz, redestad
---
jdk/test/ProblemList.txt | 2 -
.../tools/jar/multiRelease/RuntimeTest.java | 94 +++++++++++++------
.../runtimetest/base/testpackage/Main.java | 62 ------------
.../data/runtimetest/base/versionResource | 1 -
.../Helper.java.template} | 4 +-
.../Main.java.template} | 4 +-
.../runtimetest/v10/testpackage/Helper.java | 33 -------
.../runtimetest/v10/testpackage/Main.java | 62 ------------
.../data/runtimetest/v10/versionResource | 1 -
.../runtimetest/v9/testpackage/Helper.java | 33 -------
.../data/runtimetest/v9/versionResource | 1 -
.../data/runtimetest/versionResource.template | 1 +
12 files changed, 72 insertions(+), 226 deletions(-)
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Main.java
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/base/versionResource
rename jdk/test/tools/jar/multiRelease/data/runtimetest/{base/testpackage/Helper.java => testpackage/Helper.java.template} (89%)
rename jdk/test/tools/jar/multiRelease/data/runtimetest/{v9/testpackage/Main.java => testpackage/Main.java.template} (94%)
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Helper.java
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Main.java
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/v10/versionResource
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Helper.java
delete mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/v9/versionResource
create mode 100644 jdk/test/tools/jar/multiRelease/data/runtimetest/versionResource.template
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index e88054943eb..a4fe6c901f3 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -258,8 +258,6 @@ tools/jimage/JImageExtractTest.java 8170120 generic-
tools/jimage/JImageListTest.java 8170120 generic-all
tools/jimage/JImageVerifyTest.java 8170120 generic-all
-tools/jar/multiRelease/RuntimeTest.java 8173905 generic-all
-
tools/schemagen/MultiReleaseJarTest.java 8174692 generic-all
tools/wsgen/MultiReleaseJarTest.java 8174692 generic-all
diff --git a/jdk/test/tools/jar/multiRelease/RuntimeTest.java b/jdk/test/tools/jar/multiRelease/RuntimeTest.java
index 930c07c9a60..7de864c26a9 100644
--- a/jdk/test/tools/jar/multiRelease/RuntimeTest.java
+++ b/jdk/test/tools/jar/multiRelease/RuntimeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,7 @@
* @test
* @summary Test Multi-Release jar usage in runtime
* @library /test/lib
- * @library /lib/testlibrary
* @modules jdk.compiler
- * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
- * jdk.test.lib.process.OutputAnalyzer
- * jdk.test.lib.process.ProcessTools
- * CompilerUtils RuntimeTest
* @run testng RuntimeTest
*/
@@ -41,6 +36,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.UncheckedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
@@ -51,7 +47,10 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.testng.annotations.BeforeClass;
@@ -60,37 +59,53 @@ import org.testng.annotations.Test;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.compiler.CompilerUtils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
public class RuntimeTest {
public static final int SUCCESS = 0;
- private final String src = System.getProperty("test.src", ".");
- private final String usr = System.getProperty("user.dir", ".");
+ private static final String src = System.getProperty("test.src", ".");
+ private static final String usr = System.getProperty("user.dir", ".");
+
+ private static final Path srcFileRoot = Paths.get(src, "data", "runtimetest");
+ private static final Path genFileRoot = Paths.get(usr, "data", "runtimetest");
+
+ private static final int OLD_RELEASE = 8;
+ private static final int CURRENT_RELEASE = Runtime.version().major();
+ private static final int FUTURE_RELEASE = CURRENT_RELEASE + 1;
+ private static final String MRJAR_BOTH_RELEASES = "MV_BOTH.jar";
+ private static final String MRJAR_CURRENT_RELEASE = "MV_ONLY_" + CURRENT_RELEASE + ".jar";
+ private static final String NON_MRJAR_OLD_RELEASE = "NON_MV.jar";
+
+ private static final int[] versions = { OLD_RELEASE, CURRENT_RELEASE, FUTURE_RELEASE };
@DataProvider(name = "jarFiles")
Object[][] jarFiles() {
- return new Object[][] { { "MV_BOTH.jar", 9, 9, 9 },
- { "MV_ONLY_9.jar", 9, 9, 9 },
- { "NON_MV.jar", 8, 8, 8 } };
+ return new Object[][]{
+ { MRJAR_BOTH_RELEASES, CURRENT_RELEASE, CURRENT_RELEASE, CURRENT_RELEASE },
+ { MRJAR_CURRENT_RELEASE, CURRENT_RELEASE, CURRENT_RELEASE, CURRENT_RELEASE },
+ { NON_MRJAR_OLD_RELEASE, OLD_RELEASE, OLD_RELEASE, OLD_RELEASE }
+ };
}
@BeforeClass
protected void setUpTest() throws Throwable {
+ createJarSourceFiles();
compile();
Path classes = Paths.get("classes");
- jar("cfm", "MV_BOTH.jar", "manifest.txt",
- "-C", classes.resolve("base").toString(), ".",
- "--release", "9", "-C", classes.resolve("v9").toString(), ".",
- "--release", "10", "-C", classes.resolve("v10").toString(), ".")
+ jar("cfm", MRJAR_BOTH_RELEASES, "manifest.txt",
+ "-C", classes.resolve("v" + OLD_RELEASE).toString(), ".",
+ "--release", "" + CURRENT_RELEASE, "-C", classes.resolve("v" + CURRENT_RELEASE).toString(), ".",
+ "--release", "" + FUTURE_RELEASE, "-C", classes.resolve("v" + FUTURE_RELEASE).toString(), ".")
.shouldHaveExitValue(0);
- jar("cfm", "MV_ONLY_9.jar", "manifest.txt",
- "-C", classes.resolve("base").toString(), ".",
- "--release", "9", "-C", classes.resolve("v9").toString(), ".")
+ jar("cfm", MRJAR_CURRENT_RELEASE, "manifest.txt",
+ "-C", classes.resolve("v" + OLD_RELEASE).toString(), ".",
+ "--release", "" + CURRENT_RELEASE, "-C", classes.resolve("v" + CURRENT_RELEASE).toString(), ".")
.shouldHaveExitValue(0);
- jar("cfm", "NON_MV.jar", "manifest.txt",
- "-C", classes.resolve("base").toString(), ".")
+ jar("cfm", NON_MRJAR_OLD_RELEASE, "manifest.txt",
+ "-C", classes.resolve("v" + OLD_RELEASE).toString(), ".")
.shouldHaveExitValue(0);
}
@@ -203,12 +218,37 @@ public class RuntimeTest {
return ProcessTools.executeCommand(launcher.getCommand());
}
+ private static String platformPath(String p) {
+ return p.replace("/", File.separator);
+ }
+
+ private static void createJarSourceFiles() throws IOException {
+ for (int ver : versions) {
+ Files.find(srcFileRoot, 3, (file, attrs) -> (file.toString().endsWith(".template")))
+ .map(srcFileRoot::relativize)
+ .map(Path::toString)
+ .map(p -> p.replace(".template", ""))
+ .forEach(f -> {
+ try {
+ Path template = srcFileRoot.resolve(f + ".template");
+ Path out = genFileRoot.resolve(platformPath("v" + ver + "/" + f));
+ Files.createDirectories(out.getParent());
+ List lines = Files.lines(template)
+ .map(s -> s.replaceAll("\\$version", String.valueOf(ver)))
+ .collect(Collectors.toList());
+ Files.write(out, lines);
+ } catch (IOException x) {
+ throw new UncheckedIOException(x);
+ }
+ });
+ }
+ }
+
private void compile() throws Throwable {
- String[] vers = { "base", "v9", "v10" };
- for (String ver : vers) {
- Path classes = Paths.get(usr, "classes", ver);
+ for (int ver : versions) {
+ Path classes = Paths.get(usr, "classes", "v" + ver);
Files.createDirectories(classes);
- Path source = Paths.get(src, "data", "runtimetest", ver);
+ Path source = genFileRoot.resolve("v" + ver);
assertTrue(CompilerUtils.compile(source, classes));
Files.copy(source.resolve("versionResource"),
classes.resolve("versionResource"),
@@ -217,10 +257,10 @@ public class RuntimeTest {
Path classes = Paths.get(usr, "classes", "test");
Files.createDirectory(classes);
- Path source = Paths.get(src, "data", "runtimetest", "test");
+ Path source = srcFileRoot.resolve("test");
assertTrue(
- CompilerUtils.compile(source, classes, "-cp", "classes/base/"));
- Files.copy(Paths.get(src, "data", "runtimetest", "manifest.txt"),
+ CompilerUtils.compile(source, classes, "-cp", "classes/v" + OLD_RELEASE));
+ Files.copy(srcFileRoot.resolve("manifest.txt"),
Paths.get(usr, "manifest.txt"),
StandardCopyOption.REPLACE_EXISTING);
}
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Main.java b/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Main.java
deleted file mode 100644
index 892bbe7329c..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Main.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class Main {
-
- private static final int MAIN_VERSION = 8;
-
- public static void main(String[] args) {
- System.out.println("Main version: " + getMainVersion());
- System.out.println("Helpers version: " + getHelperVersion());
- System.out.println("Resource version: " + getResourceVersion());
- }
-
- public static int getMainVersion() {
- return MAIN_VERSION;
- }
-
- public static int getHelperVersion() {
- return testpackage.Helper.getHelperVersion();
- }
-
- public static int getResourceVersion() {
- ClassLoader cl = Main.class.getClassLoader();
- InputStream ris = cl.getResourceAsStream("versionResource");
- if (ris == null) {
- throw new Error("Test issue: resource versionResource"
- + " cannot be loaded!");
- }
- try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
- return Integer.parseInt(br.readLine());
- } catch (IOException ioe) {
- throw new Error("Unexpected issue", ioe);
- }
- }
-}
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/versionResource b/jdk/test/tools/jar/multiRelease/data/runtimetest/base/versionResource
deleted file mode 100644
index 301160a9306..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/versionResource
+++ /dev/null
@@ -1 +0,0 @@
-8
\ No newline at end of file
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Helper.java b/jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Helper.java.template
similarity index 89%
rename from jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Helper.java
rename to jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Helper.java.template
index 6028cf8090d..c547b004cfa 100644
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/base/testpackage/Helper.java
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Helper.java.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@ package testpackage;
public class Helper {
- private static final int HELPER_VERSION = 8;
+ private static final int HELPER_VERSION = $version;
public static int getHelperVersion() {
return HELPER_VERSION;
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Main.java b/jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Main.java.template
similarity index 94%
rename from jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Main.java
rename to jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Main.java.template
index 7afcc0efc0e..97702a7ea6c 100644
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Main.java
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/testpackage/Main.java.template
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@ import java.io.InputStreamReader;
public class Main {
- private static final int MAIN_VERSION = 9;
+ private static final int MAIN_VERSION = $version;
public static void main(String[] args) {
System.out.println("Main version: " + getMainVersion());
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Helper.java b/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Helper.java
deleted file mode 100644
index 7071b436757..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Helper.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-public class Helper {
-
- private static final int HELPER_VERSION = 10;
-
- public static int getHelperVersion() {
- return HELPER_VERSION;
- }
-}
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Main.java b/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Main.java
deleted file mode 100644
index de6fc15cbbd..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/testpackage/Main.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-public class Main {
-
- private static final int MAIN_VERSION = 10;
-
- public static void main(String[] args) {
- System.out.println("Main version: " + getMainVersion());
- System.out.println("Helpers version: " + getHelperVersion());
- System.out.println("Resource version: " + getResourceVersion());
- }
-
- public static int getMainVersion() {
- return MAIN_VERSION;
- }
-
- public static int getHelperVersion() {
- return testpackage.Helper.getHelperVersion();
- }
-
- public static int getResourceVersion() {
- ClassLoader cl = Main.class.getClassLoader();
- InputStream ris = cl.getResourceAsStream("versionResource");
- if (ris == null) {
- throw new Error("Test issue: resource versionResource"
- + " cannot be loaded!");
- }
- try (BufferedReader br = new BufferedReader(new InputStreamReader(ris))) {
- return Integer.parseInt(br.readLine());
- } catch (IOException ioe) {
- throw new Error("Unexpected issue", ioe);
- }
- }
-}
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/versionResource b/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/versionResource
deleted file mode 100644
index f599e28b8ab..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v10/versionResource
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Helper.java b/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Helper.java
deleted file mode 100644
index 8d4517d0ee8..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/testpackage/Helper.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package testpackage;
-
-public class Helper {
-
- private static final int HELPER_VERSION = 9;
-
- public static int getHelperVersion() {
- return HELPER_VERSION;
- }
-}
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/versionResource b/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/versionResource
deleted file mode 100644
index ec635144f60..00000000000
--- a/jdk/test/tools/jar/multiRelease/data/runtimetest/v9/versionResource
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/jdk/test/tools/jar/multiRelease/data/runtimetest/versionResource.template b/jdk/test/tools/jar/multiRelease/data/runtimetest/versionResource.template
new file mode 100644
index 00000000000..f43b9c66740
--- /dev/null
+++ b/jdk/test/tools/jar/multiRelease/data/runtimetest/versionResource.template
@@ -0,0 +1 @@
+$version
From f474e8ebf741704c159d833c35f3f39e4b8aaf2f Mon Sep 17 00:00:00 2001
From: Kumar Srinivasan
Date: Fri, 26 May 2017 07:39:18 -0700
Subject: [PATCH 45/62] 8180286: Remove the launchers data model flags
-d32/-d64
Reviewed-by: alanb, dholmes, mchung
---
.../java.base/share/classes/sun/launcher/LauncherHelper.java | 4 ----
.../share/classes/sun/launcher/resources/launcher.properties | 1 -
2 files changed, 5 deletions(-)
diff --git a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
index 5ac605a2092..7fb01d074e0 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
@@ -363,10 +363,6 @@ public final class LauncherHelper {
static void initHelpMessage(String progname) {
outBuf = outBuf.append(getLocalizedMessage("java.launcher.opt.header",
(progname == null) ? "java" : progname ));
- outBuf = outBuf.append(getLocalizedMessage("java.launcher.opt.datamodel",
- 32));
- outBuf = outBuf.append(getLocalizedMessage("java.launcher.opt.datamodel",
- 64));
}
/**
diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
index 7cf14706afb..768472c46f0 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
@@ -34,7 +34,6 @@ java.launcher.opt.header = Usage: {0} [options] [args...]\n\
\ / are passed as the arguments to main class.\n\n\
\ where options include:\n\n
-java.launcher.opt.datamodel =\ -d{0}\t Deprecated, will be removed in a future release\n
java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n
java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n
From da6d0e38ee7c662e4777f1eb59e4ce8c555cf370 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Fri, 26 May 2017 22:30:19 -0700
Subject: [PATCH 46/62] 8180895:
java/security/AccessController/DoPrivAccompliceTest.java has to be improved
Reviewed-by: asmotrak
---
.../DoPrivAccompliceTest.java | 108 ++++++++++--------
1 file changed, 61 insertions(+), 47 deletions(-)
diff --git a/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java b/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java
index 6ed63d9d729..2abf45d3128 100644
--- a/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java
+++ b/jdk/test/java/security/AccessController/DoPrivAccompliceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,76 +23,90 @@
* questions.
*/
-import java.io.File;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.testlibrary.JarUtils;
+
import java.io.FileWriter;
import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.nio.file.Path;
+import java.nio.file.Paths;
/*
* @test
* @bug 8048362
- * @compile ../../../lib/testlibrary/JavaToolUtils.java
- * DoPrivAccomplice.java DoPrivTest.java
* @summary Tests the doPrivileged with accomplice Generate two jars
* (DoPrivTest.jar and DoPrivAccomplice.jar) and grant permission to
- * DoPrivAccmplice.jar for reading user.home property from a PrivilagedAction.
- * Run DoPrivTest.jar and try to access user.home property using
+ * DoPrivAccmplice.jar for reading user.name property from a PrivilagedAction.
+ * Run DoPrivTest.jar and try to access user.name property using
* DoPrivAccmplice.jar.
- * @modules jdk.compiler
+ *
+ * @library /test/lib /lib/testlibrary
+ *
* @run main/othervm DoPrivAccompliceTest
*/
public class DoPrivAccompliceTest {
+ private static final String ACTION_SOURCE = DoPrivAccomplice.class.getName();
+ private static final String TEST_SOURCE = DoPrivTest.class.getName();
- private static final String PWD = System.getProperty("test.classes", "./");
- private static final String ACTION_SOURCE = "DoPrivAccomplice";
- private static final String TEST_SOURCE = "DoPrivTest";
-
- public static void createPolicyFile(URI codebaseURL) throws IOException {
- String codebase = codebaseURL.toString();
+ private static void createPolicyFile(Path jarFile, Path policy) {
+ String codebase = jarFile.toFile().toURI().toString();
String quotes = "\"";
StringBuilder policyFile = new StringBuilder();
- policyFile.append("grant codeBase ").append(quotes).
- append(codebase).append(quotes).append("{\n").
- append("permission java.util.PropertyPermission ").
- append(quotes).append("user.name").append(quotes).
- append(",").append(quotes).append("read").append(quotes).
- append(";\n};");
- try (FileWriter writer = new FileWriter(new File(PWD, "java.policy"))) {
+ policyFile.append("grant codeBase ")
+ .append(quotes).append(codebase).append(quotes)
+ .append("{\n")
+ .append("permission java.util.PropertyPermission ")
+ .append(quotes).append("user.name").append(quotes)
+ .append(",")
+ .append(quotes).append("read").append(quotes)
+ .append(";\n};");
+ try (FileWriter writer = new FileWriter(policy.toFile())) {
writer.write(policyFile.toString());
- writer.close();
} catch (IOException e) {
- System.err.println("Error while creating policy file");
- throw e;
+ throw new Error("Error while creating policy file " + policy, e);
}
}
public static void main(String[] args) throws Exception {
- final File class1 = new File(PWD, ACTION_SOURCE + ".class");
- final File class2 = new File(PWD, TEST_SOURCE + ".class");
- final File jarFile1 = new File(PWD, ACTION_SOURCE + ".jar");
- final File jarFile2 = new File(PWD, TEST_SOURCE + ".jar");
- System.out.println("Compilation successfull");
- JavaToolUtils.createJar(jarFile1, Arrays.asList(new File[]{class1}));
+ // copy class files to pwd
+ ClassFileInstaller.main(ACTION_SOURCE, TEST_SOURCE);
+ Path pwd = Paths.get(".");
+ Path jarFile1 = pwd.resolve(ACTION_SOURCE + ".jar").toAbsolutePath();
+ Path jarFile2 = pwd.resolve(TEST_SOURCE + ".jar").toAbsolutePath();
+ Path policy = pwd.resolve("java.policy").toAbsolutePath();
+
+ JarUtils.createJar(jarFile1.toString(), ACTION_SOURCE + ".class");
System.out.println("Created jar file " + jarFile1);
- JavaToolUtils.createJar(jarFile2, Arrays.asList(new File[]{class2}));
+ JarUtils.createJar(jarFile2.toString(), TEST_SOURCE + ".class");
System.out.println("Created jar file " + jarFile2);
- createPolicyFile(jarFile1.toURI());
- List commands = new ArrayList<>();
- final String pathSepartor = System.getProperty("path.separator");
- commands.add("-Djava.security.manager");
- commands.add("-Djava.security.policy=" + PWD + "/java.policy");
- commands.add("-classpath");
- commands.add(PWD + "/" + TEST_SOURCE + ".jar" + pathSepartor
- + PWD + "/" + ACTION_SOURCE + ".jar");
- commands.add(TEST_SOURCE);
- if (JavaToolUtils.runJava(commands) == 0) {
- System.out.println("Test PASSES");
- }
+
+ String pathSepartor = System.getProperty("path.separator");
+ String[] commands = {
+ "-Djava.security.manager",
+ "-Djava.security.policy=" + policy,
+ "-classpath", jarFile1 + pathSepartor + jarFile2,
+ TEST_SOURCE
+ };
+
+ String userName = System.getProperty("user.name");
+
+ createPolicyFile(jarFile1, policy);
+ System.out.println("Created policy for " + jarFile1);
+ ProcessTools.executeTestJava(commands)
+ .shouldHaveExitValue(0)
+ .shouldContain(userName)
+ .stderrShouldBeEmpty();
+
+ createPolicyFile(jarFile2, policy);
+ System.out.println("Created policy for " + jarFile2);
+ ProcessTools.executeTestJava(commands)
+ .shouldNotHaveExitValue(0)
+ .shouldNotContain(userName)
+ .stderrShouldContain("java.security.AccessControlException");
+
+ System.out.println("Test PASSES");
}
-
}
From 2bed5813315de8da29ca3e879d01c1b6d4e07f07 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev
Date: Fri, 26 May 2017 22:53:26 -0700
Subject: [PATCH 47/62] 8180890: move c.o.testlibrary.jsr292 classes to
jdk/test/java/lang/invoke directory
Reviewed-by: rriggs
---
.../invoke/ExplicitCastArgumentsTest.java | 27 +-
.../LFCaching/LFGarbageCollectedTest.java | 10 +-
.../LFCaching/LFMultiThreadCachingTest.java | 18 +-
.../LFCaching/LFSingleThreadCachingTest.java | 5 +-
.../invoke/LFCaching/LambdaFormTestCase.java | 23 +-
.../lang/invoke/LFCaching/TestMethods.java | 875 +++++++++---------
.../MethodHandles/CatchExceptionTest.java | 23 +-
.../java/lang/invoke/MethodHandlesTest.java | 45 +-
.../java/lang/invoke/PermuteArgsTest.java | 44 +-
.../invoke/TestCatchExceptionWithVarargs.java | 41 +-
.../java/lang/invoke/VarargsArrayTest.java | 20 +-
.../lib}/CodeCacheOverflowProcessor.java | 5 +-
.../test/java/lang/invoke/lib}/Helper.java | 10 +-
13 files changed, 622 insertions(+), 524 deletions(-)
rename jdk/test/{lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292 => java/lang/invoke/common/test/java/lang/invoke/lib}/CodeCacheOverflowProcessor.java (96%)
rename jdk/test/{lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292 => java/lang/invoke/common/test/java/lang/invoke/lib}/Helper.java (98%)
diff --git a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
index 347e312e3b2..8e789b75def 100644
--- a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
+++ b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,9 @@
* questions.
*/
-import com.oracle.testlibrary.jsr292.Helper;
+import sun.invoke.util.Wrapper;
+import test.java.lang.invoke.lib.Helper;
+
import java.io.File;
import java.io.Serializable;
import java.lang.invoke.MethodHandle;
@@ -31,13 +33,12 @@ import java.lang.invoke.WrongMethodTypeException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
-import sun.invoke.util.Wrapper;
/*
* @test
* @bug 8060483 8066746
* @key randomness
- * @library /lib/testlibrary /lib/testlibrary/jsr292
+ * @library /lib/testlibrary /java/lang/invoke/common
* @modules java.base/sun.invoke.util
* @summary unit tests for MethodHandles.explicitCastArguments()
* @run main ExplicitCastArgumentsTest
@@ -249,21 +250,27 @@ public class ExplicitCastArgumentsTest {
for (Class parent : parents) {
for (int j = 0; j < children.length; j++) {
// Child type to parent type non-null conversion, shoud succeed
- testConversion(mode, children[j], parent, childInst[j], childInst[j], false, null);
+ testConversion(mode, children[j], parent, childInst[j],
+ childInst[j], false, null);
// Child type to parent type null conversion, shoud succeed
- testConversion(mode, children[j], parent, null, null, false, null);
+ testConversion(mode, children[j], parent, null,
+ null, false, null);
// Parent type to child type non-null conversion with parent
// type instance, should fail
- testConversion(mode, parent, children[j], testSuperObj, null, true, ClassCastException.class);
+ testConversion(mode, parent, children[j], testSuperObj,
+ null, true, ClassCastException.class);
// Parent type to child type non-null conversion with child
// type instance, should succeed
- testConversion(mode, parent, children[j], childInst[j], childInst[j], false, null);
+ testConversion(mode, parent, children[j], childInst[j],
+ childInst[j], false, null);
// Parent type to child type null conversion, should succeed
- testConversion(mode, parent, children[j], null, null, false, null);
+ testConversion(mode, parent, children[j], null,
+ null, false, null);
}
// Parent type to child type non-null conversion with sibling
// type instance, should fail
- testConversion(mode, parent, testSubClass1, testObj02, null, true, ClassCastException.class);
+ testConversion(mode, parent, testSubClass1, testObj02,
+ null, true, ClassCastException.class);
}
// Sibling type non-null conversion, should fail
testConversion(mode, testSubClass1,
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
index 92036f09e52..de1c2de4ce8 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,11 +28,15 @@
* @ignore 8078602
* @summary Test verifies that lambda forms are garbage collected
* @author kshefov
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @build TestMethods
* @build LambdaFormTestCase
* @build LFGarbageCollectedTest
- * @run main/othervm -Xmx64m -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+HeapDumpOnOutOfMemoryError -DHEAP_DUMP=false LFGarbageCollectedTest
+ * @run main/othervm -Xmx64m
+ * -XX:SoftRefLRUPolicyMSPerMB=0
+ * -XX:+HeapDumpOnOutOfMemoryError
+ * -DHEAP_DUMP=false
+ * LFGarbageCollectedTest
*/
import java.lang.invoke.MethodHandle;
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
index 84e1dd54ffe..3a4310a4319 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
@@ -27,7 +27,7 @@
* @key randomness
* @summary Test verifies that lambda forms are cached when run with multiple threads
* @author kshefov
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @modules java.base/java.lang.invoke:open
* java.base/java.lang.ref:open
* java.management
@@ -38,16 +38,16 @@
* @run main/othervm LFMultiThreadCachingTest
*/
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
+
import java.lang.invoke.MethodHandle;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
/**
* Multiple threaded lambda forms caching test class.
@@ -57,13 +57,16 @@ public final class LFMultiThreadCachingTest extends LFCachingTestCase {
private static final TestMethods.Kind[] KINDS;
static {
- EnumSet set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
+ EnumSet set
+ = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
KINDS = set.toArray(new TestMethods.Kind[set.size()]);
if (KINDS.length < 2) {
- throw new Error("TESTBUG: KINDS.length[" + KINDS.length + "] should be at least 2");
+ throw new Error("TESTBUG: KINDS.length[" + KINDS.length
+ + "] should be at least 2");
}
}
- private static final int CORES = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
+ private static final int CORES
+ = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
/**
* Constructor a for multiple threaded lambda forms caching test case.
@@ -144,6 +147,7 @@ public final class LFMultiThreadCachingTest extends LFCachingTestCase {
* @param args Accepts no arguments.
*/
public static void main(String[] args) {
- LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
+ LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new,
+ EnumSet.allOf(TestMethods.class));
}
}
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
index bc674b0dbd2..5ca5eb91a11 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
@@ -27,7 +27,7 @@
* @key randomness
* @summary Test verifies that lambda forms are cached when run with single thread
* @author kshefov
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
+ * @library /lib/testlibrary /java/lang/invoke/common
* @modules java.base/java.lang.ref:open
* java.base/java.lang.invoke:open
* java.management
@@ -77,6 +77,7 @@ public final class LFSingleThreadCachingTest extends LFCachingTestCase {
* @param args Accepts no arguments.
*/
public static void main(String[] args) {
- LambdaFormTestCase.runTests(LFSingleThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
+ LambdaFormTestCase.runTests(LFSingleThreadCachingTest::new,
+ EnumSet.allOf(TestMethods.class));
}
}
diff --git a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
index 0bb9c494126..33a08ecd9bf 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,8 +21,11 @@
* questions.
*/
-import com.oracle.testlibrary.jsr292.Helper;
-import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
+import jdk.testlibrary.TimeLimitedRunner;
+import jdk.testlibrary.Utils;
+import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
+import test.java.lang.invoke.lib.Helper;
+
import java.lang.invoke.MethodHandle;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
@@ -32,8 +35,6 @@ import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
-import jdk.testlibrary.Utils;
-import jdk.testlibrary.TimeLimitedRunner;
/**
* Lambda forms caching test case class. Contains all necessary test routines to
@@ -44,7 +45,8 @@ import jdk.testlibrary.TimeLimitedRunner;
*/
public abstract class LambdaFormTestCase {
- private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
+ private static final long TIMEOUT = Helper.IS_THOROUGH ?
+ 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
/**
* Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
@@ -92,7 +94,8 @@ public abstract class LambdaFormTestCase {
long failCounter;
boolean passed;
- TestRun(Function ctor, Collection testMethods) {
+ TestRun(Function ctor,
+ Collection testMethods) {
this.ctor = ctor;
this.testMethods = testMethods;
long testCaseNum = testMethods.size();
@@ -175,10 +178,12 @@ public abstract class LambdaFormTestCase {
* object.
* @param testMethods list of test methods
*/
- public static void runTests(Function ctor, Collection testMethods) {
+ public static void runTests(Function ctor,
+ Collection testMethods) {
LambdaFormTestCase.TestRun run
= new LambdaFormTestCase.TestRun(ctor, testMethods);
- TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration);
+ TimeLimitedRunner runner
+ = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration);
try {
runner.call();
} catch (Exception ex) {
diff --git a/jdk/test/java/lang/invoke/LFCaching/TestMethods.java b/jdk/test/java/lang/invoke/LFCaching/TestMethods.java
index fe63b252d5d..b99f80f5191 100644
--- a/jdk/test/java/lang/invoke/LFCaching/TestMethods.java
+++ b/jdk/test/java/lang/invoke/LFCaching/TestMethods.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,8 @@
* questions.
*/
-import com.oracle.testlibrary.jsr292.Helper;
+import test.java.lang.invoke.lib.Helper;
+
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -41,462 +42,472 @@ import java.util.Map;
public enum TestMethods {
FOLD_ARGUMENTS("foldArguments") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- Class> combinerReturnType;
- if (realArity == 0) {
- combinerReturnType = void.class;
- } else {
- combinerReturnType = Helper.RNG.nextBoolean() ? void.class : mtTarget.parameterType(0);
- }
- data.put("combinerReturnType", combinerReturnType);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ Class> combinerReturnType;
+ if (realArity == 0) {
+ combinerReturnType = void.class;
+ } else {
+ combinerReturnType = Helper.RNG.nextBoolean() ?
+ void.class : mtTarget.parameterType(0);
+ }
+ data.put("combinerReturnType", combinerReturnType);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class> combinerReturnType = (Class) data.get("combinerReturnType");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- Class> rType = mtTarget.returnType();
- int combListStart = (combinerReturnType == void.class) ? 0 : 1;
- if (modifierMHArgNum < combListStart) {
- modifierMHArgNum = combListStart;
- }
- MethodHandle combiner = TestMethods.methodHandleGenerator(combinerReturnType,
- mtTarget.parameterList().subList(combListStart,
- modifierMHArgNum), kind);
- return MethodHandles.foldArguments(target, combiner);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class> combinerReturnType = (Class) data.get("combinerReturnType");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ Class> rType = mtTarget.returnType();
+ int combListStart = (combinerReturnType == void.class) ? 0 : 1;
+ if (modifierMHArgNum < combListStart) {
+ modifierMHArgNum = combListStart;
+ }
+ MethodHandle combiner = TestMethods.methodHandleGenerator(combinerReturnType,
+ mtTarget.parameterList().subList(combListStart,
+ modifierMHArgNum), kind);
+ return MethodHandles.foldArguments(target, combiner);
+ }
+ },
DROP_ARGUMENTS("dropArguments") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int dropArgsPos = Helper.RNG.nextInt(realArity + 1);
- data.put("dropArgsPos", dropArgsPos);
- MethodType mtDropArgs = TestMethods.randomMethodTypeGenerator(
- Helper.RNG.nextInt(super.maxArity - realArity));
- data.put("mtDropArgs", mtDropArgs);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int dropArgsPos = Helper.RNG.nextInt(realArity + 1);
+ data.put("dropArgsPos", dropArgsPos);
+ MethodType mtDropArgs = TestMethods.randomMethodTypeGenerator(
+ Helper.RNG.nextInt(super.maxArity - realArity));
+ data.put("mtDropArgs", mtDropArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtDropArgs = (MethodType) data.get("mtDropArgs");
- int dropArgsPos = (int) data.get("dropArgsPos");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- int mtTgtSlotsCount = TestMethods.argSlotsCount(mtTarget);
- int mtDASlotsCount = TestMethods.argSlotsCount(mtDropArgs);
- List> fakeParList;
- if (mtTgtSlotsCount + mtDASlotsCount > super.maxArity - 1) {
- fakeParList = TestMethods.reduceArgListToSlotsCount(mtDropArgs.parameterList(),
- super.maxArity - mtTgtSlotsCount - 1);
- } else {
- fakeParList = mtDropArgs.parameterList();
- }
- return MethodHandles.dropArguments(target, dropArgsPos, fakeParList);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtDropArgs = (MethodType) data.get("mtDropArgs");
+ int dropArgsPos = (int) data.get("dropArgsPos");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ int mtTgtSlotsCount = TestMethods.argSlotsCount(mtTarget);
+ int mtDASlotsCount = TestMethods.argSlotsCount(mtDropArgs);
+ List> fakeParList;
+ if (mtTgtSlotsCount + mtDASlotsCount > super.maxArity - 1) {
+ fakeParList = TestMethods.reduceArgListToSlotsCount(mtDropArgs.parameterList(),
+ super.maxArity - mtTgtSlotsCount - 1);
+ } else {
+ fakeParList = mtDropArgs.parameterList();
+ }
+ return MethodHandles.dropArguments(target, dropArgsPos, fakeParList);
+ }
+ },
EXPLICIT_CAST_ARGUMENTS("explicitCastArguments", Helper.MAX_ARITY / 2) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- MethodType mtExcplCastArgs = TestMethods.randomMethodTypeGenerator(realArity);
- if (mtTarget.returnType() == void.class) {
- mtExcplCastArgs = MethodType.methodType(void.class,
- mtExcplCastArgs.parameterArray());
- }
- if (mtExcplCastArgs.returnType() == void.class) {
- mtExcplCastArgs = MethodType.methodType(mtTarget.returnType(),
- mtExcplCastArgs.parameterArray());
- }
- data.put("mtExcplCastArgs", mtExcplCastArgs);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ MethodType mtExcplCastArgs = TestMethods.randomMethodTypeGenerator(realArity);
+ if (mtTarget.returnType() == void.class) {
+ mtExcplCastArgs = MethodType.methodType(void.class,
+ mtExcplCastArgs.parameterArray());
+ }
+ if (mtExcplCastArgs.returnType() == void.class) {
+ mtExcplCastArgs = MethodType.methodType(mtTarget.returnType(),
+ mtExcplCastArgs.parameterArray());
+ }
+ data.put("mtExcplCastArgs", mtExcplCastArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtExcplCastArgs = (MethodType) data.get("mtExcplCastArgs");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- return MethodHandles.explicitCastArguments(target, mtExcplCastArgs);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtExcplCastArgs = (MethodType) data.get("mtExcplCastArgs");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ return MethodHandles.explicitCastArguments(target, mtExcplCastArgs);
+ }
+ },
FILTER_ARGUMENTS("filterArguments", Helper.MAX_ARITY / 2) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
- data.put("filterArgsPos", filterArgsPos);
- int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
- data.put("filtersArgsArrayLength", filtersArgsArrayLength);
- MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
- data.put("mtFilter", mtFilter);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
+ data.put("filterArgsPos", filterArgsPos);
+ int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
+ data.put("filtersArgsArrayLength", filtersArgsArrayLength);
+ MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
+ data.put("mtFilter", mtFilter);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtFilter = (MethodType) data.get("mtFilter");
- int filterArgsPos = (int) data.get("filterArgsPos");
- int filtersArgsArrayLength = (int) data.get("filtersArgsArrayLength");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- MethodHandle[] filters = new MethodHandle[filtersArgsArrayLength];
- for (int i = 0; i < filtersArgsArrayLength; i++) {
- filters[i] = TestMethods.filterGenerator(mtFilter.parameterType(i),
- mtTarget.parameterType(filterArgsPos + i), kind);
- }
- return MethodHandles.filterArguments(target, filterArgsPos, filters);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtFilter = (MethodType) data.get("mtFilter");
+ int filterArgsPos = (int) data.get("filterArgsPos");
+ int filtersArgsArrayLength = (int) data.get("filtersArgsArrayLength");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ MethodHandle[] filters = new MethodHandle[filtersArgsArrayLength];
+ for (int i = 0; i < filtersArgsArrayLength; i++) {
+ filters[i] = TestMethods.filterGenerator(mtFilter.parameterType(i),
+ mtTarget.parameterType(filterArgsPos + i), kind);
+ }
+ return MethodHandles.filterArguments(target, filterArgsPos, filters);
+ }
+ },
FILTER_RETURN_VALUE("filterReturnValue") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
- int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
- MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
- data.put("mtFilter", mtFilter);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int filterArgsPos = Helper.RNG.nextInt(realArity + 1);
+ int filtersArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - filterArgsPos);
+ MethodType mtFilter = TestMethods.randomMethodTypeGenerator(filtersArgsArrayLength);
+ data.put("mtFilter", mtFilter);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtFilter = (MethodType) data.get("mtFilter");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- MethodHandle filter = TestMethods.filterGenerator(mtTarget.returnType(),
- mtFilter.returnType(), kind);
- return MethodHandles.filterReturnValue(target, filter);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtFilter = (MethodType) data.get("mtFilter");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ MethodHandle filter = TestMethods.filterGenerator(mtTarget.returnType(),
+ mtFilter.returnType(), kind);
+ return MethodHandles.filterReturnValue(target, filter);
+ }
+ },
INSERT_ARGUMENTS("insertArguments", Helper.MAX_ARITY - 3) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int insertArgsPos = Helper.RNG.nextInt(realArity + 1);
- data.put("insertArgsPos", insertArgsPos);
- int insertArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - insertArgsPos);
- MethodType mtInsertArgs = MethodType.methodType(void.class, mtTarget.parameterList()
- .subList(insertArgsPos, insertArgsPos + insertArgsArrayLength));
- data.put("mtInsertArgs", mtInsertArgs);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int insertArgsPos = Helper.RNG.nextInt(realArity + 1);
+ data.put("insertArgsPos", insertArgsPos);
+ int insertArgsArrayLength = Helper.RNG.nextInt(realArity + 1 - insertArgsPos);
+ MethodType mtInsertArgs = MethodType.methodType(void.class, mtTarget.parameterList()
+ .subList(insertArgsPos, insertArgsPos + insertArgsArrayLength));
+ data.put("mtInsertArgs", mtInsertArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtInsertArgs = (MethodType) data.get("mtInsertArgs");
- int insertArgsPos = (int) data.get("insertArgsPos");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- Object[] insertList = Helper.randomArgs(mtInsertArgs.parameterList());
- return MethodHandles.insertArguments(target, insertArgsPos, insertList);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtInsertArgs = (MethodType) data.get("mtInsertArgs");
+ int insertArgsPos = (int) data.get("insertArgsPos");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ Object[] insertList = Helper.randomArgs(mtInsertArgs.parameterList());
+ return MethodHandles.insertArguments(target, insertArgsPos, insertList);
+ }
+ },
PERMUTE_ARGUMENTS("permuteArguments", Helper.MAX_ARITY / 2) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int[] permuteArgsReorderArray = new int[realArity];
- int mtPermuteArgsNum = Helper.RNG.nextInt(Helper.MAX_ARITY);
- mtPermuteArgsNum = mtPermuteArgsNum == 0 ? 1 : mtPermuteArgsNum;
- MethodType mtPermuteArgs = TestMethods.randomMethodTypeGenerator(mtPermuteArgsNum);
- mtTarget = mtTarget.changeReturnType(mtPermuteArgs.returnType());
- for (int i = 0; i < realArity; i++) {
- int mtPermuteArgsParNum = Helper.RNG.nextInt(mtPermuteArgs.parameterCount());
- permuteArgsReorderArray[i] = mtPermuteArgsParNum;
- mtTarget = mtTarget.changeParameterType(
- i, mtPermuteArgs.parameterType(mtPermuteArgsParNum));
- }
- data.put("mtTarget", mtTarget);
- data.put("permuteArgsReorderArray", permuteArgsReorderArray);
- data.put("mtPermuteArgs", mtPermuteArgs);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int[] permuteArgsReorderArray = new int[realArity];
+ int mtPermuteArgsNum = Helper.RNG.nextInt(Helper.MAX_ARITY);
+ mtPermuteArgsNum = mtPermuteArgsNum == 0 ? 1 : mtPermuteArgsNum;
+ MethodType mtPermuteArgs = TestMethods.randomMethodTypeGenerator(mtPermuteArgsNum);
+ mtTarget = mtTarget.changeReturnType(mtPermuteArgs.returnType());
+ for (int i = 0; i < realArity; i++) {
+ int mtPermuteArgsParNum = Helper.RNG.nextInt(mtPermuteArgs.parameterCount());
+ permuteArgsReorderArray[i] = mtPermuteArgsParNum;
+ mtTarget = mtTarget.changeParameterType(
+ i, mtPermuteArgs.parameterType(mtPermuteArgsParNum));
+ }
+ data.put("mtTarget", mtTarget);
+ data.put("permuteArgsReorderArray", permuteArgsReorderArray);
+ data.put("mtPermuteArgs", mtPermuteArgs);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- MethodType mtPermuteArgs = (MethodType) data.get("mtPermuteArgs");
- int[] permuteArgsReorderArray = (int[]) data.get("permuteArgsReorderArray");
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), kind);
- return MethodHandles.permuteArguments(target, mtPermuteArgs, permuteArgsReorderArray);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ MethodType mtPermuteArgs = (MethodType) data.get("mtPermuteArgs");
+ int[] permuteArgsReorderArray = (int[]) data.get("permuteArgsReorderArray");
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), kind);
+ return MethodHandles.permuteArguments(target, mtPermuteArgs, permuteArgsReorderArray);
+ }
+ },
THROW_EXCEPTION("throwException") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- Class> rType = mtTarget.returnType();
- return MethodHandles.throwException(rType, Exception.class
- );
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ Class> rType = mtTarget.returnType();
+ return MethodHandles.throwException(rType, Exception.class
+ );
+ }
+ },
GUARD_WITH_TEST("guardWithTest") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- TestMethods.Kind targetKind;
- TestMethods.Kind fallbackKind;
- if (kind.equals(TestMethods.Kind.ONE)) {
- targetKind = TestMethods.Kind.ONE;
- fallbackKind = TestMethods.Kind.TWO;
- } else {
- targetKind = TestMethods.Kind.TWO;
- fallbackKind = TestMethods.Kind.ONE;
- }
- MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), targetKind);
- MethodHandle fallback = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), fallbackKind);
- MethodHandle test = TestMethods.methodHandleGenerator(boolean.class,
- mtTarget.parameterList().subList(0, modifierMHArgNum), kind);
- return MethodHandles.guardWithTest(test, target, fallback);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ TestMethods.Kind targetKind;
+ TestMethods.Kind fallbackKind;
+ if (kind.equals(TestMethods.Kind.ONE)) {
+ targetKind = TestMethods.Kind.ONE;
+ fallbackKind = TestMethods.Kind.TWO;
+ } else {
+ targetKind = TestMethods.Kind.TWO;
+ fallbackKind = TestMethods.Kind.ONE;
+ }
+ MethodHandle target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), targetKind);
+ MethodHandle fallback = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), fallbackKind);
+ MethodHandle test = TestMethods.methodHandleGenerator(boolean.class,
+ mtTarget.parameterList().subList(0, modifierMHArgNum), kind);
+ return MethodHandles.guardWithTest(test, target, fallback);
+ }
+ },
CATCH_EXCEPTION("catchException") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) throws NoSuchMethodException, IllegalAccessException {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- MethodHandle target;
- if (kind.equals(TestMethods.Kind.ONE)) {
- target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), TestMethods.Kind.ONE);
- } else {
- target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
- mtTarget.parameterList(), TestMethods.Kind.EXCEPT);
- }
- List> handlerParamList = new ArrayList<>(mtTarget.parameterCount() + 1);
- handlerParamList.add(Exception.class);
- handlerParamList.addAll(mtTarget.parameterList().subList(0, modifierMHArgNum));
- MethodHandle handler = TestMethods.methodHandleGenerator(
- mtTarget.returnType(), handlerParamList, TestMethods.Kind.TWO);
- return MethodHandles.catchException(target, Exception.class, handler);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind)
+ throws NoSuchMethodException, IllegalAccessException {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ MethodHandle target;
+ if (kind.equals(TestMethods.Kind.ONE)) {
+ target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), TestMethods.Kind.ONE);
+ } else {
+ target = TestMethods.methodHandleGenerator(mtTarget.returnType(),
+ mtTarget.parameterList(), TestMethods.Kind.EXCEPT);
+ }
+ List> handlerParamList = new ArrayList<>(mtTarget.parameterCount() + 1);
+ handlerParamList.add(Exception.class);
+ handlerParamList.addAll(mtTarget.parameterList().subList(0, modifierMHArgNum));
+ MethodHandle handler = TestMethods.methodHandleGenerator(
+ mtTarget.returnType(), handlerParamList, TestMethods.Kind.TWO);
+ return MethodHandles.catchException(target, Exception.class, handler);
+ }
+ },
INVOKER("invoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- return MethodHandles.invoker(mtTarget);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ return MethodHandles.invoker(mtTarget);
+ }
+ },
EXACT_INVOKER("exactInvoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- return MethodHandles.exactInvoker(mtTarget);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ return MethodHandles.exactInvoker(mtTarget);
+ }
+ },
SPREAD_INVOKER("spreadInvoker", Helper.MAX_ARITY - 1) {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- // Arity after reducing because of long and double take 2 slots.
- int realArity = mtTarget.parameterCount();
- int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
- data.put("modifierMHArgNum", modifierMHArgNum);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map data = new HashMap<>();
+ int desiredArity = Helper.RNG.nextInt(super.maxArity);
+ MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
+ data.put("mtTarget", mtTarget);
+ // Arity after reducing because of long and double take 2 slots.
+ int realArity = mtTarget.parameterCount();
+ int modifierMHArgNum = Helper.RNG.nextInt(realArity + 1);
+ data.put("modifierMHArgNum", modifierMHArgNum);
+ return data;
+ }
- @Override
- protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
- MethodType mtTarget = (MethodType) data.get("mtTarget");
- int modifierMHArgNum = (int) data.get("modifierMHArgNum");
- return MethodHandles.spreadInvoker(mtTarget, modifierMHArgNum);
- }
- },
+ @Override
+ protected MethodHandle getMH(Map data, TestMethods.Kind kind) {
+ MethodType mtTarget = (MethodType) data.get("mtTarget");
+ int modifierMHArgNum = (int) data.get("modifierMHArgNum");
+ return MethodHandles.spreadInvoker(mtTarget, modifierMHArgNum);
+ }
+ },
ARRAY_ELEMENT_GETTER("arrayElementGetter") {
- @Override
- public Map getTestCaseData() {
- Map data = new HashMap<>();
- int desiredArity = Helper.RNG.nextInt(super.maxArity);
- MethodType mtTarget = TestMethods.randomMethodTypeGenerator(desiredArity);
- data.put("mtTarget", mtTarget);
- return data;
- }
+ @Override
+ public Map getTestCaseData() {
+ Map