From 8bd00f84a548e26ccc7305197058907fc4febaf0 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Fri, 28 Apr 2017 14:34:24 +0200 Subject: [PATCH 001/105] 8179618: Fixes for range of OptoLoopAlignment and Inlining flags OptoLoopAlignment must be multiple of NOP size. Inlining flags must not exceed WarmCallInfo::MAX_VALUE(). Reviewed-by: kvn, stuefe --- hotspot/src/share/vm/opto/c2_globals.hpp | 17 +++++++++-------- .../commandLineFlagConstraintsCompiler.cpp | 7 ++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 49bcbf42ae8..491bf872035 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -420,37 +420,38 @@ develop(bool, InlineWarmCalls, false, \ "Use a heat-based priority queue to govern inlining") \ \ + /* Max values must not exceed WarmCallInfo::MAX_VALUE(). */ \ develop(intx, HotCallCountThreshold, 999999, \ "large numbers of calls (per method invocation) force hotness") \ - range(0, max_intx) \ + range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, HotCallProfitThreshold, 999999, \ "highly profitable inlining opportunities force hotness") \ - range(0, max_intx) \ + range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, HotCallTrivialWork, -1, \ "trivial execution time (no larger than this) forces hotness") \ - range(-1, max_intx) \ + range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, HotCallTrivialSize, -1, \ "trivial methods (no larger than this) force calls to be hot") \ - range(-1, max_intx) \ + range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, WarmCallMinCount, -1, \ "number of calls (per method invocation) to enable inlining") \ - range(-1, max_intx) \ + range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, WarmCallMinProfit, -1, \ "number of calls (per method invocation) to enable inlining") \ - range(-1, max_intx) \ + range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, WarmCallMaxWork, 999999, \ "execution time of the largest inlinable method") \ - range(0, max_intx) \ + range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ develop(intx, WarmCallMaxSize, 999999, \ "size of the largest inlinable method") \ - range(0, max_intx) \ + range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \ \ product(intx, MaxNodeLimit, 80000, \ "Maximum number of nodes") \ diff --git a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp index 5aeb7cfcc44..14f4c216031 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp @@ -276,14 +276,15 @@ Flag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) { return Flag::VIOLATES_CONSTRAINT; } -#ifdef SPARC + // Relevant on ppc, s390, sparc. Will be optimized where + // addr_unit() == 1. if (OptoLoopAlignment % relocInfo::addr_unit() != 0) { CommandLineError::print(verbose, "OptoLoopAlignment (" INTX_FORMAT ") must be " - "multiple of NOP size\n"); + "multiple of NOP size (%d)\n", + value, relocInfo::addr_unit()); return Flag::VIOLATES_CONSTRAINT; } -#endif return Flag::SUCCESS; } From 0a727480c2f3c9cd5c671b17ccc21ef9321db835 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 28 Apr 2017 15:41:38 -0700 Subject: [PATCH 002/105] 8179460: Fix unnecessary uses of {@docRoot} in serviceability APIs Reviewed-by: mchung --- .../classes/com/sun/tools/jconsole/JConsolePlugin.java | 7 +++---- .../share/classes/com/sun/jdi/ThreadGroupReference.java | 2 +- .../classes/com/sun/management/DiagnosticCommandMBean.java | 2 +- .../share/classes/com/sun/management/package-info.java | 6 ++---- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/jdk/src/jdk.jconsole/share/classes/com/sun/tools/jconsole/JConsolePlugin.java b/jdk/src/jdk.jconsole/share/classes/com/sun/tools/jconsole/JConsolePlugin.java index 04da16e4897..3e61ea9e438 100644 --- a/jdk/src/jdk.jconsole/share/classes/com/sun/tools/jconsole/JConsolePlugin.java +++ b/jdk/src/jdk.jconsole/share/classes/com/sun/tools/jconsole/JConsolePlugin.java @@ -34,8 +34,8 @@ import javax.swing.SwingWorker; /** * A JConsole plugin class. JConsole uses the - * - * service provider mechanism to search the JConsole plugins. + * {@link java.util.ServiceLoader service provider} + * mechanism to search the JConsole plugins. * Users can provide their JConsole plugins in a jar file * containing a file named * @@ -67,8 +67,7 @@ import javax.swing.SwingWorker; * call its {@link #getTabs getTabs} method and add the returned * tabs to the JConsole window. * - * @see - * java.util.ServiceLoader + * @see java.util.ServiceLoader * * @since 1.6 */ diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadGroupReference.java b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadGroupReference.java index 9c33180ee9b..dd003fa273e 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadGroupReference.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadGroupReference.java @@ -92,7 +92,7 @@ public interface ThreadGroupReference extends ObjectReference { * Returns a List containing each active {@link ThreadGroupReference} in this * thread group. Only the active thread groups in this immediate thread group * (and not its subgroups) are returned. - * See java.lang.ThreadGroup + * See {@link java.lang.ThreadGroup} * for information about 'active' ThreadGroups. * @return a List of {@link ThreadGroupReference} objects mirroring the * active thread groups from this thread group in the target VM. diff --git a/jdk/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java index 1d2a85e62b2..c0cf7c5f2a8 100644 --- a/jdk/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java @@ -205,7 +205,7 @@ import javax.management.DynamicMBean; * Virtual Machine is modified, the {@code DiagnosticCommandMBean} emits * a {@link javax.management.Notification} with a * {@linkplain javax.management.Notification#getType() type} of - * + * * {@code "jmx.mbean.info.changed"} and a * {@linkplain javax.management.Notification#getUserData() userData} that * is the new {@code MBeanInfo}. diff --git a/jdk/src/jdk.management/share/classes/com/sun/management/package-info.java b/jdk/src/jdk.management/share/classes/com/sun/management/package-info.java index 92b200f19b4..fd6f2d060f0 100644 --- a/jdk/src/jdk.management/share/classes/com/sun/management/package-info.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/package-info.java @@ -26,15 +26,13 @@ /** * This package contains Oracle Corporation's platform extension to * the implementation of the - * - * java.lang.management API and also defines the management + * {@link java.lang.management} API and also defines the management * interface for some other components for the platform. * *

* All platform MBeans are registered in the platform MBeanServer * which can be obtained via the - * - * java.lang.management.ManagementFactory.getPlatformMBeanServer + * {@link java.lang.management.ManagementFactory#getPlatformMBeanServer} * * @author Mandy Chung * @since 1.5 From 0ee4f3019da220a8bb3bfba065addce9415e43a0 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Tue, 9 May 2017 16:48:31 +0200 Subject: [PATCH 003/105] 8179953: [ppc] TLABWasteIncrement not loaded correctly Also fix TestOptionWithRanges to show the bug. Reviewed-by: dholmes, shade --- hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp | 2 +- .../common/optionsvalidation/JVMOption.java | 6 +++++- .../common/optionsvalidation/JVMOptionsUtils.java | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp index 798ec3bf9ff..68865489de2 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -3720,7 +3720,7 @@ void TemplateTable::_new() { __ bge(CCR0, Lslow_case); // Increment waste limit to prevent getting stuck on this slow path. - __ addi(RtlabWasteLimitValue, RtlabWasteLimitValue, (int)ThreadLocalAllocBuffer::refill_waste_limit_increment()); + __ add_const_optimized(RtlabWasteLimitValue, RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment()); __ std(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread); } // else: No allocation in the shared eden. // fallthru: __ b(Lslow_case); diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java index b10ac75c56e..20d8f7a553b 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java @@ -383,7 +383,11 @@ public abstract class JVMOption { runJava.add(VMType); } - if (GCType != null) { + if (GCType != null && + !(prepend.contains("-XX:+UseConcMarkSweepGC") || + prepend.contains("-XX:+UseSerialGC") || + prepend.contains("-XX:+UseParallelGC") || + prepend.contains("-XX:+UseG1GC"))) { runJava.add(GCType); } diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java index 3c694560e76..f406a85b86e 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java @@ -242,6 +242,9 @@ public class JVMOptionsUtils { option.addPrepend("-XX:SharedArchiveFile=TestOptionsWithRanges.jsa"); option.addPrepend("-Xshare:dump"); break; + case "TLABWasteIncrement": + option.addPrepend("-XX:+UseParallelGC"); + break; default: /* Do nothing */ break; From 30c35f5e348cd59a1c4f610ec8e86d20cb78aebf Mon Sep 17 00:00:00 2001 From: Ron Pressler Date: Tue, 9 May 2017 15:04:46 -0700 Subject: [PATCH 004/105] 8177153: LambdaMetafactory has default constructor Reviewed-by: psandoz --- .../share/classes/java/lang/invoke/LambdaMetafactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java index b09744cba7d..5f56dd6ab43 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java @@ -213,7 +213,9 @@ import java.util.Arrays; * methods. * @since 1.8 */ -public class LambdaMetafactory { +public final class LambdaMetafactory { + + private LambdaMetafactory() {} /** Flag for alternate metafactories indicating the lambda object * must be serializable */ From 26ae2cbf89f5195ee05bc443b52e7a4adef5d9ce Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 9 May 2017 17:20:10 -0700 Subject: [PATCH 005/105] 8179479: Add new styles to enable HTML 5 tables Reviewed-by: bpatel --- .../doclets/toolkit/resources/stylesheet.css | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css index 985466b8c54..073dc84bf63 100644 --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css @@ -789,4 +789,82 @@ ul.ui-autocomplete li { z-index: 1; } +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} + +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} + +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} + +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} + +table.plain { + border-collapse: collapse; + border: 1px solid black; +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid black; +} + +table.striped { + border-collapse: collapse; + border: 1px solid black; +} +table.striped > thead { + background-color: #DDD; + border: 1px solid black; +} +table.striped > tbody > tr:nth-child(even) { + background-color: #EEE +} +table.striped > tbody > tr:nth-child(odd) { + background-color: #FFF +} +table.striped > thead > tr > th, table.striped > tbody > tr > th, +table.striped > tbody > tr > td, table.striped > tbody > tr > td { + border-left: 1px solid black; + border-right: 1px solid black; +} From a6a7d06315082554f590e08ff55f3d0ce92e4e26 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Tue, 9 May 2017 18:26:42 -0700 Subject: [PATCH 006/105] 8179868: Java API Docs of javax.xml.transform.stax contains TODOs Reviewed-by: lancea, bpb --- .../javax/xml/transform/stax/package.html | 74 +++++++++---------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html index abdd5ecd846..0275a36f737 100644 --- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html +++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/package.html @@ -1,7 +1,6 @@ + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - javax.xml.transform.stax + + javax.xml.transform.stax - - - - - -

- Provides for StAX-specific transformation APIs. - TODO: better description(s). -

+ + + + + +

+ This package implements StAX-specific transformation APIs. It provides + classes which allow input from a StAX reader, that is, + {@link javax.xml.stream.XMLStreamReader} or {@link javax.xml.stream.XMLEventReader}, + and output to a StAX writer, that is, + {@link javax.xml.stream.XMLStreamWriter} or {@link javax.xml.stream.XMLEventWriter}. +

+

+ The {@link javax.xml.transform.stax.StAXSource} class encapsulates a + {@link javax.xml.stream.XMLStreamReader} or {@link javax.xml.stream.XMLEventReader} + and can be used as an input where a {@link javax.xml.transform.Source} + object is accepted. +

+

+ The {@link javax.xml.transform.stax.StAXResult} class encapsulates a + {@link javax.xml.stream.XMLStreamWriter} or {@link javax.xml.stream.XMLEventWriter} + and can be used as an output where a {@link javax.xml.transform.Result} + object is accepted. +

-

Package Specification

- - -

Related Documentation

- -

For overviews, tutorials, examples, guides, and tool documentation, please see:

- - - - - - @since 1.6 - + @since 1.6 + + From e52af5f5b3eb4149b9e88ccd382f3981162305f8 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 10 May 2017 09:02:43 +0200 Subject: [PATCH 007/105] 8178278: Move Standard Algorithm Names document to specs directory Reviewed-by: erikj, wetmore, mullan --- .../security/AlgorithmParameterGenerator.java | 16 ++++----- .../java/security/AlgorithmParameters.java | 18 +++++----- .../classes/java/security/DrbgParameters.java | 4 +-- .../classes/java/security/KeyFactory.java | 18 +++++----- .../java/security/KeyPairGenerator.java | 26 +++++++------- .../share/classes/java/security/KeyStore.java | 23 ++++++------- .../classes/java/security/MessageDigest.java | 26 +++++++------- .../share/classes/java/security/Policy.java | 14 ++++---- .../classes/java/security/SecureRandom.java | 34 +++++++++---------- .../java/security/SecureRandomSpi.java | 4 +-- .../share/classes/java/security/Security.java | 14 ++++---- .../classes/java/security/Signature.java | 22 ++++++------ .../classes/java/security/cert/CertPath.java | 6 ++-- .../java/security/cert/CertPathBuilder.java | 18 +++++----- .../java/security/cert/CertPathValidator.java | 22 ++++++------ .../classes/java/security/cert/CertStore.java | 18 +++++----- .../java/security/cert/Certificate.java | 6 ++-- .../security/cert/CertificateFactory.java | 28 +++++++-------- .../security/cert/CertificateFactorySpi.java | 6 ++-- .../java/security/cert/package-info.java | 9 +++-- .../classes/java/security/package-info.java | 9 +++-- .../java/security/spec/EncodedKeySpec.java | 6 ++-- .../security/spec/PKCS8EncodedKeySpec.java | 6 ++-- .../security/spec/X509EncodedKeySpec.java | 6 ++-- .../share/classes/javax/crypto/Cipher.java | 18 +++++----- .../javax/crypto/ExemptionMechanism.java | 14 ++++---- .../classes/javax/crypto/KeyAgreement.java | 18 +++++----- .../classes/javax/crypto/KeyGenerator.java | 18 +++++----- .../share/classes/javax/crypto/Mac.java | 18 +++++----- .../javax/crypto/SecretKeyFactory.java | 18 +++++----- .../classes/javax/crypto/package-info.java | 8 ++--- .../classes/javax/net/ssl/SSLContext.java | 21 +++++------- .../classes/javax/net/ssl/SSLEngine.java | 8 ++--- .../classes/javax/net/ssl/SSLParameters.java | 11 +++--- .../javax/net/ssl/SSLServerSocket.java | 8 ++--- .../javax/net/ssl/SSLServerSocketFactory.java | 6 ++-- .../classes/javax/net/ssl/SSLSocket.java | 8 ++--- .../javax/net/ssl/SSLSocketFactory.java | 6 ++-- .../javax/net/ssl/TrustManagerFactory.java | 6 ++-- .../classes/javax/net/ssl/package-info.java | 8 ++--- .../security/auth/login/Configuration.java | 24 ++++++------- .../security/auth/login/package-info.java | 9 +++-- .../jdk/security/jarsigner/JarSigner.java | 10 +++--- 43 files changed, 294 insertions(+), 302 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java index 7d1134493ce..8694b603c07 100644 --- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java +++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java @@ -75,9 +75,9 @@ import java.util.Objects; *
  • {@code DSA} (1024, 2048)
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#algorithmparametergenerator-algorithms"> * AlgorithmParameterGenerator section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -150,8 +150,8 @@ public class AlgorithmParameterGenerator { * @param algorithm the name of the algorithm this * parameter generator is associated with. * See the AlgorithmParameterGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#algorithmparametergenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code AlgorithmParameterGenerator} object @@ -195,8 +195,8 @@ public class AlgorithmParameterGenerator { * @param algorithm the name of the algorithm this * parameter generator is associated with. * See the AlgorithmParameterGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#algorithmparametergenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the string name of the Provider. @@ -245,8 +245,8 @@ public class AlgorithmParameterGenerator { * @param algorithm the string name of the algorithm this * parameter generator is associated with. * See the AlgorithmParameterGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#algorithmparametergenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the {@code Provider} object. diff --git a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java index e03361233a5..a5ed953e65b 100644 --- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java +++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,9 +57,9 @@ import java.util.Objects; *
  • {@code DSA}
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#algorithmparameters-algorithms"> * AlgorithmParameters section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -137,8 +137,8 @@ public class AlgorithmParameters { * * @param algorithm the name of the algorithm requested. * See the AlgorithmParameters section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#algorithmparameters-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new parameter object @@ -182,8 +182,8 @@ public class AlgorithmParameters { * * @param algorithm the name of the algorithm requested. * See the AlgorithmParameters section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#algorithmparameters-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -232,8 +232,8 @@ public class AlgorithmParameters { * * @param algorithm the name of the algorithm requested. * See the AlgorithmParameters section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#algorithmparameters-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. diff --git a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java b/jdk/src/java.base/share/classes/java/security/DrbgParameters.java index b17cf07ace8..4767861e3ad 100644 --- a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java +++ b/jdk/src/java.base/share/classes/java/security/DrbgParameters.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 @@ -188,7 +188,7 @@ import java.util.Objects; * @implSpec * By convention, a provider should name its primary DRBG implementation * with the + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> * standard {@code SecureRandom} algorithm name "DRBG". * * @implNote diff --git a/jdk/src/java.base/share/classes/java/security/KeyFactory.java b/jdk/src/java.base/share/classes/java/security/KeyFactory.java index 4d297157ebc..8171cb1b568 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyFactory.java +++ b/jdk/src/java.base/share/classes/java/security/KeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,9 +75,9 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code RSA}
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> * KeyFactory section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -163,8 +163,8 @@ public class KeyFactory { * * @param algorithm the name of the requested key algorithm. * See the KeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code KeyFactory} object @@ -197,8 +197,8 @@ public class KeyFactory { * * @param algorithm the name of the requested key algorithm. * See the KeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -239,8 +239,8 @@ public class KeyFactory { * * @param algorithm the name of the requested key algorithm. * See the KeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java index 10d2f067f83..b2f87720e80 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java +++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,9 +114,9 @@ import sun.security.util.Debug; *
  • {@code RSA} (1024, 2048, 4096)
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> * KeyPairGenerator section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -142,8 +142,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { * * @param algorithm the standard string name of the algorithm. * See the KeyPairGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. */ protected KeyPairGenerator(String algorithm) { @@ -153,8 +153,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { /** * Returns the standard name of the algorithm for this key pair generator. * See the KeyPairGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the standard string name of the algorithm. @@ -205,8 +205,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { * * @param algorithm the standard string name of the algorithm. * See the KeyPairGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code KeyPairGenerator} object @@ -264,8 +264,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { * * @param algorithm the standard string name of the algorithm. * See the KeyPairGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the string name of the provider. @@ -306,8 +306,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { * * @param algorithm the standard string name of the algorithm. * See the KeyPairGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keypairgenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java index f963cae1390..fec312740f4 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyStore.java +++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,9 +176,9 @@ import sun.security.util.Debug; *
  • {@code PKCS12}
  • * * This type is described in the + * "{@docRoot}/../specs/security/standard-names.html#keystore-types"> * KeyStore section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other types are supported. * @@ -291,9 +291,8 @@ public class KeyStore { * @param protectionAlgorithm the encryption algorithm name, for * example, {@code PBEWithHmacSHA256AndAES_256}. * See the Cipher section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation + * "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names"> + * Java Security Standard Algorithm Names Specification * for information about standard encryption algorithm names. * @param protectionParameters the encryption algorithm parameter * specification, which may be {@code null} @@ -854,8 +853,8 @@ public class KeyStore { * * @param type the type of keystore. * See the KeyStore section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keystore-types"> + * Java Security Standard Algorithm Names Specification * for information about standard keystore types. * * @return a keystore object of the specified type @@ -895,8 +894,8 @@ public class KeyStore { * * @param type the type of keystore. * See the KeyStore section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keystore-types"> + * Java Security Standard Algorithm Names Specification * for information about standard keystore types. * * @param provider the name of the provider. @@ -941,8 +940,8 @@ public class KeyStore { * * @param type the type of keystore. * See the KeyStore section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keystore-types"> + * Java Security Standard Algorithm Names Specification * for information about standard keystore types. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/java/security/MessageDigest.java b/jdk/src/java.base/share/classes/java/security/MessageDigest.java index 692dce5a10f..14eb6d6e7fe 100644 --- a/jdk/src/java.base/share/classes/java/security/MessageDigest.java +++ b/jdk/src/java.base/share/classes/java/security/MessageDigest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,9 +89,9 @@ import javax.crypto.SecretKey; *
  • {@code SHA-256}
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> * MessageDigest section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -123,8 +123,8 @@ public abstract class MessageDigest extends MessageDigestSpi { * * @param algorithm the standard name of the digest algorithm. * See the MessageDigest section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. */ protected MessageDigest(String algorithm) { @@ -154,8 +154,8 @@ public abstract class MessageDigest extends MessageDigestSpi { * * @param algorithm the name of the algorithm requested. * See the MessageDigest section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return a {@code MessageDigest} object that implements the @@ -209,8 +209,8 @@ public abstract class MessageDigest extends MessageDigestSpi { * * @param algorithm the name of the algorithm requested. * See the MessageDigest section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -262,8 +262,8 @@ public abstract class MessageDigest extends MessageDigestSpi { * * @param algorithm the name of the algorithm requested. * See the MessageDigest section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. @@ -497,8 +497,8 @@ public abstract class MessageDigest extends MessageDigestSpi { * implementation details. The name should be a standard * Java Security name (such as "SHA", "MD5", and so on). * See the MessageDigest section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the name of the algorithm diff --git a/jdk/src/java.base/share/classes/java/security/Policy.java b/jdk/src/java.base/share/classes/java/security/Policy.java index 73737ddb525..bad4f522367 100644 --- a/jdk/src/java.base/share/classes/java/security/Policy.java +++ b/jdk/src/java.base/share/classes/java/security/Policy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -365,8 +365,8 @@ public abstract class Policy { * * @param type the specified Policy type. See the Policy section in the * - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#policy-types"> + * Java Security Standard Algorithm Names Specification * for a list of standard Policy types. * * @param params parameters for the Policy, which may be null. @@ -419,8 +419,8 @@ public abstract class Policy { * * @param type the specified Policy type. See the Policy section in the * - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#policy-types"> + * Java Security Standard Algorithm Names Specification * for a list of standard Policy types. * * @param params parameters for the Policy, which may be null. @@ -485,8 +485,8 @@ public abstract class Policy { * * @param type the specified Policy type. See the Policy section in the * - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#policy-types"> + * Java Security Standard Algorithm Names Specification * for a list of standard Policy types. * * @param params parameters for the Policy, which may be null. diff --git a/jdk/src/java.base/share/classes/java/security/SecureRandom.java b/jdk/src/java.base/share/classes/java/security/SecureRandom.java index 4f9f1b3a460..ae1f04f2896 100644 --- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java +++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java @@ -126,7 +126,7 @@ import sun.security.util.Debug; * @implSpec * A {@code SecureRandom} service provider can advertise that it is thread-safe * by setting the service + * "{@docRoot}/../specs/security/standard-names.html#service-attributes">service * provider attribute "ThreadSafe" to "true" when registering the provider. * Otherwise, this class will instead synchronize access to the following * methods of the {@code SecureRandomSpi} implementation: @@ -203,8 +203,8 @@ public class SecureRandom extends java.util.Random { * the {@link Security#getProviders() Security.getProviders()} method. * *

    See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. */ public SecureRandom() { @@ -244,8 +244,8 @@ public class SecureRandom extends java.util.Random { * the {@link Security#getProviders() Security.getProviders()} method. * *

    See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @param seed the seed. @@ -341,8 +341,8 @@ public class SecureRandom extends java.util.Random { * * @param algorithm the name of the RNG algorithm. * See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @return the new {@code SecureRandom} object @@ -380,8 +380,8 @@ public class SecureRandom extends java.util.Random { * * @param algorithm the name of the RNG algorithm. * See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @param provider the name of the provider. @@ -424,8 +424,8 @@ public class SecureRandom extends java.util.Random { * * @param algorithm the name of the RNG algorithm. * See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @param provider the provider. @@ -478,8 +478,8 @@ public class SecureRandom extends java.util.Random { * * @param algorithm the name of the RNG algorithm. * See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @param params the {@code SecureRandomParameters} @@ -528,8 +528,8 @@ public class SecureRandom extends java.util.Random { * * @param algorithm the name of the RNG algorithm. * See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @param params the {@code SecureRandomParameters} @@ -581,8 +581,8 @@ public class SecureRandom extends java.util.Random { * * @param algorithm the name of the RNG algorithm. * See the {@code SecureRandom} section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#securerandom-number-generation-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard RNG algorithm names. * * @param params the {@code SecureRandomParameters} diff --git a/jdk/src/java.base/share/classes/java/security/SecureRandomSpi.java b/jdk/src/java.base/share/classes/java/security/SecureRandomSpi.java index fefbe576a02..8443baf68ee 100644 --- a/jdk/src/java.base/share/classes/java/security/SecureRandomSpi.java +++ b/jdk/src/java.base/share/classes/java/security/SecureRandomSpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ package java.security; * will synchronize access to each of the applicable engine methods * (see {@link SecureRandom} for the list of methods). However, if a * {@code SecureRandomSpi} implementation is thread-safe, the + * "{@docRoot}/../specs/security/standard-names.html#service-attributes"> * service provider attribute "ThreadSafe" should be set to "true" during * its registration, as follows: *

    diff --git a/jdk/src/java.base/share/classes/java/security/Security.java b/jdk/src/java.base/share/classes/java/security/Security.java
    index 1076b1d7da7..6c341abc92d 100644
    --- a/jdk/src/java.base/share/classes/java/security/Security.java
    +++ b/jdk/src/java.base/share/classes/java/security/Security.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -281,8 +281,8 @@ public final class Security {
         /**
          * Gets a specified property for an algorithm. The algorithm name
          * should be a standard name. See the 
    -     * Java Cryptography Architecture Standard Algorithm Name Documentation
    +     * "{@docRoot}/../specs/security/standard-names.html">
    +     * Java Security Standard Algorithm Names Specification
          * for information about standard algorithm names.
          *
          * One possible use is by specialized algorithm parsers, which may map
    @@ -511,8 +511,8 @@ public final class Security {
          * 
          *
          * 

    See the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html"> + * Java Security Standard Algorithm Names Specification * for information about standard cryptographic service names, standard * algorithm names and standard attribute names. * @@ -582,8 +582,8 @@ public final class Security { * * *

    See the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html"> + * Java Security Standard Algorithm Names Specification * for information about standard cryptographic service names, standard * algorithm names and standard attribute names. * diff --git a/jdk/src/java.base/share/classes/java/security/Signature.java b/jdk/src/java.base/share/classes/java/security/Signature.java index df5350e99f1..fd5dfad650a 100644 --- a/jdk/src/java.base/share/classes/java/security/Signature.java +++ b/jdk/src/java.base/share/classes/java/security/Signature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -106,9 +106,9 @@ import sun.security.jca.GetInstance.Instance; *

  • {@code SHA256withRSA}
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> * Signature section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -164,8 +164,8 @@ public abstract class Signature extends SignatureSpi { * * @param algorithm the standard string name of the algorithm. * See the Signature section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. */ protected Signature(String algorithm) { @@ -209,8 +209,8 @@ public abstract class Signature extends SignatureSpi { * * @param algorithm the standard name of the algorithm requested. * See the Signature section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code Signature} object @@ -332,8 +332,8 @@ public abstract class Signature extends SignatureSpi { * * @param algorithm the name of the algorithm requested. * See the Signature section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -385,8 +385,8 @@ public abstract class Signature extends SignatureSpi { * * @param algorithm the name of the algorithm requested. * See the Signature section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPath.java b/jdk/src/java.base/share/classes/java/security/cert/CertPath.java index 88df135f6c0..295c5aa8804 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/CertPath.java +++ b/jdk/src/java.base/share/classes/java/security/cert/CertPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,9 +91,9 @@ import java.util.List; *
  • {@code PkiPath}
  • * * These encodings are described in the + * "{@docRoot}/../specs/security/standard-names.html#certpath-encodings"> * CertPath Encodings section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other encodings are supported. *

    diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java index 12f608816be..46d5c77580c 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java +++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,9 +72,9 @@ import sun.security.jca.GetInstance.Instance; *

  • {@code PKIX}
  • * * This algorithm is described in the + * "{@docRoot}/../specs/security/standard-names.html#certpathbuilder-algorithms"> * CertPathBuilder section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -152,8 +152,8 @@ public class CertPathBuilder { * * @param algorithm the name of the requested {@code CertPathBuilder} * algorithm. See the CertPathBuilder section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpathbuilder-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return a {@code CertPathBuilder} object that implements the @@ -190,8 +190,8 @@ public class CertPathBuilder { * * @param algorithm the name of the requested {@code CertPathBuilder} * algorithm. See the CertPathBuilder section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpathbuilder-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -233,8 +233,8 @@ public class CertPathBuilder { * * @param algorithm the name of the requested {@code CertPathBuilder} * algorithm. See the CertPathBuilder section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpathbuilder-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java index 298923d84a2..57efedd3348 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java +++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,9 +74,9 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code PKIX}
  • * * This algorithm is described in the + * "{@docRoot}/../specs/security/standard-names.html#certpathvalidator-algorithms"> * CertPathValidator section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -152,9 +152,9 @@ public class CertPathValidator { * {@link Security#getProviders() Security.getProviders()}. * * @param algorithm the name of the requested {@code CertPathValidator} - * algorithm. See the CertPathValidator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * algorithm. See the CertPathValidator section in the + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return a {@code CertPathValidator} object that implements the @@ -190,9 +190,9 @@ public class CertPathValidator { * the {@link Security#getProviders() Security.getProviders()} method. * * @param algorithm the name of the requested {@code CertPathValidator} - * algorithm. See the CertPathValidator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * algorithm. See the CertPathValidator section in the + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -235,8 +235,8 @@ public class CertPathValidator { * * @param algorithm the name of the requested {@code CertPathValidator} * algorithm. See the CertPathValidator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpathvalidator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java index e62d39f27b0..0d7675c13af 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java +++ b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,9 +67,9 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code Collection}
  • * * This type is described in the + * "{@docRoot}/../specs/security/standard-names.html#certstore-types"> * CertStore section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other types are supported. * @@ -212,8 +212,8 @@ public class CertStore { * * @param type the name of the requested {@code CertStore} type. * See the CertStore section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certstore-types"> + * Java Security Standard Algorithm Names Specification * for information about standard types. * * @param params the initialization parameters (may be {@code null}). @@ -276,8 +276,8 @@ public class CertStore { * * @param type the requested {@code CertStore} type. * See the CertStore section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certstore-types"> + * Java Security Standard Algorithm Names Specification * for information about standard types. * * @param params the initialization parameters (may be {@code null}). @@ -337,8 +337,8 @@ public class CertStore { * * @param type the requested {@code CertStore} type. * See the CertStore section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certstore-types"> + * Java Security Standard Algorithm Names Specification * for information about standard types. * * @param params the initialization parameters (may be {@code null}). diff --git a/jdk/src/java.base/share/classes/java/security/cert/Certificate.java b/jdk/src/java.base/share/classes/java/security/cert/Certificate.java index 6923627ce7b..32662ceea15 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/Certificate.java +++ b/jdk/src/java.base/share/classes/java/security/cert/Certificate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,8 +74,8 @@ public abstract class Certificate implements java.io.Serializable { * * @param type the standard name of the certificate type. * See the CertificateFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certificatefactory-types"> + * Java Security Standard Algorithm Names Specification * for information about standard certificate types. */ protected Certificate(String type) { diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java index e63c3b403d4..ae4e8bd05c4 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java +++ b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,11 +101,11 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code PkiPath}
  • * * The type and encodings are described in the + * "{@docRoot}/../specs/security/standard-names.html#certificatefactory-types"> * CertificateFactory section and the + * "{@docRoot}/../specs/security/standard-names.html#certpath-encodings"> * CertPath Encodings section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other types or encodings are supported. * @@ -172,8 +172,8 @@ public class CertificateFactory { * * @param type the name of the requested certificate type. * See the CertificateFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certificatefactory-types"> + * Java Security Standard Algorithm Names Specification * for information about standard certificate types. * * @return a certificate factory object for the specified type @@ -213,8 +213,8 @@ public class CertificateFactory { * * @param type the certificate type. * See the CertificateFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certificatefactory-types"> + * Java Security Standard Algorithm Names Specification * for information about standard certificate types. * * @param provider the name of the provider. @@ -260,8 +260,8 @@ public class CertificateFactory { * * @param type the certificate type. * See the CertificateFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certificatefactory-types"> + * Java Security Standard Algorithm Names Specification * for information about standard certificate types. * @param provider the provider. * @@ -359,8 +359,8 @@ public class CertificateFactory { * Returns an iteration of the {@code CertPath} encodings supported * by this certificate factory, with the default encoding first. See * the CertPath Encodings section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpath-encodings"> + * Java Security Standard Algorithm Names Specification * for information about standard encoding names and their formats. *

    * Attempts to modify the returned {@code Iterator} via its @@ -399,8 +399,8 @@ public class CertificateFactory { * the data read from the {@code InputStream} inStream. The data * is assumed to be in the specified encoding. See * the CertPath Encodings section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpath-encodings"> + * Java Security Standard Algorithm Names Specification * for information about standard encoding names and their formats. * * @param inStream an {@code InputStream} containing the data diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java index 35aee847bb8..0b1bb337b3f 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java +++ b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactorySpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -183,8 +183,8 @@ public abstract class CertificateFactorySpi { * Returns an iteration of the {@code CertPath} encodings supported * by this certificate factory, with the default encoding first. See * the CertPath Encodings section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#certpath-encodings"> + * Java Security Standard Algorithm Names Specification * for information about standard encoding names. *

    * Attempts to modify the returned {@code Iterator} via its diff --git a/jdk/src/java.base/share/classes/java/security/cert/package-info.java b/jdk/src/java.base/share/classes/java/security/cert/package-info.java index 58f5fb77e0a..50b0f2c9672 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/package-info.java +++ b/jdk/src/java.base/share/classes/java/security/cert/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,10 +39,9 @@ * Certificate Revocation List (CRL) Profile *

  • RFC 2560: X.509 Internet Public Key Infrastructure Online Certificate * Status Protocol - OCSP - *
  • - * Java™ - * Cryptography Architecture Standard Algorithm Name - * Documentation
  • + *
  • + * Java™ Security Standard Algorithm Names Specification + *
  • * * *

    Related Documentation

    diff --git a/jdk/src/java.base/share/classes/java/security/package-info.java b/jdk/src/java.base/share/classes/java/security/package-info.java index 2c8205b09b9..edb91899da8 100644 --- a/jdk/src/java.base/share/classes/java/security/package-info.java +++ b/jdk/src/java.base/share/classes/java/security/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,10 +53,9 @@ *
  • PKCS #8: Private-Key Information Syntax Standard, Version 1.2, * November 1993
  • * - *
  • - * Java™ - * Cryptography Architecture Standard Algorithm Name - * Documentation
  • + *
  • + * Java™ Security Standard Algorithm Names Specification + *
  • * * *

    Related Documentation

    diff --git a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java index 5aca225d2b2..99b5a04655a 100644 --- a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java +++ b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,8 +67,8 @@ public abstract class EncodedKeySpec implements KeySpec { * array are copied to protect against subsequent modification. * @param algorithm the algorithm name of the encoded key * See the KeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. diff --git a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java index 198ca604b8c..73d79a41321 100644 --- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java +++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,8 +85,8 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec { * the array are copied to protect against subsequent modification. * @param algorithm the algorithm name of the encoded private key * See the KeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. diff --git a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java index 2d23570fe3d..7de4a2a1417 100644 --- a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java +++ b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,8 +75,8 @@ public class X509EncodedKeySpec extends EncodedKeySpec { * array are copied to protect against subsequent modification. * @param algorithm the algorithm name of the encoded public key * See the KeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. 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 48ca2b01994..cf288f5f1da 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java +++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -150,9 +150,9 @@ import sun.security.jca.*; *
  • {@code RSA/ECB/OAEPWithSHA-256AndMGF1Padding} (1024, 2048)
  • * * These transformations are described in the - * + * * Cipher section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other transformations are supported. * @@ -489,8 +489,8 @@ public class Cipher { * @param transformation the name of the transformation, e.g., * DES/CBC/PKCS5Padding. * See the Cipher section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names"> + * Java Security Standard Algorithm Names Specification * for information about standard transformation names. * * @return a cipher that implements the requested transformation @@ -567,8 +567,8 @@ public class Cipher { * @param transformation the name of the transformation, * e.g., DES/CBC/PKCS5Padding. * See the Cipher section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names"> + * Java Security Standard Algorithm Names Specification * for information about standard transformation names. * * @param provider the name of the provider. @@ -627,8 +627,8 @@ public class Cipher { * @param transformation the name of the transformation, * e.g., DES/CBC/PKCS5Padding. * See the Cipher section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names"> + * Java Security Standard Algorithm Names Specification * for information about standard transformation names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java index cf19807f2dc..35e4fdfca43 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java +++ b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,8 +125,8 @@ public class ExemptionMechanism { * mechanism. * See the ExemptionMechanism section in the * - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#exemption-mechanisms"> + * Java Security Standard Algorithm Names Specification * for information about standard exemption mechanism names. * * @return the new {@code ExemptionMechanism} object @@ -164,8 +164,8 @@ public class ExemptionMechanism { * @param algorithm the standard name of the requested exemption mechanism. * See the ExemptionMechanism section in the * - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#exemption-mechanisms"> + * Java Security Standard Algorithm Names Specification * for information about standard exemption mechanism names. * * @param provider the name of the provider. @@ -208,8 +208,8 @@ public class ExemptionMechanism { * @param algorithm the standard name of the requested exemption mechanism. * See the ExemptionMechanism section in the * - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#exemption-mechanisms"> + * Java Security Standard Algorithm Names Specification * for information about standard exemption mechanism names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java index 47449b3338c..3f77eddccc8 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java +++ b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,9 +60,9 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code DiffieHellman}
  • * * This algorithm is described in the + * "{@docRoot}/../specs/security/standard-names.html#keyagreement-algorithms"> * KeyAgreement section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -161,8 +161,8 @@ public class KeyAgreement { * @param algorithm the standard name of the requested key agreement * algorithm. * See the KeyAgreement section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyagreement-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code KeyAgreement} object @@ -208,8 +208,8 @@ public class KeyAgreement { * @param algorithm the standard name of the requested key agreement * algorithm. * See the KeyAgreement section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyagreement-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -252,8 +252,8 @@ public class KeyAgreement { * @param algorithm the standard name of the requested key agreement * algorithm. * See the KeyAgreement section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keyagreement-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java index 4cb8b79be23..135f0ce33df 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java +++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,9 +95,9 @@ import sun.security.util.Debug; *
  • {@code HmacSHA256}
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#keygenerator-algorithms"> * KeyGenerator section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -216,8 +216,8 @@ public class KeyGenerator { * * @param algorithm the standard name of the requested key algorithm. * See the KeyGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keygenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code KeyGenerator} object @@ -250,8 +250,8 @@ public class KeyGenerator { * * @param algorithm the standard name of the requested key algorithm. * See the KeyGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keygenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -293,8 +293,8 @@ public class KeyGenerator { * * @param algorithm the standard name of the requested key algorithm. * See the KeyGenerator section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#keygenerator-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/javax/crypto/Mac.java b/jdk/src/java.base/share/classes/javax/crypto/Mac.java index 5a1d12de4c6..245f12f6934 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/Mac.java +++ b/jdk/src/java.base/share/classes/javax/crypto/Mac.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,9 +61,9 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code HmacSHA256}
  • * * These algorithms are described in the - * + * * Mac section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -162,8 +162,8 @@ public class Mac implements Cloneable { * * @param algorithm the standard name of the requested MAC algorithm. * See the Mac section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#mac-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code Mac} object @@ -206,8 +206,8 @@ public class Mac implements Cloneable { * * @param algorithm the standard name of the requested MAC algorithm. * See the Mac section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#mac-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -247,8 +247,8 @@ public class Mac implements Cloneable { * * @param algorithm the standard name of the requested MAC algorithm. * See the Mac section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#mac-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java index cadf2302d20..9e4bae382c6 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java +++ b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,9 +65,9 @@ import sun.security.jca.GetInstance.Instance; *
  • {@code DESede}
  • * * These algorithms are described in the + * "{@docRoot}/../specs/security/standard-names.html#secretkeyfactory-algorithms"> * SecretKeyFactory section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -148,8 +148,8 @@ public class SecretKeyFactory { * @param algorithm the standard name of the requested secret-key * algorithm. * See the SecretKeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#secretkeyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @return the new {@code SecretKeyFactory} object @@ -183,8 +183,8 @@ public class SecretKeyFactory { * @param algorithm the standard name of the requested secret-key * algorithm. * See the SecretKeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#secretkeyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the name of the provider. @@ -227,8 +227,8 @@ public class SecretKeyFactory { * @param algorithm the standard name of the requested secret-key * algorithm. * See the SecretKeyFactory section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#secretkeyfactory-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard algorithm names. * * @param provider the provider. diff --git a/jdk/src/java.base/share/classes/javax/crypto/package-info.java b/jdk/src/java.base/share/classes/javax/crypto/package-info.java index 754b5f643c8..184676fa470 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/package-info.java +++ b/jdk/src/java.base/share/classes/javax/crypto/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,9 +42,9 @@ * having to add or rewrite code. * * * *

    Related Documentation

    diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java index 2f2a0928a15..a649bdd10a0 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,9 @@ import sun.security.jca.GetInstance; *
  • {@code TLSv1.2}
  • * * These protocols are described in the + * "{@docRoot}/../specs/security/standard-names.html#sslcontext-algorithms"> * SSLContext section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * @@ -147,9 +147,8 @@ public class SSLContext { * * @param protocol the standard name of the requested protocol. * See the SSLContext section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation + * "{@docRoot}/../specs/security/standard-names.html#sslcontext-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard protocol names. * * @return the new {@code SSLContext} object @@ -185,9 +184,8 @@ public class SSLContext { * * @param protocol the standard name of the requested protocol. * See the SSLContext section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation + * "{@docRoot}/../specs/security/standard-names.html#sslcontext-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard protocol names. * * @param provider the name of the provider. @@ -228,9 +226,8 @@ public class SSLContext { * * @param protocol the standard name of the requested protocol. * See the SSLContext section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation + * "{@docRoot}/../specs/security/standard-names.html#sslcontext-algorithms"> + * Java Security Standard Algorithm Names Specification * for information about standard protocol names. * * @param provider an instance of the provider. diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngine.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngine.java index 9613661afc2..b765128cd85 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngine.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngine.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 @@ -866,7 +866,7 @@ public abstract class SSLEngine { *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -892,7 +892,7 @@ public abstract class SSLEngine { *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -914,7 +914,7 @@ public abstract class SSLEngine { *

    * Note that the standard list of cipher suite names may be found in the * + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation. Providers * may support cipher suite names not found in this list or might not diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java index 5207c3c1f84..0172929926c 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,7 +110,7 @@ public class SSLParameters { * constructor followed by * {@code setCipherSuites(cipherSuites);}. Note that the * standard list of cipher suite names may be found in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation. Providers * may support cipher suite names not found in this list. @@ -130,7 +130,7 @@ public class SSLParameters { * {@code setCipherSuites(cipherSuites); setProtocols(protocols);}. * Note that the standard list of cipher suite names may be found in the * + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation. Providers * may support cipher suite names not found in this list. @@ -153,7 +153,7 @@ public class SSLParameters { *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -170,7 +170,7 @@ public class SSLParameters { * * @param cipherSuites the array of ciphersuites (or null). Note that the * standard list of cipher suite names may be found in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation. Providers * may support cipher suite names not found in this list or might not @@ -675,4 +675,3 @@ public class SSLParameters { applicationProtocols = tempProtocols; } } - diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java index ead7d20ae58..aa7b266c3a3 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,7 +198,7 @@ public abstract class SSLServerSocket extends ServerSocket { *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -224,7 +224,7 @@ public abstract class SSLServerSocket extends ServerSocket { *

    * Note that the standard list of cipher suite names may be found in the * + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation. Providers * may support cipher suite names not found in this list or might not @@ -254,7 +254,7 @@ public abstract class SSLServerSocket extends ServerSocket { *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java index 3629aaef3c7..1cbbf9cfcd8 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -126,7 +126,7 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -147,7 +147,7 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocket.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocket.java index 2a00d8f7f26..93e082bde07 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocket.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -270,7 +270,7 @@ public abstract class SSLSocket extends Socket *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -296,7 +296,7 @@ public abstract class SSLSocket extends Socket *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -318,7 +318,7 @@ public abstract class SSLSocket extends Socket *

    * Note that the standard list of cipher suite names may be found in the * + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation. Providers * may support cipher suite names not found in this list or might not diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java index d504e1d7a3d..8029b7d6b9a 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,7 +151,7 @@ public abstract class SSLSocketFactory extends SocketFactory *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. @@ -170,7 +170,7 @@ public abstract class SSLSocketFactory extends SocketFactory *

    * The returned array includes cipher suites from the list of standard * cipher suite names in the + * "{@docRoot}/../specs/security/standard-names.html#jsse-cipher-suite-names"> * JSSE Cipher Suite Names section of the Java Cryptography * Architecture Standard Algorithm Name Documentation, and may also * include other cipher suites that the provider supports. diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java index 466d52f1d7e..cfd144bd917 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,9 +43,9 @@ import sun.security.jca.GetInstance; *

  • {@code PKIX}
  • * * This algorithm is described in the + * "{@docRoot}/../specs/security/standard-names.html#trustmanagerfactory-algorithms"> * TrustManagerFactory section of the - * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Java Security Standard Algorithm Names Specification. * Consult the release documentation for your implementation to see if any * other algorithms are supported. * diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/package-info.java b/jdk/src/java.base/share/classes/javax/net/ssl/package-info.java index 9fd6868587e..47ea7bf1ff6 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/package-info.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,9 +31,9 @@ * the communicating peers. * * * * @since 1.4 diff --git a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java index 29d42df6855..1f0b6c95597 100644 --- a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java +++ b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -178,8 +178,8 @@ import sun.security.jca.GetInstance; * constructed by invoking one of the {@code getInstance} factory methods * with a standard type. The default policy type is "JavaLoginConfig". * See the Configuration section in the - * Java Cryptography Architecture Standard Algorithm Name Documentation + * "{@docRoot}/../specs/security/standard-names.html#configuration-types"> + * Java Security Standard Algorithm Names Specification * for a list of standard Configuration types. * * @see javax.security.auth.login.LoginContext @@ -323,9 +323,9 @@ public abstract class Configuration { * * @param type the specified Configuration type. See the Configuration * section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation for a list of standard Configuration types. + * "{@docRoot}/../specs/security/standard-names.html#configuration-types"> + * Java Security Standard Algorithm Names Specification + * for a list of standard Configuration types. * * @param params parameters for the Configuration, which may be null. * @@ -381,9 +381,9 @@ public abstract class Configuration { * * @param type the specified Configuration type. See the Configuration * section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation for a list of standard Configuration types. + * "{@docRoot}/../specs/security/standard-names.html#configuration-types"> + * Java Security Standard Algorithm Names Specification + * for a list of standard Configuration types. * * @param params parameters for the Configuration, which may be null. * @@ -448,9 +448,9 @@ public abstract class Configuration { * * @param type the specified Configuration type. See the Configuration * section in the - * Java Cryptography Architecture Standard Algorithm Name - * Documentation for a list of standard Configuration types. + * "{@docRoot}/../specs/security/standard-names.html#configuration-types"> + * Java Security Standard Algorithm Names Specification + * for a list of standard Configuration types. * * @param params parameters for the Configuration, which may be null. * diff --git a/jdk/src/java.base/share/classes/javax/security/auth/login/package-info.java b/jdk/src/java.base/share/classes/javax/security/auth/login/package-info.java index 5b43480dc0a..555b4983f38 100644 --- a/jdk/src/java.base/share/classes/javax/security/auth/login/package-info.java +++ b/jdk/src/java.base/share/classes/javax/security/auth/login/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,9 @@ *

    Package Specification

    * * * * @since 1.4 diff --git a/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java index 3c6061cf18b..54f86346f8b 100644 --- a/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java +++ b/jdk/src/jdk.jartool/share/classes/jdk/security/jarsigner/JarSigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -172,7 +172,7 @@ public final class JarSigner { * * @param algorithm the standard name of the algorithm. See * the {@code MessageDigest} section in the + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. * @return the {@code JarSigner.Builder} itself. @@ -192,7 +192,7 @@ public final class JarSigner { * * @param algorithm the standard name of the algorithm. See * the {@code MessageDigest} section in the + * "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms"> * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. * @param provider the provider. @@ -218,7 +218,7 @@ public final class JarSigner { * * @param algorithm the standard name of the algorithm. See * the {@code Signature} section in the + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. * @return the {@code JarSigner.Builder} itself. @@ -245,7 +245,7 @@ public final class JarSigner { * * @param algorithm the standard name of the algorithm. See * the {@code Signature} section in the + * "{@docRoot}/../specs/security/standard-names.html#signature-algorithms"> * Java Cryptography Architecture Standard Algorithm Name * Documentation for information about standard algorithm names. * @param provider the provider. From 69d205a2786968c360d266093c0ccee6329a97db Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 10 May 2017 09:02:51 +0200 Subject: [PATCH 008/105] 8178278: Move Standard Algorithm Names document to specs directory Reviewed-by: erikj --- make/Javadoc.gmk | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index 4d088b86a65..3b961f46511 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -367,13 +367,15 @@ COPY_SPEC_FILTER := %.html %.gif %.jpg %.mib %.css $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ - $(if $(SPECS_$m), \ - $(eval $(call SetupCopyFiles, COPY_$m, \ - SRC := $(SPECS_$m), \ - FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $(SPECS_$m))), \ - DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ - )) \ - $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \ + $(foreach d, $(SPECS_$m), \ + $(if $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \ + $(eval $(call SetupCopyFiles, COPY_$m, \ + SRC := $d, \ + FILES := $(filter $(COPY_SPEC_FILTER), $(call CacheFind, $d)), \ + DEST := $(JAVADOC_OUTPUTDIR)/specs/, \ + )) \ + $(eval JDK_SPECS_TARGETS += $(COPY_$m)) \ + ) \ ) \ ) From c74eb4302e985e1e88d7918e2ecea6477a25971c Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Wed, 10 May 2017 12:36:14 +0100 Subject: [PATCH 009/105] 8179021: Latest bugfixes to WebSocket/HPACK from the sandbox repo Reviewed-by: dfuchs --- .../java.base/share/classes/module-info.java | 3 +- .../jdk/incubator/http/HttpRequestImpl.java | 4 +- .../http/PlainTunnelingConnection.java | 6 +- .../classes/jdk/incubator/http/WebSocket.java | 95 +----- .../http/internal/hpack/Decoder.java | 5 +- .../http/internal/hpack/HeaderTable.java | 7 +- .../http/internal/websocket/BuilderImpl.java | 22 +- .../websocket/CooperativeHandler.java | 196 +++++++++--- .../http/internal/websocket/Frame.java | 5 +- .../internal/websocket/FrameConsumer.java | 22 +- .../internal/websocket/OpeningHandshake.java | 22 +- .../internal/websocket/OutgoingMessage.java | 15 +- .../http/internal/websocket/Receiver.java | 74 ++--- .../http/internal/websocket/StatusCodes.java | 136 +++------ .../http/internal/websocket/Transmitter.java | 19 +- .../internal/websocket/WebSocketImpl.java | 103 ++++--- .../java/net/httpclient/whitebox/Driver.java | 3 +- .../jdk/incubator/http/RawChannelTest.java | 287 ++++++++++++++++++ 18 files changed, 656 insertions(+), 368 deletions(-) create mode 100644 jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/RawChannelTest.java diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 838f215d888..e637bc34d7d 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -190,7 +190,8 @@ module java.base { jdk.unsupported; exports jdk.internal.vm.annotation to jdk.unsupported, - jdk.internal.vm.ci; + jdk.internal.vm.ci, + jdk.incubator.httpclient; exports jdk.internal.util.jar to jdk.jartool, jdk.jdeps, diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.java index dcf1de7125a..179cb2d7ad2 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpRequestImpl.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 @@ -123,7 +123,7 @@ class HttpRequestImpl extends HttpRequest implements WebSocketRequest { this.method = method; this.systemHeaders = new HttpHeadersImpl(); this.userHeaders = ImmutableHeaders.empty(); - this.uri = null; + this.uri = URI.create("socket://" + authority.getHostString() + ":" + Integer.toString(authority.getPort()) + "/"); this.requestProcessor = HttpRequest.noBody(); this.authority = authority; this.secure = false; 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 6432804bd9f..10549315a3d 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 @@ -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 @@ -27,6 +27,7 @@ package jdk.incubator.http; import jdk.incubator.http.internal.common.ByteBufferReference; import jdk.incubator.http.internal.common.MinimalFuture; +import jdk.incubator.http.HttpResponse.BodyHandler; import java.io.IOException; import java.net.InetSocketAddress; @@ -72,7 +73,8 @@ class PlainTunnelingConnection extends HttpConnection { public void connect() throws IOException, InterruptedException { delegate.connect(); HttpRequestImpl req = new HttpRequestImpl("CONNECT", client, address); - Exchange connectExchange = new Exchange<>(req, null); + MultiExchange mul = new MultiExchange<>(req, client, BodyHandler.discard(null)); + Exchange connectExchange = new Exchange<>(req, mul); Response r = connectExchange.responseImpl(delegate); if (r.statusCode() != 200) { throw new IOException("Tunnel failed"); diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WebSocket.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WebSocket.java index f657655f408..2433e2499e7 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WebSocket.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/WebSocket.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 @@ -43,7 +43,7 @@ import java.util.concurrent.CompletionStage; *

    To create a {@code WebSocket} use a {@linkplain HttpClient#newWebSocketBuilder( * URI, Listener) builder}. Once a {@code WebSocket} is built, it's ready * to send and receive messages. When the {@code WebSocket} is no longer needed - * it must be closed: a Close message must both be {@linkplain #sendClose() + * it must be closed: a Close message must both be {@linkplain #sendClose * sent} and {@linkplain Listener#onClose(WebSocket, int, String) received}. * The {@code WebSocket} may be also closed {@linkplain #abort() abruptly}. * @@ -93,17 +93,6 @@ public interface WebSocket { */ int NORMAL_CLOSURE = 1000; - /** - * The WebSocket Close message status code ({@value}), is - * designated for use in applications expecting a status code to indicate - * that the connection was closed abnormally, e.g., without sending or - * receiving a Close message. - * - * @see Listener#onClose(WebSocket, int, String) - * @see #abort() - */ - int CLOSED_ABNORMALLY = 1006; - /** * A builder for creating {@code WebSocket} instances. * {@Incubating} @@ -509,7 +498,7 @@ public interface WebSocket { * *

    The {@code WebSocket} will close at the earliest of completion of * the returned {@code CompletionStage} or sending a Close message. In - * particular, if a Close message has been {@link WebSocket#sendClose() + * particular, if a Close message has been {@linkplain WebSocket#sendClose * sent} before, then this invocation completes the closing handshake * and by the time this method is invoked, the {@code WebSocket} will * have been closed. @@ -642,44 +631,6 @@ public interface WebSocket { */ CompletableFuture sendText(CharSequence message, boolean isLast); - /** - * Sends a whole Text message with characters from the given {@code - * CharSequence}. - * - *

    This is a convenience method. For the general case, use {@link - * #sendText(CharSequence, boolean)}. - * - *

    Returns a {@code CompletableFuture} which completes - * normally when the message has been sent or completes exceptionally if an - * error occurs. - * - *

    The {@code CharSequence} must not be modified until the returned - * {@code CompletableFuture} completes (either normally or exceptionally). - * - *

    The returned {@code CompletableFuture} can complete exceptionally - * with: - *

      - *
    • {@link IllegalArgumentException} - - * if {@code message} is a malformed UTF-16 sequence - *
    • {@link IllegalStateException} - - * if the {@code WebSocket} is closed; - * or if a Close message has been sent; - * or if there is an outstanding send operation; - * or if a previous Binary message was sent with {@code isLast == false} - *
    • {@link IOException} - - * if an I/O error occurs during this operation; - * or if the {@code WebSocket} has been closed due to an error; - *
    - * - * @param message - * the message - * - * @return a {@code CompletableFuture} with this {@code WebSocket} - */ - default CompletableFuture sendText(CharSequence message) { - return sendText(message, true); - } - /** * Sends a Binary message with bytes from the given {@code ByteBuffer}. * @@ -831,46 +782,9 @@ public interface WebSocket { * the reason * * @return a {@code CompletableFuture} with this {@code WebSocket} - * - * @see #sendClose() */ CompletableFuture sendClose(int statusCode, String reason); - /** - * Sends an empty Close message. - * - *

    When this method has been invoked, no further messages can be sent. - * - *

    For more details on Close message see RFC 6455 section - * 5.5.1. Close - * - *

    The method returns a {@code CompletableFuture} which - * completes normally when the message has been sent or completes - * exceptionally if an error occurs. - * - *

    The returned {@code CompletableFuture} can complete exceptionally - * with: - *

      - *
    • {@link IOException} - - * if an I/O error occurs during this operation; - * or the {@code WebSocket} has been closed due to an error - *
    - * - *

    If this method has already been invoked or the {@code WebSocket} is - * closed, then subsequent invocations of this method have no effect and the - * returned {@code CompletableFuture} completes normally. - * - *

    If a Close message has been {@linkplain Listener#onClose(WebSocket, - * int, String) received} before, then this invocation completes the closing - * handshake and by the time the returned {@code CompletableFuture} - * completes, the {@code WebSocket} will have been closed. - * - * @return a {@code CompletableFuture} with this {@code WebSocket} - * - * @see #sendClose(int, String) - */ - CompletableFuture sendClose(); - /** * Allows {@code n} more messages to be received by the {@link Listener * Listener}. @@ -928,8 +842,7 @@ public interface WebSocket { * state. * *

    As the result {@link Listener#onClose(WebSocket, int, String) - * Listener.onClose} will be invoked with the status code {@link - * #CLOSED_ABNORMALLY} unless either {@code onClose} or {@link + * Listener.onClose} will be invoked unless either {@code onClose} or {@link * Listener#onError(WebSocket, Throwable) onError} has been invoked before. * In which case no additional invocation will happen. * diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/Decoder.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/Decoder.java index 179bfc616d7..9841204e50c 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/Decoder.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/Decoder.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 @@ -24,6 +24,8 @@ */ package jdk.incubator.http.internal.hpack; +import jdk.internal.vm.annotation.Stable; + import java.io.IOException; import java.io.UncheckedIOException; import java.net.ProtocolException; @@ -60,6 +62,7 @@ import static java.util.Objects.requireNonNull; */ public final class Decoder { + @Stable private static final State[] states = new State[256]; static { diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.java index 508c214b958..970ad42b54d 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.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 @@ -24,6 +24,8 @@ */ package jdk.incubator.http.internal.hpack; +import jdk.internal.vm.annotation.Stable; + import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -40,6 +42,7 @@ import static java.lang.String.format; // final class HeaderTable { + @Stable private static final HeaderField[] staticTable = { null, // To make index 1-based, instead of 0-based new HeaderField(":authority"), @@ -110,7 +113,7 @@ final class HeaderTable { private static final Map> staticIndexes; static { - staticIndexes = new HashMap<>(STATIC_TABLE_LENGTH); + staticIndexes = new HashMap<>(STATIC_TABLE_LENGTH); // TODO: Map.of for (int i = 1; i <= STATIC_TABLE_LENGTH; i++) { HeaderField f = staticTable[i]; Map values = staticIndexes diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/BuilderImpl.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/BuilderImpl.java index 15abf5e76bd..7f662922bc0 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/BuilderImpl.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/BuilderImpl.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 @@ -46,7 +46,7 @@ public final class BuilderImpl implements Builder { private final HttpClient client; private final URI uri; private final Listener listener; - private final List> headers = new LinkedList<>(); + private final Collection> headers = new LinkedList<>(); private final Collection subprotocols = new LinkedList<>(); private Duration timeout; @@ -65,17 +65,18 @@ public final class BuilderImpl implements Builder { } @Override - public Builder subprotocols(String mostPreferred, String... lesserPreferred) + public Builder subprotocols(String mostPreferred, + String... lesserPreferred) { requireNonNull(mostPreferred, "mostPreferred"); requireNonNull(lesserPreferred, "lesserPreferred"); List subprotocols = new LinkedList<>(); + subprotocols.add(mostPreferred); for (int i = 0; i < lesserPreferred.length; i++) { String p = lesserPreferred[i]; requireNonNull(p, "lesserPreferred[" + i + "]"); subprotocols.add(p); } - subprotocols.add(0, mostPreferred); this.subprotocols.clear(); this.subprotocols.addAll(subprotocols); return this; @@ -98,20 +99,9 @@ public final class BuilderImpl implements Builder { Listener getListener() { return listener; } - List> getHeaders() { return headers; } + Collection> getHeaders() { return headers; } Collection getSubprotocols() { return subprotocols; } Duration getConnectTimeout() { return timeout; } - - @Override - public String toString() { - return "WebSocket.Builder{" - + ", uri=" + uri - + ", listener=" + listener - + (!headers.isEmpty() ? ", headers=" + headers : "") - + (!subprotocols.isEmpty() ? ", subprotocols=" + subprotocols : "") - + ( timeout != null ? ", connectTimeout=" + timeout : "") - + '}'; - } } diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/CooperativeHandler.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/CooperativeHandler.java index 5e36a487a12..1ccec2d4e8a 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/CooperativeHandler.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/CooperativeHandler.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,70 +25,184 @@ package jdk.incubator.http.internal.websocket; -import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; import static java.util.Objects.requireNonNull; -final class CooperativeHandler { +/* + * A synchronization aid that assists a number of parties in running a task + * in a mutually exclusive fashion. + * + * To run the task, a party invokes `handle`. To permanently prevent the task + * from subsequent runs, the party invokes `stop`. + * + * The parties do not have to operate in different threads. + * + * The task can be either synchronous or asynchronous. + * + * If the task is synchronous, it is represented with `Runnable`. + * The handler invokes `Runnable.run` to run the task. + * + * If the task is asynchronous, it is represented with `Consumer`. + * The handler invokes `Consumer.accept(end)` to begin the task. The task + * invokes `end.run()` when it has ended. + * + * The next run of the task will not begin until the previous run has finished. + * + * The task may invoke `handle()` by itself, it's a normal situation. + */ +public final class CooperativeHandler { - private static final long CONTINUE = 0; - private static final long OFF = 1; - private static final long ON = 2; - private static final long STOP = 4; + /* + Since the task is fixed and known beforehand, no blocking synchronization + (locks, queues, etc.) is required. The job can be done solely using + nonblocking primitives. - private final AtomicLong state = new AtomicLong(OFF); + The machinery below addresses two problems: - private final Runnable task; + 1. Running the task in a sequential order (no concurrent runs): - CooperativeHandler(Runnable task) { - this.task = requireNonNull(task); + begin, end, begin, end... + + 2. Avoiding indefinite recursion: + + begin + end + begin + end + ... + + Problem #1 is solved with a finite state machine with 4 states: + + BEGIN, AGAIN, END, and STOP. + + Problem #2 is solved with a "state modifier" OFFLOAD. + + Parties invoke `handle()` to signal the task must run. A party that has + invoked `handle()` either begins the task or exploits the party that is + either beginning the task or ending it. + + The party that is trying to end the task either ends it or begins it + again. + + To avoid indefinite recursion, before re-running the task tryEnd() sets + OFFLOAD bit, signalling to its "child" tryEnd() that this ("parent") + tryEnd() is available and the "child" must offload the task on to the + "parent". Then a race begins. Whichever invocation of tryEnd() manages + to unset OFFLOAD bit first does not do the work. + + There is at most 1 thread that is beginning the task and at most 2 + threads that are trying to end it: "parent" and "child". In case of a + synchronous task "parent" and "child" are the same thread. + */ + + private static final int OFFLOAD = 1; + private static final int AGAIN = 2; + private static final int BEGIN = 4; + private static final int STOP = 8; + private static final int END = 16; + + private final AtomicInteger state = new AtomicInteger(END); + private final Consumer begin; + + public CooperativeHandler(Runnable task) { + this(asyncOf(task)); + } + + public CooperativeHandler(Consumer begin) { + this.begin = requireNonNull(begin); } /* - * Causes the task supplied to the constructor to run. The task may be run - * by this thread as well as by any other that has invoked this method. + * Runs the task (though maybe by a different party). * * The recursion which is possible here will have the maximum depth of 1: * - * task.run() - * this.startOrContinue() - * task.run() + * this.handle() + * begin.accept() + * this.handle() */ - void startOrContinue() { - long s; + public void handle() { while (true) { - s = state.get(); - if (s == OFF && state.compareAndSet(OFF, ON)) { - // No one is running the task, we are going to run it - break; - } - if (s == ON && state.compareAndSet(ON, CONTINUE)) { - // Some other thread is running the task. We have managed to - // update the state, it will be surely noticed by that thread. - return; - } - if (s == CONTINUE || s == STOP) { + int s = state.get(); + if (s == END) { + if (state.compareAndSet(END, BEGIN)) { + break; + } + } else if ((s & BEGIN) != 0) { + // Tries to change the state to AGAIN, preserving OFFLOAD bit + if (state.compareAndSet(s, AGAIN | (s & OFFLOAD))) { + return; + } + } else if ((s & AGAIN) != 0 || s == STOP) { return; + } else { + throw new InternalError(String.valueOf(s)); } } + begin.accept(this::tryEnd); + } + + private void tryEnd() { while (true) { - task.run(); - // State checks are ordered by the probability of expected values - // (it might be different in different usage patterns, say, when - // invocations to `startOrContinue()` are concurrent) - if (state.compareAndSet(ON, OFF)) { - break; // The state hasn't changed, all done + int s; + while (((s = state.get()) & OFFLOAD) != 0) { + // Tries to offload ending of the task to the parent + if (state.compareAndSet(s, s & ~OFFLOAD)) { + return; + } } - if (state.compareAndSet(CONTINUE, ON)) { - continue; + while (true) { + if (s == BEGIN) { + if (state.compareAndSet(BEGIN, END)) { + return; + } + } else if (s == AGAIN) { + if (state.compareAndSet(AGAIN, BEGIN | OFFLOAD)) { + break; + } + } else if (s == STOP) { + return; + } else { + throw new InternalError(String.valueOf(s)); + } + s = state.get(); } - // Other threads can change the state from CONTINUE to STOP only - // So if it's not ON and not CONTINUE, it can only be STOP - break; + begin.accept(this::tryEnd); } } - void stop() { + /* + * Checks whether or not this handler has been permanently stopped. + * + * Should be used from inside the task to poll the status of the handler, + * pretty much the same way as it is done for threads: + * + * if (!Thread.currentThread().isInterrupted()) { + * ... + * } + */ + public boolean isStopped() { + return state.get() == STOP; + } + + /* + * Signals this handler to ignore subsequent invocations to `handle()`. + * + * If the task has already begun, this invocation will not affect it, + * unless the task itself uses `isStopped()` method to check the state + * of the handler. + */ + public void stop() { state.set(STOP); } + + private static Consumer asyncOf(Runnable task) { + requireNonNull(task); + return ender -> { + task.run(); + ender.run(); + }; + } } diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Frame.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Frame.java index 813693aff8f..47a0ff21bde 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Frame.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Frame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ package jdk.incubator.http.internal.websocket; +import jdk.internal.vm.annotation.Stable; + import java.nio.ByteBuffer; import static jdk.incubator.http.internal.common.Utils.dump; @@ -58,6 +60,7 @@ final class Frame { CONTROL_0xE (0xE), CONTROL_0xF (0xF); + @Stable private static final Opcode[] opcodes; static { diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/FrameConsumer.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/FrameConsumer.java index d6b32d704ee..1fe63664499 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/FrameConsumer.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/FrameConsumer.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 @@ -38,7 +38,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; import static jdk.incubator.http.internal.common.Utils.dump; import static jdk.incubator.http.internal.websocket.StatusCodes.NO_STATUS_CODE; -import static jdk.incubator.http.internal.websocket.StatusCodes.checkIncomingCode; +import static jdk.incubator.http.internal.websocket.StatusCodes.isLegalToReceiveFromServer; /* * Consumes frame parts and notifies a message consumer, when there is @@ -212,20 +212,20 @@ class FrameConsumer implements Frame.Consumer { } switch (opcode) { case CLOSE: - int statusCode = NO_STATUS_CODE; + char statusCode = NO_STATUS_CODE; String reason = ""; if (payloadLen != 0) { int len = binaryData.remaining(); assert 2 <= len && len <= 125 : dump(len, payloadLen); - try { - statusCode = checkIncomingCode(binaryData.getChar()); - reason = UTF_8.newDecoder().decode(binaryData).toString(); - } catch (CheckFailedException e) { - throw new FailWebSocketException("Incorrect status code") - .initCause(e); - } catch (CharacterCodingException e) { + statusCode = binaryData.getChar(); + if (!isLegalToReceiveFromServer(statusCode)) { throw new FailWebSocketException( - "Close reason is a malformed UTF-8 sequence") + "Illegal status code: " + statusCode); + } + try { + reason = UTF_8.newDecoder().decode(binaryData).toString(); + } catch (CharacterCodingException e) { + throw new FailWebSocketException("Illegal close reason") .initCause(e); } } diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OpeningHandshake.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OpeningHandshake.java index 460b3b2b011..4af7771d8c2 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OpeningHandshake.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OpeningHandshake.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 @@ -37,6 +37,8 @@ import jdk.incubator.http.HttpRequest; import jdk.incubator.http.HttpResponse; import jdk.incubator.http.HttpResponse.BodyHandler; import jdk.incubator.http.WebSocketHandshakeException; +import jdk.incubator.http.internal.common.Pair; + import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -66,7 +68,6 @@ final class OpeningHandshake { private static final String HEADER_KEY = "Sec-WebSocket-Key"; private static final String HEADER_PROTOCOL = "Sec-WebSocket-Protocol"; private static final String HEADER_VERSION = "Sec-WebSocket-Version"; - private static final String VALUE_VERSION = "13"; // WebSocket's lucky number private static final Set FORBIDDEN_HEADERS; @@ -106,12 +107,18 @@ final class OpeningHandshake { if (connectTimeout != null) { requestBuilder.timeout(connectTimeout); } + for (Pair p : b.getHeaders()) { + if (FORBIDDEN_HEADERS.contains(p.first)) { + throw illegal("Illegal header: " + p.first); + } + requestBuilder.header(p.first, p.second); + } this.subprotocols = createRequestSubprotocols(b.getSubprotocols()); if (!this.subprotocols.isEmpty()) { String p = this.subprotocols.stream().collect(Collectors.joining(", ")); requestBuilder.header(HEADER_PROTOCOL, p); } - requestBuilder.header(HEADER_VERSION, VALUE_VERSION); + requestBuilder.header(HEADER_VERSION, "13"); // WebSocket's lucky number this.nonce = createNonce(); requestBuilder.header(HEADER_KEY, this.nonce); // Setting request version to HTTP/1.1 forcibly, since it's not possible @@ -133,11 +140,7 @@ final class OpeningHandshake { if (s.trim().isEmpty() || !isValidName(s)) { throw illegal("Bad subprotocol syntax: " + s); } - if (FORBIDDEN_HEADERS.contains(s)) { - throw illegal("Forbidden header: " + s); - } - boolean unique = sp.add(s); - if (!unique) { + if (!sp.add(s)) { throw illegal("Duplicating subprotocol: " + s); } } @@ -176,7 +179,7 @@ final class OpeningHandshake { CompletableFuture send() { return client.sendAsync(this.request, BodyHandler.discard(null)) - .thenCompose(this::resultFrom); + .thenCompose(this::resultFrom); } /* @@ -283,7 +286,6 @@ final class OpeningHandshake { private static String requireSingle(HttpHeaders responseHeaders, String headerName) - throws CheckFailedException { List values = responseHeaders.allValues(headerName); if (values.isEmpty()) { diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OutgoingMessage.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OutgoingMessage.java index 76d7c8db55f..c1dc19f756e 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OutgoingMessage.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/OutgoingMessage.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 @@ -60,6 +60,7 @@ import static jdk.incubator.http.internal.websocket.Frame.Opcode.TEXT; */ abstract class OutgoingMessage { + // Share per WebSocket? private static final SecureRandom maskingKeys = new SecureRandom(); protected ByteBuffer[] frame; @@ -71,6 +72,8 @@ abstract class OutgoingMessage { * convenient moment (up to the point where sentTo is invoked). */ protected void contextualize(Context context) { + // masking and charset decoding should be performed here rather than in + // the constructor (as of today) if (context.isCloseSent()) { throw new IllegalStateException("Close sent"); } @@ -101,7 +104,7 @@ abstract class OutgoingMessage { private final boolean isLast; Text(CharSequence characters, boolean isLast) { - CharsetEncoder encoder = UTF_8.newEncoder(); + CharsetEncoder encoder = UTF_8.newEncoder(); // Share per WebSocket? try { payload = encoder.encode(CharBuffer.wrap(characters)); } catch (CharacterCodingException e) { @@ -172,11 +175,11 @@ abstract class OutgoingMessage { Close(int statusCode, CharSequence reason) { ByteBuffer payload = ByteBuffer.allocate(125) - .putChar((char) statusCode); + .putChar((char) statusCode); CoderResult result = UTF_8.newEncoder() - .encode(CharBuffer.wrap(reason), - payload, - true); + .encode(CharBuffer.wrap(reason), + payload, + true); if (result.isOverflow()) { throw new IllegalArgumentException("Long reason"); } else if (result.isError()) { diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Receiver.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Receiver.java index a2a0ea59aab..4168da9b52b 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Receiver.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Receiver.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 @@ -58,8 +58,8 @@ final class Receiver { private final Frame.Reader reader = new Frame.Reader(); private final RawChannel.RawEvent event = createHandler(); private final AtomicLong demand = new AtomicLong(); - private final CooperativeHandler receiveHandler = - new CooperativeHandler(this::tryDeliver); + private final CooperativeHandler handler = + new CooperativeHandler(this::pushContinuously); /* * Used to ensure registering the channel event at most once (i.e. to avoid * multiple registrations). @@ -72,8 +72,8 @@ final class Receiver { this.channel = channel; this.data = channel.initialByteBuffer(); this.frameConsumer = new FrameConsumer(this.messageConsumer); - // To ensure the initial `data` will be read correctly (happens-before) - // after readable.get() + // To ensure the initial non-final `data` will be read correctly + // (happens-before) by reader after executing readable.get() readable.set(true); } @@ -88,7 +88,7 @@ final class Receiver { @Override public void handle() { readable.set(true); - receiveHandler.startOrContinue(); + handler.handle(); } }; } @@ -98,7 +98,7 @@ final class Receiver { throw new IllegalArgumentException("Negative: " + n); } demand.accumulateAndGet(n, (p, i) -> p + i < 0 ? Long.MAX_VALUE : p + i); - receiveHandler.startOrContinue(); + handler.handle(); } void acknowledge() { @@ -113,41 +113,21 @@ final class Receiver { * regardless of the current demand. */ void close() { - receiveHandler.stop(); + handler.stop(); } - private void tryDeliver() { - if (readable.get() && demand.get() > 0) { - deliverAtMostOne(); + private void pushContinuously() { + while (readable.get() && demand.get() > 0 && !handler.isStopped()) { + pushOnce(); } } - private void deliverAtMostOne() { - if (data == null) { - try { - data = channel.read(); - } catch (IOException e) { - readable.set(false); - messageConsumer.onError(e); - return; - } - if (data == null || !data.hasRemaining()) { - readable.set(false); - if (!data.hasRemaining()) { - try { - channel.registerEvent(event); - } catch (IOException e) { - messageConsumer.onError(e); - return; - } - } else if (data == null) { - messageConsumer.onComplete(); - } - return; - } + private void pushOnce() { + if (data == null && !readData()) { + return; } try { - reader.readFrame(data, frameConsumer); + reader.readFrame(data, frameConsumer); // Pushing frame parts to the consumer } catch (FailWebSocketException e) { messageConsumer.onError(e); return; @@ -156,4 +136,28 @@ final class Receiver { data = null; } } + + private boolean readData() { + try { + data = channel.read(); + } catch (IOException e) { + messageConsumer.onError(e); + return false; + } + if (data == null) { // EOF + messageConsumer.onComplete(); + return false; + } else if (!data.hasRemaining()) { // No data in the socket at the moment + data = null; + readable.set(false); + try { + channel.registerEvent(event); + } catch (IOException e) { + messageConsumer.onError(e); + } + return false; + } + assert data.hasRemaining(); + return true; + } } diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/StatusCodes.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/StatusCodes.java index 17ac991a66d..f262005ec69 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/StatusCodes.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/StatusCodes.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,120 +25,72 @@ package jdk.incubator.http.internal.websocket; -import static jdk.incubator.http.WebSocket.CLOSED_ABNORMALLY; - /* - * Utilities and common constants for WebSocket status codes. For more details - * on status codes and their meaning see: + * Utilities for WebSocket status codes. * * 1. https://tools.ietf.org/html/rfc6455#section-7.4 * 2. http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number */ final class StatusCodes { - static final int PROTOCOL_ERROR = 1002; - static final int CANNOT_ACCEPT = 1003; - static final int NO_STATUS_CODE = 1005; - static final int NOT_CONSISTENT = 1007; - static final int TOO_BIG = 1009; - static final int NO_EXTENSION = 1010; - static final int SERVICE_RESTART = 1012; - static final int TRY_AGAIN_LATER = 1013; - static final int TLS_HANDSHAKE_FAILURE = 1015; + static final int PROTOCOL_ERROR = 1002; + static final int NO_STATUS_CODE = 1005; + static final int CLOSED_ABNORMALLY = 1006; + static final int NOT_CONSISTENT = 1007; private StatusCodes() { } - /* - * Returns the given code if it doesn't violate any rules for outgoing - * codes, otherwise throws a CFE with a detailed description. - */ - static int checkOutgoingCode(int code) { - checkCommon(code); + static boolean isLegalToSendFromClient(int code) { + if (!isLegal(code)) { + return false; + } + // Codes from unreserved range if (code > 4999) { - throw new CheckFailedException("Unspecified: " + code); + return false; } - if (isNotUserSettable(code)) { - throw new CheckFailedException("Cannot set: " + code); - } - return code; - } - - /* - * Returns the given code if it doesn't violate any rules for incoming - * codes, otherwise throws a CFE with a detailed description. - */ - static int checkIncomingCode(int code) { - checkCommon(code); - if (code == NO_EXTENSION) { - throw new CheckFailedException("Bad server code: " + code); - } - return code; - } - - private static int checkCommon(int code) { - if (isOutOfRange(code)) { - throw new CheckFailedException("Out of range: " + code); - } - if (isForbidden(code)) { - throw new CheckFailedException("Forbidden: " + code); - } - if (isUnassigned(code)) { - throw new CheckFailedException("Unassigned: " + code); - } - return code; - } - - /* - * Returns true if the given code cannot be set by a user of the WebSocket - * API. e.g. this code means something which only a WebSocket implementation - * is responsible for or it doesn't make sense to be send by a WebSocket - * client. - */ - private static boolean isNotUserSettable(int code) { + // Codes below are not allowed to be sent using a WebSocket client API switch (code) { case PROTOCOL_ERROR: - case CANNOT_ACCEPT: case NOT_CONSISTENT: - case TOO_BIG: - case NO_EXTENSION: - case TRY_AGAIN_LATER: - case SERVICE_RESTART: - return true; - default: + case 1003: + case 1009: + case 1010: + case 1012: // code sent by servers + case 1013: // code sent by servers + case 1014: // code sent by servers return false; + default: + return true; } } - /* - * Returns true if the given code cannot appear on the wire. It's always an - * error to send a frame with such a code or to receive one. - */ - private static boolean isForbidden(int code) { + static boolean isLegalToReceiveFromServer(int code) { + if (!isLegal(code)) { + return false; + } + return code != 1010; // code sent by clients + } + + private static boolean isLegal(int code) { + // 2-byte unsigned integer excluding first 1000 numbers from the range + // [0, 999] which are never used + if (code < 1000 || code > 65535) { + return false; + } + // Codes from the range below has no known meaning under the WebSocket + // specification (i.e. unassigned/undefined) + if ((code >= 1016 && code <= 2999) || code == 1004) { + return false; + } + // Codes below cannot appear on the wire. It's always an error either + // to send a frame with such a code or to receive one. switch (code) { case NO_STATUS_CODE: case CLOSED_ABNORMALLY: - case TLS_HANDSHAKE_FAILURE: - return true; - default: + case 1015: return false; + default: + return true; } } - - /* - * Returns true if the given code has no known meaning under the WebSocket - * specification (i.e. unassigned/undefined). - */ - private static boolean isUnassigned(int code) { - return (code >= 1016 && code <= 2999) || code == 1004 || code == 1014; - } - - /* - * Returns true if the given code is not in domain of status codes: - * - * 2-byte unsigned integer minus first 1000 numbers from the range [0, 999] - * that are never used. - */ - private static boolean isOutOfRange(int code) { - return code < 1000 || code > 65535; - } } diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Transmitter.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Transmitter.java index 083283bc5f3..4991515cbb6 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Transmitter.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/Transmitter.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 @@ -37,11 +37,12 @@ import static java.util.Objects.requireNonNull; * * No matter whether the message has been fully sent or an error has occurred, * the transmitter reports the outcome to the supplied handler and becomes ready - * to accept a new message. Until then, it is considered "busy" and an - * IllegalStateException will be thrown on each attempt to invoke send. + * to accept a new message. Until then, the transmitter is considered "busy" and + * an IllegalStateException will be thrown on each attempt to invoke send. */ final class Transmitter { + /* This flag is used solely for assertions */ private final AtomicBoolean busy = new AtomicBoolean(); private OutgoingMessage message; private Consumer completionHandler; @@ -53,9 +54,10 @@ final class Transmitter { this.event = createHandler(); } - /* - * The supplied handler may be invoked in the calling thread, so watch out - * for stack overflow. + /** + * The supplied handler may be invoked in the calling thread. + * A {@code StackOverflowError} may thus occur if there's a possibility + * that this method is called again by the supplied handler. */ void send(OutgoingMessage message, Consumer completionHandler) { requireNonNull(message); @@ -86,8 +88,9 @@ final class Transmitter { private void send0(OutgoingMessage message, Consumer handler) { boolean b = busy.get(); assert b; // Please don't inline this, as busy.get() has memory - // visibility effects and we don't want the correctness - // of the algorithm to depend on assertions flag + // visibility effects and we don't want the program behaviour + // to depend on whether the assertions are turned on + // or turned off try { boolean sent = message.sendTo(channel); if (sent) { diff --git a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java index 863211d5948..74d1445fc29 100644 --- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java +++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.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 @@ -51,9 +51,9 @@ import java.util.function.Function; import static java.util.Objects.requireNonNull; import static java.util.concurrent.CompletableFuture.failedFuture; import static jdk.incubator.http.internal.common.Pair.pair; +import static jdk.incubator.http.internal.websocket.StatusCodes.CLOSED_ABNORMALLY; import static jdk.incubator.http.internal.websocket.StatusCodes.NO_STATUS_CODE; -import static jdk.incubator.http.internal.websocket.StatusCodes.TLS_HANDSHAKE_FAILURE; -import static jdk.incubator.http.internal.websocket.StatusCodes.checkOutgoingCode; +import static jdk.incubator.http.internal.websocket.StatusCodes.isLegalToSendFromClient; /* * A WebSocket client. @@ -74,8 +74,8 @@ final class WebSocketImpl implements WebSocket { private final AtomicBoolean outstandingSend = new AtomicBoolean(); private final CooperativeHandler sendHandler = new CooperativeHandler(this::sendFirst); - private final Queue>> queue = - new ConcurrentLinkedQueue<>(); + private final Queue>> + queue = new ConcurrentLinkedQueue<>(); private final Context context = new OutgoingMessage.Context(); private final Transmitter transmitter; private final Receiver receiver; @@ -110,6 +110,9 @@ final class WebSocketImpl implements WebSocket { r.subprotocol, r.channel, b.getListener()); + // The order of calls might cause a subtle effects, like CF will be + // returned from the buildAsync _after_ onOpen has been signalled. + // This means if onOpen is lengthy, it might cause some problems. ws.signalOpen(); return ws; }; @@ -125,7 +128,8 @@ final class WebSocketImpl implements WebSocket { WebSocketImpl(URI uri, String subprotocol, RawChannel channel, - Listener listener) { + Listener listener) + { this.uri = requireNonNull(uri); this.subprotocol = requireNonNull(subprotocol); this.channel = requireNonNull(channel); @@ -182,15 +186,17 @@ final class WebSocketImpl implements WebSocket { * Processes a Close event that came from the channel. Invoked at most once. */ private void processClose(int statusCode, String reason) { - assert statusCode != TLS_HANDSHAKE_FAILURE; // TLS problems happen long before WebSocket is alive receiver.close(); try { channel.shutdownInput(); } catch (IOException e) { Log.logError(e); } - boolean wasComplete = !closeReceived.complete(null); - if (wasComplete) { + boolean alreadyCompleted = !closeReceived.complete(null); + if (alreadyCompleted) { + // This CF is supposed to be completed only once, the first time a + // Close message is received. No further messages are pulled from + // the socket. throw new InternalError(); } int code; @@ -261,19 +267,17 @@ final class WebSocketImpl implements WebSocket { @Override public CompletableFuture sendClose(int statusCode, String reason) { - try { - checkOutgoingCode(statusCode); - } catch (CheckFailedException e) { - IllegalArgumentException ex = new IllegalArgumentException( - "Bad status code: " + statusCode, e); - failedFuture(ex); + if (!isLegalToSendFromClient(statusCode)) { + return failedFuture( + new IllegalArgumentException("statusCode: " + statusCode)); } - return enqueueClose(new Close(statusCode, reason)); - } - - @Override - public CompletableFuture sendClose() { - return enqueueClose(new Close()); + Close msg; + try { + msg = new Close(statusCode, reason); + } catch (IllegalArgumentException e) { + return failedFuture(e); + } + return enqueueClose(msg); } /* @@ -288,8 +292,8 @@ final class WebSocketImpl implements WebSocket { } catch (IOException e) { Log.logError(e); } - boolean wasComplete = !closeSent.complete(null); - if (wasComplete) { + boolean alreadyCompleted = !closeSent.complete(null); + if (alreadyCompleted) { // Shouldn't happen as this callback must run at most once throw new InternalError(); } @@ -316,40 +320,41 @@ final class WebSocketImpl implements WebSocket { private CompletableFuture enqueue(OutgoingMessage m) { CompletableFuture cf = new CompletableFuture<>(); - Consumer h = e -> { - if (e == null) { - cf.complete(WebSocketImpl.this); - sendHandler.startOrContinue(); - } else { - -// what if this is not a users message? (must be different entry points for different messages) - - // TODO: think about correct behaviour in the face of error in - // the queue, for now it seems like the best solution is to - // deliver the error and stop - cf.completeExceptionally(e); - } - }; - queue.add(pair(m, h)); // Always returns true - sendHandler.startOrContinue(); + boolean added = queue.add(pair(m, cf)); + if (!added) { + // The queue is supposed to be unbounded + throw new InternalError(); + } + sendHandler.handle(); return cf; } - private void sendFirst() { - Pair> p = queue.poll(); + /* + * This is the main sending method. It may be run in different threads, + * but never concurrently. + */ + private void sendFirst(Runnable whenSent) { + Pair> p = queue.poll(); if (p == null) { + whenSent.run(); return; } OutgoingMessage message = p.first; - Consumer h = p.second; + CompletableFuture cf = p.second; try { - // At this point messages are finally ordered and will be written - // one by one in a mutually exclusive fashion; thus it's a pretty - // convenient place to contextualize them message.contextualize(context); + Consumer h = e -> { + if (e == null) { + cf.complete(WebSocketImpl.this); + } else { + cf.completeExceptionally(e); + } + sendHandler.handle(); + whenSent.run(); + }; transmitter.send(message, h); } catch (Exception t) { - h.accept(t); + cf.completeExceptionally(t); } } @@ -381,7 +386,7 @@ final class WebSocketImpl implements WebSocket { @Override public String toString() { return super.toString() - + "[" + (closed.get() ? "OPEN" : "CLOSED") + "]: " + uri + + "[" + (closed.get() ? "CLOSED" : "OPEN") + "]: " + uri + (!subprotocol.isEmpty() ? ", subprotocol=" + subprotocol : ""); } @@ -476,7 +481,9 @@ final class WebSocketImpl implements WebSocket { int code = ((FailWebSocketException) error).getStatusCode(); enqueueClose(new Close(code, "")) .whenComplete((r, e) -> { - ex.addSuppressed(e); + if (e != null) { + ex.addSuppressed(e); + } try { channel.close(); } catch (IOException e1) { diff --git a/jdk/test/java/net/httpclient/whitebox/Driver.java b/jdk/test/java/net/httpclient/whitebox/Driver.java index c85b8f076c6..5b9e3438989 100644 --- a/jdk/test/java/net/httpclient/whitebox/Driver.java +++ b/jdk/test/java/net/httpclient/whitebox/Driver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,5 +26,6 @@ * @bug 8151299 8164704 * @modules jdk.incubator.httpclient * @run testng jdk.incubator.httpclient/jdk.incubator.http.SelectorTest + * @run testng jdk.incubator.httpclient/jdk.incubator.http.RawChannelTest * @run testng jdk.incubator.httpclient/jdk.incubator.http.ResponseHeadersTest */ diff --git a/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/RawChannelTest.java b/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/RawChannelTest.java new file mode 100644 index 00000000000..f74c9889611 --- /dev/null +++ b/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/RawChannelTest.java @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.incubator.http; + +import jdk.incubator.http.internal.websocket.RawChannel; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URI; +import java.nio.ByteBuffer; +import java.nio.channels.SelectionKey; +import java.util.Random; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; + +import static jdk.incubator.http.HttpResponse.BodyHandler.discard; +import static org.testng.Assert.assertEquals; + +/* + * This test exercises mechanics of _independent_ reads and writes on the + * RawChannel. It verifies that the underlying implementation can manage more + * than a single type of notifications at the same time. + */ +public class RawChannelTest { + + private final AtomicLong clientWritten = new AtomicLong(); + private final AtomicLong serverWritten = new AtomicLong(); + private final AtomicLong clientRead = new AtomicLong(); + private final AtomicLong serverRead = new AtomicLong(); + + /* + * Since at this level we don't have any control over the low level socket + * parameters, this latch ensures a write to the channel will stall at least + * once (socket's send buffer filled up). + */ + private final CountDownLatch writeStall = new CountDownLatch(1); + + /* + * This one works similarly by providing means to ensure a read from the + * channel will stall at least once (no more data available on the socket). + */ + private final CountDownLatch readStall = new CountDownLatch(1); + + private final AtomicInteger writeHandles = new AtomicInteger(); + private final AtomicInteger readHandles = new AtomicInteger(); + + private final CountDownLatch exit = new CountDownLatch(1); + + @Test + public void test() throws Exception { + try (ServerSocket server = new ServerSocket(0)) { + int port = server.getLocalPort(); + new TestServer(server).start(); + final RawChannel chan = channelOf(port); + + // It's very important not to forget the initial bytes, possibly + // left from the HTTP thingy + int initialBytes = chan.initialByteBuffer().remaining(); + print("RawChannel has %s initial bytes", initialBytes); + clientRead.addAndGet(initialBytes); + + chan.registerEvent(new RawChannel.RawEvent() { + + private final ByteBuffer reusableBuffer = ByteBuffer.allocate(32768); + + @Override + public int interestOps() { + return SelectionKey.OP_WRITE; + } + + @Override + public void handle() { + int i = writeHandles.incrementAndGet(); + print("OP_WRITE #%s", i); + if (i > 3) { // Fill up the send buffer not more than 3 times + try { + chan.shutdownOutput(); + } catch (IOException e) { + e.printStackTrace(); + } + return; + } + long total = 0; + try { + long n; + do { + ByteBuffer[] array = {reusableBuffer.slice()}; + n = chan.write(array, 0, 1); + total += n; + } while (n > 0); + print("OP_WRITE clogged SNDBUF with %s bytes", total); + clientWritten.addAndGet(total); + chan.registerEvent(this); + writeStall.countDown(); // signal send buffer is full + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + }); + + chan.registerEvent(new RawChannel.RawEvent() { + + @Override + public int interestOps() { + return SelectionKey.OP_READ; + } + + @Override + public void handle() { + int i = readHandles.incrementAndGet(); + print("OP_READ #%s", i); + ByteBuffer read = null; + long total = 0; + while (true) { + try { + read = chan.read(); + } catch (IOException e) { + e.printStackTrace(); + } + if (read == null) { + print("OP_READ EOF"); + break; + } else if (!read.hasRemaining()) { + print("OP_READ stall"); + try { + chan.registerEvent(this); + } catch (IOException e) { + e.printStackTrace(); + } + readStall.countDown(); + break; + } + int r = read.remaining(); + total += r; + clientRead.addAndGet(r); + } + print("OP_READ read %s bytes", total); + } + }); + exit.await(); // All done, we need to compare results: + assertEquals(clientRead.get(), serverWritten.get()); + assertEquals(serverRead.get(), clientWritten.get()); + } + } + + private static RawChannel channelOf(int port) throws Exception { + URI uri = URI.create("http://127.0.0.1:" + port + "/"); + print("raw channel to %s", uri.toString()); + HttpRequest req = HttpRequest.newBuilder(uri).build(); + HttpResponse r = HttpClient.newHttpClient().send(req, discard(null)); + r.body(); + return ((HttpResponseImpl) r).rawChannel(); + } + + private class TestServer extends Thread { // Powered by Slowpokes + + private final ServerSocket server; + + TestServer(ServerSocket server) throws IOException { + this.server = server; + } + + @Override + public void run() { + try (Socket s = server.accept()) { + InputStream is = s.getInputStream(); + OutputStream os = s.getOutputStream(); + + processHttp(is, os); + + Thread reader = new Thread(() -> { + try { + long n = readSlowly(is); + print("Server read %s bytes", n); + serverRead.addAndGet(n); + s.shutdownInput(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + + Thread writer = new Thread(() -> { + try { + long n = writeSlowly(os); + print("Server written %s bytes", n); + serverWritten.addAndGet(n); + s.shutdownOutput(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + + reader.start(); + writer.start(); + + reader.join(); + writer.join(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + exit.countDown(); + } + } + + private void processHttp(InputStream is, OutputStream os) + throws IOException + { + os.write("HTTP/1.1 200 OK\r\nContent-length: 0\r\n\r\n".getBytes()); + byte[] buf = new byte[1024]; + String s = ""; + while (true) { + int n = is.read(buf); + if (n <= 0) { + throw new RuntimeException("Unexpected end of request"); + } + s = s + new String(buf, 0, n); + if (s.contains("\r\n\r\n")) { + break; + } + } + } + + private long writeSlowly(OutputStream os) throws Exception { + byte[] first = byteArrayOfSize(1024); + long total = first.length; + os.write(first); + // Let's wait for the signal from the raw channel that its read has + // stalled, and then continue sending a bit more stuff + readStall.await(); + for (int i = 0; i < 32; i++) { + byte[] b = byteArrayOfSize(1024); + os.write(b); + total += b.length; + TimeUnit.MILLISECONDS.sleep(1); + } + return total; + } + + private long readSlowly(InputStream is) throws Exception { + // Wait for the raw channel to fill up the its send buffer + writeStall.await(); + long overall = 0; + byte[] array = new byte[1024]; + for (int n = 0; n != -1; n = is.read(array)) { + TimeUnit.MILLISECONDS.sleep(1); + overall += n; + } + return overall; + } + } + + private static void print(String format, Object... args) { + System.out.println(Thread.currentThread() + ": " + String.format(format, args)); + } + + private static byte[] byteArrayOfSize(int bound) { + return new byte[new Random().nextInt(1 + bound)]; + } +} From d1a39aa352a36224904aa0d2669c065fb392f5e8 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 10 May 2017 18:27:31 +0200 Subject: [PATCH 010/105] 8179867: JDK9 b167: demos exist in JDK bundles Reviewed-by: ihse --- make/Bundles.gmk | 1 + make/Main.gmk | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/make/Bundles.gmk b/make/Bundles.gmk index 66436381e92..ba35dcbf48e 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -183,6 +183,7 @@ ifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ $(JDK_EXTRA_EXCLUDES) \ $(SYMBOLS_EXCLUDE_PATTERN) \ + $(JDK_IMAGE_HOMEDIR)/demo/% , \ $(ALL_JDK_FILES) \ ) diff --git a/make/Main.gmk b/make/Main.gmk index cb7c7ec44d4..81131518689 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -277,7 +277,10 @@ ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \ demos-jdk: +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk) -ALL_TARGETS += demos-jdk +test-image-demos-jdk: + +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk images) + +ALL_TARGETS += demos-jdk test-image-demos-jdk ################################################################################ # Jigsaw specific data and analysis targets. @@ -631,6 +634,7 @@ else # jdk libs, even though they don't need to. To avoid warnings, make sure they # aren't built until after libjava and libjvm are available to link to. demos-jdk: java.base-libs exploded-image-optimize + test-image-demos-jdk: demos-jdk # Declare dependency from -java to -gensrc $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc)) @@ -963,7 +967,8 @@ docs-image: docs-jdk # This target builds the test image test-image: prepare-test-image test-image-hotspot-jtreg-native \ - test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest + test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest \ + test-image-demos-jdk # all-images builds all our deliverables as images. all-images: product-images test-image docs-image From 66f56c70864ec2490018b411e541b30715d814da Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 10 May 2017 18:27:48 +0200 Subject: [PATCH 011/105] 8179867: JDK9 b167: demos exist in JDK bundles Reviewed-by: ihse --- jdk/make/CompileDemos.gmk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk index 336a2538e83..5b093935cd7 100644 --- a/jdk/make/CompileDemos.gmk +++ b/jdk/make/CompileDemos.gmk @@ -291,9 +291,21 @@ endif ################################################################################ +ifneq ($(filter images, $(MAKECMDGOALS)), ) + $(eval $(call SetupCopyFiles, COPY_TO_TEST_IMAGE, \ + SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \ + DEST := $(TEST_IMAGE_DIR)/jdk/demos, \ + FILES := $(call DoubleDollar, $(call CacheFind, $(SUPPORT_OUTPUTDIR)/demos/image)), \ + )) + + IMAGES_TARGETS := $(COPY_TO_TEST_IMAGE) +endif + +################################################################################ # Hook to include the corresponding custom file, if present. $(eval $(call IncludeCustomExtension, jdk, CompileDemos.gmk)) all: $(TARGETS) +images: $(IMAGES_TARGETS) .PHONY: all From 74f02ffc4632c882ac3b8291928766a35bbbbe51 Mon Sep 17 00:00:00 2001 From: Tim Bell Date: Wed, 10 May 2017 14:55:31 -0700 Subject: [PATCH 012/105] 8180129: Bundles.gmk:181: *** unterminated call to function 'filter-out': missing ')'. Stop Reviewed-by: erikj --- make/Bundles.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/Bundles.gmk b/make/Bundles.gmk index ba35dcbf48e..81321550e23 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -183,7 +183,7 @@ ifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ $(JDK_EXTRA_EXCLUDES) \ $(SYMBOLS_EXCLUDE_PATTERN) \ - $(JDK_IMAGE_HOMEDIR)/demo/% + $(JDK_IMAGE_HOMEDIR)/demo/% \ , \ $(ALL_JDK_FILES) \ ) From fd872c65c8ce697d4c3e5c3a5c6f438319bca7ce Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 10 May 2017 15:24:29 -0700 Subject: [PATCH 013/105] 8180041: Fix HTML 5 issues in java.corba Reviewed-by: alanb, lancea --- .../sun/corba/se/spi/monitoring/package.html | 4 +- .../share/classes/org/omg/CORBA/Any.java | 4 +- .../share/classes/org/omg/CORBA/ORB.java | 10 ++- .../org/omg/CORBA/doc-files/compliance.html | 2 +- .../omg/CORBA/doc-files/generatedfiles.html | 2 +- .../share/classes/org/omg/CORBA/package.html | 20 +++--- .../org/omg/CORBA/portable/package.html | 8 +-- .../classes/org/omg/CORBA_2_3/package.html | 8 +-- .../org/omg/PortableInterceptor/IOP.idl | 4 +- .../omg/PortableInterceptor/Interceptors.idl | 72 ++++++++++--------- .../org/omg/PortableInterceptor/package.html | 8 +-- .../org/omg/PortableServer/package.html | 8 +-- 12 files changed, 78 insertions(+), 72 deletions(-) diff --git a/corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html b/corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html index 4a72719c0cf..f73b0cbb907 100644 --- a/corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html +++ b/corba/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ package - -Provides the mapping of the OMG CORBA APIs to the JavaTM + +Provides the mapping of the OMG CORBA APIs to the Java™ programming language, including the class ORB, which is implemented so that a programmer can use it as a fully-functional Object Request Broker (ORB). @@ -427,7 +427,7 @@ will contain the static methods needed for manipulating instances of the type, in this case, Account objects. - +

    The narrow Method

    When an object is the return value for a method, it is returned in the form of a generic object, either an org.omg.CORBA.Object object @@ -465,7 +465,7 @@ tutorial uses a narrow method that looks like this: helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
    - +

    Example of a Basic Helper Class

    A basic helper class, for purposes of this explanation, is one with the methods that are provided by every helper class, plus a narrow @@ -671,7 +671,7 @@ abstract public class AddressHelper      WStringSeqHelper      WStringValueHelper - +

    Other Classes

    The other classes and interfaces in the CORBA package, which are @@ -868,17 +868,17 @@ For overviews, guides, and a tutorial, please see: -

    +

    CORBA Features Not Implemented in Java IDL

    Some of the API included in org.omg subpackages is provided for conformance with the current OMG CORBA specification but is not implemented -in Sun's release of the JDKTM. This enables +in Sun's release of the JDK™. This enables other JDK licensees to provide implementations of this API in standard extensions and products. -

    +

    Features That Throw NO_IMPLEMENT

    Some of the API included in org.omg subpackages throw diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html index c8f6b33ae37..e0f5cbb0372 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/portable/package.html @@ -1,8 +1,8 @@ - + - + Provides a portability layer, that is, a set of ORB APIs that makes it possible for code generated @@ -38,7 +38,7 @@ can call into these ORB APIs.

    - +


    CORBA Features Throwing NO_IMPLEMENT() Exceptions


    diff --git a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html index c1869b1c512..7a82edb9275 100644 --- a/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html +++ b/corba/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ package - + The CORBA_2_3 package defines additions to existing CORBA interfaces in the Java[tm] Standard Edition 6.   These changes occurred in recent revisions to the CORBA API defined by the OMG.  The new methods were @@ -46,7 +46,7 @@ the Java[tm] Platform, Standard Edition 6, ORB complies, see Official Specifications for CORBA support in Java[tm] SE 6.

    - + The following methods in the abstract class org.omg.CORBA_2_3.ORB are unimplemented:

      diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl index d3c4ed75e15..3dc071dc1bb 100644 --- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl +++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -425,7 +425,7 @@ module IOP { * encoded using GIOP 1.2 with a TCS-W of UTF-16. This service context * may be sent on Reply messages with a reply_status of SYSTEM_EXCEPTION * or USER_EXCEPTION. The usage of this service context is defined - * by language mappings.

      + * by language mappings.

      * * IDL/Java: ptc/02-01-22: 1.15.2: * When a System Exception is marshaled, its GIOP Reply message shall diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl index bcb9b544a32..ca2612e5719 100644 --- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl +++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -580,7 +580,8 @@ module PortableInterceptor { * to access it will result in a BAD_INV_ORDER being thrown * with a standard minor code of 14. * - * + *
      + * * * * @@ -597,42 +598,42 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * @@ -640,7 +641,7 @@ module PortableInterceptor { * * * - * + * * * * @@ -648,14 +649,14 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * @@ -663,14 +664,14 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * @@ -678,21 +679,21 @@ module PortableInterceptor { * * - * + * * * * * * * - * + * * * * * * * - * + * * * * @@ -704,14 +705,14 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * @@ -719,49 +720,49 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * @@ -935,7 +936,8 @@ module PortableInterceptor { * standard minor code of 14. * * - *
      Shows the validity of each attribute or operation
       Inherited from RequestInfo:

      request_id

      request_id

      yesyesyesyesyes

      operation

      operation

      yesyesyesyesyes

      arguments

      arguments

      yes1no yesno no

      exceptions

      exceptions

      yesno yesyesyes

      contexts

      contexts

      yesno yesyesyes

      operation_context

      operation_context

      yesno yesyes

      result

      result

      no no yesno

      response_expected

      response_expected

      yesyesyesyesyes

      sync_scope

      sync_scope

      yesno yesyes

      reply_status

      reply_status

      no no yesyesyes

      forward_reference

      forward_reference

      no no no yes2 *

      get_slot

      get_slot

      yesyesyesyesyes

      get_request_service_context

      get_request_service_context

      yesno yesyesyes

      get_reply_service_context

      get_reply_service_context

      no no yesClientRequestInfo-specific:

      target

      target

      yesyesyesyesyes

      effective_target

      effective_target

      yesyesyesyes

      effective_profile

      effective_profile

      yesyesyesyesyes

      received_exception

      received_exception

      no no no yesno

      received_exception_id

      received_exception_id

      no no no yesno

      get_effective_component

      get_effective_component

      yesno yesyesyes

      get_effective_components

      get_effective_components

      yesno yesyesyes

      get_request_policy

      get_request_policy

      yesno yesyesyes

      add_request_service_context

      add_request_service_context

      yesno no
      + *
      + * * * * @@ -953,21 +955,21 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * * * * - * + * * * * @@ -975,21 +977,21 @@ module PortableInterceptor { * * - * + * * * * * * * - * + * * * * * * * - * + * * * * @@ -997,7 +999,7 @@ module PortableInterceptor { * * * - * + * * * * @@ -1005,14 +1007,14 @@ module PortableInterceptor { * * * - * + * * * * * * * - * + * * * * diff --git a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html index 3e192706b72..f35c5347b3f 100644 --- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html +++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html @@ -1,9 +1,9 @@ - + - + Provides a mechanism to register ORB hooks through which ORB services can intercept the normal flow of execution of the ORB. @@ -52,7 +52,7 @@ See the javadocs for class {@link org.omg.PortableInterceptor.ORBInitializer ORBInitializer} for how to go about registering interceptors. - +

      Known limitations / unimplemented methods in package org.omg.PortableInterceptor

      diff --git a/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html b/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html index cabb3b46055..9994e12ad97 100644 --- a/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html +++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html @@ -1,9 +1,9 @@ - + - + Provides classes and interfaces for making the server side of your applications portable across multivendor ORBs. @@ -160,7 +160,7 @@ follows exactly the same pattern as the other holder classes for basic types. Java IDL home page.

      Example Code

      - +

      Example Server Code

       import javax.naming.InitialContext;
      
      From 56a26d4865914c474784bd4002b96247be7a2235 Mon Sep 17 00:00:00 2001
      From: Stuart Marks 
      Date: Wed, 10 May 2017 15:59:15 -0700
      Subject: [PATCH 014/105] 8180128: small errors in String javadoc
      
      Reviewed-by: lancea
      ---
       jdk/src/java.base/share/classes/java/lang/String.java | 4 ++--
       1 file changed, 2 insertions(+), 2 deletions(-)
      
      diff --git a/jdk/src/java.base/share/classes/java/lang/String.java b/jdk/src/java.base/share/classes/java/lang/String.java
      index 1bd125dae54..d28dcdd823a 100644
      --- a/jdk/src/java.base/share/classes/java/lang/String.java
      +++ b/jdk/src/java.base/share/classes/java/lang/String.java
      @@ -335,7 +335,7 @@ public final class String
            * subarray.
            *
            * 

      Each {@code byte} in the subarray is converted to a {@code char} as - * specified in the method above. + * specified in the {@link #String(byte[],int) String(byte[],int)} constructor. * * @deprecated This method does not properly convert bytes into characters. * As of JDK 1.1, the preferred way to do this is via the @@ -390,7 +390,7 @@ public final class String /** * Allocates a new {@code String} containing characters constructed from - * an array of 8-bit integer values. Each character cin the + * an array of 8-bit integer values. Each character c in the * resulting string is constructed from the corresponding component * b in the byte array such that: * From 5adcb2d3d78dee73438e3e5eb2dc1f5c2f48d4a4 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 11 May 2017 08:56:44 +0200 Subject: [PATCH 015/105] 8179105: Respect "include_in_docs" property from imported modules Reviewed-by: mchung, erikj --- make/common/Modules.gmk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index b14616ffc21..7477013efd5 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -391,7 +391,10 @@ define ReadSingleImportMetaData else ifeq ($$(classloader), ext) PLATFORM_MODULES += $1 endif - DOCS_MODULES += $1 + ifneq ($$(include_in_docs), false) + # defaults to true if unspecified + DOCS_MODULES += $1 + endif else # Default to include in all JRE_MODULES += $1 From f69b0746773d02f60a9f3ff0ae526eefc6847a63 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 11 May 2017 09:00:56 +0200 Subject: [PATCH 016/105] 8174848: Remove gpl templates from hotspot/make Reviewed-by: erikj --- hotspot/make/templates/gpl-cp-header | 22 ---------------------- hotspot/make/templates/gpl-header | 20 -------------------- 2 files changed, 42 deletions(-) delete mode 100644 hotspot/make/templates/gpl-cp-header delete mode 100644 hotspot/make/templates/gpl-header diff --git a/hotspot/make/templates/gpl-cp-header b/hotspot/make/templates/gpl-cp-header deleted file mode 100644 index f5b3943c4c9..00000000000 --- a/hotspot/make/templates/gpl-cp-header +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) %YEARS%, Oracle and/or its affiliates. All rights reserved. -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - -This code is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License version 2 only, as -published by the Free Software Foundation. Oracle designates this -particular file as subject to the "Classpath" exception as provided -by Oracle in the LICENSE file that accompanied this code. - -This code is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -version 2 for more details (a copy is included in the LICENSE file that -accompanied this code). - -You should have received a copy of the GNU General Public License version -2 along with this work; if not, write to the Free Software Foundation, -Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -or visit www.oracle.com if you need additional information or have any -questions. diff --git a/hotspot/make/templates/gpl-header b/hotspot/make/templates/gpl-header deleted file mode 100644 index 9eadb48b613..00000000000 --- a/hotspot/make/templates/gpl-header +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) %YEARS%, Oracle and/or its affiliates. All rights reserved. -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. From 116ba945dc498493ee6562ffd64a33380d50f9cb Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 11 May 2017 14:03:50 -0700 Subject: [PATCH 017/105] 8180037: move jdk.test.lib.InMemoryJavaCompiler to a separate package Reviewed-by: mseledtsov, vlivanov --- hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java | 2 +- hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java | 2 +- hotspot/test/runtime/RedefineTests/ModifyAnonymous.java | 5 ++--- hotspot/test/runtime/Unsafe/DefineClass.java | 4 ++-- hotspot/test/runtime/Unsafe/NestedUnsafe.java | 5 +---- hotspot/test/runtime/defineAnonClass/NestedUnsafe.java | 5 ++--- hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java | 5 ++--- hotspot/test/runtime/getSysPackage/GetSysPkgTest.java | 2 +- hotspot/test/runtime/modules/ModuleStress/ModuleStress.java | 3 +-- .../test/runtime/modules/PatchModule/PatchModule2Dirs.java | 3 +-- hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java | 3 +-- .../runtime/modules/PatchModule/PatchModuleClassList.java | 2 +- .../runtime/modules/PatchModule/PatchModuleJavaBase.java | 2 +- .../test/runtime/modules/PatchModule/PatchModuleTest.java | 2 +- .../test/runtime/modules/PatchModule/PatchModuleTestJar.java | 2 +- .../runtime/modules/PatchModule/PatchModuleTestJarDir.java | 4 ++-- .../test/runtime/modules/PatchModule/PatchModuleTraceCL.java | 3 +-- .../runtime/modules/Visibility/PatchModuleVisibility.java | 2 +- .../test/runtime/modules/Visibility/XbootcpNoVisibility.java | 2 +- .../test/runtime/modules/Visibility/XbootcpVisibility.java | 2 +- 20 files changed, 25 insertions(+), 35 deletions(-) diff --git a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java index 06be649608d..f648be9f484 100644 --- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java +++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java @@ -26,7 +26,7 @@ import java.util.List; import java.util.ArrayList; import jdk.test.lib.ByteCodeLoader; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.Platform; import sun.management.ManagementFactoryHelper; diff --git a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java index 186b235f0de..249993961b2 100644 --- a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java +++ b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java @@ -31,7 +31,7 @@ * @run main BootstrapRedefine */ -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; diff --git a/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java b/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java index 700a8f04e93..3eeb96e4a0a 100644 --- a/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java +++ b/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java @@ -34,15 +34,14 @@ import java.io.FileNotFoundException; import java.io.PrintWriter; -import java.lang.NoSuchFieldException; -import java.lang.NoSuchMethodException; import java.lang.RuntimeException; import java.lang.instrument.ClassDefinition; import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.IllegalClassFormatException; import java.lang.instrument.Instrumentation; import java.security.ProtectionDomain; -import jdk.test.lib.*; + +import jdk.test.lib.compiler.InMemoryJavaCompiler; public class ModifyAnonymous { diff --git a/hotspot/test/runtime/Unsafe/DefineClass.java b/hotspot/test/runtime/Unsafe/DefineClass.java index 5973f666122..1c48d95b49b 100644 --- a/hotspot/test/runtime/Unsafe/DefineClass.java +++ b/hotspot/test/runtime/Unsafe/DefineClass.java @@ -32,8 +32,8 @@ */ import java.security.ProtectionDomain; -import java.io.InputStream; -import jdk.test.lib.InMemoryJavaCompiler; + +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/NestedUnsafe.java b/hotspot/test/runtime/Unsafe/NestedUnsafe.java index a1a995ab636..ec63bf271f6 100644 --- a/hotspot/test/runtime/Unsafe/NestedUnsafe.java +++ b/hotspot/test/runtime/Unsafe/NestedUnsafe.java @@ -31,12 +31,9 @@ * @run main NestedUnsafe */ -import java.security.ProtectionDomain; -import java.io.InputStream; import java.lang.*; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.internal.misc.Unsafe; -import static jdk.test.lib.Asserts.*; // package p; diff --git a/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java b/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java index f4a80a61a59..247a42c4291 100644 --- a/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java +++ b/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java @@ -34,11 +34,10 @@ package p; -import java.security.ProtectionDomain; -import java.io.InputStream; import java.lang.*; -import jdk.test.lib.*; + import jdk.internal.misc.Unsafe; +import jdk.test.lib.compiler.InMemoryJavaCompiler; // Test that an anonymous class in package 'p' cannot define its own anonymous class diff --git a/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java b/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java index 0d773a56feb..459b9f704b4 100644 --- a/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java +++ b/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java @@ -34,11 +34,10 @@ package p; -import java.security.ProtectionDomain; -import java.io.InputStream; import java.lang.*; -import jdk.test.lib.*; + import jdk.internal.misc.Unsafe; +import jdk.test.lib.compiler.InMemoryJavaCompiler; // Test that an anonymous class that gets put in its host's package cannot define diff --git a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java index 6847f26c8f1..75360e2e394 100644 --- a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java +++ b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java @@ -33,7 +33,7 @@ import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java index c3906bcfb15..bc6341aa9cb 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java @@ -38,8 +38,7 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.InMemoryJavaCompiler; -import java.io.File; +import jdk.test.lib.compiler.InMemoryJavaCompiler; public class ModuleStress { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java b/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java index 5af477b5c30..4c49e6613ce 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java @@ -30,10 +30,9 @@ * @run main PatchModule2Dirs */ -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; -import java.io.File; public class PatchModule2Dirs { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java index cd9a66e49ab..2ebc75ec2db 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java @@ -31,8 +31,7 @@ * @run main PatchModuleCDS */ -import java.io.File; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java index e590e63a3fc..ec9776f20a8 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java @@ -33,7 +33,7 @@ import java.nio.file.Files; import java.nio.file.Paths; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java index e43325703e9..e7fe2da1705 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java @@ -31,7 +31,7 @@ * @run main PatchModuleJavaBase */ -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java index a5eb563a230..d58ca4240ef 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java @@ -31,7 +31,7 @@ * @run main PatchModuleTest */ -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java index c7775c0c136..5979da68a5c 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java @@ -31,7 +31,7 @@ * @run main PatchModuleTestJar */ -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java index 18cc2597c2b..5c5a12e7c4b 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java @@ -32,8 +32,8 @@ */ import java.io.File; -import java.nio.file.Files; -import jdk.test.lib.InMemoryJavaCompiler; + +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java index 7dda4a51d55..d1255d61e68 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java @@ -32,8 +32,7 @@ * @run main PatchModuleTraceCL */ -import java.io.File; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java b/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java index 95fbce1b125..124fd7a5665 100644 --- a/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java +++ b/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java @@ -36,7 +36,7 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; diff --git a/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java b/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java index 5f56b2573eb..4ea90f03b2c 100644 --- a/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java +++ b/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java @@ -31,7 +31,7 @@ * @run main/othervm XbootcpNoVisibility */ -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; diff --git a/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java b/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java index 1530d8bed13..4b36695c29d 100644 --- a/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java +++ b/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java @@ -36,7 +36,7 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; From 8e28d5772d7244815995190b48840816c50d0114 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 11 May 2017 14:13:59 -0700 Subject: [PATCH 018/105] 8180004: jdk.test.lib.DynamicVMOption should be moved to jdk.test.lib.management Reviewed-by: mseledtsov, vlivanov --- hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java | 2 +- hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java | 2 +- hotspot/test/gc/parallel/TestDynShrinkHeap.java | 2 +- .../runtime/CommandLine/OptionsValidation/TestJcmdOutput.java | 2 +- .../OptionsValidation/common/optionsvalidation/JVMOption.java | 2 +- .../runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java index c6d2b547357..4b7fd30ab41 100644 --- a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java @@ -24,7 +24,7 @@ import static jdk.test.lib.Asserts.assertEQ; import static jdk.test.lib.Asserts.assertFalse; import static jdk.test.lib.Asserts.assertTrue; -import jdk.test.lib.DynamicVMOption; +import jdk.test.lib.management.DynamicVMOption; /** * @test TestDynMaxHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java index e21f066b0a0..09f24e7af35 100644 --- a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java @@ -38,7 +38,7 @@ import static jdk.test.lib.Asserts.assertEQ; import static jdk.test.lib.Asserts.assertFalse; import static jdk.test.lib.Asserts.assertTrue; -import jdk.test.lib.DynamicVMOption; +import jdk.test.lib.management.DynamicVMOption; public class TestDynMinHeapFreeRatio { diff --git a/hotspot/test/gc/parallel/TestDynShrinkHeap.java b/hotspot/test/gc/parallel/TestDynShrinkHeap.java index f5e78ab7346..78c5946c4b7 100644 --- a/hotspot/test/gc/parallel/TestDynShrinkHeap.java +++ b/hotspot/test/gc/parallel/TestDynShrinkHeap.java @@ -31,7 +31,7 @@ * @library /test/lib / * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap */ -import jdk.test.lib.DynamicVMOption; +import jdk.test.lib.management.DynamicVMOption; import java.lang.management.ManagementFactory; import java.lang.management.MemoryUsage; import java.util.ArrayList; diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java index d15d536b751..1a46eb01877 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java @@ -34,7 +34,7 @@ */ import jdk.test.lib.Asserts; -import jdk.test.lib.DynamicVMOption; +import jdk.test.lib.management.DynamicVMOption; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.dcmd.PidJcmdExecutor; diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java index b10ac75c56e..dd19e352d32 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java @@ -29,7 +29,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; -import jdk.test.lib.DynamicVMOption; +import jdk.test.lib.management.DynamicVMOption; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.dcmd.CommandExecutor; diff --git a/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java b/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java index 865fb9b8556..b88c50683b2 100644 --- a/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java +++ b/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java @@ -51,7 +51,7 @@ import java.util.List; import java.util.Properties; import java.util.Set; import jdk.test.lib.Asserts; -import jdk.test.lib.DynamicVMOption; +import jdk.test.lib.management.DynamicVMOption; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; From c775f6f58be85e196a0eb4d7402b7f30515b66fb Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 15 May 2017 12:20:15 +0200 Subject: [PATCH 019/105] 8180048: Interned string and symbol table leak memory during parallel unlinking Make appending found dead BasicHashtableEntrys to the free list atomic. Reviewed-by: ehelin, shade, coleenp --- .../src/share/vm/classfile/stringTable.cpp | 19 ++++++---- .../src/share/vm/classfile/stringTable.hpp | 8 +++-- .../src/share/vm/classfile/symbolTable.cpp | 35 +++++++++++-------- .../src/share/vm/classfile/symbolTable.hpp | 9 +++-- hotspot/src/share/vm/runtime/vmStructs.cpp | 2 +- hotspot/src/share/vm/utilities/hashtable.cpp | 31 +++++++++++++++- hotspot/src/share/vm/utilities/hashtable.hpp | 22 ++++++++++-- 7 files changed, 97 insertions(+), 29 deletions(-) diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp index 05f6fd8be46..731cba8a8a6 100644 --- a/hotspot/src/share/vm/classfile/stringTable.cpp +++ b/hotspot/src/share/vm/classfile/stringTable.cpp @@ -314,7 +314,11 @@ oop StringTable::intern(const char* utf8_string, TRAPS) { } void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) { - buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed); + BucketUnlinkContext context; + buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), &context); + _the_table->bulk_free_entries(&context); + *processed = context._num_processed; + *removed = context._num_removed; } void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) { @@ -323,6 +327,7 @@ void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_aliv assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); const int limit = the_table()->table_size(); + BucketUnlinkContext context; for (;;) { // Grab next set of buckets to scan int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; @@ -332,8 +337,11 @@ void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_aliv } int end_idx = MIN2(limit, start_idx + ClaimChunkSize); - buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed); + buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, &context); } + _the_table->bulk_free_entries(&context); + *processed = context._num_processed; + *removed = context._num_removed; } void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) { @@ -359,7 +367,7 @@ void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) { } } -void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) { +void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context) { const int limit = the_table()->table_size(); assert(0 <= start_idx && start_idx <= limit, @@ -383,10 +391,9 @@ void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClos p = entry->next_addr(); } else { *p = entry->next(); - the_table()->free_entry(entry); - (*removed)++; + context->free_entry(entry); } - (*processed)++; + context->_num_processed++; entry = *p; } } diff --git a/hotspot/src/share/vm/classfile/stringTable.hpp b/hotspot/src/share/vm/classfile/stringTable.hpp index 2c0afc8bca5..0ef225f1c54 100644 --- a/hotspot/src/share/vm/classfile/stringTable.hpp +++ b/hotspot/src/share/vm/classfile/stringTable.hpp @@ -61,9 +61,13 @@ private: // Apply the give oop closure to the entries to the buckets // in the range [start_idx, end_idx). static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); + + typedef StringTable::BucketUnlinkContext BucketUnlinkContext; // Unlink or apply the give oop closure to the entries to the buckets - // in the range [start_idx, end_idx). - static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); + // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given + // context to be freed later. + // This allows multiple threads to work on the table at once. + static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context); // Hashing algorithm, used as the hash value used by the // StringTable for bucket selection and comparison (stored in the diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 5121fdbcd64..548be92bcad 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,7 +98,7 @@ int SymbolTable::_symbols_removed = 0; int SymbolTable::_symbols_counted = 0; volatile int SymbolTable::_parallel_claimed_idx = 0; -void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int* removed) { +void SymbolTable::buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context) { for (int i = start_idx; i < end_idx; ++i) { HashtableEntry** p = the_table()->bucket_addr(i); HashtableEntry* entry = the_table()->bucket(i); @@ -111,15 +111,14 @@ void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int break; } Symbol* s = entry->literal(); - (*processed)++; + context->_num_processed++; assert(s != NULL, "just checking"); // If reference count is zero, remove. if (s->refcount() == 0) { assert(!entry->is_shared(), "shared entries should be kept live"); delete s; - (*removed)++; *p = entry->next(); - the_table()->free_entry(entry); + context->free_entry(entry); } else { p = entry->next_addr(); } @@ -132,17 +131,20 @@ void SymbolTable::buckets_unlink(int start_idx, int end_idx, int* processed, int // Remove unreferenced symbols from the symbol table // This is done late during GC. void SymbolTable::unlink(int* processed, int* removed) { - size_t memory_total = 0; - buckets_unlink(0, the_table()->table_size(), processed, removed); - _symbols_removed += *removed; - _symbols_counted += *processed; + BucketUnlinkContext context; + buckets_unlink(0, the_table()->table_size(), &context); + _the_table->bulk_free_entries(&context); + *processed = context._num_processed; + *removed = context._num_removed; + + _symbols_removed = context._num_removed; + _symbols_counted = context._num_processed; } void SymbolTable::possibly_parallel_unlink(int* processed, int* removed) { const int limit = the_table()->table_size(); - size_t memory_total = 0; - + BucketUnlinkContext context; for (;;) { // Grab next set of buckets to scan int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; @@ -152,10 +154,15 @@ void SymbolTable::possibly_parallel_unlink(int* processed, int* removed) { } int end_idx = MIN2(limit, start_idx + ClaimChunkSize); - buckets_unlink(start_idx, end_idx, processed, removed); + buckets_unlink(start_idx, end_idx, &context); } - Atomic::add(*processed, &_symbols_counted); - Atomic::add(*removed, &_symbols_removed); + + _the_table->bulk_free_entries(&context); + *processed = context._num_processed; + *removed = context._num_removed; + + Atomic::add(context._num_processed, &_symbols_counted); + Atomic::add(context._num_removed, &_symbols_removed); } // Create a new table and using alternate hash code, populate the new table diff --git a/hotspot/src/share/vm/classfile/symbolTable.hpp b/hotspot/src/share/vm/classfile/symbolTable.hpp index e45ec753ef1..8e7b1362fff 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.hpp +++ b/hotspot/src/share/vm/classfile/symbolTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,8 +154,11 @@ private: static volatile int _parallel_claimed_idx; - // Release any dead symbols - static void buckets_unlink(int start_idx, int end_idx, int* processed, int* removed); + typedef SymbolTable::BucketUnlinkContext BucketUnlinkContext; + // Release any dead symbols. Unlinked bucket entries are collected in the given + // context to be freed later. + // This allows multiple threads to work on the table at once. + static void buckets_unlink(int start_idx, int end_idx, BucketUnlinkContext* context); public: enum { symbol_alloc_batch_size = 8, diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index d5b9e3db03c..0d973ca5ee8 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -673,7 +673,7 @@ typedef CompactHashtable SymbolCompactHashTable; \ nonstatic_field(BasicHashtable, _table_size, int) \ nonstatic_field(BasicHashtable, _buckets, HashtableBucket*) \ - nonstatic_field(BasicHashtable, _free_list, BasicHashtableEntry*) \ + volatile_nonstatic_field(BasicHashtable, _free_list, BasicHashtableEntry*) \ nonstatic_field(BasicHashtable, _first_free_entry, char*) \ nonstatic_field(BasicHashtable, _end_block, char*) \ nonstatic_field(BasicHashtable, _entry_size, int) \ diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp index f5d37f45fa9..5fce98e2694 100644 --- a/hotspot/src/share/vm/utilities/hashtable.cpp +++ b/hotspot/src/share/vm/utilities/hashtable.cpp @@ -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 @@ -173,6 +173,35 @@ template void BasicHashtable::reverse() { } } +template void BasicHashtable::BucketUnlinkContext::free_entry(BasicHashtableEntry* entry) { + entry->set_next(_removed_head); + _removed_head = entry; + if (_removed_tail == NULL) { + _removed_tail = entry; + } + _num_removed++; +} + +template void BasicHashtable::bulk_free_entries(BucketUnlinkContext* context) { + if (context->_num_removed == 0) { + assert(context->_removed_head == NULL && context->_removed_tail == NULL, + "Zero entries in the unlink context, but elements linked from " PTR_FORMAT " to " PTR_FORMAT, + p2i(context->_removed_head), p2i(context->_removed_tail)); + return; + } + + // MT-safe add of the list of BasicHashTableEntrys from the context to the free list. + BasicHashtableEntry* current = _free_list; + while (true) { + context->_removed_tail->set_next(current); + BasicHashtableEntry* old = (BasicHashtableEntry*)Atomic::cmpxchg_ptr(context->_removed_head, &_free_list, current); + if (old == current) { + break; + } + current = old; + } + Atomic::add(-context->_num_removed, &_number_of_entries); +} // Copy the table to the shared space. diff --git a/hotspot/src/share/vm/utilities/hashtable.hpp b/hotspot/src/share/vm/utilities/hashtable.hpp index 51324a18c62..76e8005c260 100644 --- a/hotspot/src/share/vm/utilities/hashtable.hpp +++ b/hotspot/src/share/vm/utilities/hashtable.hpp @@ -173,11 +173,11 @@ private: // Instance variables int _table_size; HashtableBucket* _buckets; - BasicHashtableEntry* _free_list; + BasicHashtableEntry* volatile _free_list; char* _first_free_entry; char* _end_block; int _entry_size; - int _number_of_entries; + volatile int _number_of_entries; protected: @@ -225,6 +225,24 @@ protected: // Free the buckets in this hashtable void free_buckets(); + // Helper data structure containing context for the bucket entry unlink process, + // storing the unlinked buckets in a linked list. + // Also avoids the need to pass around these four members as parameters everywhere. + struct BucketUnlinkContext { + int _num_processed; + int _num_removed; + // Head and tail pointers for the linked list of removed entries. + BasicHashtableEntry* _removed_head; + BasicHashtableEntry* _removed_tail; + + BucketUnlinkContext() : _num_processed(0), _num_removed(0), _removed_head(NULL), _removed_tail(NULL) { + } + + void free_entry(BasicHashtableEntry* entry); + }; + // Add of bucket entries linked together in the given context to the global free list. This method + // is mt-safe wrt. to other calls of this method. + void bulk_free_entries(BucketUnlinkContext* context); public: int table_size() { return _table_size; } void set_entry(int index, BasicHashtableEntry* entry); From 916cb71538130c0afaf6f60bfdc49cbf5758d42c Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Thu, 11 May 2017 13:11:42 +0100 Subject: [PATCH 020/105] 8179954: AArch64: C1 and C2 volatile accesses are not sequentially consistent Reviewed-by: roland --- .../aarch64/vm/c1_LIRGenerator_aarch64.cpp | 10 ++++ .../cpu/aarch64/vm/templateTable_aarch64.cpp | 54 +++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp index 0c25198c04f..5abe4281aa2 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp @@ -1347,6 +1347,16 @@ void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address, void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result, CodeEmitInfo* info) { + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LD;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and C1 compiles the loads in another. + if (! UseBarriersForVolatile) { + __ membar(); + } + __ volatile_load_mem_reg(address, result, info); } diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp index 471a94511ad..f0f0f5a6ee5 100644 --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp @@ -2389,17 +2389,31 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr const Register obj = r4; const Register off = r19; const Register flags = r0; + const Register raw_flags = r6; const Register bc = r4; // uses same reg as obj, so don't mix them resolve_cache_and_index(byte_no, cache, index, sizeof(u2)); jvmti_post_field_access(cache, index, is_static, false); - load_field_cp_cache_entry(obj, cache, index, off, flags, is_static); + load_field_cp_cache_entry(obj, cache, index, off, raw_flags, is_static); if (!is_static) { // obj is on the stack pop_and_check_object(obj); } + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LDR;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and we interpret the loads in another. + if (! UseBarriersForVolatile) { + Label notVolatile; + __ tbz(raw_flags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); + __ membar(MacroAssembler::AnyAny); + __ bind(notVolatile); + } + const Address field(obj, off); Label Done, notByte, notBool, notInt, notShort, notChar, @@ -2407,7 +2421,8 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr // x86 uses a shift and mask or wings it with a shift plus assert // the mask is not needed. aarch64 just uses bitfield extract - __ ubfxw(flags, flags, ConstantPoolCacheEntry::tos_state_shift, ConstantPoolCacheEntry::tos_state_bits); + __ ubfxw(flags, raw_flags, ConstantPoolCacheEntry::tos_state_shift, + ConstantPoolCacheEntry::tos_state_bits); assert(btos == 0, "change code, btos != 0"); __ cbnz(flags, notByte); @@ -2529,9 +2544,11 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr #endif __ bind(Done); - // It's really not worth bothering to check whether this field - // really is volatile in the slow case. + + Label notVolatile; + __ tbz(raw_flags, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); + __ bind(notVolatile); } @@ -2979,6 +2996,19 @@ void TemplateTable::fast_accessfield(TosState state) __ null_check(r0); const Address field(r0, r1); + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LDR;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and we interpret the loads in another. + if (! UseBarriersForVolatile) { + Label notVolatile; + __ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); + __ membar(MacroAssembler::AnyAny); + __ bind(notVolatile); + } + // access field switch (bytecode()) { case Bytecodes::_fast_agetfield: @@ -3027,6 +3057,22 @@ void TemplateTable::fast_xaccess(TosState state) __ get_cache_and_index_at_bcp(r2, r3, 2); __ ldr(r1, Address(r2, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset()))); + + // 8179954: We need to make sure that the code generated for + // volatile accesses forms a sequentially-consistent set of + // operations when combined with STLR and LDAR. Without a leading + // membar it's possible for a simple Dekker test to fail if loads + // use LDR;DMB but stores use STLR. This can happen if C2 compiles + // the stores in one method and we interpret the loads in another. + if (! UseBarriersForVolatile) { + Label notVolatile; + __ ldrw(r3, Address(r2, in_bytes(ConstantPoolCache::base_offset() + + ConstantPoolCacheEntry::flags_offset()))); + __ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); + __ membar(MacroAssembler::AnyAny); + __ bind(notVolatile); + } + // make sure exception is reported in correct bcp range (getfield is // next instruction) __ increment(rbcp); From a83a070a03d906bccb8038a2ede79975673754bf Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Thu, 11 May 2017 15:05:32 +0100 Subject: [PATCH 021/105] 7155591: test/java/net/MulticastSocket/SetOutgoingIf.java fails on macOS Reviewed-by: chegar, bpb --- .../net/MulticastSocket/SetOutgoingIf.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java index 1acfa16ef38..53cb28e5f2f 100644 --- a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java +++ b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, 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 @@ -40,6 +40,10 @@ public class SetOutgoingIf { return osname.contains("Windows"); } + static boolean isMacOS() { + return System.getProperty("os.name").contains("OS X"); + } + private static boolean hasIPv6() throws Exception { List nics = Collections.list( NetworkInterface.getNetworkInterfaces()); @@ -71,7 +75,7 @@ public class SetOutgoingIf { int index = 1; for (NetworkInterface nic : Collections.list(NetworkInterface.getNetworkInterfaces())) { // we should use only network interfaces with multicast support which are in "up" state - if (!nic.isLoopback() && nic.supportsMulticast() && nic.isUp()) { + if (!nic.isLoopback() && nic.supportsMulticast() && nic.isUp() && !isTestExcludedInterface(nic)) { NetIf netIf = NetIf.create(nic); // now determine what (if any) type of addresses are assigned to this interface @@ -91,6 +95,8 @@ public class SetOutgoingIf { netIfs.add(netIf); debug("Using: " + nic); } + } else { + System.out.println("Ignore NetworkInterface nic == " + nic); } } if (netIfs.size() <= 1) { @@ -170,6 +176,15 @@ public class SetOutgoingIf { } } + private static boolean isTestExcludedInterface(NetworkInterface nif) { + if (isMacOS() && nif.getName().contains("awdl")) + return true; + String dName = nif.getDisplayName(); + if (isWindows() && dName != null && dName.contains("Teredo")) + return true; + return false; + } + private static boolean debug = true; static void debug(String message) { From a5deccf8607e087a2554b5b54598ad415f48b379 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 11 May 2017 07:43:36 -0700 Subject: [PATCH 022/105] 8180085: (ch) java/nio/channels/SocketChannel/VectorIO.java: add debug instrumentation Add some print statements potentially useful in solving JDK-8177801. Reviewed-by: alanb --- .../java/nio/channels/SocketChannel/VectorIO.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java index 907d1b21716..8f585afb21a 100644 --- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java +++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java @@ -87,8 +87,11 @@ public class VectorIO { while (rem > 0L) { long bytesWritten = sc.write(bufs); if (bytesWritten == 0) { - if (sc.isBlocking()) + if (sc.isBlocking()) { throw new RuntimeException("write did not block"); + } else { + System.err.println("Non-blocking write() wrote zero bytes"); + } Thread.sleep(50); } else { rem -= bytesWritten; @@ -140,8 +143,10 @@ public class VectorIO { for (;;) { sc = ssc.accept(); - if (sc != null) + if (sc != null) { + System.err.println("accept() succeeded"); break; + } Thread.sleep(50); } @@ -154,8 +159,12 @@ public class VectorIO { if (bytesRead < 0) break; if (bytesRead == 0) { - if (sc.isBlocking()) + if (sc.isBlocking()) { throw new RuntimeException("read did not block"); + } else { + System.err.println + ("Non-blocking read() read zero bytes"); + } Thread.sleep(50); } avail -= bytesRead; From a98da97e09b6df6949446ed1289d24e38d0f2db4 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Thu, 11 May 2017 18:41:56 +0200 Subject: [PATCH 023/105] 8180083: Adjust Jib and JDL configurations for 9 to support new generation Mach 5 Reviewed-by: tbell, ihse --- common/conf/jib-profiles.js | 154 +++++++++++++++++++++++------------- 1 file changed, 98 insertions(+), 56 deletions(-) diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js index 8ac3df48218..b6fd25a6fcf 100644 --- a/common/conf/jib-profiles.js +++ b/common/conf/jib-profiles.js @@ -239,11 +239,8 @@ var getJibProfilesCommon = function (input, data) { common.main_profile_base = { dependencies: ["boot_jdk", "gnumake", "jtreg"], default_make_targets: ["product-bundles", "test-bundles"], - configure_args: [ - "--with-version-opt=" + common.build_id, - "--enable-jtreg-failure-handler", - "--with-version-build=" + common.build_number - ] + configure_args: concat(["--enable-jtreg-failure-handler"], + versionArgs(input, common)) }; // Extra settings for debug profiles common.debug_suffix = "-debug"; @@ -269,10 +266,12 @@ var getJibProfilesCommon = function (input, data) { /** * Define common artifacts template for all main profiles - * @param pf - Name of platform in bundle names - * @param demo_ext - Type of extension for demo bundle + * @param o - Object containing data for artifacts */ - common.main_profile_artifacts = function (pf, demo_ext) { + common.main_profile_artifacts = function (o) { + var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version); + var jre_subdir = (o.jre_subdir != null ? o.jre_subdir : "jre-" + data.version); + var pf = o.platform return { artifacts: { jdk: { @@ -281,7 +280,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -290,7 +289,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -307,7 +306,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -316,15 +315,8 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" - }, - demo: { - local: "bundles/\\(jdk.*demo." + demo_ext + "\\)", - remote: [ - "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_demo." + demo_ext, - "bundles/" + pf + "/\\1" - ], } } }; @@ -333,9 +325,12 @@ var getJibProfilesCommon = function (input, data) { /** * Define common artifacts template for all debug profiles - * @param pf - Name of platform in bundle names + * @param o - Object containing data for artifacts */ - common.debug_profile_artifacts = function (pf) { + common.debug_profile_artifacts = function (o) { + var jdk_subdir = "jdk-" + data.version + "/fastdebug"; + var jre_subdir = "jre-" + data.version + "/fastdebug"; + var pf = o.platform return { artifacts: { jdk: { @@ -344,7 +339,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre: { @@ -353,7 +348,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" }, test: { @@ -370,7 +365,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jdk-" + data.version, + subdir: jdk_subdir, exploded: "images/jdk" }, jre_symbols: { @@ -379,7 +374,7 @@ var getJibProfilesCommon = function (input, data) { "bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz", "bundles/" + pf + "/\\1" ], - subdir: "jre-" + data.version, + subdir: jre_subdir, exploded: "images/jre" } } @@ -621,7 +616,7 @@ var getJibProfilesProfiles = function (input, common, data) { var testOnlyProfilesPrebuilt = { "run-test-prebuilt": { src: "src.conf", - dependencies: [ "jtreg", "gnumake", testedProfile + ".jdk", + dependencies: [ "jtreg", "gnumake", "boot_jdk", testedProfile + ".jdk", testedProfile + ".test", "src.full" ], work_dir: input.get("src.full", "install_path") + "/test", @@ -665,61 +660,53 @@ var getJibProfilesProfiles = function (input, common, data) { // // Define artifacts for profiles // - // Macosx bundles are named osx and Windows demo bundles use zip instead of + // Macosx bundles are named osx // tar.gz. var artifactData = { "linux-x64": { platform: "linux-x64", - demo_ext: "tar.gz" }, "linux-x86": { platform: "linux-x86", - demo_ext: "tar.gz" }, "macosx-x64": { platform: "osx-x64", - demo_ext: "tar.gz" + jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home", + jre_subdir: "jre-" + data.version + ".jre/Contents/Home" }, "solaris-x64": { platform: "solaris-x64", - demo_ext: "tar.gz" }, "solaris-sparcv9": { platform: "solaris-sparcv9", - demo_ext: "tar.gz" }, "windows-x64": { platform: "windows-x64", - demo_ext: "zip" }, "windows-x86": { platform: "windows-x86", - demo_ext: "zip" }, "linux-arm64": { platform: "linux-arm64-vfp-hflt", - demo_ext: "tar.gz" }, "linux-arm-vfp-hflt": { platform: "linux-arm32-vfp-hflt", - demo_ext: "tar.gz" }, "linux-arm-vfp-hflt-dyn": { platform: "linux-arm32-vfp-hflt-dyn", - demo_ext: "tar.gz" } } // Generate common artifacts for all main profiles Object.keys(artifactData).forEach(function (name) { profiles[name] = concatObjects(profiles[name], - common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext)); + common.main_profile_artifacts(artifactData[name])); }); // Generate common artifacts for all debug profiles Object.keys(artifactData).forEach(function (name) { var debugName = name + common.debug_suffix; profiles[debugName] = concatObjects(profiles[debugName], - common.debug_profile_artifacts(artifactData[name].platform)); + common.debug_profile_artifacts(artifactData[name])); }); // Extra profile specific artifacts @@ -740,7 +727,12 @@ var getJibProfilesProfiles = function (input, common, data) { artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -748,20 +740,25 @@ var getJibProfilesProfiles = function (input, common, data) { }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x64/jdk-" + data.version + + "_linux-x64_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x64/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", }, - demo: { - local: "bundles/\\(jdk.*demo.tar.gz\\)", - remote: "bundles/openjdk/GPL/linux-x64/\\1", - }, doc_api_spec: { local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)", remote: "bundles/openjdk/GPL/linux-x64/\\1", @@ -773,11 +770,29 @@ var getJibProfilesProfiles = function (input, common, data) { artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/profile/linux-x86/\\1", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ], + subdir: "jdk-" + data.version + }, + test: { + local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/linux-x86/jdk-" + data.version + + "_linux-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/linux-x86/\\1" + ] }, jre: { // This regexp needs to not match the compact* files below @@ -803,7 +818,12 @@ var getJibProfilesProfiles = function (input, common, data) { artifacts: { jdk: { local: "bundles/\\(jdk.*bin.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre: { local: "bundles/\\(jre.*bin.tar.gz\\)", @@ -811,19 +831,24 @@ var getJibProfilesProfiles = function (input, common, data) { }, test: { local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-tests.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ] }, jdk_symbols: { local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1" + remote: [ + "bundles/openjdk/GPL/windows-x86/jdk-" + data.version + + "_windows-x86_bin-symbols.tar.gz", + "bundles/openjdk/GPL/windows-x86/\\1" + ], + subdir: "jdk-" + data.version }, jre_symbols: { local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", remote: "bundles/openjdk/GPL/windows-x86/\\1", - }, - demo: { - local: "bundles/\\(jdk.*demo.zip\\)", - remote: "bundles/openjdk/GPL/windows-x86/\\1", } } }, @@ -1148,12 +1173,29 @@ var getVersion = function (major, minor, security, patch) { + "." + (minor != null ? minor : version_numbers.get("DEFAULT_VERSION_MINOR")) + "." + (security != null ? security : version_numbers.get("DEFAULT_VERSION_SECURITY")) + "." + (patch != null ? patch : version_numbers.get("DEFAULT_VERSION_PATCH")); - while (version.match(".*\.0$")) { + while (version.match(".*\\.0$")) { version = version.substring(0, version.length - 2); } return version; }; +/** + * Constructs the common version configure args based on build type and + * other version inputs + */ +var versionArgs = function(input, common) { + var args = ["--with-version-build=" + common.build_number]; + if (input.build_type == "promoted") { + args = concat(args, + // This needs to be changed when we start building release candidates + "--with-version-pre=ea", + "--without-version-opt"); + } else { + args = concat(args, "--with-version-opt=" + common.build_id); + } + return args; +} + // Properties representation of the common/autoconf/version-numbers file. Lazily // initiated by the function below. var version_numbers; From b05e3d5acf5b367188f3b6aa92ec9c38f5dcda73 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 11 May 2017 10:48:00 -0700 Subject: [PATCH 024/105] 8179592: Update tables in java.base to be HTML 5-friendly Reviewed-by: mchung, darcy, martin --- .../share/classes/java/io/DataInput.java | 20 ++-- .../classes/java/io/RandomAccessFile.java | 9 +- .../java/io/SerializablePermission.java | 10 +- .../share/classes/java/lang/Character.java | 7 +- .../share/classes/java/lang/Class.java | 27 +++-- .../share/classes/java/lang/Double.java | 8 +- .../share/classes/java/lang/Float.java | 8 +- .../classes/java/lang/RuntimePermission.java | 9 +- .../share/classes/java/lang/String.java | 28 ++++- .../share/classes/java/lang/System.java | 14 ++- .../java/lang/invoke/LambdaMetafactory.java | 9 +- .../java/lang/invoke/MethodHandleInfo.java | 9 +- .../java/lang/invoke/MethodHandles.java | 7 +- .../java/lang/reflect/AnnotatedElement.java | 8 +- .../java/lang/reflect/ReflectPermission.java | 9 +- .../share/classes/java/math/BigDecimal.java | 8 +- .../share/classes/java/math/RoundingMode.java | 58 ++++++++-- .../share/classes/java/net/Inet4Address.java | 14 +-- .../share/classes/java/net/Inet6Address.java | 53 ++++----- .../share/classes/java/net/InetAddress.java | 7 +- .../share/classes/java/net/NetPermission.java | 9 +- .../java.base/share/classes/java/net/URI.java | 24 ++-- .../share/classes/java/net/URLConnection.java | 9 +- .../share/classes/java/net/URLPermission.java | 14 ++- .../channels/AsynchronousChannelGroup.java | 9 +- .../nio/channels/AsynchronousFileChannel.java | 9 +- .../AsynchronousServerSocketChannel.java | 9 +- .../channels/AsynchronousSocketChannel.java | 9 +- .../java/nio/channels/DatagramChannel.java | 9 +- .../java/nio/channels/FileChannel.java | 9 +- .../nio/channels/ServerSocketChannel.java | 9 +- .../java/nio/channels/SocketChannel.java | 9 +- .../classes/java/nio/charset/Charset.java | 9 +- .../classes/java/nio/file/FileSystem.java | 8 +- .../share/classes/java/nio/file/Files.java | 28 ++++- .../classes/java/nio/file/LinkPermission.java | 10 +- .../file/attribute/AclFileAttributeView.java | 9 +- .../attribute/BasicFileAttributeView.java | 9 +- .../file/attribute/DosFileAttributeView.java | 9 +- .../attribute/PosixFileAttributeView.java | 9 +- .../java/nio/file/spi/FileSystemProvider.java | 9 +- .../classes/java/security/DrbgParameters.java | 7 +- .../share/classes/java/security/Provider.java | 12 +- .../java/security/SecurityPermission.java | 16 ++- .../java/security/cert/X509Extension.java | 9 +- .../classes/java/text/DecimalFormat.java | 20 ++-- .../classes/java/text/MessageFormat.java | 14 ++- .../classes/java/text/SimpleDateFormat.java | 50 +++++---- .../java/time/chrono/HijrahChronology.java | 36 +++--- .../classes/java/time/chrono/IsoEra.java | 21 ++-- .../classes/java/time/chrono/MinguoEra.java | 23 ++-- .../java/time/chrono/ThaiBuddhistEra.java | 23 ++-- .../java/time/format/DateTimeFormatter.java | 51 ++++----- .../classes/java/time/temporal/IsoFields.java | 8 +- .../java/time/temporal/WeekFields.java | 14 ++- .../share/classes/java/util/Deque.java | 6 +- .../share/classes/java/util/Formatter.java | 106 +++++++++++++----- .../classes/java/util/GregorianCalendar.java | 97 ++++++++-------- .../share/classes/java/util/Locale.java | 75 +++++++------ .../share/classes/java/util/Queue.java | 2 +- .../classes/java/util/ResourceBundle.java | 13 ++- .../java/util/concurrent/BlockingDeque.java | 4 +- .../java/util/concurrent/BlockingQueue.java | 2 +- .../java/util/concurrent/ForkJoinPool.java | 2 +- .../classes/java/util/regex/Pattern.java | 48 +++++--- .../java/util/spi/CalendarNameProvider.java | 16 ++- .../java/util/stream/StreamOpFlag.java | 4 +- .../classes/javax/net/ssl/SSLPermission.java | 10 +- 68 files changed, 831 insertions(+), 408 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/io/DataInput.java b/jdk/src/java.base/share/classes/java/io/DataInput.java index acc7f996878..70f78a6a068 100644 --- a/jdk/src/java.base/share/classes/java/io/DataInput.java +++ b/jdk/src/java.base/share/classes/java/io/DataInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,9 @@ package java.io; * far left-hand column. * *

      - *
      Shows the validity of each attribute or operation
       Inherited from RequestInfo:

      request_id

      request_id

      yesyesyesyesyes

      operation

      operation

      yesyesyesyesyes

      arguments

      arguments

      no yes1yesno2 *

      exceptions

      exceptions

      no yesyesyesyes

      contexts

      contexts

      no yesyesyesyes

      operation_context

      operation_context

      no yesyesno

      result

      result

      no no yesno

      response_expected

      response_expected

      yesyesyesyesyes

      sync_scope

      sync_scope

      yesyesyes
      + *
      + * + * * * * * - * + * * @@ -86,14 +87,14 @@ package java.io; * * * - * + * * * - * + * * * * - * + * * * - * + * * * - * + * * + * *
      Bit values and bytes
      * All characters in the range {@code '\u005Cu0001'} to @@ -71,7 +72,7 @@ package java.io; * Bit Values
      Byte 1Byte 10 * bits 6-0 *
      Bit Values
      Byte 1Byte 11 * 1 * 0 * bits 10-6 *
      Byte 2Byte 21 * 0 * bits 5-0 @@ -108,7 +109,7 @@ package java.io; * Bit Values
      Byte 1Byte 11 * 1 * 1 @@ -116,17 +117,18 @@ package java.io; * bits 15-12 *
      Byte 2Byte 21 * 0 * bits 11-6 *
      Byte 3Byte 31 * 0 * bits 5-0 *
      *
    *

    diff --git a/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java b/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java index 4fb409ec977..b2e08f8cb27 100644 --- a/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -136,8 +136,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { * in which the file is to be opened. The permitted values and their * meanings are: * - * + *
    + * + * * + * + * * * + * *
    Access mode permitted values and meanings
    ValueMeaning
    {@code "r"} Open for reading only. Invoking any of the {@code write} * methods of the resulting object will cause an @@ -153,6 +157,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { * Open for reading and writing, as with {@code "rw"}, and also * require that every update to the file's content be written * synchronously to the underlying storage device.
    * * The {@code "rws"} and {@code "rwd"} modes work much like the {@link diff --git a/jdk/src/java.base/share/classes/java/io/SerializablePermission.java b/jdk/src/java.base/share/classes/java/io/SerializablePermission.java index 8aded4dcad2..93034a165a4 100644 --- a/jdk/src/java.base/share/classes/java/io/SerializablePermission.java +++ b/jdk/src/java.base/share/classes/java/io/SerializablePermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,12 +44,16 @@ import java.util.StringTokenizer; * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. * - * + *
    + * + * * * * * * + * + * * * * @@ -79,7 +83,7 @@ import java.util.StringTokenizer; * * - * + * *
    Permission target name, what the permission allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    enableSubclassImplementationCode could remove a configured filter and remove protections * already established.
    * * @see java.security.BasicPermission diff --git a/jdk/src/java.base/share/classes/java/lang/Character.java b/jdk/src/java.base/share/classes/java/lang/Character.java index 028190da55b..fd6682e6196 100644 --- a/jdk/src/java.base/share/classes/java/lang/Character.java +++ b/jdk/src/java.base/share/classes/java/lang/Character.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -9566,7 +9566,9 @@ class Character implements java.io.Serializable, Comparable { * Determines if the specified character is ISO-LATIN-1 white space. * This method returns {@code true} for the following five * characters only: - * + *
    + * + * * * * @@ -9577,6 +9579,7 @@ class Character implements java.io.Serializable, Comparable { * * * + * *
    truechars
    {@code '\t'} {@code U+0009}{@code HORIZONTAL TABULATION}
    {@code '\n'} {@code U+000A}{@code CARRIAGE RETURN}
    {@code ' '} {@code U+0020}{@code SPACE}
    * * @param ch the character to be tested. diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index a7f1262c3b5..4251a6963b4 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -724,18 +724,23 @@ public final class Class implements java.io.Serializable, * one or more '{@code [}' characters representing the depth of the array * nesting. The encoding of element type names is as follows: * - *

    - * + *
    Element Type     Encoding - *
    boolean     Z - *
    byte     B - *
    char     C + *
    + * + * + * + * + * *
    Element types and encodings
    Element Type Encoding + *
    boolean Z + *
    byte B + *
    char C *
    class or interface - *     Lclassname; - *
    double     D - *
    float     F - *
    int     I - *
    long     J - *
    short     S + * Lclassname; + *
    double D + *
    float F + *
    int I + *
    long J + *
    short S + *
    * *

    The class or interface name classname is the binary name of diff --git a/jdk/src/java.base/share/classes/java/lang/Double.java b/jdk/src/java.base/share/classes/java/lang/Double.java index 75a227e5282..a7aa0a0f626 100644 --- a/jdk/src/java.base/share/classes/java/lang/Double.java +++ b/jdk/src/java.base/share/classes/java/lang/Double.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -255,9 +255,12 @@ public final class Double extends Number implements Comparable { * * * - * + *
    * + * * + * + * * * * @@ -272,6 +275,7 @@ public final class Double extends Number implements Comparable { * * * + * *
    Examples
    Floating-point ValueHexadecimal String
    {@code 1.0} {@code 0x1.0p0}
    {@code -1.0} {@code -0x1.0p0}
    {@code 2.0} {@code 0x1.0p1}{@code 0x0.fffffffffffffp-1022}
    {@code Double.MIN_VALUE}{@code 0x0.0000000000001p-1022}
    * @param d the {@code double} to be converted. * @return a hex string representation of the argument. diff --git a/jdk/src/java.base/share/classes/java/lang/Float.java b/jdk/src/java.base/share/classes/java/lang/Float.java index 60e08db7ad5..77c1d1671d5 100644 --- a/jdk/src/java.base/share/classes/java/lang/Float.java +++ b/jdk/src/java.base/share/classes/java/lang/Float.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -256,9 +256,12 @@ public final class Float extends Number implements Comparable { * * * - * + *
    * + * * + * + * * * * @@ -273,6 +276,7 @@ public final class Float extends Number implements Comparable { * * * + * *
    Examples
    Floating-point ValueHexadecimal String
    {@code 1.0} {@code 0x1.0p0}
    {@code -1.0} {@code -0x1.0p0}
    {@code 2.0} {@code 0x1.0p1}{@code 0x0.fffffep-126}
    {@code Float.MIN_VALUE}{@code 0x0.000002p-126}
    * @param f the {@code float} to be converted. * @return a hex string representation of the argument. diff --git a/jdk/src/java.base/share/classes/java/lang/RuntimePermission.java b/jdk/src/java.base/share/classes/java/lang/RuntimePermission.java index 489bcf64375..b1a4280498a 100644 --- a/jdk/src/java.base/share/classes/java/lang/RuntimePermission.java +++ b/jdk/src/java.base/share/classes/java/lang/RuntimePermission.java @@ -43,13 +43,17 @@ import java.lang.module.ModuleFinder; * target names, and for each provides a description of what the permission * allows and a discussion of the risks of granting code the permission. * - * + *
    + * + * * * * * * + * + * * * * @@ -383,6 +387,7 @@ import java.lang.module.ModuleFinder; * {@linkplain ModuleFinder#ofSystem system modules} in the runtime image. * * + * *
    permission target name, + * what the target allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    createClassLoader
    * * @implNote diff --git a/jdk/src/java.base/share/classes/java/lang/String.java b/jdk/src/java.base/share/classes/java/lang/String.java index d28dcdd823a..ea94633597c 100644 --- a/jdk/src/java.base/share/classes/java/lang/String.java +++ b/jdk/src/java.base/share/classes/java/lang/String.java @@ -2203,12 +2203,16 @@ public final class String *

    The string {@code "boo:and:foo"}, for example, yields the * following results with these parameters: * - *

    + *
    + * + * * * * * * + * + * * * * @@ -2227,6 +2231,7 @@ public final class String * * * + * *
    Split example showing regex, limit, and result
    RegexLimitResult
    :2{@code { "boo", "and:foo" }}
    o0{@code { "b", "", ":and:f" }}
    * *

    An invocation of this method of the form @@ -2326,15 +2331,20 @@ public final class String *

    The string {@code "boo:and:foo"}, for example, yields the following * results with these expressions: * - *

    + *
    + * + * * * * * + * + * * * * * + * *
    Split examples showing regex and result
    RegexResult
    :{@code { "boo", "and", "foo" }}
    o{@code { "b", "", ":and:f" }}
    * * @@ -2445,13 +2455,17 @@ public final class String * {@code String} may be a different length than the original {@code String}. *

    * Examples of lowercase mappings are in the following table: - * + *
    + * + * * * * * * * + * + * * * * @@ -2480,6 +2494,7 @@ public final class String * sigma * * + * *
    Lowercase mapping examples showing language code of locale, upper case, lower case, and description
    Language Code of LocaleUpper CaseLower CaseDescription
    tr (Turkish)\u0130lowercased all chars in String
    * * @param locale use the case transformation rules for this locale @@ -2526,13 +2541,17 @@ public final class String *

    * Examples of locale-sensitive and 1:M case mappings are in the following table. * - * + *
    + * + * * * * * * * + * + * * * * @@ -2557,6 +2576,7 @@ public final class String * * * + * *
    Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.
    Language Code of LocaleLower CaseUpper CaseDescription
    tr (Turkish)\u0069FAHRVERGNÜGEN
    * @param locale use the case transformation rules for this locale * @return the {@code String}, converted to uppercase. diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index 630380e2d4b..10664819e4f 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -575,9 +575,13 @@ public final class System { * system properties, a set of system properties is first created and * initialized. This set of system properties always includes values * for the following keys: - * + *
    + * + * * * + * + * * * @@ -636,6 +640,7 @@ public final class System { * * * + * *
    Shows property keys and associated values
    KeyDescription of Associated Value
    java.versionJava Runtime Environment version which may be interpreted * as a {@link Runtime.Version}
    User's home directory
    user.dirUser's current working directory
    *

    * Multiple paths in a system property value are separated by the path @@ -647,9 +652,13 @@ public final class System { * * @implNote In addition to the standard system properties, the system * properties may include the following keys: - * + *
    + * + * * * + * + * * * * @@ -658,6 +667,7 @@ public final class System { * * * + * *
    Shows property keys and associated values
    KeyDescription of Associated Value
    {@code jdk.module.path}The application module path
    {@code jdk.module.upgrade.path}The module name of the initial/main module
    {@code jdk.module.main.class}The main class name of the initial module
    * * @return the system properties diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java index 5f56dd6ab43..95719763b0f 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -149,8 +149,12 @@ import java.util.Arrays; * capture argument (corresponding to the receiver) must be non-null. * *

    A type Q is considered adaptable to S as follows: - * + *
    + * + * * + * + * * * * @@ -176,6 +180,7 @@ import java.util.Arrays; *
    for return types: none * * + * *
    adaptable types
    QSLink-time checksInvocation-time checks
    PrimitivePrimitiveQ can be converted to S via a primitive widening conversionCast from Q to S
    * * @apiNote These linkage methods are designed to support the evaluation diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java index a53e0076756..909f271c672 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,8 +81,12 @@ import static java.lang.invoke.MethodHandleStatics.*; * The Lookup Factory Methods * correspond to all major use cases for methods, constructors, and fields. * These use cases may be distinguished using small integers as follows: - * + *
    + * + * * + * + * * * * @@ -119,6 +123,7 @@ import static java.lang.invoke.MethodHandleStatics.*; * * * + * *
    reference kinds
    reference kinddescriptive namescopememberbehavior
    {@code 1}{@code REF_getField}{@code class}{@code FT f;}{@code (T) this.f;}{@code 9}{@code REF_invokeInterface}{@code interface}{@code T m(A*);}{@code (T) this.m(arg*);}
    * @since 1.8 */ diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index ae40f169ff2..292fd9bb6c4 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -278,12 +278,16 @@ public class MethodHandles { * (Bytecode behaviors are described in section 5.4.3.5 of the Java Virtual Machine Specification.) * Here is a summary of the correspondence between these factory methods and * the behavior of the resulting method handles: - * + *
    + * + * * * * * * + * + * * * * @@ -340,6 +344,7 @@ public class MethodHandles { * * * + * *
    lookup method behaviors
    lookup expressionmemberbytecode behavior
    {@link java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}{@code FT f;}{@code (T) this.f;}{@link java.lang.invoke.MethodHandles.Lookup#findClass lookup.findClass("C")}{@code class C { ... }}{@code C.class;}
    * * Here, the type {@code C} is the class or interface being searched for a member, diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java index 3bc54c2856a..fd15669931b 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.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 @@ -105,10 +105,13 @@ import sun.reflect.annotation.AnnotationType; *

    The table below summarizes which kind of annotation presence * different methods in this interface examine. * - * + *
    * + * * * + * + * * * @@ -127,6 +130,7 @@ import sun.reflect.annotation.AnnotationType; * * + * *
    Overview of kind of presence detected by different AnnotatedElement methods
    Kind of Presence
    MethodDirectly PresentIndirectly PresentPresentAssociated
    {@code T}{@link #getAnnotation(Class) getAnnotation(Class<T>)} * X
    {@code T[]}{@link #getDeclaredAnnotationsByType(Class) getDeclaredAnnotationsByType(Class<T>)} * XX
    * *

    For an invocation of {@code get[Declared]AnnotationsByType( Class < diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/ReflectPermission.java b/jdk/src/java.base/share/classes/java/lang/reflect/ReflectPermission.java index df6178358df..8b34ae3b4f2 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/ReflectPermission.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/ReflectPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,12 +32,16 @@ package java.lang.reflect; * provides a summary description of what the permission allows, * and discusses the risks of granting code the permission. * - * + *
    + * + * * * * * * + * + * * * * @@ -58,6 +62,7 @@ package java.lang.reflect; * help in its attempt to compromise security in the system. * * + * *
    Table shows permission target name, what the permission allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    suppressAccessChecks
    * * @see java.security.Permission diff --git a/jdk/src/java.base/share/classes/java/math/BigDecimal.java b/jdk/src/java.base/share/classes/java/math/BigDecimal.java index 5feb70fec43..f0b40ffed96 100644 --- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java +++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,15 +120,19 @@ import java.util.Arrays; * preferred scale for representing a result. The preferred * scale for each operation is listed in the table below. * - * + *
    * + * * + * + * * * * * * + * *
    Preferred Scales for Results of Arithmetic Operations *
    OperationPreferred Scale of Result
    Addmax(addend.scale(), augend.scale())
    Subtractmax(minuend.scale(), subtrahend.scale())
    Multiplymultiplier.scale() + multiplicand.scale()
    Dividedividend.scale() - divisor.scale()
    Square rootradicand.scale()/2
    * * These scales are the ones used by the methods which return exact diff --git a/jdk/src/java.base/share/classes/java/math/RoundingMode.java b/jdk/src/java.base/share/classes/java/math/RoundingMode.java index 042d4f5f177..79ecce36e7f 100644 --- a/jdk/src/java.base/share/classes/java/math/RoundingMode.java +++ b/jdk/src/java.base/share/classes/java/math/RoundingMode.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 @@ -51,8 +51,9 @@ package java.math; * proper {@code MathContext}. A summary table showing the results * of these rounding operations for all rounding modes appears below. * - * + *
    * + * * * @@ -64,6 +65,8 @@ package java.math; * * * + * + * * * * @@ -75,7 +78,8 @@ package java.math; * * * - *
    Summary of Rounding Operations Under Different Rounding Modes
    Result of rounding input to one digit with the given * rounding mode
    {@code HALF_DOWN}{@code HALF_EVEN}{@code UNNECESSARY}
    5.5 6 5 6 5 6 5 6 throw {@code ArithmeticException}
    2.5 3 2 3 2 3 2 2 throw {@code ArithmeticException}
    -1.6 -2 -1 -1 -2 -2 -2 -2 throw {@code ArithmeticException}
    -2.5 -3 -2 -2 -3 -3 -2 -2 throw {@code ArithmeticException}
    -5.5 -6 -5 -5 -6 -6 -5 -6 throw {@code ArithmeticException}
    + *

    * * *

    This {@code enum} is intended to replace the integer-based @@ -100,10 +104,13 @@ public enum RoundingMode { * value. * *

    Example: - * + *
    * + * * * + * * * * @@ -114,6 +121,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode UP Examples
    Input NumberInput rounded to one digit
    with {@code UP} rounding + *
    5.5 6
    2.5 3
    1.6 2
    -1.6 -2
    -2.5 -3
    -5.5 -6
    */ UP(BigDecimal.ROUND_UP), @@ -124,10 +132,13 @@ public enum RoundingMode { * rounding mode never increases the magnitude of the calculated value. * *

    Example: - * + *
    * + * * * + * * * * @@ -138,6 +149,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode DOWN Examples
    Input NumberInput rounded to one digit
    with {@code DOWN} rounding + *
    5.5 5
    2.5 2
    1.6 1
    -1.6 -1
    -2.5 -2
    -5.5 -5
    */ DOWN(BigDecimal.ROUND_DOWN), @@ -149,10 +161,13 @@ public enum RoundingMode { * that this rounding mode never decreases the calculated value. * *

    Example: - * + *
    * + * * * + * * * * @@ -163,6 +178,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode CEILING Examples
    Input NumberInput rounded to one digit
    with {@code CEILING} rounding + *
    5.5 6
    2.5 3
    1.6 2
    -1.6 -1
    -2.5 -2
    -5.5 -5
    */ CEILING(BigDecimal.ROUND_CEILING), @@ -174,10 +190,13 @@ public enum RoundingMode { * this rounding mode never increases the calculated value. * *

    Example: - * + *
    * + * * * + * * * * @@ -188,6 +207,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode FLOOR Examples
    Input NumberInput rounded to one digit
    with {@code FLOOR} rounding + *
    5.5 5
    2.5 2
    1.6 1
    -1.6 -2
    -2.5 -3
    -5.5 -6
    */ FLOOR(BigDecimal.ROUND_FLOOR), @@ -201,10 +221,13 @@ public enum RoundingMode { * mode commonly taught at school. * *

    Example: - * + *
    * + * * * + * * * * @@ -215,6 +238,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode HALF_UP Examples
    Input NumberInput rounded to one digit
    with {@code HALF_UP} rounding + *
    5.5 6
    2.5 3
    1.6 2
    -1.6 -2
    -2.5 -3
    -5.5 -6
    */ HALF_UP(BigDecimal.ROUND_HALF_UP), @@ -227,10 +251,13 @@ public enum RoundingMode { * {@code RoundingMode.DOWN}. * *

    Example: - * + *
    * + * * * + * * * * @@ -241,6 +268,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode HALF_DOWN Examples
    Input NumberInput rounded to one digit
    with {@code HALF_DOWN} rounding + *
    5.5 5
    2.5 2
    1.6 2
    -1.6 -2
    -2.5 -2
    -5.5 -5
    */ HALF_DOWN(BigDecimal.ROUND_HALF_DOWN), @@ -260,10 +288,13 @@ public enum RoundingMode { * arithmetic in Java. * *

    Example: - * + *
    * + * * * + * * * * @@ -274,6 +305,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode HALF_EVEN Examples
    Input NumberInput rounded to one digit
    with {@code HALF_EVEN} rounding + *
    5.5 6
    2.5 2
    1.6 2
    -1.6 -2
    -2.5 -2
    -5.5 -6
    */ HALF_EVEN(BigDecimal.ROUND_HALF_EVEN), @@ -284,10 +316,13 @@ public enum RoundingMode { * specified on an operation that yields an inexact result, an * {@code ArithmeticException} is thrown. *

    Example: - * + *
    * + * * * + * * * * @@ -298,6 +333,7 @@ public enum RoundingMode { * * * + * *
    Rounding mode UNNECESSARY Examples
    Input NumberInput rounded to one digit
    with {@code UNNECESSARY} rounding + *
    5.5 throw {@code ArithmeticException}
    2.5 throw {@code ArithmeticException}
    1.6 throw {@code ArithmeticException}
    -1.6 throw {@code ArithmeticException}
    -2.5 throw {@code ArithmeticException}
    -5.5 throw {@code ArithmeticException}
    */ UNNECESSARY(BigDecimal.ROUND_UNNECESSARY); diff --git a/jdk/src/java.base/share/classes/java/net/Inet4Address.java b/jdk/src/java.base/share/classes/java/net/Inet4Address.java index 1efd9fca038..25c5ab41224 100644 --- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java +++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,12 +41,12 @@ import java.io.ObjectStreamException; * Textual representation of IPv4 address used as input to methods * takes one of the following forms: * - *

    - * - * - * - * - *
    {@code d.d.d.d}
    {@code d.d.d}
    {@code d.d}
    {@code d}
    + *
      + *
    • {@code d.d.d.d}
    • + *
    • {@code d.d.d}
    • + *
    • {@code d.d}
    • + *
    • {@code d}
    • + *
    * *

    When four parts are specified, each is interpreted as a byte of * data and assigned, from left to right, to the four bytes of an IPv4 diff --git a/jdk/src/java.base/share/classes/java/net/Inet6Address.java b/jdk/src/java.base/share/classes/java/net/Inet6Address.java index a6ebe99127d..0df84877cd5 100644 --- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java +++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,9 +49,9 @@ import java.util.Arrays; * the hexadecimal values of the eight 16-bit pieces of the * address. This is the full form. For example, * - *

    - * - *
    {@code 1080:0:0:0:8:800:200C:417A}
    + *
      + *
    • {@code 1080:0:0:0:8:800:200C:417A}
    • + *
    * *

    Note that it is not necessary to write the leading zeros in * an individual field. However, there must be at least one numeral @@ -66,9 +66,9 @@ import java.util.Arrays; * The "::" can also be used to compress the leading and/or trailing * zeros in an address. For example, * - *

    - * - *
    {@code 1080::8:800:200C:417A}
    + *
      + *
    • {@code 1080::8:800:200C:417A}
    • + *
    * *
  • An alternative form that is sometimes more convenient * when dealing with a mixed environment of IPv4 and IPv6 nodes is @@ -77,35 +77,35 @@ import java.util.Arrays; * are the decimal values of the four low-order 8-bit pieces of the * standard IPv4 representation address, for example, * - *

    - * - * - *
    {@code ::FFFF:129.144.52.38}
    {@code ::129.144.52.38}
    + *
      + *
    • {@code ::FFFF:129.144.52.38}
    • + *
    • {@code ::129.144.52.38}
    • + *
    * *

    where "::FFFF:d.d.d.d" and "::d.d.d.d" are, respectively, the * general forms of an IPv4-mapped IPv6 address and an * IPv4-compatible IPv6 address. Note that the IPv4 portion must be * in the "d.d.d.d" form. The following forms are invalid: * - *

    - * - * - * - * - *
    {@code ::FFFF:d.d.d}
    {@code ::FFFF:d.d}
    {@code ::d.d.d}
    {@code ::d.d}
    + *
      + *
    • {@code ::FFFF:d.d.d}
    • + *
    • {@code ::FFFF:d.d}
    • + *
    • {@code ::d.d.d}
    • + *
    • {@code ::d.d}
    • + *
    * *

    The following form: * - *

    - * - *
    {@code ::FFFF:d}
    + *
      + *
    • {@code ::FFFF:d}
    • + *
    * *

    is valid, however it is an unconventional representation of * the IPv4-compatible IPv6 address, * - *

    - * - *
    {@code ::255.255.0.d}
    + *
      + *
    • {@code ::255.255.0.d}
    • + *
    * *

    while "::d" corresponds to the general IPv6 address * "0:0:0:0:0:0:0:d".

  • @@ -119,9 +119,10 @@ import java.util.Arrays; *

    Special IPv6 address

    * *
    - * - * - *
    IPv4-mapped addressOf the form::ffff:w.x.y.z, this IPv6 address is used to + * + * + * + *
    Description of IPv4-mapped address
    IPv4-mapped addressOf the form ::ffff:w.x.y.z, this IPv6 address is used to * represent an IPv4 address. It allows the native program to * use the same address data structure and also the same * socket when communicating with both IPv4 and IPv6 nodes. diff --git a/jdk/src/java.base/share/classes/java/net/InetAddress.java b/jdk/src/java.base/share/classes/java/net/InetAddress.java index 84457f30066..22d9ce80303 100644 --- a/jdk/src/java.base/share/classes/java/net/InetAddress.java +++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,9 @@ import sun.net.util.IPAddressUtil; * *

    Address types

    * - *
    + *
    + * + * * * + * *
    Description of unicast and multicast address types
    unicastAn identifier for a single interface. A packet sent to * a unicast address is delivered to the interface identified by @@ -96,6 +98,7 @@ import sun.net.util.IPAddressUtil; * An identifier for a set of interfaces (typically belonging * to different nodes). A packet sent to a multicast address is * delivered to all interfaces identified by that address.
    * *

    IP address scope

    diff --git a/jdk/src/java.base/share/classes/java/net/NetPermission.java b/jdk/src/java.base/share/classes/java/net/NetPermission.java index dad3fb99f32..f156fb7af50 100644 --- a/jdk/src/java.base/share/classes/java/net/NetPermission.java +++ b/jdk/src/java.base/share/classes/java/net/NetPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,12 +47,16 @@ import java.util.StringTokenizer; * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. * - * + *
    + * + * * * * * * + * + * * * * @@ -151,6 +155,7 @@ import java.util.StringTokenizer; * creating a ProtectionDomain/CodeSource for a class even though * that class really didn't come from that location. * + *
    Permission target name, what the permission allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    allowHttpTraceThe ability to use the HTTP TRACE method in HttpURLConnection.
    * * @see java.security.BasicPermission diff --git a/jdk/src/java.base/share/classes/java/net/URI.java b/jdk/src/java.base/share/classes/java/net/URI.java index 3bf4895c1e5..48c224798a0 100644 --- a/jdk/src/java.base/share/classes/java/net/URI.java +++ b/jdk/src/java.base/share/classes/java/net/URI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,11 +83,11 @@ import java.lang.NullPointerException; // for javadoc * not begin with a slash character ({@code '/'}). Opaque URIs are not * subject to further parsing. Some examples of opaque URIs are: * - *
    - * - * - * - *
    {@code mailto:java-net@java.sun.com}
    {@code news:comp.lang.java}
    {@code urn:isbn:096139210x}
    + *
      + *
    • {@code mailto:java-net@java.sun.com}
    • + *
    • {@code news:comp.lang.java}
    • + *
    • {@code urn:isbn:096139210x}
    • + *
    * *

    A hierarchical URI is either an absolute URI whose * scheme-specific part begins with a slash character, or a relative URI, that @@ -132,8 +132,12 @@ import java.lang.NullPointerException; // for javadoc * *

    All told, then, a URI instance has the following nine components: * - *

    + *
    + * + * * + * + * * * * @@ -143,6 +147,7 @@ import java.lang.NullPointerException; // for javadoc * * * + * *
    Describes the components of a URI:scheme,scheme-specific-part,authority,user-info,host,port,path,query,fragment
    ComponentType
    scheme{@code String}
    scheme-specific-part    {@code String}
    authority{@code String}
    path{@code String}
    query{@code String}
    fragment{@code String}
    * * In a given instance any particular component is either undefined or @@ -248,7 +253,9 @@ import java.lang.NullPointerException; // for javadoc * which are taken from that specification, are used below to describe these * constraints: * - *
    + *
    + * + * * * + * *
    Describes categories alpha,digit,alphanum,unreserved,punct,reserved,escaped,and other
    alphaThe US-ASCII alphabetic characters, * {@code 'A'} through {@code 'Z'} @@ -279,6 +286,7 @@ import java.lang.NullPointerException; // for javadoc * java.lang.Character#isSpaceChar(char) Character.isSpaceChar} * method)  (Deviation from RFC 2396, which is * limited to US-ASCII)
    * *

    The set of all legal URI characters consists of diff --git a/jdk/src/java.base/share/classes/java/net/URLConnection.java b/jdk/src/java.base/share/classes/java/net/URLConnection.java index e88c2f5f40c..c9331b704af 100644 --- a/jdk/src/java.base/share/classes/java/net/URLConnection.java +++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,13 +54,18 @@ import sun.security.action.GetPropertyAction; * read from and to write to the resource referenced by the URL. In * general, creating a connection to a URL is a multistep process: * - *

    + *
    + * + * * * + * + * * * + * *
    Describes the process of creating a connection to a URL: openConnection() and connect() over time.
    {@code openConnection()}{@code connect()}
    Manipulate parameters that affect the connection to the remote * resource.Interact with the resource; query header fields and * contents.
    * ----------------------------> *
    time
    diff --git a/jdk/src/java.base/share/classes/java/net/URLPermission.java b/jdk/src/java.base/share/classes/java/net/URLPermission.java index e78c7aee68c..43a8bd43066 100644 --- a/jdk/src/java.base/share/classes/java/net/URLPermission.java +++ b/jdk/src/java.base/share/classes/java/net/URLPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,9 +72,12 @@ import java.security.Permission; * separated by '/' characters. path may also be empty. The path is specified * in a similar way to the path in {@link java.io.FilePermission}. There are * three different ways as the following examples show: - * + *
    * + * * + * + * * * * @@ -90,6 +93,7 @@ import java.security.Permission; * example). * * + * *
    URL Examples
    Example urlDescription
    http://www.oracle.com/a/b/c.htmlA url which identifies a specific (single) resource
    *

    * The '*' and '-' may only be specified in the final segment of a path and must be @@ -246,9 +250,12 @@ public final class URLPermission extends Permission { *

  • otherwise, return false
  • * *

    Some examples of how paths are matched are shown below: - * + *
    * + * * + * + * * * * @@ -256,6 +263,7 @@ public final class URLPermission extends Permission { * * * + * *
    Examples of Path Matching
    this's pathp's pathmatch
    /a/b/a/byes
    /a/b/*/a/b/cyes
    /a/b/*/a/b/c/dno
    /a/b/-/a/b/c/d/eyes
    /a/b/-/a/b/c/*yes
    /a/b/*/a/b/c/-no
    */ public boolean implies(Permission p) { diff --git a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousChannelGroup.java b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousChannelGroup.java index d7bb619bd21..acd7da8b1d9 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousChannelGroup.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousChannelGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -60,11 +60,15 @@ import java.util.concurrent.TimeUnit; * default group is not configured then the pooled threads of the default group * are {@link Thread#isDaemon daemon} threads. * - * + *
    + * + * * * * * + * + * * * * * + * *
    System properties
    System propertyDescription
    {@code java.nio.channels.DefaultThreadPool.threadFactory} The value of this property is taken to be the fully-qualified name @@ -86,6 +90,7 @@ import java.util.concurrent.TimeUnit; * unspecified error to be thrown during the construction of the default * group.
    * *

    Threading

    diff --git a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java index 4b5548e79e5..9653a433050 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -133,8 +133,12 @@ public abstract class AsynchronousFileChannel *

    In addition to {@code READ} and {@code WRITE}, the following options * may be present: * - * + *
    + * + * * + * + * * * * * + * *
    additional options
    Option Description
    {@link StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING} When opening an existing file, the file is first truncated to a @@ -186,6 +190,7 @@ public abstract class AsynchronousFileChannel * href="../file/package-summary.html#integrity"> Synchronized I/O file * integrity).
    * *

    An implementation may also support additional options. diff --git a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java index 44a2460426f..137451c7763 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -52,11 +52,15 @@ import java.io.IOException; *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Channels of this type support the following options: *

    - * + *
    + * + * * * * * + * + * * * * @@ -65,6 +69,7 @@ import java.io.IOException; * * * + * *
    Socket options
    Option NameDescription
    {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} The size of the socket receive buffer {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} Re-use address
    *
    * Additional (implementation specific) options may also be supported. diff --git a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousSocketChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousSocketChannel.java index d5e2abeb63a..6ba16628632 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousSocketChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/AsynchronousSocketChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -62,11 +62,15 @@ import java.nio.ByteBuffer; *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Asynchronous socket channels support the following options: *

    - * + *
    + * + * * * * * + * + * * * * @@ -87,6 +91,7 @@ import java.nio.ByteBuffer; * * * + * *
    Socket options
    Option NameDescription
    {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} The size of the socket send buffer {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} Disable the Nagle algorithm
    *
    * Additional (implementation specific) options may also be supported. diff --git a/jdk/src/java.base/share/classes/java/nio/channels/DatagramChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/DatagramChannel.java index 0b3278bf356..ac96bc61596 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/DatagramChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/DatagramChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,11 +57,15 @@ import java.nio.channels.spi.SelectorProvider; * setOption} method. A datagram channel to an Internet Protocol socket supports * the following options: *
    - * + *
    + * + * * * * * + * + * * * * @@ -97,6 +101,7 @@ import java.nio.channels.spi.SelectorProvider; * IP_MULTICAST_LOOP} * * + * *
    Socket options
    Option NameDescription
    {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} The size of the socket send buffer Loopback for Internet Protocol (IP) multicast datagrams
    *
    * Additional (implementation specific) options may also be supported. diff --git a/jdk/src/java.base/share/classes/java/nio/channels/FileChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/FileChannel.java index d4fb4564259..551ef21bb2c 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/FileChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/FileChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,8 +174,12 @@ public abstract class FileChannel *

    In the addition to {@code READ} and {@code WRITE}, the following * options may be present: * - * + *
    + * + * * + * + * * * * * + * *
    additional options
    Option Description
    {@link StandardOpenOption#APPEND APPEND} If this option is present then the file is opened for writing and @@ -237,6 +241,7 @@ public abstract class FileChannel * href="../file/package-summary.html#integrity"> Synchronized I/O file * integrity).
    * *

    An implementation may also support additional options. diff --git a/jdk/src/java.base/share/classes/java/nio/channels/ServerSocketChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/ServerSocketChannel.java index 7c9666bbdd8..ea8951b2d2e 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/ServerSocketChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/ServerSocketChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,11 +46,15 @@ import java.nio.channels.spi.SelectorProvider; *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Server-socket channels support the following options: *

    - * + *
    + * + * * * * * + * + * * * * @@ -59,6 +63,7 @@ import java.nio.channels.spi.SelectorProvider; * * * + * *
    Socket options
    Option NameDescription
    {@link java.net.StandardSocketOptions#SO_RCVBUF SO_RCVBUF} The size of the socket receive buffer {@link java.net.StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} Re-use address
    *
    * Additional (implementation specific) options may also be supported. diff --git a/jdk/src/java.base/share/classes/java/nio/channels/SocketChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/SocketChannel.java index c25cc68edf2..0025d2c22cf 100644 --- a/jdk/src/java.base/share/classes/java/nio/channels/SocketChannel.java +++ b/jdk/src/java.base/share/classes/java/nio/channels/SocketChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,11 +66,15 @@ import java.nio.channels.spi.SelectorProvider; *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Socket channels support the following options: *

    - * + *
    + * + * * * * * + * + * * * * @@ -96,6 +100,7 @@ import java.nio.channels.spi.SelectorProvider; * * * + * *
    Socket options
    Option NameDescription
    {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} The size of the socket send buffer {@link java.net.StandardSocketOptions#TCP_NODELAY TCP_NODELAY} Disable the Nagle algorithm
    *
    * Additional (implementation specific) options may also be supported. diff --git a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java index a9a8b91e692..480ede3e6a2 100644 --- a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java +++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -147,8 +147,12 @@ import sun.security.action.GetPropertyAction; * implementation to see if any other charsets are supported. The behavior * of such optional charsets may differ between implementations. * - *
    + *
    + * + * * + * + * * * @@ -165,6 +169,7 @@ import sun.security.action.GetPropertyAction; * * + * *
    Description of standard charsets
    CharsetDescription
    {@code US-ASCII}Seven-bit ASCII, a.k.a. {@code ISO646-US}, * a.k.a. the Basic Latin block of the Unicode character set
    {@code UTF-16}Sixteen-bit UCS Transformation Format, * byte order identified by an optional byte-order mark
    * *

    The {@code UTF-8} charset is specified by - * + *
    + * + * * * * @@ -348,7 +350,7 @@ public abstract class FileSystem * platform (note that the backslash is escaped; as a string literal in the * Java Language the pattern would be "C:\\\\*") * - * + * *
    Pattern Language
    {@code *.java}Matches a path that represents a file name ending in {@code .java}
    * * diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java index 3a6491440a7..ac662e4e431 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/Files.java +++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, 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 @@ -233,8 +233,12 @@ public final class Files { *

    In the addition to {@code READ} and {@code WRITE}, the following * options may be present: * - * + *
    + * + * * + * + * * * * * + * *
    Options
    Option Description
    {@link StandardOpenOption#APPEND APPEND} If this option is present then the file is opened for writing and @@ -294,6 +298,7 @@ public final class Files { * href="package-summary.html#integrity"> Synchronized I/O file * integrity).
    * *

    An implementation may also support additional implementation specific @@ -1188,8 +1193,12 @@ public final class Files { * *

    The {@code options} parameter may include any of the following: * - * + *
    + * + * * + * + * * * * * + * *
    Options
    Option Description
    {@link StandardCopyOption#REPLACE_EXISTING REPLACE_EXISTING} If the target file exists, then the target file is replaced if it @@ -1215,6 +1224,7 @@ public final class Files { * new link. In other words, the {@code COPY_ATTRIBUTES} option may be * ignored when copying a symbolic link.
    * *

    An implementation of this interface may support additional @@ -1306,8 +1316,12 @@ public final class Files { * *

    The {@code options} parameter may include any of the following: * - * + *
    + * + * * + * + * * * * + * *
    Options
    Option Description
    {@link StandardCopyOption#REPLACE_EXISTING REPLACE_EXISTING} If the target file exists, then the target file is replaced if it @@ -1326,6 +1340,7 @@ public final class Files { * example, when the target location is on a different {@code FileStore} * and would require that the file be copied, or target location is * associated with a different provider to this object.
    * *

    An implementation of this interface may support additional @@ -1909,7 +1924,9 @@ public final class Files { * attributes} parameter: * *

    - * + *
    + * + * * * * @@ -1927,6 +1944,7 @@ public final class Files { * * * + * *
    Possible values
    {@code "*"} Read all {@link BasicFileAttributes basic-file-attributes}. {@code "posix:permissions,owner,size"} Reads the POSIX file permissions, owner, and file size.
    *
    * diff --git a/jdk/src/java.base/share/classes/java/nio/file/LinkPermission.java b/jdk/src/java.base/share/classes/java/nio/file/LinkPermission.java index bf54e168774..8f82d9f2adb 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/LinkPermission.java +++ b/jdk/src/java.base/share/classes/java/nio/file/LinkPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 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 @@ -33,13 +33,16 @@ import java.security.BasicPermission; *

    The following table provides a summary description of what the permission * allows, and discusses the risks of granting code the permission. * - * + *
    + * + * * * * * * + * + * * * * * + * *
    Table shows permission target name, what the permission allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    hard Ability to add an existing file to a directory. This is sometimes @@ -55,6 +58,7 @@ import java.security.BasicPermission; * linking to any file or directory in the file system thus allowing the * attacker to access to all files.
    * * @since 1.7 diff --git a/jdk/src/java.base/share/classes/java/nio/file/attribute/AclFileAttributeView.java b/jdk/src/java.base/share/classes/java/nio/file/attribute/AclFileAttributeView.java index 429bfde8a1b..4ba76741dd0 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/attribute/AclFileAttributeView.java +++ b/jdk/src/java.base/share/classes/java/nio/file/attribute/AclFileAttributeView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -94,11 +94,15 @@ import java.io.IOException; *

    Where dynamic access to file attributes is required, the attributes * supported by this attribute view are as follows: *

    - * + *
    + * + * * * * * + * + * * * * @@ -107,6 +111,7 @@ import java.io.IOException; * * * + * *
    Supported attributes
    Name Type
    "acl" {@link List}<{@link AclEntry}> "owner" {@link UserPrincipal}
    *
    * diff --git a/jdk/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java b/jdk/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java index bfa3fdc2676..465fb6bc3f3 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java +++ b/jdk/src/java.base/share/classes/java/nio/file/attribute/BasicFileAttributeView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -41,11 +41,15 @@ import java.io.IOException; *

    Where dynamic access to file attributes is required, the attributes * supported by this attribute view have the following names and types: *

    - * + *
    + * + * * * * * + * + * * * * @@ -82,6 +86,7 @@ import java.io.IOException; * * * + * *
    Supported attributes
    Name Type
    "lastModifiedTime" {@link FileTime} "fileKey" {@link Object}
    *
    * diff --git a/jdk/src/java.base/share/classes/java/nio/file/attribute/DosFileAttributeView.java b/jdk/src/java.base/share/classes/java/nio/file/attribute/DosFileAttributeView.java index c12d8a0e5f0..be4f570b46b 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/attribute/DosFileAttributeView.java +++ b/jdk/src/java.base/share/classes/java/nio/file/attribute/DosFileAttributeView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -41,11 +41,15 @@ import java.io.IOException; * BasicFileAttributeView}, and in addition, the following attributes are * supported: *
    - * + *
    + * + * * * * * + * + * * * * @@ -62,6 +66,7 @@ import java.io.IOException; * * * + * *
    Supported attributes
    Name Type
    readonly {@link Boolean} archive {@link Boolean}
    *
    * diff --git a/jdk/src/java.base/share/classes/java/nio/file/attribute/PosixFileAttributeView.java b/jdk/src/java.base/share/classes/java/nio/file/attribute/PosixFileAttributeView.java index f8c36523d66..9e171768603 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/attribute/PosixFileAttributeView.java +++ b/jdk/src/java.base/share/classes/java/nio/file/attribute/PosixFileAttributeView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -74,11 +74,15 @@ import java.io.IOException; * BasicFileAttributeView} and {@link FileOwnerAttributeView}, and in addition, * the following attributes are supported: *
    - * + *
    + * + * * * * * + * + * * * * @@ -87,6 +91,7 @@ import java.io.IOException; * * * + * *
    Supported attributes
    Name Type
    "permissions" {@link Set}<{@link PosixFilePermission}> "group" {@link GroupPrincipal}
    *
    * diff --git a/jdk/src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java b/jdk/src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java index b92cf525eef..26dc40606de 100644 --- a/jdk/src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java +++ b/jdk/src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, 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 @@ -919,8 +919,12 @@ public abstract class FileSystemProvider { * according to all of access modes specified in the {@code modes} parameter * as follows: * - * + *
    + * + * * + * + * * * * * + * *
    Access Modes
    Value Description
    {@link AccessMode#READ READ} Checks that the file exists and that the Java virtual machine has @@ -940,6 +944,7 @@ public abstract class FileSystemProvider { * virtual machine has permission to search the directory in order to * access file or subdirectories.
    * *

    If the {@code modes} parameter is of length zero, then the existence diff --git a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java b/jdk/src/java.base/share/classes/java/security/DrbgParameters.java index 4767861e3ad..05723baa916 100644 --- a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java +++ b/jdk/src/java.base/share/classes/java/security/DrbgParameters.java @@ -263,14 +263,19 @@ public class DrbgParameters { * Capability effective = ((DrbgParametes.Initiate) s.getParameters()) * .getCapability(); * - * + *
    + * + * * * * * + * + * * * * + * *
    requested and effective capabilities
    Requested ValuePossible Effective Values
    NONENONE, RESEED_ONLY, PR_AND_RESEED
    RESEED_ONLYRESEED_ONLY, PR_AND_RESEED
    PR_AND_RESEEDPR_AND_RESEED
    *

    * A DRBG implementation supporting prediction resistance must also diff --git a/jdk/src/java.base/share/classes/java/security/Provider.java b/jdk/src/java.base/share/classes/java/security/Provider.java index f53660346a5..cc5313e2a19 100644 --- a/jdk/src/java.base/share/classes/java/security/Provider.java +++ b/jdk/src/java.base/share/classes/java/security/Provider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,17 +61,21 @@ import java.util.function.Function; * security framework. Services of this type cannot be added, removed, * or modified by applications. * The following attributes are automatically placed in each Provider object: - * + *
    * + * * + * + * * - * + * * * * - + * * * + * *
    Attributes Automatically Placed in a Provider Object
    NameValue
    {@code Provider.id name}{@code String.valueOf(provider.getName())}{@code String.valueOf(provider.getName())}
    {@code Provider.id version}{@code String.valueOf(provider.getVersionStr())}
    {@code Provider.id info}{@code String.valueOf(provider.getInfo())}{@code String.valueOf(provider.getInfo())}
    {@code Provider.id className}{@code provider.getClass().getName()}
    * *

    Each provider has a name and a version string. A provider normally diff --git a/jdk/src/java.base/share/classes/java/security/SecurityPermission.java b/jdk/src/java.base/share/classes/java/security/SecurityPermission.java index 8234624d26e..e0d25c9689f 100644 --- a/jdk/src/java.base/share/classes/java/security/SecurityPermission.java +++ b/jdk/src/java.base/share/classes/java/security/SecurityPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,12 +45,16 @@ import java.util.StringTokenizer; * target names, and for each provides a description of what the permission * allows and a discussion of the risks of granting code the permission. * - * + *
    + * + * * * * * * + * + * * * * @@ -196,6 +200,7 @@ import java.util.StringTokenizer; * described under the "removeProvider.{provider name}" permission. * * + * *
    target name, what the permission allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    authProvider.{provider name}
    * *

    @@ -204,13 +209,17 @@ import java.util.StringTokenizer; * {@link IdentityScope}, {@link Signer}. Use of them is discouraged. See the * applicable classes for more information. * - * + *
    + * + * * * * * * + * * + * * * * @@ -308,6 +317,7 @@ import java.util.StringTokenizer; * data encrypted under that session key. * * + * *
    target name, what the permission allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    insertProvider.{provider name}Addition of a new provider, with the specified name
    * * @implNote diff --git a/jdk/src/java.base/share/classes/java/security/cert/X509Extension.java b/jdk/src/java.base/share/classes/java/security/cert/X509Extension.java index 03469606eed..9a988f4dc93 100644 --- a/jdk/src/java.base/share/classes/java/security/cert/X509Extension.java +++ b/jdk/src/java.base/share/classes/java/security/cert/X509Extension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,10 +152,14 @@ public interface X509Extension { * by periods. * *

    For example:
    - * + *
    + * + * * * * + * + * * * * @@ -176,6 +180,7 @@ public interface X509Extension { * * * + * *
    Examples of OIDs and extension names
    OID (Object Identifier)Extension Name
    2.5.29.14SubjectKeyIdentifier
    2.5.29.15AuthorityKeyIdentifier
    2.5.29.36PolicyConstraints
    * * @param oid the Object Identifier value for the extension. diff --git a/jdk/src/java.base/share/classes/java/text/DecimalFormat.java b/jdk/src/java.base/share/classes/java/text/DecimalFormat.java index 4484654afbd..eb5107cdea4 100644 --- a/jdk/src/java.base/share/classes/java/text/DecimalFormat.java +++ b/jdk/src/java.base/share/classes/java/text/DecimalFormat.java @@ -172,19 +172,22 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * are not localized. * *

    - * - * + *
    + * + * + * * + * * * + * * + * * + * * + * * + * * *
    Chart showing symbol, location, localized, and meaning.
    Symbol * Location * Localized? * Meaning + *
    0 * Number * Yes * Digit - *
    # * Number * Yes @@ -194,7 +197,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Number * Yes * Decimal separator or monetary decimal separator - *
    - * Number * Yes @@ -204,7 +207,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Number * Yes * Grouping separator - *
    E * Number * Yes @@ -215,7 +218,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Subpattern boundary * Yes * Separates positive and negative subpatterns - *
    % * Prefix or suffix * Yes @@ -225,7 +228,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * Prefix or suffix * Yes * Multiply by 1000 and show as per mille value - *
    ¤ (\u00A4) * Prefix or suffix * No @@ -241,6 +244,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter; * for example, "'#'#" formats 123 to * "#123". To create a single quote * itself, use two in a row: "# o''clock". + *
    *
    * diff --git a/jdk/src/java.base/share/classes/java/text/MessageFormat.java b/jdk/src/java.base/share/classes/java/text/MessageFormat.java index 951e81f6473..1275f3cc33a 100644 --- a/jdk/src/java.base/share/classes/java/text/MessageFormat.java +++ b/jdk/src/java.base/share/classes/java/text/MessageFormat.java @@ -146,11 +146,15 @@ import java.util.Locale; * shown in the table are illegal. A SubformatPattern must * be a valid pattern string for the {@code Format} subclass used. * - * + *
    + * + * * * + * * * *
    Shows how FormatType and FormatStyle values map to Format instances
    FormatType * FormatStyle * Subformat Created + *
    (none) * (none) @@ -213,6 +217,7 @@ import java.util.Locale; * choice * SubformatPattern * {@code new} {@link ChoiceFormat#ChoiceFormat(String) ChoiceFormat}{@code (subformatPattern)} + *
    * *

    Usage Information

    @@ -766,11 +771,15 @@ public class MessageFormat extends Format { * argument is unavailable if arguments is * null or has fewer than argumentIndex+1 elements. * - * + *
    + * + * * * + * * * *
    Examples of subformat,argument,and formatted text
    Subformat * Argument * Formatted Text + *
    any * unavailable @@ -805,6 +814,7 @@ public class MessageFormat extends Format { * null * any * argument.toString() + *
    *

    * If pos is non-null, and refers to diff --git a/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java b/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java index 58cf6930679..70987ad99df 100644 --- a/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java +++ b/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java @@ -92,18 +92,22 @@ import sun.util.locale.provider.LocaleProviderAdapter; * 'A' to 'Z' and from 'a' to * 'z' are reserved): *

    - * - * + *
    + * + * + * * + * * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * + * * *
    Chart shows pattern letters, date/time component, presentation, and examples.
    Letter * Date or Time Component * Presentation * Examples + *
    G * Era designator * Text * AD - *
    y * Year * Year @@ -113,7 +117,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Week year * Year * 2009; 09 - *
    M * Month in year (context sensitive) * Month @@ -123,7 +127,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Month in year (standalone form) * Month * July; Jul; 07 - *
    w * Week in year * Number @@ -133,7 +137,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Week in month * Number * 2 - *
    D * Day in year * Number @@ -143,7 +147,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Day in month * Number * 10 - *
    F * Day of week in month * Number @@ -153,7 +157,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Day name in week * Text * Tuesday; Tue - *
    u * Day number of week (1 = Monday, ..., 7 = Sunday) * Number @@ -163,7 +167,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Am/pm marker * Text * PM - *
    H * Hour in day (0-23) * Number @@ -173,7 +177,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Hour in day (1-24) * Number * 24 - *
    K * Hour in am/pm (0-11) * Number @@ -183,7 +187,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Hour in am/pm (1-12) * Number * 12 - *
    m * Minute in hour * Number @@ -193,7 +197,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Second in minute * Number * 55 - *
    S * Millisecond * Number @@ -203,7 +207,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Time zone * General time zone * Pacific Standard Time; PST; GMT-08:00 - *
    Z * Time zone * RFC 822 time zone @@ -213,6 +217,7 @@ import sun.util.locale.provider.LocaleProviderAdapter; * Time zone * ISO 8601 time zone * -08; -0800; -08:00 + *
    *
    * Pattern letters are usually repeated, as their number determines the @@ -370,43 +375,48 @@ import sun.util.locale.provider.LocaleProviderAdapter; * the U.S. locale. The given date and time are 2001-07-04 12:08:56 local time * in the U.S. Pacific Time time zone. *
    - * - * + *
    + * + * + * * + * * * + * * * + * * * + * * * + * * * + * * * *
    Examples of date and time patterns interpreted in the U.S. locale
    Date and Time Pattern * Result + *
    "yyyy.MM.dd G 'at' HH:mm:ss z" * 2001.07.04 AD at 12:08:56 PDT - *
    "EEE, MMM d, ''yy" * Wed, Jul 4, '01 *
    "h:mm a" * 12:08 PM - *
    "hh 'o''clock' a, zzzz" * 12 o'clock PM, Pacific Daylight Time *
    "K:mm a, z" * 0:08 PM, PDT - *
    "yyyyy.MMMMM.dd GGG hh:mm aaa" * 02001.July.04 AD 12:08 PM *
    "EEE, d MMM yyyy HH:mm:ss Z" * Wed, 4 Jul 2001 12:08:56 -0700 - *
    "yyMMddHHmmssZ" * 010704120856-0700 *
    "yyyy-MM-dd'T'HH:mm:ss.SSSZ" * 2001-07-04T12:08:56.235-0700 - *
    "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" * 2001-07-04T12:08:56.235-07:00 *
    "YYYY-'W'ww-u" * 2001-W27-3 + *
    *
    * diff --git a/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java b/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java index 4dedfe3a247..0ec1b591bc2 100644 --- a/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java +++ b/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java @@ -103,17 +103,18 @@ import sun.util.logging.PlatformLogger; * *

    * CLDR and LDML identify variants: - * + *
    + * * - * - * - * - * - * + * + * + * + * + * * * * - * + * * * * @@ -147,36 +148,37 @@ import sun.util.logging.PlatformLogger; *

    * The Hijrah property resource is a set of properties that describe the calendar. * The syntax is defined by {@code java.util.Properties#load(Reader)}. - *

    Variants of Hijrah Calendars
    Chronology IDCalendar TypeLocale extension, see {@link java.util.Locale}Description
    Chronology IDCalendar TypeLocale extension, see {@link java.util.Locale}Description
    Hijrah-umalquraislamic-umalquraca-islamic-umalqura
    + *
    + * * - * - * - * - * + * + * + * + * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * diff --git a/jdk/src/java.base/share/classes/java/time/chrono/IsoEra.java b/jdk/src/java.base/share/classes/java/time/chrono/IsoEra.java index b376789bfe2..702fabdf920 100644 --- a/jdk/src/java.base/share/classes/java/time/chrono/IsoEra.java +++ b/jdk/src/java.base/share/classes/java/time/chrono/IsoEra.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,25 +70,26 @@ import java.time.DateTimeException; * A definition has therefore been created with two eras - 'Current era' (CE) for * years on or after 0001-01-01 (ISO), and 'Before current era' (BCE) for years before that. * - *
    Configuration of Hijrah Calendar
    Property Name Property value Description
    Property Name Property value Description
    idChronology Id, for example, "Hijrah-umalqura"The Id of the calendar in common usage
    typeCalendar type, for example, "islamic-umalqura"LDML defines the calendar types
    versionVersion, for example: "1.8.0_1"The version of the Hijrah variant data
    iso-startISO start date, formatted as {@code yyyy-MM-dd}, for example: "1900-04-30"The ISO date of the first day of the minimum Hijrah year.
    yyyy - a numeric 4 digit year, for example "1434"The value is a sequence of 12 month lengths, * for example: "29 30 29 30 29 30 30 30 29 30 29 29"
    + *
    + * * - * - * - * - * + * + * + * + * * * * - * + * * * - * + * * * - * + * * * - * + * * * * diff --git a/jdk/src/java.base/share/classes/java/time/chrono/MinguoEra.java b/jdk/src/java.base/share/classes/java/time/chrono/MinguoEra.java index a8a42a7cb58..edac0ec02e7 100644 --- a/jdk/src/java.base/share/classes/java/time/chrono/MinguoEra.java +++ b/jdk/src/java.base/share/classes/java/time/chrono/MinguoEra.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,26 +71,27 @@ import java.time.DateTimeException; * All previous years, zero or earlier in the proleptic count or one and greater * in the year-of-era count, are part of the 'Before Republic of China' era. * - *
    ISO years and eras
    year-of-eraeraproleptic-year
    year-of-eraeraproleptic-year
    2CE2
    1CE1
    1BCE0
    2BCE-1
    + *
    + * * - * - * - * - * - * + * + * + * + * + * * * * - * + * * * - * + * * * - * + * * * - * + * * * * diff --git a/jdk/src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java b/jdk/src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java index 5bc2cda8b3f..53cb5d870be 100644 --- a/jdk/src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java +++ b/jdk/src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,26 +71,27 @@ import java.time.DateTimeException; * All previous years, zero or earlier in the proleptic count or one and greater * in the year-of-era count, are part of the 'Before Buddhist' era. * - *
    Minguo years and eras
    year-of-eraeraproleptic-yearISO proleptic-year
    year-of-eraeraproleptic-yearISO proleptic-year
    2ROC21913
    1ROC11912
    1BEFORE_ROC01911
    2BEFORE_ROC-11910
    + *
    + * * - * - * - * - * - * + * + * + * + * + * * * * - * + * * * - * + * * * - * + * * * - * + * * * * diff --git a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java index 6b0559b21ad..cda0f8abb48 100644 --- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java +++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -150,105 +150,106 @@ import java.util.Set; * implementation of {@code java.text.Format}. * *

    Predefined Formatters

    - *
    Buddhist years and eras
    year-of-eraeraproleptic-yearISO proleptic-year
    year-of-eraeraproleptic-yearISO proleptic-year
    2BE2-542
    1BE1-543
    1BEFORE_BE0-544
    2BEFORE_BE-1-545
    + *
    + * * - * - * - * - * + * + * + * + * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * - * + * * * * * - * + * * * * * - * + * * * * * - * + * * * * - * + * * * * * - * + * * * * diff --git a/jdk/src/java.base/share/classes/java/time/temporal/IsoFields.java b/jdk/src/java.base/share/classes/java/time/temporal/IsoFields.java index 26e7e168446..9740a9defc0 100644 --- a/jdk/src/java.base/share/classes/java/time/temporal/IsoFields.java +++ b/jdk/src/java.base/share/classes/java/time/temporal/IsoFields.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -136,15 +136,19 @@ import sun.util.locale.provider.LocaleResources; *

    * For example: * - *

    Predefined Formatters
    FormatterDescriptionExample
    FormatterDescriptionExample
    {@link #ofLocalizedDate ofLocalizedDate(dateStyle)} Formatter with date style from the locale '2011-12-03'
    {@link #ofLocalizedTime ofLocalizedTime(timeStyle)} Formatter with time style from the locale '10:15:30'
    {@link #ofLocalizedDateTime ofLocalizedDateTime(dateTimeStyle)} Formatter with a style for date and time from the locale '3 Jun 2008 11:05:30'
    {@link #ofLocalizedDateTime ofLocalizedDateTime(dateStyle,timeStyle)} * Formatter with date and time styles from the locale '3 Jun 2008 11:05'
    {@link #BASIC_ISO_DATE}Basic ISO date '20111203'
    {@link #ISO_LOCAL_DATE} ISO Local Date '2011-12-03'
    {@link #ISO_OFFSET_DATE} ISO Date with offset '2011-12-03+01:00'
    {@link #ISO_DATE} ISO Date with or without offset '2011-12-03+01:00'; '2011-12-03'
    {@link #ISO_LOCAL_TIME} Time without offset '10:15:30'
    {@link #ISO_OFFSET_TIME} Time with offset '10:15:30+01:00'
    {@link #ISO_TIME} Time with or without offset '10:15:30+01:00'; '10:15:30'
    {@link #ISO_LOCAL_DATE_TIME} ISO Local Date and Time '2011-12-03T10:15:30'
    {@link #ISO_OFFSET_DATE_TIME} Date Time with Offset * 2011-12-03T10:15:30+01:00'
    {@link #ISO_ZONED_DATE_TIME} Zoned Date Time '2011-12-03T10:15:30+01:00[Europe/Paris]'
    {@link #ISO_DATE_TIME} Date and time with ZoneId '2011-12-03T10:15:30+01:00[Europe/Paris]'
    {@link #ISO_ORDINAL_DATE} Year and day of year '2012-337'
    {@link #ISO_WEEK_DATE} Year and Week 2012-W48-6'
    {@link #ISO_INSTANT} Date and Time of an Instant '2011-12-03T10:15:30Z'
    {@link #RFC_1123_DATE_TIME} RFC 1123 / RFC 822 'Tue, 3 Jun 2008 11:05:30 GMT'
    + *
    * + * * + * + * * * * * * * + * *
    Examples of Week based Years
    DateDay-of-weekField values
    2008-12-28SundayWeek 52 of week-based-year 2008
    2008-12-29MondayWeek 1 of week-based-year 2009
    2008-12-31WednesdayWeek 1 of week-based-year 2009
    2009-01-01ThursdayWeek 1 of week-based-year 2009
    2009-01-04SundayWeek 1 of week-based-year 2009
    2009-01-05MondayWeek 2 of week-based-year 2009
    * * @implSpec diff --git a/jdk/src/java.base/share/classes/java/time/temporal/WeekFields.java b/jdk/src/java.base/share/classes/java/time/temporal/WeekFields.java index faee176d3e7..2f13368d28f 100644 --- a/jdk/src/java.base/share/classes/java/time/temporal/WeekFields.java +++ b/jdk/src/java.base/share/classes/java/time/temporal/WeekFields.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -127,10 +127,13 @@ import sun.util.locale.provider.LocaleResources; * The earliest period is referred to as week 0 if it has less than the minimal number of days * and week 1 if it has at least the minimal number of days. * - * + *
    * + * * * + * + * * * * @@ -139,6 +142,7 @@ import sun.util.locale.provider.LocaleResources; * * * + * *
    Examples of WeekFields
    DateDay-of-weekFirst day: Monday
    Minimal days: 4
    First day: Monday
    Minimal days: 5
    2008-12-31WednesdayWeek 5 of December 2008Week 5 of December 2008
    2009-01-01ThursdayWeek 1 of January 2009Week 0 of January 2009
    2009-01-05MondayWeek 2 of January 2009Week 1 of January 2009
    * *

    Week of Year

    @@ -157,10 +161,13 @@ import sun.util.locale.provider.LocaleResources; * The first and last weeks of a year may contain days from the * previous calendar year or next calendar year respectively. * - * + *
    * + * * * + * + * * * * @@ -169,6 +176,7 @@ import sun.util.locale.provider.LocaleResources; * * * + * *
    Examples of WeekFields for week-based-year
    DateDay-of-weekFirst day: Monday
    Minimal days: 4
    First day: Monday
    Minimal days: 5
    2008-12-31WednesdayWeek 1 of 2009Week 53 of 2008
    2009-01-01ThursdayWeek 1 of 2009Week 53 of 2008
    2009-01-05MondayWeek 2 of 2009Week 1 of 2009
    * * @implSpec diff --git a/jdk/src/java.base/share/classes/java/util/Deque.java b/jdk/src/java.base/share/classes/java/util/Deque.java index 9ea576886e1..48eaa3eb28b 100644 --- a/jdk/src/java.base/share/classes/java/util/Deque.java +++ b/jdk/src/java.base/share/classes/java/util/Deque.java @@ -56,7 +56,7 @@ package java.util; *

    The twelve methods described above are summarized in the * following table: * - * + *
    * * * @@ -99,7 +99,7 @@ package java.util; * inherited from the {@code Queue} interface are precisely equivalent to * {@code Deque} methods as indicated in the following table: * - *
    Summary of Deque methods
    + *
    * * * @@ -137,7 +137,7 @@ package java.util; * beginning of the deque. Stack methods are precisely equivalent to * {@code Deque} methods as indicated in the table below: * - *
    Comparison of Queue and Deque methods
    {@code Queue} Method
    + *
    * * * diff --git a/jdk/src/java.base/share/classes/java/util/Formatter.java b/jdk/src/java.base/share/classes/java/util/Formatter.java index f2609764a51..39c23af20ff 100644 --- a/jdk/src/java.base/share/classes/java/util/Formatter.java +++ b/jdk/src/java.base/share/classes/java/util/Formatter.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 @@ -290,12 +290,14 @@ import jdk.internal.math.FormattedFloatingDecimal; *
      *    out.toUpperCase(Locale.getDefault(Locale.Category.FORMAT)) 
    * - *
    Comparison of Stack and Deque methods
    Stack Method
    - * + *
    + * + * * + * * *
    genConv
    Conversion * Argument Category * Description - * + *
    {@code 'b'}, {@code 'B'} * general * If the argument arg is {@code null}, then the result is @@ -365,6 +367,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * line separator * The result is the platform-specific line separator * + *
    * *

    Any characters not explicitly defined as conversions are illegal and are @@ -381,8 +384,9 @@ import jdk.internal.math.FormattedFloatingDecimal; * *

    The following conversion characters are used for formatting times: * - * - * + *
    + * + * * *
    time
    {@code 'H'} * Hour of the day for the 24-hour clock, formatted as two digits with * a leading zero as necessary i.e. {@code 00 - 23}. @@ -446,11 +450,14 @@ import jdk.internal.math.FormattedFloatingDecimal; * 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to * {@code Long.MAX_VALUE}. * + *
    * *

    The following conversion characters are used for formatting dates: * - * + *
    + * + * * * *
    date
    {@code 'B'} * Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths @@ -502,12 +509,15 @@ import jdk.internal.math.FormattedFloatingDecimal; *
    {@code 'e'} * Day of month, formatted as two digits, i.e. {@code 1 - 31}. * + *
    * *

    The following conversion characters are used for formatting common * date/time compositions. * - * + *
    + * + * * * *
    composites
    {@code 'R'} * Time formatted for the 24-hour clock as {@code "%tH:%tM"} @@ -531,6 +541,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"}, * e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}. * + *
    * *

    Any characters not explicitly defined as date/time conversion suffixes @@ -541,14 +552,16 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    The following table summarizes the supported flags. y means the * flag is supported for the indicated argument types. * - * - * + *
    + * + * * + * * *
    genConv
    Flag General * Character Integral * Floating Point * Date/Time * Description - * + *
    '-' y * y * y @@ -599,6 +612,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * - * The result will enclose negative numbers in parentheses * + *
    * *

    1 Depends on the definition of {@link Formattable}. @@ -705,7 +719,9 @@ import jdk.internal.math.FormattedFloatingDecimal; * *

    The following general conversions may be applied to any argument type: * - * + *
    + * + * * * *
    dgConv
    {@code 'b'} * '\u0062' @@ -756,11 +772,14 @@ import jdk.internal.math.FormattedFloatingDecimal; * '\u0053' * The upper-case variant of {@code 's'}. * + *
    * *

    The following flags apply to general conversions: * - * + *
    + * + * * * *
    dFlags
    {@code '-'} * '\u002d' @@ -775,6 +794,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * Requires the output use an alternate form. The definition of the * form is specified by the conversion. * + *
    * *

    The width is the minimum number of characters to @@ -801,7 +821,9 @@ import jdk.internal.math.FormattedFloatingDecimal; * {@code false} then an {@link IllegalFormatCodePointException} will be * thrown. * - * + *
    + * + * * * *
    charConv
    {@code 'c'} * '\u0063' @@ -817,6 +839,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * '\u0043' * The upper-case variant of {@code 'c'}. * + *
    * *

    The {@code '-'} flag defined for General @@ -902,7 +925,9 @@ import jdk.internal.math.FormattedFloatingDecimal; * {@code short}, {@link Short}, {@code int} and {@link Integer}, * {@code long}, and {@link Long}. * - * + *
    + * + * * * *
    IntConv
    {@code 'd'} * '\u0064' @@ -968,6 +993,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * all hexadecimal digits {@code 'a'} - {@code 'f'} * ('\u0061' - '\u0066'). * + *
    * *

    If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and @@ -982,7 +1008,9 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    The following flags apply to numeric integral * conversions: * - * + *
    + * + * * * *
    intFlags
    {@code '+'} * '\u002b' @@ -1025,6 +1053,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * ('\u0028') and append a {@code ')'} * ('\u0029') to negative values. * + *
    * *

    If no flags are given the default formatting is @@ -1060,7 +1089,9 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    The following conversions may be applied to {@link * java.math.BigInteger}. * - * + *
    + * + * * * *
    bIntConv
    {@code 'd'} * '\u0064' @@ -1125,6 +1156,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * all hexadecimal digits {@code 'a'} - {@code 'f'} * ('\u0061' - '\u0066'). * + *
    * *

    If the conversion is {@code 'o'}, {@code 'x'}, or {@code 'X'} and @@ -1154,7 +1186,9 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    The following conversions may be applied to {@code float}, {@link * Float}, {@code double} and {@link Double}. * - * + *
    + * + * * * *
    floatConv
    {@code 'e'} * '\u0065' @@ -1331,6 +1365,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * ('\u0070' and all hexadecimal digits {@code 'a'} - * {@code 'f'} ('\u0061' - '\u0066'). * + *
    * *

    All flags defined for Byte, Short, Integer, and @@ -1388,7 +1423,9 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    The following conversions may be applied {@link java.math.BigDecimal * BigDecimal}. * - * + *
    + * + * * * *
    floatConv
    {@code 'e'} * '\u0065' @@ -1492,6 +1529,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * For a canonical representation of the value, use {@link * BigDecimal#toString()}. * + *
    * *

    All flags defined for Byte, Short, Integer, and @@ -1512,7 +1550,9 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    This conversion may be applied to {@code long}, {@link Long}, {@link * Calendar}, {@link Date} and {@link TemporalAccessor TemporalAccessor} * - * + *
    + * + * * * *
    DTConv
    {@code 't'} * '\u0074' @@ -1521,6 +1561,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * '\u0054' * The upper-case variant of {@code 't'}. * + *
    * *

    The following date and time conversion character suffixes are defined @@ -1532,7 +1573,9 @@ import jdk.internal.math.FormattedFloatingDecimal; * *

    The following conversion characters are used for formatting times: * - * + *
    + * + * * * *
    time
    {@code 'H'} * '\u0048' @@ -1620,11 +1663,14 @@ import jdk.internal.math.FormattedFloatingDecimal; * {@code Long.MAX_VALUE}. The precision of this value is limited by * the resolution of the underlying operating system or hardware. * + *
    * *

    The following conversion characters are used for formatting dates: * - * + *
    + * + * * * *
    date
    {@code 'B'} * '\u0042' @@ -1692,12 +1738,15 @@ import jdk.internal.math.FormattedFloatingDecimal; * Day of month, formatted as two digits, i.e. {@code 1 - 31} where * "{@code 1}" is the first day of the month. * + *
    * *

    The following conversion characters are used for formatting common * date/time compositions. * - * + *
    + * + * * * *
    composites
    {@code 'R'} * '\u0052' @@ -1727,6 +1776,7 @@ import jdk.internal.math.FormattedFloatingDecimal; * Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"}, * e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}. * + *
    * *

    The {@code '-'} flag defined for General @@ -1748,7 +1798,9 @@ import jdk.internal.math.FormattedFloatingDecimal; * *

    The conversion does not correspond to any argument. * - * + *
    + * + * * * *
    DTConv
    {@code '%'} * The result is a literal {@code '%'} ('\u0025') @@ -1767,18 +1819,22 @@ import jdk.internal.math.FormattedFloatingDecimal; *

    The precision is not applicable. If the precision is specified an * {@link IllegalFormatPrecisionException} will be thrown. * + *

    * *

    Line Separator

    * *

    The conversion does not correspond to any argument. * - * + *
    + * + * * * *
    DTConv
    {@code 'n'} * the platform-specific line separator as returned by {@link * System#lineSeparator()}. * + *
    * *

    Flags, width, and precision are not applicable. If any are provided an diff --git a/jdk/src/java.base/share/classes/java/util/GregorianCalendar.java b/jdk/src/java.base/share/classes/java/util/GregorianCalendar.java index c482aa96747..8d2835fe5ac 100644 --- a/jdk/src/java.base/share/classes/java/util/GregorianCalendar.java +++ b/jdk/src/java.base/share/classes/java/util/GregorianCalendar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -159,88 +159,89 @@ import sun.util.calendar.ZoneInfo; * undefined. GregorianCalendar uses the following * default value for each calendar field if its value is undefined. * - * + *
    + * + * + * + * + * + * + * * * - * - * - * - * - * - * * * - * - * * * - * - * * * - * - * * * - * - * * * - * - * * * - * - * * * - * - * * * - * - * * * diff --git a/jdk/src/java.base/share/classes/java/util/Locale.java b/jdk/src/java.base/share/classes/java/util/Locale.java index 2057e3befa4..45d13fa3db9 100644 --- a/jdk/src/java.base/share/classes/java/util/Locale.java +++ b/jdk/src/java.base/share/classes/java/util/Locale.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1587,44 +1587,50 @@ public final class Locale implements Cloneable, Serializable { * *

    Grandfathered tags with canonical replacements are as follows: * - *

    GregorianCalendar default field values
    + * Field + * + Default Value + *
    Field
    - *
    Default Value
    - *
    - * ERA
    + *
    + * ERA * - * AD
    + *
    + * AD *
    - * YEAR
    + *
    + * YEAR * - * 1970
    + *
    + * 1970 *
    - * MONTH
    + *
    + * MONTH * - * JANUARY
    + *
    + * JANUARY *
    - * DAY_OF_MONTH
    + *
    + * DAY_OF_MONTH * - * 1
    + *
    + * 1 *
    - * DAY_OF_WEEK
    + *
    + * DAY_OF_WEEK * - * the first day of week
    + *
    + * the first day of week *
    - * WEEK_OF_MONTH
    + *
    + * WEEK_OF_MONTH * - * 0
    + *
    + * 0 *
    - * DAY_OF_WEEK_IN_MONTH
    + *
    + * DAY_OF_WEEK_IN_MONTH * - * 1
    + *
    + * 1 *
    - * AM_PM
    + *
    + * AM_PM * - * AM
    + *
    + * AM *
    - * HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND
    + *
    + * HOUR, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND * - * 0
    + *
    + * 0 *
    + *
    + * + * + * + * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * * *
    Grandfathered tags with canonical replacements
    grandfathered tagmodern replacement
    grandfathered tag modern replacement
    art-lojban jbo
    i-ami ami
    i-bnn bnn
    i-hak hak
    i-klingon tlh
    i-lux lb
    i-navajo nv
    i-pwn pwn
    i-tao tao
    i-tay tay
    i-tsu tsu
    no-bok nb
    no-nyn nn
    sgn-BE-FR sfb
    sgn-BE-NL vgt
    sgn-CH-DE sgg
    zh-guoyu cmn
    zh-hakka hak
    zh-min-nan nan
    zh-xiang hsn
    art-lojbanjbo
    i-amiami
    i-bnnbnn
    i-hakhak
    i-klingontlh
    i-luxlb
    i-navajonv
    i-pwnpwn
    i-taotao
    i-taytay
    i-tsutsu
    no-boknb
    no-nynnn
    sgn-BE-FRsfb
    sgn-BE-NLvgt
    sgn-CH-DEsgg
    zh-guoyucmn
    zh-hakkahak
    zh-min-nannan
    zh-xianghsn
    * *

    Grandfathered tags with no modern replacement will be * converted as follows: * - * + *
    + * + * + * + * * - * - * - * - * - * - * - * + * + * + * + * + * + * * *
    Grandfathered tags with no modern replacement
    grandfathered tagconverts to
    grandfathered tag converts to
    cel-gaulish xtg-x-cel-gaulish
    en-GB-oed en-GB-x-oed
    i-default en-x-i-default
    i-enochian und-x-i-enochian
    i-mingo see-x-i-mingo
    zh-min nan-x-zh-min
    cel-gaulishxtg-x-cel-gaulish
    en-GB-oeden-GB-x-oed
    i-defaulten-x-i-default
    i-enochianund-x-i-enochian
    i-mingosee-x-i-mingo
    zh-minnan-x-zh-min
    * @@ -2767,12 +2773,16 @@ public final class Locale implements Cloneable, Serializable { * * The filtering method will behave as follows: * - * + *
    + * + * * * * * * + * + * * * * + * *
    Filtering method behavior
    Filtering ModeLanguage Priority List: {@code "de-DE"}Language Priority List: {@code "de-*-DE"}
    * {@link FilteringMode#AUTOSELECT_FILTERING AUTOSELECT_FILTERING} @@ -2832,6 +2842,7 @@ public final class Locale implements Cloneable, Serializable { * not a valid basic language range. *
    * * @see #filter(List, Collection, FilteringMode) diff --git a/jdk/src/java.base/share/classes/java/util/Queue.java b/jdk/src/java.base/share/classes/java/util/Queue.java index 914e293ce2c..f8383b67b41 100644 --- a/jdk/src/java.base/share/classes/java/util/Queue.java +++ b/jdk/src/java.base/share/classes/java/util/Queue.java @@ -47,7 +47,7 @@ package java.util; * implementations; in most implementations, insert operations cannot * fail. * - * + *
    * * * diff --git a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java index bd95564ade8..e7fecee180c 100644 --- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java @@ -1222,12 +1222,15 @@ public abstract class ResourceBundle { *

    Calling getBundle with the locale arguments below will * instantiate resource bundles as follows: * - *

    Summary of Queue methods
    + *
    + * + * * * * * * + * *
    getBundle() locale to resource bundle mapping
    Locale("fr", "CH")MyResources_fr_CH.class, parent MyResources_fr.properties, parent MyResources.class
    Locale("fr", "FR")MyResources_fr.properties, parent MyResources.class
    Locale("de", "DE")MyResources_en.properties, parent MyResources.class
    Locale("en", "US")MyResources_en.properties, parent MyResources.class
    Locale("es", "ES")MyResources_es_ES.class, parent MyResources.class
    * *

    The file MyResources_fr_CH.properties is never used because it is @@ -1311,9 +1314,9 @@ public abstract class ResourceBundle { * sequence of locale-format combinations to be used to call * control.newBundle. * - * - * + *
    + * + * * * * + * + * * * diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java b/jdk/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java index 36fc4fd63d6..f93af80ad48 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/BlockingDeque.java @@ -53,7 +53,7 @@ import java.util.NoSuchElementException; * and the fourth blocks for only a given maximum time limit before giving * up. These methods are summarized in the following table: * - *
    locale-format combinations for newBundle
    Locale
    @@ -1322,6 +1325,8 @@ public abstract class ResourceBundle { * style="vertical-align: top; text-align: left; font-weight: bold; width: 50%;">format
    *
    Locale("de", "DE")
    *
    + *
    * * * @@ -128,7 +128,7 @@ import java.util.NoSuchElementException; * {@code BlockingQueue} interface are precisely equivalent to * {@code BlockingDeque} methods as indicated in the following table: * - *
    Summary of BlockingDeque methods
    First Element (Head)
    + *
    * * * diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java b/jdk/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java index 64190701af2..65a523e6b40 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/BlockingQueue.java @@ -53,7 +53,7 @@ import java.util.Queue; * and the fourth blocks for only a given maximum time limit before giving * up. These methods are summarized in the following table: * - *
    Comparison of BlockingQueue and BlockingDeque methods
    {@code BlockingQueue} Method
    + *
    * * * diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java index 4a0b3bb0ff7..cd14b0057ec 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java @@ -109,7 +109,7 @@ import java.util.concurrent.locks.LockSupport; * async event-style tasks that are not usually joined, in which case * there is little difference among choice of methods. * - *
    Summary of BlockingQueue methods
    + *
    * * * diff --git a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java index 1b03f26b686..b79c850bebf 100644 --- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java +++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,13 +79,15 @@ import java.util.stream.StreamSupport; * *

    Summary of regular-expression constructs

    * - *
    Summary of task execution methods
    - * + *
    + * + * * * * * + * + * * * * @@ -383,6 +385,7 @@ import java.util.stream.StreamSupport; * * * + * *
    Regular expression constructs, and what they match
    ConstructMatches
     
    Characters
    {@code (?>}X{@code )}X, as an independent, non-capturing group
    * *


    @@ -429,8 +432,9 @@ import java.util.stream.StreamSupport; *

    The precedence of character-class operators is as follows, from * highest to lowest: * - *

    + *
    + * + * * * * @@ -446,6 +450,7 @@ import java.util.stream.StreamSupport; * * * + * *
    Precedence of character class operators.
    1    Literal escape    {@code \x}
    5    Intersection{@code [a-z&&[aeiou]]}
    * *

    Note that a different set of metacharacters are in effect inside @@ -496,7 +501,9 @@ import java.util.stream.StreamSupport; * left to right. In the expression {@code ((A)(B(C)))}, for example, there * are four such groups:

    * - *
    + *
    + * + * * * * @@ -505,6 +512,7 @@ import java.util.stream.StreamSupport; * * * + * *
    Capturing group numberings
    1    {@code ((A)(B(C)))}
    2    {@code (B(C))}
    4    {@code (C)}
    * *

    Group zero always stands for the entire expression. @@ -641,12 +649,15 @@ import java.util.stream.StreamSupport; * of Unicode Regular Expression * , when {@link #UNICODE_CHARACTER_CLASS} flag is specified. * - * + *
    + * + * * * * - * + * + * + * * * * @@ -685,6 +696,7 @@ import java.util.stream.StreamSupport; * * * + * *
    predefined and posix character classes in Unicode mode
    ClassesMatches
    {@code \p{Lower}}A lowercase character:{@code \p{IsLowercase}}
    {@code \p{Upper}}A word character: {@code [\p{Alpha}\p{gc=Mn}\p{gc=Me}\p{gc=Mc}\p{Digit}\p{gc=Pc}\p{IsJoin_Control}]}
    {@code \W}A non-word character: {@code [^\w]}
    *

    * @@ -1207,11 +1219,14 @@ public final class Pattern *

    The input {@code "boo:and:foo"}, for example, yields the following * results with these parameters: * - *

    + *
    + * + * * * * + * + * * * * @@ -1230,6 +1245,7 @@ public final class Pattern * * * + * *
    Split examples showing regex, limit, and result
    Regex    Limit    Result    
    :2{@code { "boo", "and:foo" }}
    o0{@code { "b", "", ":and:f" }}
    * * @param input @@ -1294,14 +1310,18 @@ public final class Pattern *

    The input {@code "boo:and:foo"}, for example, yields the following * results with these expressions: * - *

    + *
    + * + * * * + * + * * * * * + * *
    Split examples showing regex and result
    Regex    Result
    :{@code { "boo", "and", "foo" }}
    o{@code { "b", "", ":and:f" }}
    * * diff --git a/jdk/src/java.base/share/classes/java/util/spi/CalendarNameProvider.java b/jdk/src/java.base/share/classes/java/util/spi/CalendarNameProvider.java index 4c08dd0eb73..396ffeae696 100644 --- a/jdk/src/java.base/share/classes/java/util/spi/CalendarNameProvider.java +++ b/jdk/src/java.base/share/classes/java/util/spi/CalendarNameProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,12 +46,16 @@ import java.util.Map; * Calendar}. The following are calendar-common fields and their values to be * supported for each calendar system. * - * + *
    + * + * * * * * * + * + * * * * @@ -73,17 +77,22 @@ import java.util.Map; * * * + * *
    Field values
    FieldValueDescription
    {@link Calendar#MONTH}{@link Calendar#JANUARY} to {@link Calendar#UNDECIMBER}{@link Calendar#AM} to {@link Calendar#PM}0 - AM, 1 - PM
    * *

    The following are calendar-specific fields and their values to be supported. * - * + *
    + * + * * * * * * * + * + * * * * @@ -154,6 +163,7 @@ import java.util.Map; * * * + * *
    Calendar type and field values
    Calendar TypeFieldValueDescription
    {@code "gregory"}{@link Calendar#ERA}1Anno Hijrah (AH)
    * *

    Calendar field value names for {@code "gregory"} must be consistent with diff --git a/jdk/src/java.base/share/classes/java/util/stream/StreamOpFlag.java b/jdk/src/java.base/share/classes/java/util/stream/StreamOpFlag.java index e4ad988eaf1..a8e06b2f7ce 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/StreamOpFlag.java +++ b/jdk/src/java.base/share/classes/java/util/stream/StreamOpFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ import java.util.Spliterator; * contexts: * *

    - * + *
    * * * diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLPermission.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLPermission.java index b27142128ae..9db1f79a0d2 100644 --- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLPermission.java +++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,14 +44,17 @@ import java.security.*; * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. * - *
    Type Characteristics
    + *
    + * + * * * * * * + * * + * * * * * * + * *
    permission name, what it allows, and associated risks
    Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    setHostnameVerifierThe ability to set a callback which can decide whether to @@ -84,6 +87,7 @@ import java.security.*; *
    * * @see java.security.BasicPermission From 25e5108c99ead867effffa50a7c3800adcc418ae Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 11 May 2017 13:58:05 -0700 Subject: [PATCH 025/105] 8180037: move jdk.test.lib.InMemoryJavaCompiler to a separate package Reviewed-by: mseledtsov, vlivanov --- test/lib/RedefineClassHelper.java | 2 +- .../lib/jdk/test/lib/{ => compiler}/InMemoryJavaCompiler.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename test/lib/jdk/test/lib/{ => compiler}/InMemoryJavaCompiler.java (98%) diff --git a/test/lib/RedefineClassHelper.java b/test/lib/RedefineClassHelper.java index 75768092365..2c236907a7a 100644 --- a/test/lib/RedefineClassHelper.java +++ b/test/lib/RedefineClassHelper.java @@ -23,7 +23,7 @@ import java.io.PrintWriter; import java.lang.instrument.*; -import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; /* * Helper class to write tests that redefine classes. diff --git a/test/lib/jdk/test/lib/InMemoryJavaCompiler.java b/test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java similarity index 98% rename from test/lib/jdk/test/lib/InMemoryJavaCompiler.java rename to test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java index 4033fcab0ca..e174b320180 100644 --- a/test/lib/jdk/test/lib/InMemoryJavaCompiler.java +++ b/test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.compiler; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -56,7 +56,7 @@ import javax.tools.ToolProvider; * *
      * {@code
    - * import jdk.test.lib.InMemoryJavaCompiler;
    + * import jdk.test.lib.compiler.InMemoryJavaCompiler;
      * import jdk.test.lib.ByteClassLoader;
      *
      * class Example {
    
    From ce8579b6c7802c1c9bd428647e43b892739b8170 Mon Sep 17 00:00:00 2001
    From: Igor Ignatyev 
    Date: Thu, 11 May 2017 13:58:54 -0700
    Subject: [PATCH 026/105] 8180004: jdk.test.lib.DynamicVMOption should be moved
     to jdk.test.lib.management
    
    Reviewed-by: mseledtsov, vlivanov
    ---
     test/lib/jdk/test/lib/{ => management}/DynamicVMOption.java | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
     rename test/lib/jdk/test/lib/{ => management}/DynamicVMOption.java (99%)
    
    diff --git a/test/lib/jdk/test/lib/DynamicVMOption.java b/test/lib/jdk/test/lib/management/DynamicVMOption.java
    similarity index 99%
    rename from test/lib/jdk/test/lib/DynamicVMOption.java
    rename to test/lib/jdk/test/lib/management/DynamicVMOption.java
    index 17f545e126e..786f1d85b22 100644
    --- a/test/lib/jdk/test/lib/DynamicVMOption.java
    +++ b/test/lib/jdk/test/lib/management/DynamicVMOption.java
    @@ -20,7 +20,8 @@
      * or visit www.oracle.com if you need additional information or have any
      * questions.
      */
    -package jdk.test.lib;
    +
    +package jdk.test.lib.management;
     
     import com.sun.management.HotSpotDiagnosticMXBean;
     import java.lang.management.ManagementFactory;
    
    From f2fceb6de153ed263614bac7d87b16a53fe9c5b9 Mon Sep 17 00:00:00 2001
    From: Kumar Srinivasan 
    Date: Thu, 11 May 2017 15:12:38 -0700
    Subject: [PATCH 027/105] 8179632: Fix the old doclet documentation
    
    Reviewed-by: jjg
    ---
     .../classes/com/sun/javadoc/package-info.java |  2 +-
     .../com/sun/tools/doclets/package-info.java   | 12 ++-----
     .../tools/doclets/standard/package-info.java  | 33 +++++++++++++++++++
     3 files changed, 36 insertions(+), 11 deletions(-)
     create mode 100644 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java
    
    diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java b/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java
    index 87b3feecaea..dfc4ff38092 100644
    --- a/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java
    +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java
    @@ -26,7 +26,7 @@
     /**
     

    Note: The declarations in this package have been superseded by those -in the package {@code jdk.javadoc.doclet}. +in the package {@link jdk.javadoc.doclet}. For more information, see the Migration Guide in the documentation for that package.

    diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/package-info.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/package-info.java index 735bfa5c5cc..c8912b29074 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/package-info.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/package-info.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 @@ -26,16 +26,8 @@ /**

    Note: The declarations in this package have been superseded by those -in the new package {@code jdk.javadoc.doclet}. +in the new package {@link jdk.javadoc.doclet}.

    - - As of JDK version 1.5, replaced by - {@code com.sun.tools.doclets.internal.toolkit.util}. - -

    This is NOT part of any supported API. - If you write code that depends on this, you do so at your own risk. - This code and its internal interfaces are subject to change or - deletion without notice. */ package com.sun.tools.doclets; diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java new file mode 100644 index 00000000000..4b93a8cbd8b --- /dev/null +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** +

    +Note: The declarations in this package have been superseded by those +in the new package {@link jdk.javadoc.doclet}. +

    +*/ + +package com.sun.tools.doclets.standard; From 810e80970aaf23855dde1bd60ff2905507481546 Mon Sep 17 00:00:00 2001 From: Doug Lea Date: Thu, 11 May 2017 19:34:59 -0400 Subject: [PATCH 028/105] 8179515: Class java.util.concurrent.ThreadLocalRandom fails to Initialize when using SecurityManager Break connection to security framework by using VM.getSavedProperty to read the proeprty. Reviewed-by: dholmes, martin, redestad, psandoz, mchung --- .../classes/java/util/concurrent/ThreadLocalRandom.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java index 22c1f9a2e29..02820050420 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java @@ -49,6 +49,7 @@ import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.StreamSupport; import jdk.internal.misc.Unsafe; +import jdk.internal.misc.VM; /** * A random number generator isolated to the current thread. Like the @@ -1093,11 +1094,8 @@ public class ThreadLocalRandom extends Random { // at end of to survive static initialization circularity static { - if (java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction<>() { - public Boolean run() { - return Boolean.getBoolean("java.util.secureRandomSeed"); - }})) { + String sec = VM.getSavedProperty("java.util.secureRandomSeed"); + if (Boolean.parseBoolean(sec)) { byte[] seedBytes = java.security.SecureRandom.getSeed(8); long s = (long)seedBytes[0] & 0xffL; for (int i = 1; i < 8; ++i) From 147981060124c248d278c54b6c13689cd527001d Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 11 May 2017 18:04:24 -0700 Subject: [PATCH 029/105] 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules Reviewed-by: lancea --- .../classes/javax/sql/rowset/package.html | 65 +++++----- .../classes/javax/sql/rowset/spi/package.html | 20 +-- .../share/classes/java/sql/SQLPermission.java | 9 +- .../share/classes/java/sql/Statement.java | 122 ++++++++++-------- 4 files changed, 115 insertions(+), 101 deletions(-) diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html index 1d9bf523cd5..ad5f08e2986 100644 --- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html +++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html @@ -1,11 +1,11 @@ - - + + javax.sql.rowset Package - + Standard interfaces and base classes for JDBC RowSet @@ -48,7 +48,7 @@ that a standard RowSet implementation either implements or extends.
  • 5.0 Related Documentation -

    1.0 Package Specification

    +

    1.0 Package Specification

    This package specifies five standard JDBC RowSet interfaces. All five extend the RowSet interface described in the JDBC 3.0 @@ -63,7 +63,7 @@ developers who intend to provide their own compliant RowSet impleme should pay particular attention to the assertions detailed in specification interfaces. -

    2.0 Standard RowSet Definitions

    +

    2.0 Standard RowSet Definitions

    • JdbcRowSet - A wrapper around a ResultSet object that makes it possible to use the result set as a @@ -136,7 +136,7 @@ column matches, a JoinRowSet object establishes relationships betwe RowSet instances without the need to touch the originating data source.
    -

    3.0 Implementer's Guide

    +

    3.0 Implementer's Guide

    Compliant implementations of JDBC RowSet Implementations must follow the assertions described in this specification. In accordance with the terms of the Java Community Process, a @@ -173,47 +173,40 @@ the BaseRowSet class as a basis for their implementations. The following table illustrates the features that the BaseRowSet abstract class provides.
    - +
    + + + + + + + - - - - - - + +the standard RowSet properties. - - + +by compliant implementations. - - + + - - + +
    Features in BaseRowSet
    FeatureDetails
    Feature
    -
    Details
    -
    Properties
    -
    Provides standard JavaBeans property manipulation + PropertiesProvides standard JavaBeans property manipulation mechanisms to allow applications to get and set RowSet command and property values. Refer to the documentation of the javax.sql.RowSet interface (available in the JDBC 3.0 specification) for more details on -the standard RowSet properties.
    -
    Event notification
    -
    Provides standard JavaBeans event notifications + Event notificationProvides standard JavaBeans event notifications to registered event listeners. Refer to the documentation of javax.sql.RowSetEvent interface (available in the JDBC 3.0 specification) for more details on how to register and handle standard RowSet events generated -by compliant implementations.
    -
    Setters for a RowSet object's command
    -
    Provides a complete set of setter methods - for setting RowSet command parameters.
    -
    Setters for a RowSet object's commandProvides a complete set of setter methods + for setting RowSet command parameters.
    Streams
    -
    Provides fields for storing of stream instances - in addition to providing a set of constants for stream type designation.
    -
    StreamsProvides fields for storing of stream instances + in addition to providing a set of constants for stream type designation.
    @@ -289,13 +282,13 @@ match column as a basis for adding the RowSet object.
  • -

    4.0 Related Specifications

    +

    4.0 Related Specifications

    -

    5.0 Related Documentation

    +

    5.0 Related Documentation

    • JDBC RowSet Tutorial diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html index b5aada863b4..3c3dbc5eec1 100644 --- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html +++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html @@ -1,5 +1,5 @@ - - + + diff --git a/jdk/src/java.naming/share/classes/javax/naming/directory/package.html b/jdk/src/java.naming/share/classes/javax/naming/directory/package.html index eb363d71a39..c339eb2f043 100644 --- a/jdk/src/java.naming/share/classes/javax/naming/directory/package.html +++ b/jdk/src/java.naming/share/classes/javax/naming/directory/package.html @@ -82,7 +82,7 @@ that support more sophisticated search filters.

      Package Specification

      The JNDI API Specification and related documents can be found in the -JNDI documentation. +{@extLink jndi_overview JNDI documentation}. @since 1.3 diff --git a/jdk/src/java.naming/share/classes/javax/naming/event/package.html b/jdk/src/java.naming/share/classes/javax/naming/event/package.html index e70ca97a03c..899981e77f9 100644 --- a/jdk/src/java.naming/share/classes/javax/naming/event/package.html +++ b/jdk/src/java.naming/share/classes/javax/naming/event/package.html @@ -117,7 +117,7 @@ and the listener is automatically deregistered. The JNDI API Specification and related documents can be found in the -JNDI documentation. +{@extLink jndi_overview JNDI documentation}. @since 1.3 diff --git a/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html b/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html index 8af8ce7b988..e43cdc54670 100644 --- a/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html +++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html @@ -258,7 +258,7 @@ public class VendorXControlFactory extends ControlFactory {

      Package Specification

      The JNDI API Specification and related documents can be found in the -JNDI documentation. +{@extLink jndi_overview JNDI documentation}. @since 1.3 diff --git a/jdk/src/java.naming/share/classes/javax/naming/package.html b/jdk/src/java.naming/share/classes/javax/naming/package.html index 224e0cbddf7..817720fdbb2 100644 --- a/jdk/src/java.naming/share/classes/javax/naming/package.html +++ b/jdk/src/java.naming/share/classes/javax/naming/package.html @@ -135,7 +135,7 @@ Otherwise, programs should catch NamingException.

      Package Specification

      The JNDI API Specification and related documents can be found in the -JNDI documentation. +{@extLink jndi_overview JNDI documentation}. @since 1.3 diff --git a/jdk/src/java.naming/share/classes/javax/naming/spi/package.html b/jdk/src/java.naming/share/classes/javax/naming/spi/package.html index 6d7dd578c2a..73ee0f9d30e 100644 --- a/jdk/src/java.naming/share/classes/javax/naming/spi/package.html +++ b/jdk/src/java.naming/share/classes/javax/naming/spi/package.html @@ -82,7 +82,7 @@ different providers to cooperate to complete JNDI operations.

      Package Specification

      The JNDI SPI Specification and related documents can be found in the -JNDI documentation. +{@extLink jndi_overview JNDI documentation}. @since 1.3 From f5156046b4ac1ab87f14e9998719b1960652aef4 Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Fri, 12 May 2017 14:35:58 -0400 Subject: [PATCH 039/105] 8180309: Minor update to javax.sql.rowset package.html Reviewed-by: mchung --- .../java.sql.rowset/share/classes/javax/sql/rowset/package.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html index ad5f08e2986..e52d3c9ec99 100644 --- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html +++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html @@ -284,7 +284,7 @@ match column as a basis for adding the RowSet object.

      4.0 Related Specifications

      From 48dc9fb500e41b6242e5e38278f4dfb003cd6169 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Fri, 12 May 2017 15:15:43 -0400 Subject: [PATCH 040/105] 8180082: Broken javadoc links Reviewed-by: mchung, bpb, chegar, ihse --- .../share/classes/java/io/ObjectInputStream.java | 3 ++- .../share/classes/java/io/ObjectOutputStream.java | 5 +++-- .../share/classes/java/io/ObjectStreamClass.java | 9 +++++---- .../java.base/share/classes/java/io/package-info.java | 8 +++++--- .../java.base/share/classes/java/lang/CharSequence.java | 6 +++--- .../java.base/share/classes/java/lang/ModuleLayer.java | 2 +- jdk/src/java.base/share/classes/java/lang/String.java | 2 +- jdk/src/java.base/share/classes/java/security/Key.java | 4 ++-- .../java.base/share/classes/java/security/KeyRep.java | 4 ++-- jdk/src/java.base/share/specs/serialization/output.md | 3 ++- .../share/classes/java/lang/management/package.html | 9 ++++----- .../share/classes/com/sun/management/package-info.java | 2 +- 12 files changed, 31 insertions(+), 26 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java index 15d735e88c3..bffc5a81ee8 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -216,7 +216,8 @@ import sun.reflect.misc.ReflectUtil; * @see java.io.DataInput * @see java.io.ObjectOutputStream * @see java.io.Serializable - * @see Object Serialization Specification, Section 3, Object Input Classes + * @see + * Object Serialization Specification, Section 3, Object Input Classes * @since 1.1 */ public class ObjectInputStream diff --git a/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java b/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java index 06845442958..135e5645a36 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -156,7 +156,8 @@ import sun.reflect.misc.ReflectUtil; * @see java.io.ObjectInputStream * @see java.io.Serializable * @see java.io.Externalizable - * @see Object Serialization Specification, Section 2, Object Output Classes + * @see + * Object Serialization Specification, Section 2, Object Output Classes * @since 1.1 */ public class ObjectOutputStream diff --git a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java index 0f2af6495fe..e5a323830ee 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,13 +62,14 @@ import static java.io.ObjectStreamField.*; * loaded in this Java VM can be found/created using the lookup method. * *

      The algorithm to compute the SerialVersionUID is described in - * Object - * Serialization Specification, Section 4.6, Stream Unique Identifiers. + * + * Object Serialization Specification, Section 4.6, Stream Unique Identifiers. * * @author Mike Warres * @author Roger Riggs * @see ObjectStreamField - * @see Object Serialization Specification, Section 4, Class Descriptors + * @see + * Object Serialization Specification, Section 4, Class Descriptors * @since 1.1 */ public class ObjectStreamClass implements Serializable { diff --git a/jdk/src/java.base/share/classes/java/io/package-info.java b/jdk/src/java.base/share/classes/java/io/package-info.java index cf1b699cd0d..3d9685886cb 100644 --- a/jdk/src/java.base/share/classes/java/io/package-info.java +++ b/jdk/src/java.base/share/classes/java/io/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,8 @@ * *

      Package Specification

      * * *

      Related Documentation

      @@ -41,7 +42,8 @@ * For overviews, tutorials, examples, guides, and tool documentation, * please see: *
        - *
      • Serialization Enhancements + *
      • {@extLink serialver_tool_reference The serialver tool}
      • + *
      • {@extLink serialization_guide Serialization Documentation}
      • *
      * * @since 1.0 diff --git a/jdk/src/java.base/share/classes/java/lang/CharSequence.java b/jdk/src/java.base/share/classes/java/lang/CharSequence.java index 2972f10079f..e8ee5aa5b50 100644 --- a/jdk/src/java.base/share/classes/java/lang/CharSequence.java +++ b/jdk/src/java.base/share/classes/java/lang/CharSequence.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -123,7 +123,7 @@ public interface CharSequence { * *

      The stream binds to this sequence when the terminal stream operation * commences (specifically, for mutable sequences the spliterator for the - * stream is late-binding). + * stream is late-binding). * If the sequence is modified during that operation then the result is * undefined. * @@ -173,7 +173,7 @@ public interface CharSequence { * *

      The stream binds to this sequence when the terminal stream operation * commences (specifically, for mutable sequences the spliterator for the - * stream is late-binding). + * stream is late-binding). * If the sequence is modified during that operation then the result is * undefined. * diff --git a/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java index 549662ff9c0..70fbd8bce81 100644 --- a/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java +++ b/jdk/src/java.base/share/classes/java/lang/ModuleLayer.java @@ -84,7 +84,7 @@ import sun.security.util.SecurityConstants; * started. The boot layer contains module {@code java.base} and is the only * layer in the Java virtual machine with a module named "{@code java.base}". * The modules in the boot layer are mapped to the bootstrap class loader and - * other class loaders that are + * other class loaders that are * built-in into the Java virtual machine. The boot layer will often be * the {@link #parents() parent} when creating additional layers.

      * diff --git a/jdk/src/java.base/share/classes/java/lang/String.java b/jdk/src/java.base/share/classes/java/lang/String.java index ea94633597c..7191669709e 100644 --- a/jdk/src/java.base/share/classes/java/lang/String.java +++ b/jdk/src/java.base/share/classes/java/lang/String.java @@ -203,7 +203,7 @@ public final class String * Class String is special cased within the Serialization Stream Protocol. * * A String instance is written into an ObjectOutputStream according to - * + * * Object Serialization Specification, Section 6.2, "Stream Elements" */ private static final ObjectStreamField[] serialPersistentFields = diff --git a/jdk/src/java.base/share/classes/java/security/Key.java b/jdk/src/java.base/share/classes/java/security/Key.java index 09542e394a2..0f8e84e718e 100644 --- a/jdk/src/java.base/share/classes/java/security/Key.java +++ b/jdk/src/java.base/share/classes/java/security/Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,7 @@ package java.security; *

      A Key should use KeyRep as its serialized representation. * Note that a serialized Key may contain sensitive information * which should not be exposed in untrusted environments. See the - * + * * Security Appendix * of the Serialization Specification for more information. * diff --git a/jdk/src/java.base/share/classes/java/security/KeyRep.java b/jdk/src/java.base/share/classes/java/security/KeyRep.java index f97208f1083..9d53635f7ce 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyRep.java +++ b/jdk/src/java.base/share/classes/java/security/KeyRep.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 @@ -42,7 +42,7 @@ import javax.crypto.spec.SecretKeySpec; * * Note that a serialized Key may contain sensitive information * which should not be exposed in untrusted environments. See the - * + * * Security Appendix * of the Serialization Specification for more information. * diff --git a/jdk/src/java.base/share/specs/serialization/output.md b/jdk/src/java.base/share/specs/serialization/output.md index 944abbbc0dd..46b47cc45e6 100644 --- a/jdk/src/java.base/share/specs/serialization/output.md +++ b/jdk/src/java.base/share/specs/serialization/output.md @@ -221,7 +221,8 @@ object is serialized as follows: If the replacement object is not one of the types covered by Steps 3 through 7, processing resumes using the replacement object at Step 10. -9. If the object is a `java.lang.String,` the string is written as length +9. + If the object is a `java.lang.String,` the string is written as length information followed by the contents of the string encoded in modified UTF-8. For details, refer to [Section 6.2, "Stream Elements"](protocol.html#stream-elements). A handle is assigned to the diff --git a/jdk/src/java.management/share/classes/java/lang/management/package.html b/jdk/src/java.management/share/classes/java/lang/management/package.html index 67246f00e1e..f1d22738272 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/package.html +++ b/jdk/src/java.management/share/classes/java/lang/management/package.html @@ -1,5 +1,5 @@ + + + + + + +@HEADER_TITLE@ + + + +

      @HEADER_TITLE@

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Modules
      GroupJava SEJDKJavaFX
      Foundation@CORE_MODULES@
      Security@SECURITY_MODULES@
      Instrumentation and
      Management
      @INSTRUMENT_MGMT_MODULES@
      Integration@INTEGRATION_MODULES@
      User Interface@UI_TOOLKITS_MODULES@
      Compiler and Scripting@COMPILER_SCRIPTING_MODULES@
      Debugging@DEBUG_MODULES@
      Tools and Tool APIs@TOOL_MODULES@
      Incubating Features@INCUBATOR_MODULES@
      Java EE@JAVA_EE_MODULES@
      Outside Java SEJDKJavaFX
      Others@OTHER_MODULES@
      + +

      +


      +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 new file mode 100644 index 00000000000..0e7d0c8aed1 --- /dev/null +++ b/jdk/make/src/classes/build/tools/docs/docs-module-groups.properties @@ -0,0 +1,101 @@ +# Module Grouping for the docs bundle page +# + +core_modules=\ +java.base \ +jdk.charsets \ +jdk.localedata \ +jdk.net \ +jdk.sctp \ +jdk.zipfs + +java_ee_modules=\ +java.activation \ +java.corba \ +java.transaction \ +java.xml.bind \ +java.xml.ws \ +java.xml.ws.annotation + +security_modules=\ +java.security.jgss \ +java.security.sasl \ +java.xml.crypto \ +jdk.security.auth \ +jdk.security.jgss \ +jdk.crypto.cryptoki \ +jdk.crypto.ec \ +jdk.crypto.mscapi \ +jdk.crypto.ucrypto + +instrument_mgmt_modules=\ +java.instrument \ +java.management \ +java.management.rmi \ +jdk.jfr \ +jdk.management \ +jdk.management.agent \ +jdk.management.cmm \ +jdk.management.jfr \ +jdk.management.resource \ + +integration_modules=\ +java.logging \ +java.naming \ +java.prefs \ +java.rmi \ +java.sql \ +java.sql.rowset \ +java.xml \ +jdk.httpserver \ +jdk.naming.dns \ +jdk.naming.rmi + +ui_toolkits_modules=\ +java.datatransfer \ +java.desktop \ +javafx.base \ +javafx.controls \ +javafx.fxml \ +javafx.graphics \ +javafx.media \ +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=\ +jdk.attach \ +jdk.editpad \ +jdk.jartool \ +jdk.javadoc \ +jdk.jcmd \ +jdk.jconsole \ +jdk.jdeps \ +jdk.jlink \ +jdk.jshell \ +jdk.jstatd \ +jdk.pack \ +jdk.policytool \ +jdk.packager.services \ +jdk.rmic + +compiler_scripting_modules=\ +java.compiler \ +java.scripting \ +jdk.compiler \ +jdk.dynalink \ +jdk.scripting.nashorn \ +jdk.scripting.nashorn.shell + +incubator_modules=\ +jdk.incubator.httpclient From 999aabdd77e8a322b12cd4a618a666180b25a7b6 Mon Sep 17 00:00:00 2001 From: Ron Pressler Date: Fri, 12 May 2017 13:43:06 -0700 Subject: [PATCH 043/105] 8180075: Javadoc of MethodHandles.Lookup::bind should note the difference from MethodHandle::bindTo Reviewed-by: psandoz --- .../share/classes/java/lang/invoke/MethodHandles.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index 292fd9bb6c4..d53d9d4ecca 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -1660,7 +1660,7 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method * (If the trailing array argument is the only argument, * the given receiver value will be bound to it.) *

      - * This is equivalent to the following code: + * This is almost equivalent to the following code, with some differences noted below: *

      {@code
       import static java.lang.invoke.MethodHandles.*;
       import static java.lang.invoke.MethodType.*;
      @@ -1673,7 +1673,10 @@ return mh1;
                * where {@code defc} is either {@code receiver.getClass()} or a super
                * type of that class, in which the requested method is accessible
                * to the lookup class.
      -         * (Note that {@code bindTo} does not preserve variable arity.)
      +         * (Unlike {@code bind}, {@code bindTo} does not preserve variable arity.
      +         * Also, {@code bindTo} may throw a {@code ClassCastException} in instances where {@code bind} would
      +         * throw an {@code IllegalAccessException}, as in the case where the member is {@code protected} and
      +         * the receiver is restricted by {@code findVirtual} to the lookup class.)
                * @param receiver the object from which the method is accessed
                * @param name the name of the method
                * @param type the type of the method, with the receiver argument omitted
      
      From 44bdf50a3a65181713ce66616249c185b4e296cf Mon Sep 17 00:00:00 2001
      From: Stuart Marks 
      Date: Fri, 12 May 2017 14:52:26 -0700
      Subject: [PATCH 044/105] 8180137: fix broken link in java.lang.Iterable
      
      Reviewed-by: rriggs
      ---
       jdk/src/java.base/share/classes/java/lang/Iterable.java | 9 +++------
       1 file changed, 3 insertions(+), 6 deletions(-)
      
      diff --git a/jdk/src/java.base/share/classes/java/lang/Iterable.java b/jdk/src/java.base/share/classes/java/lang/Iterable.java
      index 89059022905..a58faa4b250 100644
      --- a/jdk/src/java.base/share/classes/java/lang/Iterable.java
      +++ b/jdk/src/java.base/share/classes/java/lang/Iterable.java
      @@ -31,16 +31,13 @@ import java.util.Spliterators;
       import java.util.function.Consumer;
       
       /**
      - * Implementing this interface allows an object to be the target of
      - * the "for-each loop" statement. See
      - * 
      - * For-each Loop
      - * 
      + * Implementing this interface allows an object to be the target of the enhanced
      + * {@code for} statement (sometimes called the "for-each loop" statement).
        *
        * @param  the type of elements returned by the iterator
        *
        * @since 1.5
      - * @jls 14.14.2 The enhanced for statement
      + * @jls 14.14.2 The enhanced {@code for} statement
        */
       public interface Iterable {
           /**
      
      From d1a9610d059c655f2fa3c0c85d313b87c91eae83 Mon Sep 17 00:00:00 2001
      From: Bhavesh Patel 
      Date: Fri, 12 May 2017 18:05:40 -0700
      Subject: [PATCH 045/105] 8178043: Support grouping modules in unified javadoc
      
      Reviewed-by: jjg, ksrini
      ---
       .../html/AbstractModuleIndexWriter.java       |   7 +-
       .../formats/html/ModuleIndexFrameWriter.java  |   7 +-
       .../formats/html/ModuleIndexWriter.java       |  45 ++---
       .../html/ModulePackageIndexFrameWriter.java   |   5 +-
       .../formats/html/PackageIndexWriter.java      |  11 +-
       .../html/resources/standard.properties        |  10 +-
       .../doclets/toolkit/Configuration.java        |   6 +-
       .../toolkit/resources/doclets.properties      |   1 +
       .../internal/doclets/toolkit/util/Group.java  | 164 ++++++++++++++----
       .../doclet/testModules/TestModules.java       | 139 +++++++++++++--
       10 files changed, 313 insertions(+), 82 deletions(-)
      
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
      index 4bdbfd70012..ce4a233b43e 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
      @@ -25,6 +25,7 @@
       
       package jdk.javadoc.internal.doclets.formats.html;
       
      +import java.util.Collection;
       import java.util.Map;
       import java.util.Set;
       import java.util.SortedMap;
      @@ -101,7 +102,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
            * @param tableSummary summary for the table
            * @param body the document tree to which the modules list will be added
            */
      -    protected abstract void addModulesList(Map> modules, String text,
      +    protected abstract void addModulesList(Collection modules, String text,
                   String tableSummary, Content body);
       
           /**
      @@ -173,7 +174,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
            * @param body the document tree to which the index will be added
            */
           protected void addIndex(Content body) {
      -        addIndexContents(modules, "doclet.Module_Summary",
      +        addIndexContents(configuration.modules, "doclet.Module_Summary",
                       configuration.getText("doclet.Member_Table_Summary",
                       configuration.getText("doclet.Module_Summary"),
                       configuration.getText("doclet.modules")), body);
      @@ -201,7 +202,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
            * @param tableSummary summary for the table
            * @param body the document tree to which the index contents will be added
            */
      -    protected void addIndexContents(Map> modules, String text,
      +    protected void addIndexContents(Collection modules, String text,
                   String tableSummary, Content body) {
               HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
                       ? HtmlTree.NAV()
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
      index 592c2c496c7..2f7b7e81018 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -25,6 +25,7 @@
       
       package jdk.javadoc.internal.doclets.formats.html;
       
      +import java.util.Collection;
       import java.util.Map;
       import java.util.Set;
       
      @@ -81,7 +82,7 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
           /**
            * {@inheritDoc}
            */
      -    protected void addModulesList(Map> modules, String text,
      +    protected void addModulesList(Collection modules, String text,
                   String tableSummary, Content body) {
               Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true,
                       contents.modulesLabel);
      @@ -90,7 +91,7 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
                       : HtmlTree.DIV(HtmlStyle.indexContainer, heading);
               HtmlTree ul = new HtmlTree(HtmlTag.UL);
               ul.setTitle(contents.modulesLabel);
      -        for (ModuleElement mdle: modules.keySet()) {
      +        for (ModuleElement mdle: modules) {
                   ul.addContent(getModuleLink(mdle));
               }
               htmlTree.addContent(ul);
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
      index 02f43ef7eac..958d92dec87 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
      @@ -30,7 +30,7 @@ import java.util.*;
       import javax.lang.model.element.ModuleElement;
       import javax.lang.model.element.PackageElement;
       
      -import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
      +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
      @@ -56,11 +56,16 @@ import jdk.javadoc.internal.doclets.toolkit.util.Group;
       public class ModuleIndexWriter extends AbstractModuleIndexWriter {
       
           /**
      -     * Set representing the modules.
      +     * Map representing the group of modules as specified on the command line.
            *
            * @see Group
            */
      -    private final SortedSet modules;
      +    private final Map> groupModuleMap;
      +
      +    /**
      +     * List to store the order groups as specified on the command line.
      +     */
      +    private final List groupList;
       
           /**
            * HTML tree for main tag.
      @@ -74,7 +79,8 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
            */
           public ModuleIndexWriter(ConfigurationImpl configuration, DocPath filename) {
               super(configuration, filename);
      -        modules = configuration.modules;
      +        groupModuleMap = configuration.group.groupModules(configuration.modules);
      +        groupList = configuration.group.getGroupList();
           }
       
           /**
      @@ -96,11 +102,13 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
            */
           @Override
           protected void addIndex(Content body) {
      -        if (modules != null && !modules.isEmpty()) {
      -            addIndexContents(configuration.getText("doclet.Modules"),
      -                    configuration.getText("doclet.Member_Table_Summary",
      -                            configuration.getText("doclet.Module_Summary"),
      -                            configuration.getText("doclet.modules")), body);
      +        for (String groupname : groupList) {
      +            SortedSet list = groupModuleMap.get(groupname);
      +            if (list != null && !list.isEmpty()) {
      +                addIndexContents(list,
      +                        groupname, configuration.getText("doclet.Member_Table_Summary",
      +                                groupname, configuration.getText("doclet.modules")), body);
      +            }
               }
           }
       
      @@ -111,7 +119,7 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
            * @param tableSummary summary for the table
            * @param body the document tree to which the index contents will be added
            */
      -    protected void addIndexContents(String title, String tableSummary, Content body) {
      +    protected void addIndexContents(Collection modules, String title, String tableSummary, Content body) {
               HtmlTree htmltree = (configuration.allowTag(HtmlTag.NAV))
                       ? HtmlTree.NAV()
                       : new HtmlTree(HtmlTag.DIV);
      @@ -123,7 +131,7 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
               }
               htmltree.addContent(ul);
               body.addContent(htmltree);
      -        addModulesList(title, tableSummary, body);
      +        addModulesList(modules, title, tableSummary, body);
           }
       
           /**
      @@ -133,15 +141,17 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
            * @param tableSummary the summary of the table tag
            * @param body the content tree to which the module list will be added
            */
      -    protected void addModulesList(String text, String tableSummary, Content body) {
      +    protected void addModulesList(Collection modules, String text, String tableSummary, Content body) {
               Content table = (configuration.isOutputHtml5())
                       ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
                       : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
               table.addContent(getSummaryTableHeader(moduleTableHeader, "col"));
               Content tbody = new HtmlTree(HtmlTag.TBODY);
      -        addModulesList(tbody);
      +        addModulesList(modules, tbody);
               table.addContent(tbody);
      -        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
      +        Content anchor = getMarkerAnchor(text);
      +        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor);
      +        div.addContent(table);
               if (configuration.allowTag(HtmlTag.MAIN)) {
                   htmlTree.addContent(div);
               } else {
      @@ -154,7 +164,7 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
            *
            * @param tbody the documentation tree to which the list will be added
            */
      -    protected void addModulesList(Content tbody) {
      +    protected void addModulesList(Collection modules, Content tbody) {
               boolean altColor = true;
               for (ModuleElement mdle : modules) {
                   if (!mdle.isUnnamed()) {
      @@ -260,9 +270,4 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
           protected void addModulePackagesList(Map> modules, String text,
                   String tableSummary, Content body, ModuleElement mdle) {
           }
      -
      -    @Override
      -    protected void addModulesList(Map> modules, String text,
      -            String tableSummary, Content body) {
      -    }
       }
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
      index 28275956185..45e0b2ec83d 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -26,6 +26,7 @@
       package jdk.javadoc.internal.doclets.formats.html;
       
       import java.util.ArrayList;
      +import java.util.Collection;
       import java.util.List;
       import java.util.Map;
       import java.util.Set;
      @@ -175,7 +176,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
           protected void addOverviewHeader(Content body) {
           }
       
      -    protected void addModulesList(Map> modules, String text,
      +    protected void addModulesList(Collection modules, String text,
                   String tableSummary, Content body) {
           }
       
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
      index 71deeaa50b6..3e05c3e3933 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
      @@ -29,11 +29,12 @@ import java.util.*;
       
       import javax.lang.model.element.PackageElement;
       
      -import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
      +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
       import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
       import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
      +import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
       import jdk.javadoc.internal.doclets.toolkit.Content;
       import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
       import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
      @@ -112,8 +113,8 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
                   SortedSet list = groupPackageMap.get(groupname);
                   if (list != null && !list.isEmpty()) {
                       addIndexContents(list,
      -                                 groupname, configuration.getText("doclet.Member_Table_Summary",
      -                                                                  groupname, configuration.getText("doclet.packages")), body);
      +                        groupname, configuration.getText("doclet.Member_Table_Summary",
      +                                groupname, configuration.getText("doclet.packages")), body);
                   }
               }
           }
      @@ -131,7 +132,9 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
               Content tbody = new HtmlTree(HtmlTag.TBODY);
               addPackagesList(packages, tbody);
               table.addContent(tbody);
      -        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
      +        Content anchor = getMarkerAnchor(text);
      +        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, anchor);
      +        div.addContent(table);
               if (configuration.allowTag(HtmlTag.MAIN)) {
                   htmlTree.addContent(div);
               } else {
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
      index f1bd5111654..7ea09a3c793 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
      @@ -192,9 +192,9 @@ doclet.ClassUse_No.usage.of.0=No usage of {0}
       doclet.Window_ClassUse_Header=Uses of {0} {1}
       doclet.ClassUse_Title=Uses of {0}
       doclet.navClassUse=Use
      -doclet.Error_in_packagelist=Error in using -group option: {0} {1}
      -doclet.Groupname_already_used=In -group option, groupname already used: {0}
      -doclet.Same_package_name_used=Package name format used twice: {0}
      +doclet.Error_in_grouplist=Bad -group option: {0} {1}
      +doclet.Groupname_already_used=In -group option, group name already used: {0}
      +doclet.Same_element_name_used=Element name or pattern used twice: {0}
       
       # option specifiers
       doclet.usage.d.parameters=\
      @@ -274,9 +274,9 @@ doclet.usage.excludedocfilessubdir.description=\
           Exclude any doc-files subdirectories with given name
       
       doclet.usage.group.parameters=\
      -     :..
      +     :...
       doclet.usage.group.description=\
      -    Group specified packages together in overview page
      +    Group specified elements together in overview page
       
       doclet.usage.nocomment.description=\
           Suppress description and tags, generate only declarations
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
      index 952aa36595d..c9dbb536897 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
      @@ -699,7 +699,11 @@ public abstract class Configuration {
               typeElementCatalog = new TypeElementCatalog(includedTypeElements, this);
               initTagletManager(customTagStrs);
               groups.stream().forEach((grp) -> {
      -            group.checkPackageGroups(grp.value1, grp.value2);
      +            if (showModules) {
      +                group.checkModuleGroups(grp.value1, grp.value2);
      +            } else {
      +                group.checkPackageGroups(grp.value1, grp.value2);
      +            }
               });
           }
       
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties
      index 14b0ef8e8e9..c100ad7e435 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties
      @@ -49,6 +49,7 @@ Use --allow-script-in-comments to allow use of JavaScript.
       doclet.Packages=Packages
       doclet.Modules=Modules
       doclet.Other_Packages=Other Packages
      +doclet.Other_Modules=Other Modules
       doclet.Notice_taglet_registered=Registered Taglet {0} ...
       doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0}
       doclet.Notice_taglet_overriden=Note: Custom tags that override standard tags: {0}
      diff --git a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
      index 28d216bc1f7..c891f9191f5 100644
      --- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
      +++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Group.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -27,7 +27,7 @@ package jdk.javadoc.internal.doclets.toolkit.util;
       
       import java.util.*;
       
      -import javax.lang.model.element.Element;
      +import javax.lang.model.element.ModuleElement;
       import javax.lang.model.element.PackageElement;
       
       import jdk.javadoc.internal.doclets.toolkit.Configuration;
      @@ -35,7 +35,7 @@ import jdk.javadoc.internal.doclets.toolkit.Messages;
       
       
       /**
      - * Process and manage grouping of packages, as specified by "-group" option on
      + * Process and manage grouping of elements, as specified by "-group" option on
        * the command line.
        * 

      * For example, if user has used -group option as @@ -79,10 +79,10 @@ public class Group { private List groupList = new ArrayList<>(); /** - * Map of non-regular expressions(possible package names) with the + * Map of non-regular expressions(possible package or module names) with the * corresponding group name. */ - private Map pkgNameGroupMap = new HashMap<>(); + private Map elementNameGroupMap = new HashMap<>(); /** * The global configuration information for this run. @@ -106,12 +106,58 @@ public class Group { messages = configuration.getMessages(); } + /** + * Depending upon the format of the module name provided in the "-group" + * option, generate two separate maps. There will be a map for mapping + * regular expression(only meta character allowed is '*' and that is at the + * end of the regular expression) on to the group name. And another map + * for mapping (possible) module names(if the name format doesn't contain + * meta character '*', then it is assumed to be a module name) on to the + * group name. This will also sort all the regular expressions found in the + * reverse order of their lengths, i.e. longest regular expression will be + * first in the sorted list. + * + * @param groupname The name of the group from -group option. + * @param moduleNameFormList List of the module name formats. + */ + public boolean checkModuleGroups(String groupname, String moduleNameFormList) { + String[] mdlPatterns = moduleNameFormList.split(":"); + if (groupList.contains(groupname)) { + initMessages(); + messages.warning("doclet.Groupname_already_used", groupname); + return false; + } + groupList.add(groupname); + for (String mdlPattern : mdlPatterns) { + if (mdlPattern.length() == 0) { + initMessages(); + messages.warning("doclet.Error_in_grouplist", groupname, moduleNameFormList); + return false; + } + if (mdlPattern.endsWith("*")) { + mdlPattern = mdlPattern.substring(0, mdlPattern.length() - 1); + if (foundGroupFormat(regExpGroupMap, mdlPattern)) { + return false; + } + regExpGroupMap.put(mdlPattern, groupname); + sortedRegExpList.add(mdlPattern); + } else { + if (foundGroupFormat(elementNameGroupMap, mdlPattern)) { + return false; + } + elementNameGroupMap.put(mdlPattern, groupname); + } + } + Collections.sort(sortedRegExpList, new MapKeyComparator()); + return true; + } + /** * Depending upon the format of the package name provided in the "-group" * option, generate two separate maps. There will be a map for mapping * regular expression(only meta character allowed is '*' and that is at the * end of the regular expression) on to the group name. And another map - * for mapping (possible) package names(if the name format doesen't contain + * for mapping (possible) package names(if the name format doesn't contain * meta character '*', then it is assumed to be a package name) on to the * group name. This will also sort all the regular expressions found in the * reverse order of their lengths, i.e. longest regular expression will be @@ -121,32 +167,31 @@ public class Group { * @param pkgNameFormList List of the package name formats. */ public boolean checkPackageGroups(String groupname, String pkgNameFormList) { - StringTokenizer strtok = new StringTokenizer(pkgNameFormList, ":"); + String[] pkgPatterns = pkgNameFormList.split(":"); if (groupList.contains(groupname)) { initMessages(); messages.warning("doclet.Groupname_already_used", groupname); return false; } groupList.add(groupname); - while (strtok.hasMoreTokens()) { - String id = strtok.nextToken(); - if (id.length() == 0) { + for (String pkgPattern : pkgPatterns) { + if (pkgPattern.length() == 0) { initMessages(); - messages.warning("doclet.Error_in_packagelist", groupname, pkgNameFormList); + messages.warning("doclet.Error_in_grouplist", groupname, pkgNameFormList); return false; } - if (id.endsWith("*")) { - id = id.substring(0, id.length() - 1); - if (foundGroupFormat(regExpGroupMap, id)) { + if (pkgPattern.endsWith("*")) { + pkgPattern = pkgPattern.substring(0, pkgPattern.length() - 1); + if (foundGroupFormat(regExpGroupMap, pkgPattern)) { return false; } - regExpGroupMap.put(id, groupname); - sortedRegExpList.add(id); + regExpGroupMap.put(pkgPattern, groupname); + sortedRegExpList.add(pkgPattern); } else { - if (foundGroupFormat(pkgNameGroupMap, id)) { + if (foundGroupFormat(elementNameGroupMap, pkgPattern)) { return false; } - pkgNameGroupMap.put(id, groupname); + elementNameGroupMap.put(pkgPattern, groupname); } } Collections.sort(sortedRegExpList, new MapKeyComparator()); @@ -162,39 +207,82 @@ public class Group { } /** - * Search if the given map has given the package format. + * Search if the given map has the given element format. * * @param map Map to be searched. - * @param pkgFormat The pacakge format to search. + * @param elementFormat The format to search. * - * @return true if package name format found in the map, else false. + * @return true if element name format found in the map, else false. */ - boolean foundGroupFormat(Map map, String pkgFormat) { - if (map.containsKey(pkgFormat)) { + boolean foundGroupFormat(Map map, String elementFormat) { + if (map.containsKey(elementFormat)) { initMessages(); - messages.error("doclet.Same_package_name_used", pkgFormat); + messages.error("doclet.Same_element_name_used", elementFormat); return true; } return false; } + /** + * Group the modules according the grouping information provided on the + * command line. Given a list of modules, search each module name in + * regular expression map as well as module name map to get the + * corresponding group name. Create another map with mapping of group name + * to the module list, which will fall under the specified group. If any + * module doesn't belong to any specified group on the command line, then + * a new group named "Other Modules" will be created for it. If there are + * no groups found, in other words if "-group" option is not at all used, + * then all the modules will be grouped under group "Modules". + * + * @param modules Specified modules. + * @return map of group names and set of module elements. + */ + public Map> groupModules(Set modules) { + Map> groupModuleMap = new HashMap<>(); + String defaultGroupName = + (elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? + configuration.getResources().getText("doclet.Modules") : + configuration.getResources().getText("doclet.Other_Modules"); + // if the user has not used the default group name, add it + if (!groupList.contains(defaultGroupName)) { + groupList.add(defaultGroupName); + } + for (ModuleElement mdl : modules) { + String moduleName = mdl.isUnnamed() ? null : mdl.getQualifiedName().toString(); + String groupName = mdl.isUnnamed() ? null : elementNameGroupMap.get(moduleName); + // if this module is not explicitly assigned to a group, + // try matching it to group specified by regular expression + if (groupName == null) { + groupName = regExpGroupName(moduleName); + } + // if it is in neither group map, put it in the default + // group + if (groupName == null) { + groupName = defaultGroupName; + } + getModuleList(groupModuleMap, groupName).add(mdl); + } + return groupModuleMap; + } + /** * Group the packages according the grouping information provided on the * command line. Given a list of packages, search each package name in * regular expression map as well as package name map to get the * corresponding group name. Create another map with mapping of group name * to the package list, which will fall under the specified group. If any - * package doesen't belong to any specified group on the comamnd line, then + * package doesn't belong to any specified group on the command line, then * a new group named "Other Packages" will be created for it. If there are * no groups found, in other words if "-group" option is not at all used, * then all the packages will be grouped under group "Packages". * * @param packages Packages specified on the command line. + * @return map of group names and set of package elements */ public Map> groupPackages(Set packages) { Map> groupPackageMap = new HashMap<>(); String defaultGroupName = - (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? + (elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())? configuration.getResources().getText("doclet.Packages") : configuration.getResources().getText("doclet.Other_Packages"); // if the user has not used the default group name, add it @@ -203,7 +291,7 @@ public class Group { } for (PackageElement pkg : packages) { String pkgName = pkg.isUnnamed() ? null : configuration.utils.getPackageName(pkg); - String groupName = pkg.isUnnamed() ? null : pkgNameGroupMap.get(pkgName); + String groupName = pkg.isUnnamed() ? null : elementNameGroupMap.get(pkgName); // if this package is not explicitly assigned to a group, // try matching it to group specified by regular expression if (groupName == null) { @@ -220,15 +308,15 @@ public class Group { } /** - * Search for package name in the sorted regular expression + * Search for element name in the sorted regular expression * list, if found return the group name. If not, return null. * - * @param pkgName Name of package to be found in the regular + * @param elementName Name of element to be found in the regular * expression list. */ - String regExpGroupName(String pkgName) { + String regExpGroupName(String elementName) { for (String regexp : sortedRegExpList) { - if (pkgName.startsWith(regexp)) { + if (elementName.startsWith(regexp)) { return regExpGroupMap.get(regexp); } } @@ -239,7 +327,7 @@ public class Group { * For the given group name, return the package list, on which it is mapped. * Create a new list, if not found. * - * @param map Map to be searched for gorup name. + * @param map Map to be searched for group name. * @param groupname Group name to search. */ SortedSet getPkgList(Map> map, @@ -247,6 +335,18 @@ public class Group { return map.computeIfAbsent(groupname, g -> new TreeSet<>(configuration.utils.makePackageComparator())); } + /** + * For the given group name, return the module list, on which it is mapped. + * Create a new list, if not found. + * + * @param map Map to be searched for group name. + * @param groupname Group name to search. + */ + SortedSet getModuleList(Map> map, + String groupname) { + return map.computeIfAbsent(groupname, g -> new TreeSet<>(configuration.utils.makeModuleComparator())); + } + /** * Return the list of groups, in the same order as specified * on the command line. diff --git a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java index 09e58515904..950211fad63 100644 --- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java +++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java @@ -25,6 +25,7 @@ * @test * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 8175823 8166306 + * 8178043 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -326,6 +327,54 @@ public class TestModules extends JavadocTester { checkAllModulesLink(false); } + /** + * Test -group option for modules. The overview-summary.html page should group the modules accordingly. + */ + @Test + void testGroupOption() { + javadoc("-d", "out-group", "--show-module-contents=all", + "-tag", "regular:a:Regular Tag:", + "-tag", "moduletag:s:Module Tag:", + "--module-source-path", testSrc, + "-group", "Module Group A", "moduleA*", + "-group", "Module Group B & C", "moduleB*:moduleC*", + "-group", "Java SE Modules", "java*", + "--module", "moduleA,moduleB,moduleC,moduletags", + "moduleA/concealedpkgmdlA", "testpkgmdlA", "testpkg2mdlB", "testpkgmdlB", "testpkgmdlC", + "testpkgmdltags"); + checkExit(Exit.OK); + checkGroupOption(); + } + + /** + * Test -group option for unnamed modules. The overview-summary.html page should group the packages accordingly. + */ + @Test + void testUnnamedModuleGroupOption() { + javadoc("-d", "out-groupnomodule", "-use", + "-overview", testSrc("overview.html"), + "-sourcepath", testSrc, + "-group", "Package Group 0", "testpkgnomodule", + "-group", "Package Group 1", "testpkgnomodule1", + "testpkgnomodule", "testpkgnomodule1"); + checkExit(Exit.OK); + checkUnnamedModuleGroupOption(); + } + + /** + * Test -group option for a single module. + */ + @Test + void testGroupOptionSingleModule() { + javadoc("-d", "out-groupsinglemodule", "-use", + "--module-source-path", testSrc, + "-group", "Module Group B", "moduleB*", + "--module", "moduleB", + "testpkg2mdlB", "testpkgmdlB"); + checkExit(Exit.OK); + //checkOverviewSummaryPackages(); + } + void checkDescription(boolean found) { checkOutput("moduleA-summary.html", found, "\n" @@ -346,8 +395,10 @@ public class TestModules extends JavadocTester { + "

      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" - + "\n" + + "
      \n" + ""); checkOutput("overview-summary.html", false, "
      Modules 
      \n" @@ -355,8 +406,10 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" - + "\n" + + "
      \n" + ""); } @@ -405,7 +458,9 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" + + "
      Modules 
      \n" + ""); checkOutput("overview-summary.html", false, @@ -416,7 +471,9 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" + + "
      Modules 
      \n" + ""); } @@ -495,7 +552,7 @@ public class TestModules extends JavadocTester { void checkOverviewSummaryModules() { checkOutput("overview-summary.html", true, - "
      Modules 
      \n" + "
      \n" + "\n" + "\n" + "\n" @@ -512,7 +569,7 @@ public class TestModules extends JavadocTester { void checkOverviewSummaryPackages() { checkOutput("overview-summary.html", false, - "
      Modules 
      Module
      \n" + "
      \n" + "\n" + "\n" + "\n" @@ -523,7 +580,9 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" + + "
      Modules 
      Module
      \n" + ""); checkOutput("overview-summary.html", true, @@ -537,7 +596,9 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" + + "
      Packages 
      \n" + ""); } @@ -574,7 +635,9 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" + + "
      Packages 
      \n" + ""); checkOutput("overview-summary.html", true, @@ -591,7 +654,9 @@ public class TestModules extends JavadocTester { + "
      \n" + "
      The overview summary page header.
      \n" + "
      \n" - + "
      \n" + + "
      Packages 
      \n" + ""); } @@ -974,4 +1039,54 @@ public class TestModules extends JavadocTester { + "", ""); } + + void checkGroupOption() { + checkOutput("overview-summary.html", true, + "
      Packages Concealed 
      \n" + + "", + "
      Module Group A 
      \n" + + "", + "
      Module Group B & C 
      \n" + + ""); + checkOutput("overview-summary.html", false, + "
      Other Modules 
      \n" + + "", + "Java SE Modules"); + } + + void checkUnnamedModuleGroupOption() { + checkOutput("overview-summary.html", true, + "
      Modules 
      \n" + + "\n" + + "", + "
      Package Group 0 
      \n" + + ""); + } + + void checkGroupOptionSingleModule() { + checkOutput("overview-summary.html", true, + "
      Package Group 1 
      \n" + + ""); + checkOutput("overview-summary.html", false, + "
      Module Group B 
      \n" + + ""); + } } From 2e29628481c029e281c6650a3b9264c3811e48eb Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 15 May 2017 16:34:52 +0200 Subject: [PATCH 046/105] 8180342: Fixup path for jtreg Reviewed-by: erikj --- common/autoconf/generated-configure.sh | 420 ++++++++++++++++++++++++- common/autoconf/toolchain.m4 | 2 + 2 files changed, 421 insertions(+), 1 deletion(-) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index d79d68917e4..cf23d7e99b8 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -5183,7 +5183,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1494609053 +DATE_WHEN_GENERATED=1494858828 ############################################################################### # @@ -48896,6 +48896,424 @@ $as_echo "no, not found" >&6; } fi + # Only process if variable expands to non-empty + + if test "x$JTREGEXE" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # First separate the path from the arguments. This will split at the first + # space. + complete="$JTREGEXE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Input might be given as Windows format, start by converting to + # unix format. + new_path=`$CYGPATH -u "$path"` + + # Now try to locate executable using which + new_path=`$WHICH "$new_path" 2> /dev/null` + # bat and cmd files are not always considered executable in cygwin causing which + # to not find them + if test "x$new_path" = x \ + && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ + && test "x`$LS \"$path\" 2>/dev/null`" != x; then + new_path=`$CYGPATH -u "$path"` + fi + if test "x$new_path" = x; then + # Oops. Which didn't find the executable. + # The splitting of arguments from the executable at a space might have been incorrect, + # since paths with space are more likely in Windows. Give it another try with the whole + # argument. + path="$complete" + arguments="EOL" + new_path=`$CYGPATH -u "$path"` + new_path=`$WHICH "$new_path" 2> /dev/null` + # bat and cmd files are not always considered executable in cygwin causing which + # to not find them + if test "x$new_path" = x \ + && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ + && test "x`$LS \"$path\" 2>/dev/null`" != x; then + new_path=`$CYGPATH -u "$path"` + fi + if test "x$new_path" = x; then + # It's still not found. Now this is an unrecoverable error. + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;} + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5 +$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;} + fi + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + fi + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file presence. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + # Short path failed, file does not exist as specified. + # Try adding .exe or .cmd + if test -f "${new_path}.exe"; then + input_to_shortpath="${new_path}.exe" + elif test -f "${new_path}.cmd"; then + input_to_shortpath="${new_path}.cmd" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$new_path\", is invalid." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$new_path\", is invalid." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&5 +$as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" >&6;} + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + else + input_to_shortpath="$new_path" + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + new_path="$input_to_shortpath" + + input_path="$input_to_shortpath" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $input_to_shortpath | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + # remove trailing .exe if any + new_path="${new_path/%.exe/}" + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + # First separate the path from the arguments. This will split at the first + # space. + complete="$JTREGEXE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Input might be given as Windows format, start by converting to + # unix format. + new_path="$path" + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + + # Now try to locate executable using which + new_path=`$WHICH "$new_path" 2> /dev/null` + + if test "x$new_path" = x; then + # Oops. Which didn't find the executable. + # The splitting of arguments from the executable at a space might have been incorrect, + # since paths with space are more likely in Windows. Give it another try with the whole + # argument. + path="$complete" + arguments="EOL" + new_path="$path" + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + + new_path=`$WHICH "$new_path" 2> /dev/null` + # bat and cmd files are not always considered executable in MSYS causing which + # to not find them + if test "x$new_path" = x \ + && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ + && test "x`$LS \"$path\" 2>/dev/null`" != x; then + new_path="$path" + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + fi + + if test "x$new_path" = x; then + # It's still not found. Now this is an unrecoverable error. + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;} + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: You might be mixing spaces in the path and extra arguments, which is not allowed." >&5 +$as_echo "$as_me: You might be mixing spaces in the path and extra arguments, which is not allowed." >&6;} + fi + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + fi + + # Now new_path has a complete unix path to the binary + if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then + # Keep paths in /bin as-is, but remove trailing .exe if any + new_path="${new_path/%.exe/}" + # Do not save /bin paths to all_fixpath_prefixes! + else + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $new_path` + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + # Output is in $new_path + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + # remove trailing .exe if any + new_path="${new_path/%.exe/}" + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + fi + + else + # We're on a unix platform. Hooray! :) + # First separate the path from the arguments. This will split at the first + # space. + complete="$JTREGEXE" + path="${complete%% *}" + tmp="$complete EOL" + arguments="${tmp#* }" + + # Cannot rely on the command "which" here since it doesn't always work. + is_absolute_path=`$ECHO "$path" | $GREP ^/` + if test -z "$is_absolute_path"; then + # Path to executable is not absolute. Find it. + IFS_save="$IFS" + IFS=: + for p in $PATH; do + if test -f "$p/$path" && test -x "$p/$path"; then + new_path="$p/$path" + break + fi + done + IFS="$IFS_save" + else + # This is an absolute path, we can use it without further modifications. + new_path="$path" + fi + + if test "x$new_path" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&5 +$as_echo "$as_me: The path of JTREGEXE, which resolves as \"$complete\", is not found." >&6;} + has_space=`$ECHO "$complete" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: This might be caused by spaces in the path, which is not allowed." >&5 +$as_echo "$as_me: This might be caused by spaces in the path, which is not allowed." >&6;} + fi + as_fn_error $? "Cannot locate the the path of JTREGEXE" "$LINENO" 5 + fi + fi + + # Now join together the path and the arguments once again + if test "x$arguments" != xEOL; then + new_complete="$new_path ${arguments% *}" + else + new_complete="$new_path" + fi + + if test "x$complete" != "x$new_complete"; then + JTREGEXE="$new_complete" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JTREGEXE to \"$new_complete\"" >&5 +$as_echo "$as_me: Rewriting JTREGEXE to \"$new_complete\"" >&6;} + fi + fi + + + # Only process if variable expands to non-empty + + if test "x$JT_HOME" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$JT_HOME" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of JT_HOME" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + JT_HOME="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$JT_HOME" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + JT_HOME="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting JT_HOME to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting JT_HOME to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$JT_HOME" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of JT_HOME, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of JT_HOME, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + if test -d "$path"; then + JT_HOME="`cd "$path"; $THEPWDCMD -L`" + else + dir="`$DIRNAME "$path"`" + base="`$BASENAME "$path"`" + JT_HOME="`cd "$dir"; $THEPWDCMD -L`/$base" + fi + fi + fi + + diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4 index 2f02ec62f4f..fca9b065aab 100644 --- a/common/autoconf/toolchain.m4 +++ b/common/autoconf/toolchain.m4 @@ -1000,6 +1000,8 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], fi fi + BASIC_FIXUP_EXECUTABLE(JTREGEXE) + BASIC_FIXUP_PATH(JT_HOME) AC_SUBST(JT_HOME) AC_SUBST(JTREGEXE) ]) From ac1c8796b2e9cd5b8247503bea1b88036de573b2 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Mon, 15 May 2017 20:27:38 -0700 Subject: [PATCH 047/105] 8180060: Examine copyright header for some files Reviewed-by: lancea --- .../xerces/internal/util/FeatureState.java | 9 +---- .../util/ParserConfigurationSettings.java | 2 +- .../xerces/internal/util/PropertyState.java | 8 +--- .../apache/xerces/internal/util/Status.java | 8 +--- .../dtd/nonvalidating/XMLSimpleType.java | 39 +++++++------------ 5 files changed, 18 insertions(+), 48 deletions(-) diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/FeatureState.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/FeatureState.java index e78b30c3773..36e56879d18 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/FeatureState.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/FeatureState.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,14 +23,6 @@ * questions. */ -/* - * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved. - */ - -/* - * $Id: FeatureState.java 3024 2011-03-01 03:46:13Z joehw $ - */ - package com.sun.org.apache.xerces.internal.util; public class FeatureState { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java index 36ef62a6da1..7eca1d312da 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/ParserConfigurationSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/PropertyState.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/PropertyState.java index 5e133cae65c..5788b64ab12 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/PropertyState.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/PropertyState.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,13 +23,6 @@ * questions. */ -/* - * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved. - */ - -/* - * $Id: PropertyState.java 3024 2011-03-01 03:46:13Z joehw $ - */ package com.sun.org.apache.xerces.internal.util; public class PropertyState { diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/Status.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/Status.java index 5fdcc5e19c1..b6d169eaa3d 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/Status.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/Status.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,13 +23,6 @@ * questions. */ -/* - * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved. - */ - -/* - * $Id: Status.java 3024 2011-03-01 03:46:13Z joehw $ - */ package com.sun.org.apache.xerces.internal.util; public enum Status { diff --git a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLSimpleType.java b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLSimpleType.java index 31ae534390e..6d0763ef3a4 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLSimpleType.java +++ b/jaxp/src/java.xml/share/classes/com/sun/xml/internal/stream/dtd/nonvalidating/XMLSimpleType.java @@ -1,32 +1,21 @@ /* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. */ - /* - * Copyright 2005 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.sun.xml.internal.stream.dtd.nonvalidating; From f7ec0ea64a471861e769abb6b0f4310538380e71 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 16 May 2017 14:13:48 +0200 Subject: [PATCH 048/105] 8180420: Set PATH for dot and pandoc in JIB Reviewed-by: erikj --- common/conf/jib-profiles.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js index b6fd25a6fcf..1892fafab9f 100644 --- a/common/conf/jib-profiles.js +++ b/common/conf/jib-profiles.js @@ -997,7 +997,8 @@ var getJibProfilesDependencies = function (input, common) { ext: "tar.gz", revision: "2.38.0-1+1.1", module: "graphviz-" + input.target_platform, - configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot" + configure_args: "DOT=" + input.get("graphviz", "install_path") + "/dot", + environment_path: input.get("graphviz", "install_path") }, pandoc: { @@ -1005,7 +1006,8 @@ var getJibProfilesDependencies = function (input, common) { ext: "tar.gz", revision: "1.17.2+1.0", module: "pandoc-" + input.target_platform, - configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc" + configure_args: "PANDOC=" + input.get("pandoc", "install_path") + "/pandoc/pandoc", + environment_path: input.get("pandoc", "install_path") + "/pandoc" }, }; From 62b2c4716cf1ade3da20d728f3406f94a580953f Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 16 May 2017 14:14:26 +0200 Subject: [PATCH 049/105] 8180328: Bad links in footer of all javadoc-generated pages Reviewed-by: erikj --- make/Docs.gmk | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/make/Docs.gmk b/make/Docs.gmk index 2859070391d..f95a57d376f 100644 --- a/make/Docs.gmk +++ b/make/Docs.gmk @@ -48,11 +48,8 @@ $(eval $(call IncludeCustomExtension, , Docs.gmk)) MODULES_SOURCE_PATH := $(call PathList, $(call GetModuleSrcPath) \ $(SUPPORT_OUTPUTDIR)/rmic/* $(JDK_TOPDIR)/src/*/share/doc/stub) -# Should we use -Xdocrootparent? Allow custom to overwrite. -DOCROOTPARENT_FLAG ?= TRUE - # URLs -JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage +JAVADOC_BASE_URL := http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=homepage BUG_SUBMIT_URL := http://bugreport.java.com/bugreport/ COPYRIGHT_URL := {@docroot}/../legal/cpyr.html LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html @@ -130,7 +127,7 @@ JAVADOC_BOTTOM := \ \ Submit a bug or feature
      \ For further API reference and developer documentation, see \ - Java SE \ + Java SE \ Documentation. That documentation contains more detailed, \ developer-targeted descriptions, with conceptual overviews, definitions \ of terms, workarounds, and working code examples.
      \ @@ -236,10 +233,6 @@ define SetupApiDocsGenerationBody $1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \ $$(JAVADOC_DISABLED_DOCLINT))) - ifeq ($$($$DOCROOTPARENT_FLAG), TRUE) - $1_OPTIONS += -Xdocrootparent $$(JAVADOC_BASE_URL) - endif - $1_OPTIONS += -doctitle '$$($1_DOC_TITLE)' $1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)' $1_OPTIONS += -header '$$($1_HEADER_TITLE)' From 27770e6af7916c0e07866a099d2ca7e148abb55e Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Tue, 16 May 2017 09:42:38 -0400 Subject: [PATCH 050/105] 8180319: Update Serialization spec to omit obsolete serialver -show and change history Reviewed-by: chegar --- .../share/specs/serialization/changelog.md | 181 ------------------ .../share/specs/serialization/class.md | 8 +- .../specs/serialization/images/class.gif | Bin 4139 -> 0 bytes .../share/specs/serialization/index.md | 6 +- .../share/specs/serialization/security.md | 6 +- .../share/specs/serialization/serial-arch.md | 4 +- 6 files changed, 8 insertions(+), 197 deletions(-) delete mode 100644 jdk/src/java.base/share/specs/serialization/changelog.md delete mode 100644 jdk/src/java.base/share/specs/serialization/images/class.gif diff --git a/jdk/src/java.base/share/specs/serialization/changelog.md b/jdk/src/java.base/share/specs/serialization/changelog.md deleted file mode 100644 index 343dd5833ea..00000000000 --- a/jdk/src/java.base/share/specs/serialization/changelog.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. - -include-before: '[CONTENTS](index.html) | [PREV](index.html) | [NEXT](serial-arch.html)' -include-after: '[CONTENTS](index.html) | [PREV](index.html) | [NEXT](serial-arch.html)' - -title: 'Java Object Serialization Specification: 0 - Change History' ---- - -------------------------------------------------------------------------------- - -May 12, 2005 Updates for Java^TM^ SE Development Kit, v6 Beta 1 - -- Added statement about how an array object returned by a `readResolve` - invocation for an unshared read is handled. -- Clarified the behavior in the event of an invalid `serialPersistentFields` - value. -- Clarified that `serialVersionUID` matching is waived for array classes. -- Clarified when `IllegalArgumentException` is thrown by - `ObjectOutputStream.PutFields` methods. - -July 24, 2003 Updates for Java^TM^ 2 SDK, Standard Edition, v1.5 Beta 1 - -- Added support for serializing enum constants. -- Added specification of class modifier flags used in the computation of - default `serialVersionUID` values to [Section 4.6, "Stream Unique - Identifiers"](class.html#stream-unique-identifiers). - -Aug. 16, 2001 Updates for Java^TM^ 2 SDK, Standard Edition, v1.4 Beta 2 - -- Added support for class-defined `readObjectNoData` methods, to be used for - initializing serializable class fields in cases not covered by - class-defined readObject methods. See [Section 3.5, "The readObjectNoData - Method"](input.html#the-readobjectnodata-method), as well as Appendix A, - "Security in Object Serialization". -- New methods `ObjectOutputStream.writeUnshared` and - `ObjectInputStream.readUnshared` provide a mechanism for ensuring unique - references to deserialized objects. See [Section 2.1, "The - ObjectOutputStream Class"](output.html#the-objectoutputstream-class), - [Section 3.1, "The ObjectInputStream - Class"](input.html#the-objectinputstream-class), as well as Appendix A, - "Security in Object Serialization". -- Documented new security checks in the one-argument constructors for - `ObjectOutputStream` and `ObjectInputStream`. See [Section 2.1, "The - ObjectOutputStream Class"](output.html#the-objectoutputstream-class) and - [Section 3.1, "The ObjectInputStream - Class"](input.html#the-objectinputstream-class). -- Added caution against using inner classes for serialization in [Section - 1.10, "The Serializable - Interface"](serial-arch.html#the-serializable-interface). -- Clarified requirement that class-defined `writeObject` methods invoke - `ObjectOutputStream.defaultWriteObject` or `writeFields` once before - writing optional data, and that class-defined `readObject` methods invoke - `ObjectInputStream.defaultReadObject` or `readFields` once before reading - optional data. See [Section 2.3, "The writeObject - Method"](output.html#the-writeobject-method) and [Section 3.4, "The - readObject Method"](input.html#the-readobject-method). -- Clarified the behavior of `ObjectInputStream` when class-defined - `readObject` or `readExternal` methods attempt read operations which exceed - the bounds of available data; see [Section 3.4, "The readObject - Method"](input.html#the-readobject-method) and [Section 3.6, "The - readExternal Method"](input.html#the-readexternal-method). -- Clarified the description of non-proxy class descriptor field type strings - to require that they be written in "field descriptor" format; see [Section - 6.2, "Stream Elements"](protocol.html#stream-elements). - -July 30, 1999 Updates for Java^TM^ 2 SDK, Standard Edition, v1.3 Beta - -- Added the ability to write `String` objects for which the UTF encoding is - longer than 65535 bytes in length. See [Section 6.2, "Stream - Elements"](protocol.html#stream-elements). -- New methods `ObjectOutputStream.writeClassDescriptor` and - `ObjectInputStream.readClassDescriptor` provide a means of customizing the - serialized representation of `ObjectStreamClass` class descriptors. See - [Section 2.1, "The ObjectOutputStream - Class"](output.html#the-objectoutputstream-class) and [Section 3.1, "The - ObjectInputStream Class"](input.html#the-objectinputstream-class). -- Expanded Appendix A, "[Security in Object - Serialization"](security.html#security-in-object-serialization). - -Sept. 30, 1998 Updates for JDK^TM^ 1.2 Beta4 RC1 - -- Documentation corrections only. - -June 22, 1998 Updates for JDK^TM^ 1.2 Beta4 - -- Eliminated JDK^TM^ 1.2 `java.io` interfaces, `Replaceable` and - `Resolvable`.References to either of these classes as an interface should - be replaced with `java.io.Serializable`. Serialization will use reflection - to invoke the methods, `writeReplace` and `readResolve`, if the - Serializable class defines these methods. See [Section 2.5, "The - writeReplace Method"](output.html#the-writereplace-method) and [Section - 3.7, "The readResolve Method"](input.html#the-readresolve-method). -- New javadoc tags *@serial*, *@serialField*, and *@serialData* provide a way - to document the Serialized Form of a Serializable class. Javadoc generates - a serialization specification based on the contents of these tags. See - [Section 1.6, "Documenting Serializable Fields and Data for a - Class"](serial-arch.html#documenting-serializable-fields-and-data-for-a-class). -- Special Serializable class member, `serialPersistentFields`, must be - declared private. See [Section 1.5, "Defining Serializable Fields for a - Class"](serial-arch.html#defining-serializable-fields-for-a-class). -- Clarified the steps involved in computing the `serialVersionUID` in - [Section 4.6, "Stream Unique - Identifiers"](class.html#stream-unique-identifiers). - -Feb. 6, 1998 Updates for JDK^TM^ 1.2 Beta 3 - -- Introduced the concept of `STREAM_PROTOCOL` versions. Added the - `STREAM_PROTOCOL_2` version to indicate a new format for `Externalizable` - objects that enable skipping by an `Externalizable` object within the - stream, even when the object's class is not available in the local Virtual - Machine. Compatibility issues are discussed in [Section 6.3, "Stream - Protocol Versions"](protocol.html#stream-protocol-versions). -- `The ObjectInputStream.resolveClass` method can return a local class in a - different package than the name of the class within the stream. This - capability enables renaming of packages between releases. The - `serialVersionUID` and the base class name must be the same in the stream - and in the local version of the class. See [Section 3.1, "The - ObjectInputStream Class"](input.html#the-objectinputstream-class). -- Allow substitution of `String` or `array` objects when writing them to or - reading them from the stream. See [Section 2.1, "The ObjectOutputStream - Class"](output.html#the-objectoutputstream-class) and [Section 3.1, "The - ObjectInputStream Class"](input.html#the-objectinputstream-class). - -Sept. 4, 1997 Updates for JDK^TM^ 1.2 Beta1 - -- Separated the Replaceable interface into two interfaces: Replaceable and - Resolvable. The Replaceable interface allows a class to nominate its own - replacement just before serializing the object to the stream. The - Resolvable interface allows a class to nominate its own replacement when - reading an object from the stream. -- Modified serialization to use the JDK^TM^ 1.2 security model. There is a - check for `SerializablePermission "enableSubstitution"` within the - `ObjectInputStream.enableReplace` and `ObjectOutputStream.enableResolve` - methods. See [Section 2.1, "The ObjectOutputStream - Class"](output.html#the-objectoutputstream-class) and [Section 3.1, "The - ObjectInputStream Class"](input.html#the-objectinputstream-class). -- Updated `writeObject`'s exception handler to write handled `IOException`s - into the stream. See [Section 2.1, "The ObjectOutputStream - Class"](output.html#the-objectoutputstream-class). - -July 3, 1997 Updates for JDK^TM^ 1.2 Alpha - -- Documented the requirements for specifying the serialized state of classes. - See [Section 1.5, "Defining Serializable Fields for a - Class"](serial-arch.html#defining-serializable-fields-for-a-class). -- Added the Serializable Fields API to allow classes more flexibility in - accessing the serialized fields of a class. The stream protocol is - unchanged. See [Section 1.7, "Accessing Serializable Fields of a - Class](serial-arch.html#accessing-serializable-fields-of-a-class)," - [Section 2.2, "The ObjectOutputStream.PutField - Class](output.html#the-objectoutputstream.putfield-class)," and [Section - 3.2, "The ObjectInputStream.GetField - Class"](input.html#the-objectinputstream.getfield-class). -- Clarified that field descriptors and data are written to and read from the - stream in canonical order. See [Section 4.1, "The ObjectStreamClass - Class"](class.html#the-objectstreamclass-class). - -------------------------------------------------------------------------------- - -*[Copyright](../../../legal/SMICopyright.html) © 2005, 2017, Oracle -and/or its affiliates. All rights reserved.* diff --git a/jdk/src/java.base/share/specs/serialization/class.md b/jdk/src/java.base/share/specs/serialization/class.md index 5393b0bc6c3..03b94b7d099 100644 --- a/jdk/src/java.base/share/specs/serialization/class.md +++ b/jdk/src/java.base/share/specs/serialization/class.md @@ -241,13 +241,7 @@ The `toString` method returns a printable representation with name and type. ## 4.5 Inspecting Serializable Classes The program *serialver* can be used to find out if a class is serializable and -to get its `serialVersionUID`. When invoked with the-show option, it puts up a -simple user interface. To find out if a class is serializable and to find out -its *serialVersionUID*`,` enter its full class name, then press either the -Enter or the Show button. The string printed can be copied and pasted into the -evolved class. - -> ![*serialver, Serial Version Inspector program*](images/class.gif) +to get its `serialVersionUID`. When invoked on the command line with one or more class names, serialver prints the `serialVersionUID` for each class in a form suitable for copying into an diff --git a/jdk/src/java.base/share/specs/serialization/images/class.gif b/jdk/src/java.base/share/specs/serialization/images/class.gif deleted file mode 100644 index 15b4bf80c59c233a29144f0d5fb44ff9ce27f2b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4139 zcmeH{`8yPB)W>gBh7e_$=FzG$(Nj{{l1F7NNvSMJmh8$FX2w{?He+c_WLC!5X2ue- z4rL;eJ+i0Llgd__5N0r5p7&pPe|*mm=eqB6o$u$|=Umr)OwCPnw4F6X5nu^ynz_z> zKR>@1x8~&Jk|_b>+9ojSClmSs>C0)D;210ALG3 zy#R3E#3-(Vi02d3C z2_hRJs7_NbD7OM7KveIr#l4Lz5sM9)7-ysQPaquy6i);45~w@9Q60F80nUGv9bmEw z015y}Ktu+BVgN)oGyno%>cIVg&m zDa-qk6gf@FqUHBamq7p1C|hj`f&sAF5B}aDae?e-0Qf)~2Y3K%0YCr%Lu9jo$qN9? zgTosG;sKFXz!e3&yFjCO3m4YJb1y$OSpxS1Kms5D(Aa#^|J(n~1deTDHva;E2!R4b z*{qDw7z5d*=FnP}-Gr4@xs+k{Ea!C+^py99)@QkIQubd=R5mZqYfFP$7do_+=Xa1a zT-!6uE0|q0ouEXch6>hII*69sbE%Tun`@S)cBj3vppRvhdnxl$RpCI9ZH4#8_Nt{A8*gRT=T$Yi^u#nXp;5``<%KmM_?NWE_ z@3mRFQ)OWxS{Kem0{K$)3ojbhWu<1i072 zX?KWxcrrpwQZ?6|DPhYb7n*yp(gGz4a!n64(gzCE-QNzqO8$&I5$b7rZN7gM!R~@vHA3# zS7E>FVQ=;4i5~-3%9yY8KAdVbF3^A2xuZfoFGqg}HPfg!WAW^Q;!5Z+_nODkDpxtb zpJ!aGRc}<;>4q%+8S#AU6ZGD9WxHY5X~&O?A07_fuW@o#IUORj6Soo{`xqsDoHK~r zSGn{Vr&_`piu>!~@)v^Xab(3KrG@3MWRH^C49L1%_mg?_!e3jQ6xm;%$1Y@kub!z`wo$oO{v9{1}<5#~B z;#Ru0_#yPy+U+6iJ_Ft#6S$B+$tsNyY-~y43h&K{_0@$TzxB1{iPCl9>e8=`#Vy4E z;${t^FpVf+n94J*EMQmkc?gvN!Tn zwA8N&cx51U}02M!1^JC}CJM0~|JdscS440TPzIfdV z-go(%8bw>)#l%0o=?O#KBSFqx%Nky`i}p9m{0i=KD!Ji?qh?=Chsvv-V}(*Itt_m? zjlI_7OAim5W_ZbkaLcK@WY(F;Wm8u@KiZ^lhN(P7?l?&e$^ccWy4QBg`$|?YmW)_h za(b4rn*CrT7OwWuLudG!FA@5;g9(LST_F8B5Fg`i>YC828z@hmvzR(qy4%XtKt4zE z&&1rqR5wAONnToI8QpHT4pVzbUiO6>x=#1V!Tw~u%43fcl)6H>6?yxEy-g@;H#?pM z6<#@W^k#P9yAtN(e2pufhADM@Ud}9k2MxH%j&ezE>zn$(%Zbv}>ceoM5@u`&jL0@4<5A%QK$N zSSAF%eKD(mgol4KpRc~wBwGE%E?CI)DJmR(f1F5vtn7Mc53S)7@g~x9&E2l~s8#PL zg>wC^(}qgak?(lLFy{S2ACEBm>Akm#P)Sc6#ggntQ6y~gz|_@$r$?Q))et@x@4Z8r zallZk>R&$kW!onB^c`-|`GSE6W4`0iHWo^M4VTUW;l1{a<~nC6Jgu)E9Lfbvg9 zzx)R-TaM`=vgwCCk!M#%h=Gf>QnNpdB&@FWZzDGx{F_%%GCCxT=nqoe>!0M2@fp^! zrTDe{39T_|=lr5(eX*40%G_nwbY+f;Y4x+zo8?Z21)Oq2#quYmEHmB2LsbVF=Td7v zq#o(xwdGg-c=AU1TyP-2)02o3k~|>pO_bD5|Gg@Y`z$8()bDj^`c_=YRh}>yCpCx2 zR5Er%Pe@FU6uK;)%IMOcG|8&%*{OdzdDqj)lc(PIlB-X`t6HZl!vuW{nLn&?^1WU2 zweRkgFm~81GSy|s`^MM)S{ZIV5^R6% zXukT#J(Mdq!b`lp z`UU!y)1uw|8y}YO`F`b6p78g%0CVE%SNPT1_LE5C$2*8$)z{|~T`lLSqpRNse01HK zq=GU|SP=|%)b(Hu0x~Zux9?OHy!9wqV4hu@vept9j7bIm7O9`MeOou^0snKIwlI1- z<US@u6fJ#m?9aQj@MbSzWP5B*U-saTZ-B8wKRJFN;~=qkv?GPzgIdmKnnq4N%R+xA zIr15#b#yvym3O&v^^Hd)9_vt66Uw!@`#m(QX(+Nk6wRGLD-lCG&P3@ABHm*keyB0z zVQ;*+iIHEn{_b%%Q{1KD^+V!P)LwYFIKt|&Li9niP??s<+yPAUo2dQph`-J5ZimOf zT99s9m_y{K0OOcgT=whjw5`bw=q<}A#VY4o{o(dW&g=Bm(2OvE;` z$O}-k3^ayd6C>>&3-Js!WyjciB8;H%x8U)^L8!cem@^!d{;+M38`{PUgT%Hc^5(i1W~lb(zcSBCCois zv=+jF)EZXg8Bh9#@r5V$EZgqU3U3>5^gu)@EXTV-v5&=*`mph1kl6l76c>&^3Q3$8 zj=e+~bw%|a8^$SDVoVE-VJO%V|%T3xqzI=ofF zPq*S{a53Rf0@^cKzBb9t76G9Ux_8AT>clN@kc4GifKIefJ5r=Iv9m9waZBV+B_ZyY zN9;NWD~(GPtBs@IOx;I}N}EjMKnNK_5ksxGLnF>h;_;=!coz=l)0@~L7RsU^Uc)P` zM=W*5BsrX9e1wz!ax&ei&G$Ywed$Q5^Hi#H%@gNZqM9jD#e?XSK=jomJ>2d0fFI~T zl^$qELXVIlLP$&^>2@tC!j2r@b}5PS}2(Mrd3=Dhsh03>0JeAp)qnnoRD9CTN)@o_YM+H1^M=?FAOz%3TuRy^?a=#{3 zt-F``(4G~7Vj-xkzyqwV$6gTvRuqgKt;gOIYtN2Hv2j#(VjVmAJsU4z6JQ0YdIe7; KjYUMj+5Z7Z0Atkv diff --git a/jdk/src/java.base/share/specs/serialization/index.md b/jdk/src/java.base/share/specs/serialization/index.md index c254405c8ed..1ad49f7cbdc 100644 --- a/jdk/src/java.base/share/specs/serialization/index.md +++ b/jdk/src/java.base/share/specs/serialization/index.md @@ -20,8 +20,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. -include-before: 'CONTENTS | PREV | [NEXT](changelog.html)' -include-after: 'CONTENTS | PREV | [NEXT](changelog.html)' +include-before: 'CONTENTS | PREV | [NEXT](serial-arch.html)' +include-after: 'CONTENTS | PREV | [NEXT](serial-arch.html)' title: 'Java Object Serialization Specification: Contents' --- @@ -30,8 +30,6 @@ title: 'Java Object Serialization Specification: Contents' ## Table of Contents -### 0 [Change History](changelog.html) - ### 1 [System Architecture](serial-arch.html) - 1.1 [Overview](serial-arch.html#overview) diff --git a/jdk/src/java.base/share/specs/serialization/security.md b/jdk/src/java.base/share/specs/serialization/security.md index 14848f080b1..9f26748daa9 100644 --- a/jdk/src/java.base/share/specs/serialization/security.md +++ b/jdk/src/java.base/share/specs/serialization/security.md @@ -28,9 +28,9 @@ title: 'Java Object Serialization Specification: A - Security in Object Serializ ------------------------------------------------------------------------------- -Refer to the [Secure Coding Guidelines for the Java Programming -Language](http://www.oracle.com/technetwork/java/seccodeguide-139067.html) for -information about security in object serialization. +Refer to the [Secure Coding Guidelines for the Java Programming +Language](http://www.oracle.com/pls/topic/lookup?ctx=javase9&id=secure_coding_guidelines_javase) +for information about security in object serialization. ------------------------------------------------------------------------------- diff --git a/jdk/src/java.base/share/specs/serialization/serial-arch.md b/jdk/src/java.base/share/specs/serialization/serial-arch.md index 0cfe94993ea..4ff54731688 100644 --- a/jdk/src/java.base/share/specs/serialization/serial-arch.md +++ b/jdk/src/java.base/share/specs/serialization/serial-arch.md @@ -20,8 +20,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. -include-before: '[CONTENTS](index.html) | [PREV](changelog.html) | [NEXT](output.html)' -include-after: '[CONTENTS](index.html) | [PREV](changelog.html) | [NEXT](output.html)' +include-before: '[CONTENTS](index.html) | [PREV](index.html) | [NEXT](output.html)' +include-after: '[CONTENTS](index.html) | [PREV](index.html) | [NEXT](output.html)' title: 'Java Object Serialization Specification: 1 - System Architecture' --- From 187b51e2254d33281f764a7ea3130d503ce64a0f Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:52 +0000 Subject: [PATCH 051/105] Added tag jdk-9+170 for changeset 8ad1bd49f4bc --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 88b31a1ce33..1aa95fe45fa 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -412,3 +412,4 @@ ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166 35017c286513ddcbcc6b63b99679c604993fc639 jdk-9+167 143d4c87bc1ef1ed6dadd613cd9dd4488fdefc29 jdk-9+168 b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 +4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170 From 9b6308c921201e85e447fb5e6db9d55471289352 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:53 +0000 Subject: [PATCH 052/105] Added tag jdk-9+170 for changeset aa1fcec9731f --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 6dde9ab35df..1a96c62ac8c 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -412,3 +412,4 @@ a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165 43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167 03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168 b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169 +8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170 From cb190703ef201965fbe9afbfbdcbc315f3091301 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:53 +0000 Subject: [PATCH 053/105] Added tag jdk-9+170 for changeset e3a622b2b7db --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 1ce36c1698b..3f07e474bf8 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -572,3 +572,4 @@ c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165 1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167 fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168 16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169 +38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170 From 335eb16c0836ff1856246e4abc17d4f755103406 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:54 +0000 Subject: [PATCH 054/105] Added tag jdk-9+170 for changeset be2c212f16dd --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index f4217d62903..94fd9c26006 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -412,3 +412,4 @@ a7942c3b1e59495dbf51dc7c41aab355fcd253d7 jdk-9+165 7828aedcb525df40b7c8122bcc3f997c75ebaf7f jdk-9+167 e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168 177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169 +ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170 From e87b6392b79dc1f4d4f3f247021dfa758e00d281 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:54 +0000 Subject: [PATCH 055/105] Added tag jdk-9+170 for changeset 13796d1d9f0a --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index bc1c0c2fae9..3de43d927d2 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -412,3 +412,4 @@ d02b6fbcab06c59a5f5a4a6736bd4ec6d2567855 jdk-9+162 646567dcfa64b9a39b33d71330427737d1c1a0d5 jdk-9+167 23a87f409371fb8ce7b764cccb3a74c3f6b29900 jdk-9+168 5d9d2a65fb26aa183019346c11d9314819621665 jdk-9+169 +6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170 From 319619e55f30048ea998a2ce8929870fc143a0af Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:54 +0000 Subject: [PATCH 056/105] Added tag jdk-9+170 for changeset 5198a9f0c661 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index a06eb101dc0..21073a683c7 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -415,3 +415,4 @@ b1f30c27367bd286fa4eb8a767335e917a5b5b82 jdk-9+166 1c610f1b4097c64cdd722a7fb59f5a4d9cc15ca9 jdk-9+167 2746716dcc5a8c28ccf41df0c8fb620b1a1e7098 jdk-9+168 912cf69806d518c5af7fba30b340c4cb5458dd22 jdk-9+169 +e75d3abe579a7b39b762fc0a1a337c49eb072d82 jdk-9+170 From 6dd266ef16eec60d08e103c9ca01d98edbe94195 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:56 +0000 Subject: [PATCH 057/105] Added tag jdk-9+170 for changeset 685d1772b3cf --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 309e95d806c..842a6874e19 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -403,3 +403,4 @@ e36e62d3ea53c316f295b37bcc19867fbf510235 jdk-9+165 e118c818dbf84d15191414c453b77c089116fdc0 jdk-9+167 0f81cde5a1f75786f381dbfb59b9afbab70174c7 jdk-9+168 131e250080158e57ce45130560f5f987b92642b5 jdk-9+169 +550bfc15779f8f339610793867fdc251125811b5 jdk-9+170 From 2e6d1426b2fdfa98e40e97b7156fc86e016f7d76 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Thu, 18 May 2017 14:54:56 +0000 Subject: [PATCH 058/105] Added tag jdk-9+170 for changeset f5f796453339 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index f6415c80f54..0b1896d3de1 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -412,3 +412,4 @@ c7f3df19667b093538c6eecb73dcb3fb531706b4 jdk-9+164 f260f1a2acf616509a4ee5a29bc7f2acca3853e3 jdk-9+167 bc21e5ba6bf1538551093f57fa0f1a6571be05cc jdk-9+168 0e522ff8b9f52a9d4929af9a6aa84110f4dcd81d jdk-9+169 +18355c879c69a33167f1862896738a7b9a4da729 jdk-9+170 From ec43007637a55b7891cd83e6c2815f725a607665 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 18 May 2017 10:22:19 -0700 Subject: [PATCH 059/105] 8180395: move FilterClassLoader and ParentLastURLClassLoader to top level testlibrary Reviewed-by: psandoz --- .../lib/classloader/FilterClassLoader.java | 50 ++++++++++++++++++ .../classloader/ParentLastURLClassLoader.java | 51 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 test/lib/jdk/test/lib/classloader/FilterClassLoader.java create mode 100644 test/lib/jdk/test/lib/classloader/ParentLastURLClassLoader.java diff --git a/test/lib/jdk/test/lib/classloader/FilterClassLoader.java b/test/lib/jdk/test/lib/classloader/FilterClassLoader.java new file mode 100644 index 00000000000..327b1d27a7d --- /dev/null +++ b/test/lib/jdk/test/lib/classloader/FilterClassLoader.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.classloader; + +import java.util.function.Predicate; +/** + * A classloader, which using target classloader in case provided condition + * for class name is met, and using parent otherwise + */ +public class FilterClassLoader extends ClassLoader { + + private final ClassLoader target; + private final Predicate condition; + + public FilterClassLoader(ClassLoader target, ClassLoader parent, + Predicate condition) { + super(parent); + this.condition = condition; + this.target = target; + } + + @Override + public Class loadClass(String name) throws ClassNotFoundException { + if (condition.test(name)) { + return target.loadClass(name); + } + return super.loadClass(name); + } +} diff --git a/test/lib/jdk/test/lib/classloader/ParentLastURLClassLoader.java b/test/lib/jdk/test/lib/classloader/ParentLastURLClassLoader.java new file mode 100644 index 00000000000..71d8953b812 --- /dev/null +++ b/test/lib/jdk/test/lib/classloader/ParentLastURLClassLoader.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.classloader; + +import java.net.URL; +import java.net.URLClassLoader; + +/** + * An url classloader, which trying to load class from provided URL[] first, + * and using parent classloader in case it failed + */ +public class ParentLastURLClassLoader extends URLClassLoader { + + public ParentLastURLClassLoader(URL urls[], ClassLoader parent) { + super(urls, parent); + } + + @Override + public Class loadClass(String name) throws ClassNotFoundException { + try { + Class c = findClass(name); + if (c != null) { + return c; + } + } catch (ClassNotFoundException e) { + // ignore + } + return super.loadClass(name); + } +} From 2c901208104e35e42a2c2b323c79b651312802c4 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 18 May 2017 10:22:20 -0700 Subject: [PATCH 060/105] 8180395: move FilterClassLoader and ParentLastURLClassLoader to top level testlibrary Reviewed-by: psandoz --- .../jdk/testlibrary/FilterClassLoader.java | 49 ------------------ .../testlibrary/ParentLastURLClassLoader.java | 50 ------------------- 2 files changed, 99 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/FilterClassLoader.java delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/ParentLastURLClassLoader.java diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/FilterClassLoader.java b/jdk/test/lib/testlibrary/jdk/testlibrary/FilterClassLoader.java deleted file mode 100644 index fc4e82857f4..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/FilterClassLoader.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.testlibrary; - -import java.util.function.Predicate; -/** - * A classloader, which using target classloader in case provided condition - * for class name is met, and using parent otherwise - */ -public class FilterClassLoader extends ClassLoader { - - private final ClassLoader target; - private final Predicate condition; - - public FilterClassLoader(ClassLoader target, ClassLoader parent, - Predicate condition) { - super(parent); - this.condition = condition; - this.target = target; - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException { - if (condition.test(name)) { - return target.loadClass(name); - } - return super.loadClass(name); - } -} diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ParentLastURLClassLoader.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ParentLastURLClassLoader.java deleted file mode 100644 index 5537ebd3047..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ParentLastURLClassLoader.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.testlibrary; - -import java.net.URL; -import java.net.URLClassLoader; - -/** - * An url classloader, which trying to load class from provided URL[] first, - * and using parent classloader in case it failed - */ -public class ParentLastURLClassLoader extends URLClassLoader { - - public ParentLastURLClassLoader(URL urls[], ClassLoader parent) { - super(urls, parent); - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException { - try { - Class c = findClass(name); - if (c != null) { - return c; - } - } catch (ClassNotFoundException e) { - // ignore - } - return super.loadClass(name); - } -} From 08ce8454f6bf937c0796ac18876108a4b7231ede Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 18 May 2017 10:22:55 -0700 Subject: [PATCH 061/105] 8180519: Windows FILETIME should be converted to and from ULARGE_INTEGER not LARGE_INTEGER Change LARGE_INTEGER to ULARGE_INTEGER for FILETIMEs used with the GetFileTime() and SetFileTime() functions. Reviewed-by: rriggs --- .../java.base/windows/native/libjava/WinNTFileSystem_md.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c b/jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c index 5e1664e31fd..3ffd441c40c 100644 --- a/jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c +++ b/jdk/src/java.base/windows/native/libjava/WinNTFileSystem_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -472,7 +472,7 @@ Java_java_io_WinNTFileSystem_getLastModifiedTime(JNIEnv *env, jobject this, jobject file) { jlong rv = 0; - LARGE_INTEGER modTime; + ULARGE_INTEGER modTime; FILETIME t; HANDLE h; WCHAR *pathbuf = fileToNTPath(env, file, ids.path); @@ -784,7 +784,7 @@ Java_java_io_WinNTFileSystem_setLastModifiedTime(JNIEnv *env, jobject this, FILE_FLAG_BACKUP_SEMANTICS, 0); if (h != INVALID_HANDLE_VALUE) { - LARGE_INTEGER modTime; + ULARGE_INTEGER modTime; FILETIME t; modTime.QuadPart = (time + 11644473600000L) * 10000L; t.dwLowDateTime = (DWORD)modTime.LowPart; From c7bb91a8f4c3ec0f78c993086f44361b56df274e Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 18 May 2017 12:53:19 -0700 Subject: [PATCH 062/105] 8177809: File.lastModified() is losing milliseconds (always ends in 000) Use higher precision time values where available. Reviewed-by: bchristi, rriggs --- .../unix/native/libjava/UnixFileSystem_md.c | 19 +++++++++++++++---- jdk/test/java/io/File/SetLastModified.java | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c b/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c index 77fe35dcee0..95b5674830d 100644 --- a/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c +++ b/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -229,7 +229,13 @@ Java_java_io_UnixFileSystem_getLastModifiedTime(JNIEnv *env, jobject this, WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) { struct stat64 sb; if (stat64(path, &sb) == 0) { - rv = 1000 * (jlong)sb.st_mtime; +#ifndef MACOSX + rv = (jlong)sb.st_mtim.tv_sec * 1000; + rv += (jlong)sb.st_mtim.tv_nsec / 1000000; +#else + rv = (jlong)sb.st_mtimespec.tv_sec * 1000; + rv += (jlong)sb.st_mtimespec.tv_nsec / 1000000; +#endif } } END_PLATFORM_STRING(env, path); return rv; @@ -413,8 +419,13 @@ Java_java_io_UnixFileSystem_setLastModifiedTime(JNIEnv *env, jobject this, struct timeval tv[2]; /* Preserve access time */ - tv[0].tv_sec = sb.st_atime; - tv[0].tv_usec = 0; +#ifndef MACOSX + tv[0].tv_sec = sb.st_atim.tv_sec; + tv[0].tv_usec = sb.st_atim.tv_nsec / 1000; +#else + tv[0].tv_sec = sb.st_atimespec.tv_sec; + tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000; +#endif /* Change last-modified time */ tv[1].tv_sec = time / 1000; diff --git a/jdk/test/java/io/File/SetLastModified.java b/jdk/test/java/io/File/SetLastModified.java index 249b7cca94c..1f45dd912ef 100644 --- a/jdk/test/java/io/File/SetLastModified.java +++ b/jdk/test/java/io/File/SetLastModified.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* @test - @bug 4091757 6652379 + @bug 4091757 6652379 8177809 @summary Basic test for setLastModified method */ From 08a3a230438c17685043cb21a2ed95702adbd4e0 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 18 May 2017 14:16:25 -0700 Subject: [PATCH 063/105] 8167554: jshell tool: re-execute a range and/or sequence of snippets 8180508: jshell tool: support id ranges in all commands with id arguments Reviewed-by: jlahoda --- .../internal/jshell/tool/ArgTokenizer.java | 11 + .../jdk/internal/jshell/tool/JShellTool.java | 377 ++++++++++++++---- .../jshell/tool/resources/l10n.properties | 92 ++++- .../jdk/jshell/CommandCompletionTest.java | 6 +- langtools/test/jdk/jshell/EditorTestBase.java | 2 +- .../jshell/MergedTabShiftTabCommandTest.java | 10 +- langtools/test/jdk/jshell/ToolBasicTest.java | 151 +++++-- .../jdk/jshell/ToolLocaleMessageTest.java | 1 - langtools/test/jdk/jshell/ToolSimpleTest.java | 54 ++- 9 files changed, 546 insertions(+), 158 deletions(-) diff --git a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ArgTokenizer.java b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ArgTokenizer.java index ad66b67d61e..1fb0661959e 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ArgTokenizer.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ArgTokenizer.java @@ -120,6 +120,17 @@ class ArgTokenizer { } } + /** + * Is the specified option allowed. + * + * @param opt the option to check + * @return true if the option is allowed + */ + boolean isAllowedOption(String opt) { + Boolean has = options.get(opt); + return has != null; + } + /** * Has the specified option been encountered. * diff --git a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java index 0a54674d7a4..c58ba51b883 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java @@ -90,7 +90,6 @@ import static java.nio.file.StandardOpenOption.CREATE; import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; import static java.nio.file.StandardOpenOption.WRITE; import java.util.MissingResourceException; -import java.util.Optional; import java.util.ResourceBundle; import java.util.ServiceLoader; import java.util.Spliterators; @@ -126,6 +125,7 @@ import static jdk.internal.jshell.tool.ContinuousCompletionProvider.STARTSWITH_M public class JShellTool implements MessageHandler { private static final Pattern LINEBREAK = Pattern.compile("\\R"); + private static final Pattern ID = Pattern.compile("[se]?\\d+([-\\s].*)?"); static final String RECORD_SEPARATOR = "\u241E"; private static final String RB_NAME_PREFIX = "jdk.internal.jshell.tool.resources"; private static final String VERSION_RB_NAME = RB_NAME_PREFIX + ".version"; @@ -1189,36 +1189,54 @@ public class JShellTool implements MessageHandler { } } - private void processCommand(String cmd) { - if (cmd.startsWith("/-")) { + /** + * Process a command (as opposed to a snippet) -- things that start with + * slash. + * + * @param input + */ + private void processCommand(String input) { + if (input.startsWith("/-")) { try { //handle "/-[number]" - cmdUseHistoryEntry(Integer.parseInt(cmd.substring(1))); + cmdUseHistoryEntry(Integer.parseInt(input.substring(1))); return ; } catch (NumberFormatException ex) { //ignore } } - String arg = ""; - int idx = cmd.indexOf(' '); + String cmd; + String arg; + int idx = input.indexOf(' '); if (idx > 0) { - arg = cmd.substring(idx + 1).trim(); - cmd = cmd.substring(0, idx); + arg = input.substring(idx + 1).trim(); + cmd = input.substring(0, idx); + } else { + cmd = input; + arg = ""; } + // find the command as a "real command", not a pseudo-command or doc subject Command[] candidates = findCommand(cmd, c -> c.kind.isRealCommand); switch (candidates.length) { case 0: - if (!rerunHistoryEntryById(cmd.substring(1))) { - errormsg("jshell.err.no.such.command.or.snippet.id", cmd); + // not found, it is either a snippet command or an error + if (ID.matcher(cmd.substring(1)).matches()) { + // it is in the form of a snipppet id, see if it is a valid history reference + rerunHistoryEntriesById(input); + } else { + errormsg("jshell.err.invalid.command", cmd); fluffmsg("jshell.msg.help.for.help"); - } break; + } + break; case 1: Command command = candidates[0]; // If comand was successful and is of a replayable kind, add it the replayable history if (command.run.apply(arg) && command.kind == CommandKind.REPLAY) { addToReplayHistory((command.command + " " + arg).trim()); - } break; + } + break; default: + // command if too short (ambigous), show the possibly matches errormsg("jshell.err.command.ambiguous", cmd, Arrays.stream(candidates).map(c -> c.command).collect(Collectors.joining(", "))); fluffmsg("jshell.msg.help.for.help"); @@ -1701,6 +1719,9 @@ public class JShellTool implements MessageHandler { registerCommand(new Command("context", "help.context", CommandKind.HELP_SUBJECT)); + registerCommand(new Command("rerun", + "help.rerun", + CommandKind.HELP_SUBJECT)); commandCompletions = new ContinuousCompletionProvider( commands.values().stream() @@ -2247,6 +2268,20 @@ public class JShellTool implements MessageHandler { Predicate defFilter, String rawargs, String cmd) { ArgTokenizer at = new ArgTokenizer(cmd, rawargs.trim()); at.allowedOptions("-all", "-start"); + return argsOptionsToSnippets(snippetSupplier, defFilter, at); + } + + /** + * Convert user arguments to a Stream of snippets referenced by those + * arguments (or lack of arguments). + * + * @param snippets the base list of possible snippets + * @param defFilter the filter to apply to the arguments if no argument + * @param at the ArgTokenizer, with allowed options set + * @return + */ + private Stream argsOptionsToSnippets(Supplier> snippetSupplier, + Predicate defFilter, ArgTokenizer at) { List args = new ArrayList<>(); String s; while ((s = at.next()) != null) { @@ -2263,11 +2298,11 @@ public class JShellTool implements MessageHandler { errormsg("jshell.err.conflicting.options", at.whole()); return null; } - if (at.hasOption("-all")) { + if (at.isAllowedOption("-all") && at.hasOption("-all")) { // all snippets including start-up, failed, and overwritten return snippetSupplier.get(); } - if (at.hasOption("-start")) { + if (at.isAllowedOption("-start") && at.hasOption("-start")) { // start-up snippets return snippetSupplier.get() .filter(this::inStartUp); @@ -2277,54 +2312,227 @@ public class JShellTool implements MessageHandler { return snippetSupplier.get() .filter(defFilter); } - return argsToSnippets(snippetSupplier, args); + return new ArgToSnippets<>(snippetSupplier).argsToSnippets(args); } /** - * Convert user arguments to a Stream of snippets referenced by those - * arguments. + * Support for converting arguments that are definition names, snippet ids, + * or snippet id ranges into a stream of snippets, * - * @param snippetSupplier the base list of possible snippets - * @param args the user's argument to the command, maybe be the empty list - * @return a Stream of referenced snippets or null if no matches to specific - * arg + * @param the snipper subtype */ - private Stream argsToSnippets(Supplier> snippetSupplier, - List args) { - Stream result = null; - for (String arg : args) { + private class ArgToSnippets { + + // the supplier of snippet streams + final Supplier> snippetSupplier; + // these two are parallel, and lazily filled if a range is encountered + List allSnippets; + String[] allIds = null; + + /** + * + * @param snippetSupplier the base list of possible snippets + */ + ArgToSnippets(Supplier> snippetSupplier) { + this.snippetSupplier = snippetSupplier; + } + + /** + * Convert user arguments to a Stream of snippets referenced by those + * arguments. + * + * @param args the user's argument to the command, maybe be the empty + * list + * @return a Stream of referenced snippets or null if no matches to + * specific arg + */ + Stream argsToSnippets(List args) { + Stream result = null; + for (String arg : args) { + // Find the best match + Stream st = argToSnippets(arg); + if (st == null) { + return null; + } else { + result = (result == null) + ? st + : Stream.concat(result, st); + } + } + return result; + } + + /** + * Convert a user argument to a Stream of snippets referenced by the + * argument. + * + * @param snippetSupplier the base list of possible snippets + * @param arg the user's argument to the command + * @return a Stream of referenced snippets or null if no matches to + * specific arg + */ + Stream argToSnippets(String arg) { + if (arg.contains("-")) { + return range(arg); + } // Find the best match Stream st = layeredSnippetSearch(snippetSupplier, arg); if (st == null) { - Stream est = layeredSnippetSearch(state::snippets, arg); - if (est == null) { - errormsg("jshell.err.no.such.snippets", arg); - } else { - errormsg("jshell.err.the.snippet.cannot.be.used.with.this.command", - arg, est.findFirst().get().source()); - } + badSnippetErrormsg(arg); return null; - } - if (result == null) { - result = st; } else { - result = Stream.concat(result, st); + return st; } } - return result; - } - private Stream layeredSnippetSearch(Supplier> snippetSupplier, String arg) { - return nonEmptyStream( - // the stream supplier - snippetSupplier, - // look for active user declarations matching the name - sn -> isActive(sn) && matchingDeclaration(sn, arg), - // else, look for any declarations matching the name - sn -> matchingDeclaration(sn, arg), - // else, look for an id of this name - sn -> sn.id().equals(arg) - ); + /** + * Look for inappropriate snippets to give best error message + * + * @param arg the bad snippet arg + * @param errKey the not found error key + */ + void badSnippetErrormsg(String arg) { + Stream est = layeredSnippetSearch(state::snippets, arg); + if (est == null) { + if (ID.matcher(arg).matches()) { + errormsg("jshell.err.no.snippet.with.id", arg); + } else { + errormsg("jshell.err.no.such.snippets", arg); + } + } else { + errormsg("jshell.err.the.snippet.cannot.be.used.with.this.command", + arg, est.findFirst().get().source()); + } + } + + /** + * Search through the snippets for the best match to the id/name. + * + * @param the snippet type + * @param aSnippetSupplier the supplier of snippet streams + * @param arg the arg to match + * @return a Stream of referenced snippets or null if no matches to + * specific arg + */ + Stream layeredSnippetSearch(Supplier> aSnippetSupplier, String arg) { + return nonEmptyStream( + // the stream supplier + aSnippetSupplier, + // look for active user declarations matching the name + sn -> isActive(sn) && matchingDeclaration(sn, arg), + // else, look for any declarations matching the name + sn -> matchingDeclaration(sn, arg), + // else, look for an id of this name + sn -> sn.id().equals(arg) + ); + } + + /** + * Given an id1-id2 range specifier, return a stream of snippets within + * our context + * + * @param arg the range arg + * @return a Stream of referenced snippets or null if no matches to + * specific arg + */ + Stream range(String arg) { + int dash = arg.indexOf('-'); + String iid = arg.substring(0, dash); + String tid = arg.substring(dash + 1); + int iidx = snippetIndex(iid); + if (iidx < 0) { + return null; + } + int tidx = snippetIndex(tid); + if (tidx < 0) { + return null; + } + if (tidx < iidx) { + errormsg("jshell.err.end.snippet.range.less.than.start", iid, tid); + return null; + } + return allSnippets.subList(iidx, tidx+1).stream(); + } + + /** + * Lazily initialize the id mapping -- needed only for id ranges. + */ + void initIdMapping() { + if (allIds == null) { + allSnippets = snippetSupplier.get() + .sorted((a, b) -> order(a) - order(b)) + .collect(toList()); + allIds = allSnippets.stream() + .map(sn -> sn.id()) + .toArray(n -> new String[n]); + } + } + + /** + * Return all the snippet ids -- within the context, and in order. + * + * @return the snippet ids + */ + String[] allIds() { + initIdMapping(); + return allIds; + } + + /** + * Establish an order on snippet ids. All startup snippets are first, + * all error snippets are last -- within that is by snippet number. + * + * @param id the id string + * @return an ordering int + */ + int order(String id) { + try { + switch (id.charAt(0)) { + case 's': + return Integer.parseInt(id.substring(1)); + case 'e': + return 0x40000000 + Integer.parseInt(id.substring(1)); + default: + return 0x20000000 + Integer.parseInt(id); + } + } catch (Exception ex) { + return 0x60000000; + } + } + + /** + * Establish an order on snippets, based on its snippet id. All startup + * snippets are first, all error snippets are last -- within that is by + * snippet number. + * + * @param sn the id string + * @return an ordering int + */ + int order(Snippet sn) { + return order(sn.id()); + } + + /** + * Find the index into the parallel allSnippets and allIds structures. + * + * @param s the snippet id name + * @return the index, or, if not found, report the error and return a + * negative number + */ + int snippetIndex(String s) { + int idx = Arrays.binarySearch(allIds(), 0, allIds().length, s, + (a, b) -> order(a) - order(b)); + if (idx < 0) { + // the id is not in the snippet domain, find the right error to report + if (!ID.matcher(s).matches()) { + errormsg("jshell.err.range.requires.id", s); + } else { + badSnippetErrormsg(s); + } + } + return idx; + } + } private boolean cmdDrop(String rawargs) { @@ -2342,24 +2550,13 @@ public class JShellTool implements MessageHandler { errormsg("jshell.err.drop.arg"); return false; } - Stream stream = argsToSnippets(this::dropableSnippets, args); + Stream stream = new ArgToSnippets<>(this::dropableSnippets).argsToSnippets(args); if (stream == null) { // Snippet not found. Error already printed fluffmsg("jshell.msg.see.classes.etc"); return false; } - List snippets = stream.collect(toList()); - if (snippets.size() > args.size()) { - // One of the args references more thean one snippet - errormsg("jshell.err.drop.ambiguous"); - fluffmsg("jshell.msg.use.one.of", snippets.stream() - .map(sn -> String.format("\n/drop %-5s : %s", sn.id(), sn.source().replace("\n", "\n "))) - .collect(Collectors.joining(", ")) - ); - return false; - } - snippets.stream() - .forEach(sn -> state.drop(sn).forEach(this::handleEvent)); + stream.forEach(sn -> state.drop(sn).forEach(this::handleEvent)); return true; } @@ -2690,37 +2887,38 @@ public class JShellTool implements MessageHandler { } private boolean cmdSave(String rawargs) { - ArgTokenizer at = new ArgTokenizer("/save", rawargs.trim()); - at.allowedOptions("-all", "-start", "-history"); - String filename = at.next(); - if (filename == null) { + // The filename to save to is the last argument, extract it + String[] args = rawargs.split("\\s"); + String filename = args[args.length - 1]; + if (filename.isEmpty()) { errormsg("jshell.err.file.filename", "/save"); return false; } - if (!checkOptionsAndRemainingInput(at)) { - return false; - } - if (at.optionCount() > 1) { - errormsg("jshell.err.conflicting.options", at.whole()); + // All the non-filename arguments are the specifier of what to save + String srcSpec = Arrays.stream(args, 0, args.length - 1) + .collect(Collectors.joining("\n")); + // From the what to save specifier, compute the snippets (as a stream) + ArgTokenizer at = new ArgTokenizer("/save", srcSpec); + at.allowedOptions("-all", "-start", "-history"); + Stream snippetStream = argsOptionsToSnippets(state::snippets, this::mainActive, at); + if (snippetStream == null) { + // error occurred, already reported return false; } try (BufferedWriter writer = Files.newBufferedWriter(toPathResolvingUserHome(filename), Charset.defaultCharset(), CREATE, TRUNCATE_EXISTING, WRITE)) { if (at.hasOption("-history")) { + // they want history (commands and snippets), ignore the snippet stream for (String s : input.currentSessionHistory()) { writer.write(s); writer.write("\n"); } - } else if (at.hasOption("-start")) { - writer.append(startup.toString()); } else { - String sources = (at.hasOption("-all") - ? state.snippets() - : state.snippets().filter(this::mainActive)) + // write the snippet stream to the file + writer.write(snippetStream .map(Snippet::source) - .collect(Collectors.joining("\n")); - writer.write(sources); + .collect(Collectors.joining("\n"))); } } catch (FileNotFoundException e) { errormsg("jshell.err.file.not.found", "/save", filename, e.getMessage()); @@ -2837,14 +3035,21 @@ public class JShellTool implements MessageHandler { return true; } - private boolean rerunHistoryEntryById(String id) { - Optional snippet = state.snippets() - .filter(s -> s.id().equals(id)) - .findFirst(); - return snippet.map(s -> { - rerunSnippet(s); - return true; - }).orElse(false); + /** + * Handle snippet reevaluation commands: {@code /}. These commands are a + * sequence of ids and id ranges (names are permitted, though not in the + * first position. Support for names is purposely not documented). + * + * @param rawargs the whole command including arguments + */ + private void rerunHistoryEntriesById(String rawargs) { + ArgTokenizer at = new ArgTokenizer("/", rawargs.trim().substring(1)); + at.allowedOptions(); + Stream stream = argsOptionsToSnippets(state::snippets, sn -> true, at); + if (stream != null) { + // successfully parsed, rerun snippets + stream.forEach(sn -> rerunSnippet(sn)); + } } private void rerunSnippet(Snippet snippet) { diff --git a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties index f636404da0b..e67778189f6 100644 --- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties +++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties @@ -50,7 +50,7 @@ jshell.err.file.filename = ''{0}'' requires a filename argument. jshell.err.startup.unexpected.exception = Unexpected exception reading start-up: {0} jshell.err.unexpected.exception = Unexpected exception: {0} -jshell.err.no.such.command.or.snippet.id = No such command or snippet id: {0} +jshell.err.invalid.command = Invalid command: {0} jshell.err.command.ambiguous = Command: ''{0}'' is ambiguous: {1} jshell.msg.set.restore = Setting new options and restoring state. jshell.msg.set.editor.set = Editor set to: {0} @@ -105,10 +105,13 @@ For example ''/help /list'' or ''/help intro''.\n\ Subjects:\n\ \n +jshell.err.no.snippet.with.id = No snippet with id: {0} +jshell.err.end.snippet.range.less.than.start = End of snippet range less than start: {0} - {1} +jshell.err.range.requires.id = Snippet ranges require snippet ids: {0} + jshell.err.drop.arg =\ In the /drop argument, please specify an import, variable, method, or class to drop.\n\ Specify by id or name. Use /list to see ids. Use /reset to reset all state. -jshell.err.drop.ambiguous = The argument references more than one import, variable, method, or class. jshell.err.failed = Failed. jshell.msg.native.method = Native Method jshell.msg.unknown.source = Unknown Source @@ -225,7 +228,11 @@ Show the source of snippets, prefaced with the snippet id.\n\ /list \n\t\ List snippets with the specified name (preference for active snippets)\n\n\ /list \n\t\ - List the snippet with the specified snippet id + List the snippet with the specified snippet id\n\n\ +/list ...\n\t\ + List the snippets with the specified snippet ids\n\n\ +/list -\n\t\ + List the snippets within the range of snippet ids help.edit.summary = edit a source entry referenced by name or id help.edit.args = @@ -238,6 +245,10 @@ If no editor has been set, a simple editor will be launched.\n\ Edit the snippet or snippets with the specified name (preference for active snippets)\n\n\ /edit \n\t\ Edit the snippet with the specified snippet id\n\n\ +/edit ...\n\t\ + Edit the snippets with the specified snippet ids\n\n\ +/edit -\n\t\ + Edit the snippets within the range of snippet ids\n\n\ /edit\n\t\ Edit the currently active snippets of code that you typed or read with /open @@ -249,7 +260,11 @@ Drop a snippet -- making it inactive.\n\ /drop \n\t\ Drop the snippet with the specified name\n\n\ /drop \n\t\ - Drop the snippet with the specified snippet id + Drop the snippet with the specified snippet id\n\n\ +/drop ...\n\t\ + Drop the snippets with the specified snippet ids\n\n\ +/drop -\n\t\ + Drop the snippets within the range of snippet ids help.save.summary = Save snippet source to a file. help.save.args = [-all|-history|-start] @@ -264,7 +279,13 @@ Save the specified snippets and/or commands to the specified file.\n\ /save -history \n\t\ Save the sequential history of all commands and snippets entered since jshell was launched.\n\n\ /save -start \n\t\ - Save the current start-up definitions to the file. + Save the current start-up definitions to the file.\n\n\ +/save \n\t\ + Save the snippet with the specified snippet id\n\n\ +/save ... \n\t\ + Save the snippets with the specified snippet ids\n\n\ +/save - \n\t\ + Save the snippets within the range of snippet ids help.open.summary = open a file as source input help.open.args = @@ -285,6 +306,10 @@ List the type, name, and value of jshell variables.\n\ List jshell variables with the specified name (preference for active variables)\n\n\ /vars \n\t\ List the jshell variable with the specified snippet id\n\n\ +/vars ... \n\t\ + List the jshell variables with the specified snippet ids\n\n\ +/vars - \n\t\ + List the jshell variables within the range of snippet ids\n\n\ /vars -start\n\t\ List the automatically added start-up jshell variables\n\n\ /vars -all\n\t\ @@ -301,6 +326,10 @@ List the name, parameter types, and return type of jshell methods.\n\ List jshell methods with the specified name (preference for active methods)\n\n\ /methods \n\t\ List the jshell method with the specified snippet id\n\n\ +/methods ... \n\t\ + List jshell methods with the specified snippet ids\n\n\ +/methods - \n\t\ + List jshell methods within the range of snippet ids\n\n\ /methods -start\n\t\ List the automatically added start-up jshell methods\n\n\ /methods -all\n\t\ @@ -317,6 +346,10 @@ List jshell classes, interfaces, and enums.\n\ List jshell types with the specified name (preference for active types)\n\n\ /types \n\t\ List the jshell type with the specified snippet id\n\n\ +/types ... \n\t\ + List jshell types with the specified snippet ids\n\n\ +/types - \n\t\ + List jshell types within the range of snippet ids\n\n\ /types -start\n\t\ List the automatically added start-up jshell types\n\n\ /types -all\n\t\ @@ -461,17 +494,24 @@ Display information about jshell (abbreviation for /help).\n\ /? \n\t\ Display information about the specified help subject. Example: /? intro -help.bang.summary = re-run last snippet +help.bang.summary = rerun last snippet -- see /help rerun help.bang.args = help.bang =\ Reevaluate the most recently entered snippet. -help.id.summary = re-run snippet by id +help.id.summary = rerun snippets by id or id range -- see /help rerun help.id.args = help.id =\ -Reevaluate the snippet specified by the id. +/ \n\ +\n\ +/-\n\ +\n\ +Reevaluate the snippets specified by the id or id range.\n\ +An id range is represented as a two ids separated by a hyphen, e.g.: 3-17\n\ +Start-up and error snippets maybe used, e.g.: s3-s9 or e1-e4\n\ +Any number of ids or id ranges may be used, e.g.: /3-7 s4 14-16 e2 -help.previous.summary = re-run n-th previous snippet +help.previous.summary = rerun n-th previous snippet -- see /help rerun help.previous.args = help.previous =\ Reevaluate the n-th most recently entered snippet. @@ -509,7 +549,7 @@ Shift- i\n\t\t\ then release and press "i", and jshell will propose possible imports\n\t\t\ which will resolve the identifier based on the content of the specified classpath. -help.context.summary = the evaluation context options for /env /reload and /reset +help.context.summary = a description of the evaluation context options for /env /reload and /reset help.context =\ These options configure the evaluation context, they can be specified when\n\ jshell is started: on the command-line, or restarted with the commands /env,\n\ @@ -540,6 +580,38 @@ They are:\n\t\ On the command-line these options must have two dashes, e.g.: --module-path\n\ On jshell commands they can have one or two dashes, e.g.: -module-path\n\ +help.rerun.summary = a description of ways to re-evaluate previously entered snippets +help.rerun =\ +There are four ways to re-evaluate previously entered snippets.\n\ +The last snippet can be re-evaluated using: /!\n\ +The n-th previous snippet can be re-evaluated by slash-minus and the digits of n, e.g.: /-4\n\ +For example:\n\ +\n\ + \tjshell> 2 + 2\n\ + \t$1 ==> 4\n\ +\n\ + \tjshell> /!\n\ + \t2 + 2\n\ + \t$2 ==> 4\n\ +\n\ + \tjshell> int z\n\ + \tz ==> 0\n\ +\n\ + \tjshell> /-1\n\ + \tint z;\n\ + \tz ==> 0\n\ +\n\ + \tjshell> /-4\n\ + \t2 + 2\n\ + \t$5 ==> 4\n\ +\n\ +The snippets to re-evaluate may be specified by snippet id or id range.\n\ +An id range is represented as a two ids separated by a hyphen, e.g.: 3-17\n\ +Start-up and error snippets maybe used, e.g.: s3-s9 or e1-e4\n\ +Any number of ids or id ranges may be used, e.g.: /3-7 s4 14-16 e2\n\ +\n\ +Finally, you can search backwards through history by entering ctrl-R followed by the string to search for. + help.set._retain = \ The '-retain' option saves a setting so that it is used in future sessions.\n\ The -retain option can be used on the following forms of /set:\n\n\t\ diff --git a/langtools/test/jdk/jshell/CommandCompletionTest.java b/langtools/test/jdk/jshell/CommandCompletionTest.java index 4424604fc23..535a9eb1c7e 100644 --- a/langtools/test/jdk/jshell/CommandCompletionTest.java +++ b/langtools/test/jdk/jshell/CommandCompletionTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8144095 8164825 8169818 8153402 8165405 8177079 8178013 + * @bug 8144095 8164825 8169818 8153402 8165405 8177079 8178013 8167554 * @summary Test Command Completion * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -162,13 +162,13 @@ public class CommandCompletionTest extends ReplToolTesting { "/edit ", "/env ", "/exit ", "/help ", "/history ", "/imports ", "/list ", "/methods ", "/open ", "/reload ", "/reset ", - "/save ", "/set ", "/types ", "/vars ", "context ", "intro ", "shortcuts "), + "/save ", "/set ", "/types ", "/vars ", "context ", "intro ", "rerun ", "shortcuts "), a -> assertCompletion(a, "/? |", false, "/! ", "/- ", "/ ", "/? ", "/drop ", "/edit ", "/env ", "/exit ", "/help ", "/history ", "/imports ", "/list ", "/methods ", "/open ", "/reload ", "/reset ", - "/save ", "/set ", "/types ", "/vars ", "context ", "intro ", "shortcuts "), + "/save ", "/set ", "/types ", "/vars ", "context ", "intro ", "rerun ", "shortcuts "), a -> assertCompletion(a, "/help /s|", false, "/save ", "/set "), a -> assertCompletion(a, "/help /set |", false, diff --git a/langtools/test/jdk/jshell/EditorTestBase.java b/langtools/test/jdk/jshell/EditorTestBase.java index 074b4a5bd14..927ebc6466e 100644 --- a/langtools/test/jdk/jshell/EditorTestBase.java +++ b/langtools/test/jdk/jshell/EditorTestBase.java @@ -73,7 +73,7 @@ public abstract class EditorTestBase extends ReplToolTesting { for (String edit : new String[] {"/ed", "/edit"}) { test(new String[]{"--no-startup"}, a -> assertCommandOutputStartsWith(a, edit + " 1", - "| No such snippet: 1"), + "| No snippet with id: 1"), a -> assertCommandOutputStartsWith(a, edit + " unknown", "| No such snippet: unknown") ); diff --git a/langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java b/langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java index 6a9dd82cf84..da74700b406 100644 --- a/langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java +++ b/langtools/test/jdk/jshell/MergedTabShiftTabCommandTest.java @@ -66,17 +66,17 @@ public class MergedTabShiftTabCommandTest extends UITesting { Pattern.quote(getResource("jshell.console.see.next.command.doc")) + "\n" + "\r\u0005/"); - inputSink.write("lis\011"); - waitOutput(out, "list $"); + inputSink.write("ed\011"); + waitOutput(out, "edit $"); inputSink.write("\011"); waitOutput(out, ".*-all.*" + "\n\n" + Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n\r\u0005/"); inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.list.summary")) + "\n\n" + - Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/list "); + waitOutput(out, Pattern.quote(getResource("help.edit.summary")) + "\n\n" + + Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/edit "); inputSink.write("\011"); - waitOutput(out, Pattern.quote(getResource("help.list").replaceAll("\t", " "))); + waitOutput(out, Pattern.quote(getResource("help.edit").replaceAll("\t", " "))); inputSink.write("\u0003/env \011"); waitOutput(out, "\u0005/env -\n" + diff --git a/langtools/test/jdk/jshell/ToolBasicTest.java b/langtools/test/jdk/jshell/ToolBasicTest.java index 93321fb58e8..be5bce056c8 100644 --- a/langtools/test/jdk/jshell/ToolBasicTest.java +++ b/langtools/test/jdk/jshell/ToolBasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405 8174796 8174797 8175304 + * @bug 8143037 8142447 8144095 8140265 8144906 8146138 8147887 8147886 8148316 8148317 8143955 8157953 8080347 8154714 8166649 8167643 8170162 8172102 8165405 8174796 8174797 8175304 8167554 8180508 * @summary Tests for Basic tests for REPL tool * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -190,8 +190,8 @@ public class ToolBasicTest extends ReplToolTesting { public void testRerun() { test(false, new String[] {"--no-startup"}, - (a) -> assertCommand(a, "/0", "| No such command or snippet id: /0\n| Type /help for help."), - (a) -> assertCommand(a, "/5", "| No such command or snippet id: /5\n| Type /help for help.") + (a) -> assertCommand(a, "/0", "| No snippet with id: 0"), + (a) -> assertCommand(a, "/5", "| No snippet with id: 5") ); String[] codes = new String[] { "int a = 0;", // var @@ -252,9 +252,9 @@ public class ToolBasicTest extends ReplToolTesting { ); test(false, new String[] {"--no-startup"}, - (a) -> assertCommand(a, "/s1", "| No such command or snippet id: /s1\n| Type /help for help."), - (a) -> assertCommand(a, "/1", "| No such command or snippet id: /1\n| Type /help for help."), - (a) -> assertCommand(a, "/e1", "| No such command or snippet id: /e1\n| Type /help for help.") + (a) -> assertCommand(a, "/s1", "| No snippet with id: s1"), + (a) -> assertCommand(a, "/1", "| No snippet with id: 1"), + (a) -> assertCommand(a, "/e1", "| No snippet with id: e1") ); } @@ -481,17 +481,19 @@ public class ToolBasicTest extends ReplToolTesting { public void testSave() throws IOException { Compiler compiler = new Compiler(); Path path = compiler.getPath("testSave.repl"); - List list = Arrays.asList( - "int a;", - "class A { public String toString() { return \"A\"; } }" - ); - test( - (a) -> assertVariable(a, "int", "a"), - (a) -> assertCommand(a, "()", null, null, null, "", ""), - (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), - (a) -> assertCommand(a, "/save " + path.toString(), "") - ); - assertEquals(Files.readAllLines(path), list); + { + List list = Arrays.asList( + "int a;", + "class A { public String toString() { return \"A\"; } }" + ); + test( + (a) -> assertVariable(a, "int", "a"), + (a) -> assertCommand(a, "()", null, null, null, "", ""), + (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), + (a) -> assertCommand(a, "/save " + path.toString(), "") + ); + assertEquals(Files.readAllLines(path), list); + } { List output = new ArrayList<>(); test( @@ -499,28 +501,47 @@ public class ToolBasicTest extends ReplToolTesting { (a) -> assertCommand(a, "()", null, null, null, "", ""), (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), (a) -> assertCommandCheckOutput(a, "/list -all", (out) -> - output.addAll(Stream.of(out.split("\n")) - .filter(str -> !str.isEmpty()) - .map(str -> str.substring(str.indexOf(':') + 2)) - .filter(str -> !str.startsWith("/")) - .collect(Collectors.toList()))), + output.addAll(Stream.of(out.split("\n")) + .filter(str -> !str.isEmpty()) + .map(str -> str.substring(str.indexOf(':') + 2)) + .filter(str -> !str.startsWith("/")) + .collect(Collectors.toList()))), (a) -> assertCommand(a, "/save -all " + path.toString(), "") ); assertEquals(Files.readAllLines(path), output); } - List output = new ArrayList<>(); - test( - (a) -> assertVariable(a, "int", "a"), - (a) -> assertCommand(a, "()", null, null, null, "", ""), - (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), - (a) -> assertCommandCheckOutput(a, "/history", (out) -> - output.addAll(Stream.of(out.split("\n")) - .filter(str -> !str.isEmpty()) - .collect(Collectors.toList()))), - (a) -> assertCommand(a, "/save -history " + path.toString(), "") - ); - output.add("/save -history " + path.toString()); - assertEquals(Files.readAllLines(path), output); + { + List output = new ArrayList<>(); + test( + (a) -> assertCommand(a, "int a;", null), + (a) -> assertCommand(a, "int b;", null), + (a) -> assertCommand(a, "int c;", null), + (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), + (a) -> assertCommandCheckOutput(a, "/list b c a A", (out) -> + output.addAll(Stream.of(out.split("\n")) + .filter(str -> !str.isEmpty()) + .map(str -> str.substring(str.indexOf(':') + 2)) + .filter(str -> !str.startsWith("/")) + .collect(Collectors.toList()))), + (a) -> assertCommand(a, "/save 2-3 1 4 " + path.toString(), "") + ); + assertEquals(Files.readAllLines(path), output); + } + { + List output = new ArrayList<>(); + test( + (a) -> assertVariable(a, "int", "a"), + (a) -> assertCommand(a, "()", null, null, null, "", ""), + (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), + (a) -> assertCommandCheckOutput(a, "/history", (out) -> + output.addAll(Stream.of(out.split("\n")) + .filter(str -> !str.isEmpty()) + .collect(Collectors.toList()))), + (a) -> assertCommand(a, "/save -history " + path.toString(), "") + ); + output.add("/save -history " + path.toString()); + assertEquals(Files.readAllLines(path), output); + } } public void testStartRetain() { @@ -652,6 +673,64 @@ public class ToolBasicTest extends ReplToolTesting { ); } + public void testRerunIdRange() { + Compiler compiler = new Compiler(); + Path startup = compiler.getPath("rangeStartup"); + String[] startupSources = new String[] { + "boolean go = false", + "void println(String s) { if (go) System.out.println(s); }", + "void println(int i) { if (go) System.out.println(i); }", + "println(\"s4\")", + "println(\"s5\")", + "println(\"s6\")" + }; + String[] sources = new String[] { + "frog", + "go = true", + "println(2)", + "println(3)", + "println(4)", + "querty" + }; + compiler.writeToFile(startup, startupSources); + test(false, new String[]{"--startup", startup.toString()}, + a -> assertCommandOutputStartsWith(a, sources[0], "| Error:"), + a -> assertCommand(a, sources[1], "go ==> true", "", null, "", ""), + a -> assertCommand(a, sources[2], "", "", null, "2\n", ""), + a -> assertCommand(a, sources[3], "", "", null, "3\n", ""), + a -> assertCommand(a, sources[4], "", "", null, "4\n", ""), + a -> assertCommandOutputStartsWith(a, sources[5], "| Error:"), + a -> assertCommand(a, "/3", "println(3)", "", null, "3\n", ""), + a -> assertCommand(a, "/s4", "println(\"s4\")", "", null, "s4\n", ""), + a -> assertCommandOutputStartsWith(a, "/e1", "frog\n| Error:"), + a -> assertCommand(a, "/2-4", + "println(2)\nprintln(3)\nprintln(4)", + "", null, "2\n3\n4\n", ""), + a -> assertCommand(a, "/s4-s6", + startupSources[3] + "\n" +startupSources[4] + "\n" +startupSources[5], + "", null, "s4\ns5\ns6\n", ""), + a -> assertCommand(a, "/s4-4", null, + "", null, "s4\ns5\ns6\n2\n3\n4\n", ""), + a -> assertCommandCheckOutput(a, "/e1-e2", + s -> { + assertTrue(s.trim().startsWith("frog\n| Error:"), + "Output: \'" + s + "' does not start with: " + "| Error:"); + assertTrue(s.trim().lastIndexOf("| Error:") > 10, + "Output: \'" + s + "' does not have second: " + "| Error:"); + }), + a -> assertCommand(a, "/4 s4 2", + "println(4)\nprintln(\"s4\")\nprintln(2)", + "", null, "4\ns4\n2\n", ""), + a -> assertCommand(a, "/s5 2-4 3", + "println(\"s5\")\nprintln(2)\nprintln(3)\nprintln(4)\nprintln(3)", + "", null, "s5\n2\n3\n4\n3\n", ""), + a -> assertCommand(a, "/2 ff", "| No such snippet: ff"), + a -> assertCommand(a, "/4-2", "| End of snippet range less than start: 4 - 2"), + a -> assertCommand(a, "/s5-s3", "| End of snippet range less than start: s5 - s3"), + a -> assertCommand(a, "/4-s5", "| End of snippet range less than start: 4 - s5") + ); + } + @Test(enabled = false) // TODO 8158197 public void testHeadlessEditPad() { String prevHeadless = System.getProperty("java.awt.headless"); diff --git a/langtools/test/jdk/jshell/ToolLocaleMessageTest.java b/langtools/test/jdk/jshell/ToolLocaleMessageTest.java index dc45091a0c0..6111320f1af 100644 --- a/langtools/test/jdk/jshell/ToolLocaleMessageTest.java +++ b/langtools/test/jdk/jshell/ToolLocaleMessageTest.java @@ -117,7 +117,6 @@ public class ToolLocaleMessageTest extends ReplToolTesting { (a) -> assertCommandFail(a, "/drop rats"), (a) -> assertCommandOK(a, "void dup() {}"), (a) -> assertCommandOK(a, "int dup"), - (a) -> assertCommandFail(a, "/drop dup"), (a) -> assertCommandFail(a, "/edit zebra", "zebra"), (a) -> assertCommandFail(a, "/list zebra", "zebra", "No such snippet: zebra"), (a) -> assertCommandFail(a, "/open", "/open"), diff --git a/langtools/test/jdk/jshell/ToolSimpleTest.java b/langtools/test/jdk/jshell/ToolSimpleTest.java index 909318aaeff..647d0fdafcc 100644 --- a/langtools/test/jdk/jshell/ToolSimpleTest.java +++ b/langtools/test/jdk/jshell/ToolSimpleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 + * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 * @summary Simple jshell tool tests * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main @@ -37,6 +37,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.function.Consumer; +import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -202,7 +203,7 @@ public class ToolSimpleTest extends ReplToolTesting { @Test public void testUnknownCommand() { test((a) -> assertCommand(a, "/unknown", - "| No such command or snippet id: /unknown\n" + + "| Invalid command: /unknown\n" + "| Type /help for help.")); } @@ -274,10 +275,26 @@ public class ToolSimpleTest extends ReplToolTesting { ); } + @Test + public void testDropRange() { + test(false, new String[]{"--no-startup"}, + a -> assertVariable(a, "int", "a"), + a -> assertMethod(a, "int b() { return 0; }", "()int", "b"), + a -> assertClass(a, "class A {}", "class", "A"), + a -> assertImport(a, "import java.util.stream.*;", "", "java.util.stream.*"), + a -> assertCommand(a, "for (int i = 0; i < 10; ++i) {}", ""), + a -> assertCommand(a, "/drop 3-5 b 1", + "| dropped class A\n" + + "| dropped method b()\n" + + "| dropped variable a\n"), + a -> assertCommand(a, "/list", "") + ); + } + @Test public void testDropNegative() { test(false, new String[]{"--no-startup"}, - a -> assertCommandOutputStartsWith(a, "/drop 0", "| No such snippet: 0"), + a -> assertCommandOutputStartsWith(a, "/drop 0", "| No snippet with id: 0"), a -> assertCommandOutputStartsWith(a, "/drop a", "| No such snippet: a"), a -> assertCommandCheckOutput(a, "/drop", assertStartsWith("| In the /drop argument, please specify an import, variable, method, or class to drop.")), @@ -292,27 +309,23 @@ public class ToolSimpleTest extends ReplToolTesting { @Test public void testAmbiguousDrop() { - Consumer check = s -> { - assertTrue(s.startsWith("| The argument references more than one import, variable, method, or class"), s); - int lines = s.split("\n").length; - assertEquals(lines, 5, "Expected 3 ambiguous keys, but found: " + (lines - 2) + "\n" + s); - }; test( a -> assertVariable(a, "int", "a"), a -> assertMethod(a, "int a() { return 0; }", "()int", "a"), a -> assertClass(a, "class a {}", "class", "a"), - a -> assertCommandCheckOutput(a, "/drop a", check), - a -> assertCommandCheckOutput(a, "/vars", assertVariables()), - a -> assertCommandCheckOutput(a, "/methods", assertMethods()), - a -> assertCommandCheckOutput(a, "/types", assertClasses()), - a -> assertCommandCheckOutput(a, "/imports", assertImports()) + a -> assertCommand(a, "/drop a", + "| dropped variable a\n" + + "| dropped method a()\n" + + "| dropped class a") ); test( a -> assertMethod(a, "int a() { return 0; }", "()int", "a"), a -> assertMethod(a, "double a(int a) { return 0; }", "(int)double", "a"), a -> assertMethod(a, "double a(double a) { return 0; }", "(double)double", "a"), - a -> assertCommandCheckOutput(a, "/drop a", check), - a -> assertCommandCheckOutput(a, "/methods", assertMethods()) + a -> assertCommand(a, "/drop a", + "| dropped method a()\n" + + "| dropped method a(int)\n" + + "| dropped method a(double)\n") ); } @@ -402,12 +415,14 @@ public class ToolSimpleTest extends ReplToolTesting { String arg = "qqqq"; List startVarList = new ArrayList<>(START_UP); startVarList.add("int aardvark"); + startVarList.add("int weevil"); test( a -> assertCommandCheckOutput(a, "/list -all", s -> checkLineToList(s, START_UP)), a -> assertCommandOutputStartsWith(a, "/list " + arg, "| No such snippet: " + arg), a -> assertVariable(a, "int", "aardvark"), + a -> assertVariable(a, "int", "weevil"), a -> assertCommandOutputContains(a, "/list aardvark", "aardvark"), a -> assertCommandCheckOutput(a, "/list -start", s -> checkLineToList(s, START_UP)), @@ -415,6 +430,11 @@ public class ToolSimpleTest extends ReplToolTesting { s -> checkLineToList(s, startVarList)), a -> assertCommandOutputStartsWith(a, "/list s3", "s3 : import"), + a -> assertCommandCheckOutput(a, "/list 1-2 s3", + s -> { + assertTrue(Pattern.matches(".*aardvark.*\\R.*weevil.*\\R.*s3.*import.*", s.trim()), + "No match: " + s); + }), a -> assertCommandOutputStartsWith(a, "/list " + arg, "| No such snippet: " + arg) ); @@ -439,6 +459,8 @@ public class ToolSimpleTest extends ReplToolTesting { s -> checkLineToList(s, startVarList)), a -> assertCommandOutputStartsWith(a, "/vars -all", "| int aardvark = 0\n| int a = "), + a -> assertCommandOutputStartsWith(a, "/vars 1-4", + "| int aardvark = 0\n| int a = "), a -> assertCommandOutputStartsWith(a, "/vars f", "| This command does not accept the snippet 'f'"), a -> assertCommand(a, "/var " + arg, From 3bb25bd637963e1fff721e77d3b17f81bdfdbd10 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 18 May 2017 15:43:43 -0700 Subject: [PATCH 064/105] 8180391: move SerializationUtils to top level testlibrary Reviewed-by: psandoz --- .../jdk/test/lib/util/SerializationUtils.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/lib/jdk/test/lib/util/SerializationUtils.java diff --git a/test/lib/jdk/test/lib/util/SerializationUtils.java b/test/lib/jdk/test/lib/util/SerializationUtils.java new file mode 100644 index 00000000000..3b6e65aefd7 --- /dev/null +++ b/test/lib/jdk/test/lib/util/SerializationUtils.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +/** + * Common library for various test serialization utility functions. + */ +public final class SerializationUtils { + /** + * Serialize an object into byte array. + */ + public static byte[] serialize(Object obj) throws IOException { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + try (ObjectOutputStream out = new ObjectOutputStream(bs)) { + out.writeObject(obj); + } + return bs.toByteArray(); + } + + /** + * Deserialize an object from byte array. + */ + public static Object deserialize(byte[] ba) throws IOException, ClassNotFoundException { + try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(ba))) { + return in.readObject(); + } + } + private SerializationUtils() {} +} From eed4c8949e481e25799ec9b06ed005275d33422b Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 18 May 2017 15:43:44 -0700 Subject: [PATCH 065/105] 8180391: move SerializationUtils to top level testlibrary Reviewed-by: psandoz --- .../CompactString/SerializationTest.java | 7 ++- .../CompactStringBufferSerialization.java | 7 ++- .../CompactStringBuilderSerialization.java | 7 ++- .../jdk/testlibrary/SerializationUtils.java | 51 ------------------- 4 files changed, 9 insertions(+), 63 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/SerializationUtils.java diff --git a/jdk/test/java/lang/String/CompactString/SerializationTest.java b/jdk/test/java/lang/String/CompactString/SerializationTest.java index e4c94c573ba..94fa9aadabf 100644 --- a/jdk/test/java/lang/String/CompactString/SerializationTest.java +++ b/jdk/test/java/lang/String/CompactString/SerializationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,13 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static jdk.testlibrary.SerializationUtils.*; +import static jdk.test.lib.util.SerializationUtils.*; import static org.testng.Assert.assertEquals; /* * @test * @bug 8077559 - * @library /lib/testlibrary - * @build jdk.testlibrary.SerializationUtils + * @library /test/lib * @summary Tests Compact String. This one is testing String serialization * among -XX:+CompactStrings/-XX:-CompactStrings/LegacyString * @run testng/othervm -XX:+CompactStrings SerializationTest diff --git a/jdk/test/java/lang/StringBuffer/CompactStringBufferSerialization.java b/jdk/test/java/lang/StringBuffer/CompactStringBufferSerialization.java index 346c824ed12..3f721d52959 100644 --- a/jdk/test/java/lang/StringBuffer/CompactStringBufferSerialization.java +++ b/jdk/test/java/lang/StringBuffer/CompactStringBufferSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,13 @@ import java.io.*; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static jdk.testlibrary.SerializationUtils.*; +import static jdk.test.lib.util.SerializationUtils.*; import static org.testng.Assert.*; /* * @test * @bug 8077559 - * @library /lib/testlibrary - * @build jdk.testlibrary.SerializationUtils + * @library /test/lib * @summary Tests Compact String. This one is testing StringBuffer serialization * among -XX:+CompactStrings/-XX:-CompactStrings/LegacyStringBuffer * @run testng/othervm -XX:+CompactStrings CompactStringBufferSerialization diff --git a/jdk/test/java/lang/StringBuilder/CompactStringBuilderSerialization.java b/jdk/test/java/lang/StringBuilder/CompactStringBuilderSerialization.java index 0c622d78665..6a66e2b9dd2 100644 --- a/jdk/test/java/lang/StringBuilder/CompactStringBuilderSerialization.java +++ b/jdk/test/java/lang/StringBuilder/CompactStringBuilderSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,13 @@ import java.io.*; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static jdk.testlibrary.SerializationUtils.*; +import static jdk.test.lib.util.SerializationUtils.*; import static org.testng.Assert.*; /* * @test * @bug 8077559 - * @library /lib/testlibrary - * @build jdk.testlibrary.SerializationUtils + * @library /test/lib * @summary Tests Compact String. This one is testing StringBuilder serialization * among -XX:+CompactStrings/-XX:-CompactStrings/LegacyStringBuilder * @run testng/othervm -XX:+CompactStrings CompactStringBuilderSerialization diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/SerializationUtils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/SerializationUtils.java deleted file mode 100644 index 3dbc66692db..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/SerializationUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.io.*; - -/** - * Common library for various test serialization utility functions. - */ -public final class SerializationUtils { - /* - * Serialize an object into byte array. - */ - public static byte[] serialize(Object obj) throws Exception { - try (ByteArrayOutputStream bs = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(bs);) { - out.writeObject(obj); - return bs.toByteArray(); - } - } - - /* - * Deserialize an object from byte array. - */ - public static Object deserialize(byte[] ba) throws Exception { - try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(ba));) { - return in.readObject(); - } - } -} From 735d9b2c365c4f984e6cd899152068eb9eb27411 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 18 May 2017 15:51:25 -0700 Subject: [PATCH 066/105] 8180397: remove jdk.testlibrary.IOUtils Reviewed-by: alanb --- .../AnnotationTypeRuntimeAssumptionTest.java | 10 +-- .../LambdaClassLoaderSerialization.java | 9 +-- .../StaticInterfaceMethodInWayOfDefault.java | 11 +-- .../testlibrary/jdk/testlibrary/IOUtils.java | 71 ------------------- .../tools/jarsigner/EntriesOrder.java | 10 +-- 5 files changed, 11 insertions(+), 100 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/IOUtils.java diff --git a/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java b/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java index 32589256c59..fc45bef98f9 100644 --- a/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java +++ b/jdk/test/java/lang/annotation/AnnotationType/AnnotationTypeRuntimeAssumptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ * @test * @summary Test consistent parsing of ex-RUNTIME annotations that * were changed and separately compiled to have CLASS retention - * @library /lib/testlibrary - * @build jdk.testlibrary.IOUtils * @run main AnnotationTypeRuntimeAssumptionTest */ @@ -35,8 +33,6 @@ import java.io.InputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import jdk.testlibrary.IOUtils; - import static java.lang.annotation.RetentionPolicy.CLASS; import static java.lang.annotation.RetentionPolicy.RUNTIME; @@ -140,7 +136,7 @@ public class AnnotationTypeRuntimeAssumptionTest { String altPath = altName.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(altPath)) { if (is != null) { - byte[] bytes = IOUtils.readFully(is); + byte[] bytes = is.readAllBytes(); // patch class bytes to contain original name for (int i = 0; i < bytes.length - 2; i++) { if (bytes[i] == '_' && @@ -163,7 +159,7 @@ public class AnnotationTypeRuntimeAssumptionTest { String path = name.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(path)) { if (is != null) { - byte[] bytes = IOUtils.readFully(is); + byte[] bytes = is.readAllBytes(); return defineClass(name, bytes, 0, bytes.length); } else { diff --git a/jdk/test/java/lang/invoke/lambda/LambdaClassLoaderSerialization.java b/jdk/test/java/lang/invoke/lambda/LambdaClassLoaderSerialization.java index 6c97e3407cb..822fc45c269 100644 --- a/jdk/test/java/lang/invoke/lambda/LambdaClassLoaderSerialization.java +++ b/jdk/test/java/lang/invoke/lambda/LambdaClassLoaderSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ * @test * @bug 8004970 * @summary Lambda serialization in the presence of class loaders - * @library /lib/testlibrary - * @build jdk.testlibrary.IOUtils * @run main LambdaClassLoaderSerialization * @author Peter Levart */ @@ -38,9 +36,6 @@ import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import java.util.Arrays; - -import jdk.testlibrary.IOUtils; public class LambdaClassLoaderSerialization { @@ -130,7 +125,7 @@ public class LambdaClassLoaderSerialization { String path = name.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(path)) { if (is != null) { - byte[] bytes = IOUtils.readFully(is); + byte[] bytes = is.readAllBytes(); return defineClass(name, bytes, 0, bytes.length); } else { throw new ClassNotFoundException(name); diff --git a/jdk/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java b/jdk/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java index 4ad93eb3447..ebd99e4cf84 100644 --- a/jdk/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java +++ b/jdk/test/java/lang/reflect/Method/InterfaceStatic/StaticInterfaceMethodInWayOfDefault.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,19 +27,14 @@ * @summary Test that a static method on an interface doesn't hide a default * method with the same name and signature in a separate compilation * scenario. - * @library /lib/testlibrary - * @build jdk.testlibrary.IOUtils * @run main StaticInterfaceMethodInWayOfDefault */ import java.io.IOException; import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.concurrent.Callable; -import jdk.testlibrary.IOUtils; - public class StaticInterfaceMethodInWayOfDefault { public interface A_v1 { } @@ -147,7 +142,7 @@ public class StaticInterfaceMethodInWayOfDefault { String altPath = altName.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(altPath)) { if (is != null) { - byte[] bytes = IOUtils.readFully(is); + byte[] bytes = is.readAllBytes(); // patch class bytes to contain original name for (int i = 0; i < bytes.length - 2; i++) { if (bytes[i] == '_' && @@ -170,7 +165,7 @@ public class StaticInterfaceMethodInWayOfDefault { String path = name.replace('.', '/').concat(".class"); try (InputStream is = getResourceAsStream(path)) { if (is != null) { - byte[] bytes = IOUtils.readFully(is); + byte[] bytes = is.readAllBytes(); return defineClass(name, bytes, 0, bytes.length); } else { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/IOUtils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/IOUtils.java deleted file mode 100644 index 4bfddd0485c..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/IOUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -/** - * Defines useful I/O methods. - */ -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; - -public final class IOUtils { - - /* - * Prevent instantiation. - */ - private IOUtils() {} - - /** - * Read all bytes from in - * until EOF is detected. - * @param in input stream, must not be null - * @return bytes read - * @throws IOException Any IO error. - */ - public static byte[] readFully(InputStream is) throws IOException { - byte[] output = {}; - int pos = 0; - while (true) { - int bytesToRead; - if (pos >= output.length) { // Only expand when there's no room - bytesToRead = output.length + 1024; - if (output.length < pos + bytesToRead) { - output = Arrays.copyOf(output, pos + bytesToRead); - } - } else { - bytesToRead = output.length - pos; - } - int cc = is.read(output, pos, bytesToRead); - if (cc < 0) { - if (output.length != pos) { - output = Arrays.copyOf(output, pos); - } - break; - } - pos += cc; - } - return output; - } -} diff --git a/jdk/test/sun/security/tools/jarsigner/EntriesOrder.java b/jdk/test/sun/security/tools/jarsigner/EntriesOrder.java index 1b804bb9505..91eada85dd8 100644 --- a/jdk/test/sun/security/tools/jarsigner/EntriesOrder.java +++ b/jdk/test/sun/security/tools/jarsigner/EntriesOrder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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 @@ -25,11 +25,9 @@ * @test * @bug 8031572 * @summary jarsigner -verify exits with 0 when a jar file is not properly signed - * @library /lib/testlibrary * @modules java.base/sun.security.tools.keytool * jdk.jartool/sun.security.tools.jarsigner * jdk.jartool/sun.tools.jar - * @build jdk.testlibrary.IOUtils * @run main EntriesOrder */ @@ -45,8 +43,6 @@ import java.util.jar.JarInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import jdk.testlibrary.IOUtils; - public class EntriesOrder { public static void main(String[] args) throws Exception { @@ -114,7 +110,7 @@ public class EntriesOrder { Enumeration jes = jf.entries(); while (jes.hasMoreElements()) { JarEntry je = jes.nextElement(); - IOUtils.readFully(jf.getInputStream(je)); + jf.getInputStream(je).readAllBytes(); Certificate[] certs = je.getCertificates(); if (certs != null && certs.length > 0) { cc++; @@ -146,7 +142,7 @@ public class EntriesOrder { while (true) { JarEntry je = jis.getNextJarEntry(); if (je == null) break; - IOUtils.readFully(jis); + jis.readAllBytes(); Certificate[] certs = je.getCertificates(); if (certs != null && certs.length > 0) { cc++; From bf025a7c015e05eba9c4b31336269c1810a6a831 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 18 May 2017 17:07:36 -0700 Subject: [PATCH 067/105] 8180621: remove jdk.testlibrary.management.InputArguments Reviewed-by: mchung --- .../management/InputArguments.java | 88 ------------------- 1 file changed, 88 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/management/InputArguments.java diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/management/InputArguments.java b/jdk/test/lib/testlibrary/jdk/testlibrary/management/InputArguments.java deleted file mode 100644 index 7fc2f678490..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/management/InputArguments.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary.management; - -import java.lang.management.RuntimeMXBean; -import java.lang.management.ManagementFactory; -import java.util.List; - -/** - * This class provides access to the input arguments to the VM. - */ -public class InputArguments { - private static final List args; - - static { - RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); - args = runtimeMxBean.getInputArguments(); - } - - /** - * Returns true if {@code arg} is an input argument to the VM. - * - * This is useful for checking boolean flags such as -XX:+UseSerialGC or - * -XX:-UsePerfData. - * - * @param arg The name of the argument. - * @return {@code true} if the given argument is an input argument, - * otherwise {@code false}. - */ - public static boolean contains(String arg) { - return args.contains(arg); - } - - /** - * Returns true if {@code prefix} is the start of an input argument to the - * VM. - * - * This is useful for checking if flags describing a quantity, such as - * -XX:+MaxMetaspaceSize=100m, is set without having to know the quantity. - * To check if the flag -XX:MaxMetaspaceSize is set, use - * {@code InputArguments.containsPrefix("-XX:MaxMetaspaceSize")}. - * - * @param prefix The start of the argument. - * @return {@code true} if the given argument is the start of an input - * argument, otherwise {@code false}. - */ - public static boolean hasArgStartingWith(String prefix) { - for (String arg : args) { - if (arg.startsWith(prefix)) { - return true; - } - } - return false; - } - - /** - * Get the string containing input arguments passed to the VM - */ - public static String getInputArguments() { - StringBuilder result = new StringBuilder(); - for (String arg : args) - result.append(arg).append(' '); - - return result.toString(); - } - -} From 365839bc1dcf05d89558cfd0964b88688a2c843b Mon Sep 17 00:00:00 2001 From: Nishit Jain Date: Fri, 19 May 2017 11:06:57 +0530 Subject: [PATCH 068/105] 6609740: [Fmt-De] format error in DecimalFormat Reviewed-by: naoto --- .../classes/java/text/DecimalFormat.java | 46 +++---- .../text/Format/DecimalFormat/Bug6609740.java | 129 ++++++++++++++++++ 2 files changed, 152 insertions(+), 23 deletions(-) create mode 100644 jdk/test/java/text/Format/DecimalFormat/Bug6609740.java diff --git a/jdk/src/java.base/share/classes/java/text/DecimalFormat.java b/jdk/src/java.base/share/classes/java/text/DecimalFormat.java index 4484654afbd..05204f89e9d 100644 --- a/jdk/src/java.base/share/classes/java/text/DecimalFormat.java +++ b/jdk/src/java.base/share/classes/java/text/DecimalFormat.java @@ -3197,13 +3197,6 @@ public class DecimalFormat extends NumberFormat { isCurrencyFormat = false; useExponentialNotation = false; - // Two variables are used to record the subrange of the pattern - // occupied by phase 1. This is used during the processing of the - // second pattern (the one representing negative numbers) to ensure - // that no deviation exists in phase 1 between the two patterns. - int phaseOneStart = 0; - int phaseOneLength = 0; - int start = 0; for (int j = 1; j >= 0 && start < pattern.length(); --j) { boolean inQuote = false; @@ -3254,9 +3247,6 @@ public class DecimalFormat extends NumberFormat { ch == groupingSeparator || ch == decimalSeparator) { phase = 1; - if (j == 1) { - phaseOneStart = pos; - } --pos; // Reprocess this character continue; } else if (ch == CURRENCY_SIGN) { @@ -3327,17 +3317,29 @@ public class DecimalFormat extends NumberFormat { break; case 1: - // Phase one must be identical in the two sub-patterns. We - // enforce this by doing a direct comparison. While - // processing the first sub-pattern, we just record its - // length. While processing the second, we compare - // characters. - if (j == 1) { - ++phaseOneLength; - } else { - if (--phaseOneLength == 0) { - phase = 2; - affix = suffix; + // The negative subpattern (j = 0) serves only to specify the + // negative prefix and suffix, so all the phase 1 characters + // e.g. digits, zeroDigit, groupingSeparator, + // decimalSeparator, exponent are ignored + if (j == 0) { + while (pos < pattern.length()) { + char negPatternChar = pattern.charAt(pos); + if (negPatternChar == digit + || negPatternChar == zeroDigit + || negPatternChar == groupingSeparator + || negPatternChar == decimalSeparator) { + ++pos; + } else if (pattern.regionMatches(pos, exponent, + 0, exponent.length())) { + pos = pos + exponent.length(); + } else { + // Not a phase 1 character, consider it as + // suffix and parse it in phase 2 + --pos; //process it again in outer loop + phase = 2; + affix = suffix; + break; + } } continue; } @@ -3391,7 +3393,6 @@ public class DecimalFormat extends NumberFormat { while (pos < pattern.length() && pattern.charAt(pos) == zeroDigit) { ++minExponentDigits; - ++phaseOneLength; ++pos; } @@ -3410,7 +3411,6 @@ public class DecimalFormat extends NumberFormat { phase = 2; affix = suffix; --pos; - --phaseOneLength; continue; } break; diff --git a/jdk/test/java/text/Format/DecimalFormat/Bug6609740.java b/jdk/test/java/text/Format/DecimalFormat/Bug6609740.java new file mode 100644 index 00000000000..0dd8bd292d9 --- /dev/null +++ b/jdk/test/java/text/Format/DecimalFormat/Bug6609740.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 6609740 + * @summary Checks the formatting and parsing of a number based + * on the positive and negative sub-patterns, also + * checks few invalid number patterns + */ +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Locale; + +public class Bug6609740 { + + public static void main(String[] args) { + + double dNumber = -3456.349347; + String fOutput = "(3,456.35)"; + String[] validCases = {"#,##0.0#;(#,##0.0#)", "#,##0.0#;(#)", + "#,##0.0#;(#,##0)"}; + + // formatting with the valid cases + NumberFormat nf = NumberFormat.getInstance(Locale.US); + for (String pattern : validCases) { + formatOnPattern(nf, pattern, dNumber, fOutput); + } + + // parsing with the valid cases + String parseString = "(3,456.35)"; + Number pOutput = -3456.35; + for (String pattern : validCases) { + parseOnPattern(nf, pattern, parseString, pOutput); + } + + // should throw parse exception + String[] invalidParseCases = {"#,##0.0#;0", "#,##0.0#;()"}; + for (String pattern : invalidParseCases) { + if (nf instanceof DecimalFormat) { + ((DecimalFormat) nf).applyPattern(pattern); + } + + try { + nf.parse(parseString); + } catch (ParseException ex) { + continue; + } + throw new RuntimeException("[FAILED: Should throw" + + " ParseException for pattern: " + + pattern + " and input: " + parseString + "]"); + } + + // should throw exception on invalid patterns + // invalid patterns: no positive subpattern, zero after non-zero in + // the decimal part i.e. 0#0, multiple decimal separators, + // multiple percent, malformed pattern + String[] invalidPatterns = {";(#,##0.0#)", "#,##0.0#0;(#)", + "#,##0.0.#", "#,##0%%", ".#,##0"}; + for (String pattern : invalidPatterns) { + if (nf instanceof DecimalFormat) { + try { + ((DecimalFormat) nf).applyPattern(pattern); + } catch (IllegalArgumentException ex) { + continue; + } + throw new RuntimeException("[FAILED: Should throw" + + " IllegalArgumentException for invalid pattern: " + + pattern + "]"); + } + } + } + + private static void formatOnPattern(NumberFormat nf, String pattern, + double number, String expected) { + + if (nf instanceof DecimalFormat) { + ((DecimalFormat) nf).applyPattern(pattern); + } + + String formatted = nf.format(number); + if (!formatted.equals(expected)) { + throw new RuntimeException("[FAILED: Unable to format the number" + + " based on the pattern: '" + pattern + "', Expected : '" + + expected + "', Found: '" + formatted + "']"); + } + } + + private static void parseOnPattern(NumberFormat nf, String pattern, + String parseString, Number expected) { + + if (nf instanceof DecimalFormat) { + ((DecimalFormat) nf).applyPattern(pattern); + } + + try { + Number output = nf.parse(parseString); + if (expected.doubleValue() != output.doubleValue()) { + throw new RuntimeException("[FAILED: Unable to parse the number" + + " based on the pattern: '" + pattern + "', Expected : '" + + expected + "', Found: '" + output + "']"); + } + } catch (ParseException ex) { + throw new RuntimeException("[FAILED: Unable to parse the pattern:" + + " '" + pattern + "']", ex); + } + } + +} From 834902117a211fd96b4f2f0e7bee6ae16d750717 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 19 May 2017 13:33:17 -0700 Subject: [PATCH 069/105] 8180644: move jdk.testlibrary.NetworkConfiguration to the top level test library Reviewed-by: psandoz --- .../jdk/test/lib/NetworkConfiguration.java | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 test/lib/jdk/test/lib/NetworkConfiguration.java diff --git a/test/lib/jdk/test/lib/NetworkConfiguration.java b/test/lib/jdk/test/lib/NetworkConfiguration.java new file mode 100644 index 00000000000..b8a4720643a --- /dev/null +++ b/test/lib/jdk/test/lib/NetworkConfiguration.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib; + +import java.io.PrintStream; +import java.io.UncheckedIOException; +import java.io.IOException; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import static java.net.NetworkInterface.getNetworkInterfaces; +import static java.util.Collections.list; + +/** + * Helper class for retrieving network interfaces and local addresses + * suitable for testing. + */ +public class NetworkConfiguration { + + private Map> ip4Interfaces; + private Map> ip6Interfaces; + + private NetworkConfiguration( + Map> ip4Interfaces, + Map> ip6Interfaces) { + this.ip4Interfaces = ip4Interfaces; + this.ip6Interfaces = ip6Interfaces; + } + + /** + * Returns a stream of interfaces suitable for functional tests. + */ + public Stream interfaces() { + return Stream.concat(ip4Interfaces(), ip6Interfaces()) + .distinct(); + } + + /** + * Returns a stream of interfaces suitable for IPv4 functional tests. + */ + public Stream ip4Interfaces() { + return ip4Interfaces.keySet() + .stream() + .filter(NetworkConfiguration::isNotExcludedInterface) + .filter(hasIp4Addresses); + } + + /** + * Returns a stream of interfaces suitable for IPv6 functional tests. + */ + public Stream ip6Interfaces() { + return ip6Interfaces.keySet() + .stream() + .filter(NetworkConfiguration::isNotExcludedInterface) + .filter(hasIp6Addresses); + } + + private static boolean isNotExcludedInterface(NetworkInterface nif) { + if (Platform.isOSX() && nif.getName().contains("awdl")) { + return false; + } + String dName = nif.getDisplayName(); + if (Platform.isWindows() && dName != null && dName.contains("Teredo")) { + return false; + } + return true; + } + + private final Predicate hasIp4Addresses = nif -> + ip4Interfaces.get(nif).stream().anyMatch(a -> !a.isAnyLocalAddress()); + + private final Predicate hasIp6Addresses = nif -> + ip6Interfaces.get(nif).stream().anyMatch(a -> !a.isAnyLocalAddress()); + + + /** + * Returns a stream of interfaces suitable for IPv4 multicast tests. + */ + public Stream ip4MulticastInterfaces() { + return ip4Interfaces().filter(supportsIp4Multicast); + } + + /** + * Returns a stream of interfaces suitable for IPv6 multicast tests. + */ + public Stream ip6MulticastInterfaces() { + return ip6Interfaces().filter(supportsIp6Multicast); + } + + private final Predicate supportsIp4Multicast = nif -> { + try { + if (!nif.supportsMulticast() || nif.isLoopback()) { + return false; + } + return hasIp4Addresses.test(nif); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }; + + private final Predicate supportsIp6Multicast = nif -> { + try { + if (!nif.supportsMulticast() || nif.isLoopback()) { + return false; + } + + return hasIp6Addresses.test(nif); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }; + + /** + * Returns all addresses on all "functional" interfaces. + */ + public Stream addresses(NetworkInterface nif) { + return Stream.concat(ip4Interfaces.get(nif).stream(), + ip6Interfaces.get(nif).stream()); + } + + /** + * Returns all IPv4 addresses on all "functional" interfaces. + */ + public Stream ip4Addresses() { + return ip4Interfaces().flatMap(this::ip4Addresses); + } + + /** + * Returns all IPv6 addresses on all "functional" interfaces. + */ + public Stream ip6Addresses() { + return ip6Interfaces().flatMap(this::ip6Addresses); + } + + /** + * Returns all IPv4 addresses the given interface. + */ + public Stream ip4Addresses(NetworkInterface nif) { + return ip4Interfaces.get(nif).stream(); + } + + /** + * Returns all IPv6 addresses for the given interface. + */ + public Stream ip6Addresses(NetworkInterface nif) { + return ip6Interfaces.get(nif).stream(); + } + + /** + * Return a NetworkConfiguration instance. + */ + public static NetworkConfiguration probe() throws IOException { + Map> ip4Interfaces = new HashMap<>(); + Map> ip6Interfaces = new HashMap<>(); + + List nifs = list(getNetworkInterfaces()); + for (NetworkInterface nif : nifs) { + // ignore interfaces that are down + if (!nif.isUp() || nif.isPointToPoint()) { + continue; + } + + List ip4Addresses = new LinkedList<>(); + List ip6Addresses = new LinkedList<>(); + ip4Interfaces.put(nif, ip4Addresses); + ip6Interfaces.put(nif, ip6Addresses); + for (InetAddress addr : list(nif.getInetAddresses())) { + if (addr instanceof Inet4Address) { + ip4Addresses.add((Inet4Address) addr); + } else if (addr instanceof Inet6Address) { + ip6Addresses.add((Inet6Address) addr); + } + } + } + return new NetworkConfiguration(ip4Interfaces, ip6Interfaces); + } + + @Override + public String toString() { + return interfaces().map(NetworkConfiguration::interfaceInformation) + .collect(Collectors.joining()); + } + + /** Returns detailed information for the given interface. */ + public static String interfaceInformation(NetworkInterface nif) { + StringBuilder sb = new StringBuilder(); + try { + sb.append("Display name: ") + .append(nif.getDisplayName()) + .append("\n"); + sb.append("Name: ") + .append(nif.getName()) + .append("\n"); + for (InetAddress inetAddress : list(nif.getInetAddresses())) { + sb.append("InetAddress: ") + .append(inetAddress) + .append("\n"); + } + sb.append("Up? ") + .append(nif.isUp()) + .append("\n"); + sb.append("Loopback? ") + .append(nif.isLoopback()) + .append("\n"); + sb.append("PointToPoint? ") + .append(nif.isPointToPoint()) + .append("\n"); + sb.append("Supports multicast? ") + .append(nif.supportsMulticast()) + .append("\n"); + sb.append("Virtual? ") + .append(nif.isVirtual()) + .append("\n"); + sb.append("Hardware address: ") + .append(Arrays.toString(nif.getHardwareAddress())) + .append("\n"); + sb.append("MTU: ") + .append(nif.getMTU()) + .append("\n"); + sb.append("Index: ") + .append(nif.getIndex()) + .append("\n"); + sb.append("\n"); + return sb.toString(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + /** Prints all the system interface information to the give stream. */ + public static void printSystemConfiguration(PrintStream out) { + try { + out.println("*** all system network interface configuration ***"); + for (NetworkInterface nif : list(getNetworkInterfaces())) { + out.print(interfaceInformation(nif)); + } + out.println("*** end ***"); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} From f8c5d25081b76261c2d61e782b2467f0180bf38d Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 19 May 2017 13:33:47 -0700 Subject: [PATCH 070/105] 8180644: move jdk.testlibrary.NetworkConfiguration to the top level test library Reviewed-by: duke --- jdk/test/java/net/Inet6Address/B6206527.java | 5 +- jdk/test/java/net/Inet6Address/B6558853.java | 5 +- jdk/test/java/net/InetAddress/CheckJNI.java | 13 +- .../java/net/MulticastSocket/JoinLeave.java | 5 +- .../net/MulticastSocket/SetLoopbackMode.java | 6 +- .../java/net/NetworkConfigurationProbe.java | 5 +- jdk/test/java/net/Socket/LinkLocal.java | 6 +- .../SocketPermissionTest.java | 5 +- jdk/test/java/net/ipv6tests/B6521014.java | 5 +- .../DatagramChannel/BasicMulticastTests.java | 9 +- .../MulticastSendReceiveTests.java | 13 +- .../DatagramChannel/NetworkConfiguration.java | 101 ------- .../channels/DatagramChannel/Promiscuous.java | 9 +- .../jdk/testlibrary/NetworkConfiguration.java | 267 ------------------ .../https/HttpsURLConnection/B6216082.java | 6 +- 15 files changed, 49 insertions(+), 411 deletions(-) delete mode 100644 jdk/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java diff --git a/jdk/test/java/net/Inet6Address/B6206527.java b/jdk/test/java/net/Inet6Address/B6206527.java index 4fc90e170c0..9ce617b3437 100644 --- a/jdk/test/java/net/Inet6Address/B6206527.java +++ b/jdk/test/java/net/Inet6Address/B6206527.java @@ -25,14 +25,13 @@ * @test 1.1 05/01/05 * @bug 6206527 * @summary "cannot assign address" when binding ServerSocket on Suse 9 - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main B6206527 */ import java.net.*; import java.util.*; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; public class B6206527 { diff --git a/jdk/test/java/net/Inet6Address/B6558853.java b/jdk/test/java/net/Inet6Address/B6558853.java index 3c546c2f02c..408c30de64a 100644 --- a/jdk/test/java/net/Inet6Address/B6558853.java +++ b/jdk/test/java/net/Inet6Address/B6558853.java @@ -25,8 +25,7 @@ * @test * @bug 6558853 * @summary getHostAddress() on connections using IPv6 link-local addrs should have zone id - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main B6558853 */ @@ -35,7 +34,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.*; import java.util.Optional; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; public class B6558853 implements Runnable { private InetAddress addr = null; diff --git a/jdk/test/java/net/InetAddress/CheckJNI.java b/jdk/test/java/net/InetAddress/CheckJNI.java index 89f00a9c1a7..76ac633e921 100644 --- a/jdk/test/java/net/InetAddress/CheckJNI.java +++ b/jdk/test/java/net/InetAddress/CheckJNI.java @@ -22,17 +22,16 @@ */ /* @test - @bug 4889870 4890033 - @summary java -Xcheck:jni failing in net code on Solaris / [Datagram]Socket.getLocalAddress() failure - @library /lib/testlibrary - @build jdk.testlibrary.NetworkConfiguration - @run main/othervm -Xcheck:jni CheckJNI -*/ + * @bug 4889870 4890033 + * @summary java -Xcheck:jni failing in net code on Solaris / [Datagram]Socket.getLocalAddress() failure + * @library /test/lib + * @run main/othervm -Xcheck:jni CheckJNI + */ import java.net.*; import java.util.*; import java.util.stream.Collectors; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; public class CheckJNI { static Socket s; diff --git a/jdk/test/java/net/MulticastSocket/JoinLeave.java b/jdk/test/java/net/MulticastSocket/JoinLeave.java index 93dd93930b6..2e59a08444e 100644 --- a/jdk/test/java/net/MulticastSocket/JoinLeave.java +++ b/jdk/test/java/net/MulticastSocket/JoinLeave.java @@ -25,8 +25,7 @@ * @test * @bug 4091811 4148753 4102731 * @summary Test java.net.MulticastSocket joinGroup and leaveGroup - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main JoinLeave */ @@ -35,7 +34,7 @@ import java.io.UncheckedIOException; import java.net.InetAddress; import java.net.MulticastSocket; import java.net.NetworkInterface; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; public class JoinLeave { diff --git a/jdk/test/java/net/MulticastSocket/SetLoopbackMode.java b/jdk/test/java/net/MulticastSocket/SetLoopbackMode.java index c5c26e29be6..03bb39b48de 100644 --- a/jdk/test/java/net/MulticastSocket/SetLoopbackMode.java +++ b/jdk/test/java/net/MulticastSocket/SetLoopbackMode.java @@ -25,14 +25,14 @@ * @test * @bug 4686717 * @summary Test MulticastSocket.setLoopbackMode - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main/othervm SetLoopbackMode */ + import java.net.*; import java.io.IOException; import java.util.Enumeration; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; public class SetLoopbackMode { diff --git a/jdk/test/java/net/NetworkConfigurationProbe.java b/jdk/test/java/net/NetworkConfigurationProbe.java index 8b8127a55e2..607671b8045 100644 --- a/jdk/test/java/net/NetworkConfigurationProbe.java +++ b/jdk/test/java/net/NetworkConfigurationProbe.java @@ -24,15 +24,14 @@ /** * @test * @summary NOT A TEST. Captures the network interface configuration. - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main NetworkConfigurationProbe */ import java.net.Inet4Address; import java.net.Inet6Address; import java.net.NetworkInterface; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; import static java.util.stream.Collectors.joining; import static java.lang.System.out; diff --git a/jdk/test/java/net/Socket/LinkLocal.java b/jdk/test/java/net/Socket/LinkLocal.java index e62522cb581..9957c5c44f0 100644 --- a/jdk/test/java/net/Socket/LinkLocal.java +++ b/jdk/test/java/net/Socket/LinkLocal.java @@ -26,11 +26,11 @@ * @bug 4469866 * @summary Connecting to a link-local IPv6 address should not * causes a SocketException to be thrown. - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main LinkLocal */ -import jdk.testlibrary.NetworkConfiguration; + +import jdk.test.lib.NetworkConfiguration; import java.net.*; import java.util.List; diff --git a/jdk/test/java/net/SocketPermission/SocketPermissionTest.java b/jdk/test/java/net/SocketPermission/SocketPermissionTest.java index e67802afc33..360fd2c8c62 100644 --- a/jdk/test/java/net/SocketPermission/SocketPermissionTest.java +++ b/jdk/test/java/net/SocketPermission/SocketPermissionTest.java @@ -25,8 +25,7 @@ * @test * @bug 8047031 * @summary SocketPermission tests for legacy socket types - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run testng/othervm SocketPermissionTest */ @@ -55,7 +54,7 @@ import org.testng.annotations.Test; import static org.testng.Assert.*; -import static jdk.testlibrary.NetworkConfiguration.probe; +import static jdk.test.lib.NetworkConfiguration.probe; import static java.nio.charset.StandardCharsets.UTF_8; public class SocketPermissionTest { diff --git a/jdk/test/java/net/ipv6tests/B6521014.java b/jdk/test/java/net/ipv6tests/B6521014.java index 5efa77d9663..a622bb1a69d 100644 --- a/jdk/test/java/net/ipv6tests/B6521014.java +++ b/jdk/test/java/net/ipv6tests/B6521014.java @@ -25,15 +25,14 @@ * @test * @bug 6521014 6543428 * @summary IOException thrown when Socket tries to bind to an local IPv6 address on SuSE Linux - * @library /lib/testlibrary - * @build jdk.testlibrary.NetworkConfiguration + * @library /test/lib * @run main B6521014 */ import java.net.*; import java.io.*; import java.util.*; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; /* * diff --git a/jdk/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java b/jdk/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java index c60b6b7cd94..4ce1b41f701 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java +++ b/jdk/test/java/nio/channels/DatagramChannel/BasicMulticastTests.java @@ -24,7 +24,8 @@ /* @test * @bug 4527345 * @summary Unit test for DatagramChannel's multicast support - * @build BasicMulticastTests NetworkConfiguration + * @library /test/lib + * @build BasicMulticastTests * @run main BasicMulticastTests */ @@ -34,6 +35,8 @@ import java.net.*; import java.util.*; import java.io.IOException; +import jdk.test.lib.NetworkConfiguration; + public class BasicMulticastTests { /** @@ -204,14 +207,14 @@ public class BasicMulticastTests { NetworkConfiguration config = NetworkConfiguration.probe(); - NetworkInterface nif = config.ip4Interfaces().iterator().next(); + NetworkInterface nif = config.ip4MulticastInterfaces().iterator().next(); InetAddress anySource = config.ip4Addresses(nif).iterator().next(); membershipKeyTests(nif, ip4Group, anySource); exceptionTests(nif); // re-run the membership key tests with IPv6 if available - Iterator iter = config.ip6Interfaces().iterator(); + Iterator iter = config.ip6MulticastInterfaces().iterator(); if (iter.hasNext()) { nif = iter.next(); anySource = config.ip6Addresses(nif).iterator().next(); diff --git a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java index db061a833fc..591e3945e98 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java +++ b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java @@ -24,7 +24,8 @@ /* @test * @bug 4527345 7026376 6633549 * @summary Unit test for DatagramChannel's multicast support - * @build MulticastSendReceiveTests NetworkConfiguration + * @library /test/lib + * @build MulticastSendReceiveTests * @run main MulticastSendReceiveTests * @run main/othervm -Djava.net.preferIPv4Stack=true MulticastSendReceiveTests * @key randomness @@ -36,6 +37,9 @@ import java.net.*; import static java.net.StandardProtocolFamily.*; import java.util.*; import java.io.IOException; +import java.util.stream.Collectors; + +import jdk.test.lib.NetworkConfiguration; public class MulticastSendReceiveTests { @@ -238,14 +242,15 @@ public class MulticastSendReceiveTests { // multicast groups used for the test InetAddress ip4Group = InetAddress.getByName("225.4.5.6"); InetAddress ip6Group = InetAddress.getByName("ff02::a"); - - for (NetworkInterface nif: config.ip4Interfaces()) { + for (NetworkInterface nif: config.ip4MulticastInterfaces() + .collect(Collectors.toList())) { InetAddress source = config.ip4Addresses(nif).iterator().next(); test(INET, nif, ip4Group, source); test(UNSPEC, nif, ip4Group, source); } - for (NetworkInterface nif: config.ip6Interfaces()) { + for (NetworkInterface nif: config.ip6MulticastInterfaces() + .collect(Collectors.toList())) { InetAddress source = config.ip6Addresses(nif).iterator().next(); test(INET6, nif, ip6Group, source); test(UNSPEC, nif, ip6Group, source); diff --git a/jdk/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java b/jdk/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java deleted file mode 100644 index f2d2567bb2a..00000000000 --- a/jdk/test/java/nio/channels/DatagramChannel/NetworkConfiguration.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.net.*; -import java.util.*; -import java.io.IOException; - -/** - * Helper class for multicasting tests. - */ - -class NetworkConfiguration { - - private Map> ip4Interfaces; - private Map> ip6Interfaces; - - private NetworkConfiguration(Map> ip4Interfaces, - Map> ip6Interfaces) - { - this.ip4Interfaces = ip4Interfaces; - this.ip6Interfaces = ip6Interfaces; - } - - Iterable ip4Interfaces() { - return ip4Interfaces.keySet(); - } - - Iterable ip6Interfaces() { - return ip6Interfaces.keySet(); - } - - Iterable ip4Addresses(NetworkInterface nif) { - return ip4Interfaces.get(nif); - } - - Iterable ip6Addresses(NetworkInterface nif) { - return ip6Interfaces.get(nif); - } - - private static final boolean isMacOs = - System.getProperty("os.name").equals("Mac OS X"); - - static NetworkConfiguration probe() throws IOException { - Map> ip4Interfaces = - new HashMap>(); - Map> ip6Interfaces = - new HashMap>(); - - // find the interfaces that support IPv4 and IPv6 - List nifs = Collections - .list(NetworkInterface.getNetworkInterfaces()); - for (NetworkInterface nif: nifs) { - // ignore intertaces that are down or don't support multicast - if (!nif.isUp() || !nif.supportsMulticast() || nif.isLoopback() - || (isMacOs && nif.getName().contains("awdl"))) - continue; - - List addrs = Collections.list(nif.getInetAddresses()); - for (InetAddress addr: addrs) { - if (!addr.isAnyLocalAddress()) { - if (addr instanceof Inet4Address) { - List list = ip4Interfaces.get(nif); - if (list == null) { - list = new LinkedList(); - } - list.add(addr); - ip4Interfaces.put(nif, list); - } else if (addr instanceof Inet6Address) { - List list = ip6Interfaces.get(nif); - if (list == null) { - list = new LinkedList(); - } - list.add(addr); - ip6Interfaces.put(nif, list); - } - } - } - } - return new NetworkConfiguration(ip4Interfaces, ip6Interfaces); - } -} diff --git a/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java index 21c8c18440f..d79a641002c 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java +++ b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java @@ -25,7 +25,8 @@ * @bug 8014377 * @summary Test for interference when two sockets are bound to the same * port but joined to different multicast groups - * @build Promiscuous NetworkConfiguration + * @library /test/lib + * @build Promiscuous * @run main Promiscuous * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous * @key randomness @@ -37,6 +38,9 @@ import java.net.*; import static java.net.StandardProtocolFamily.*; import java.util.*; import java.io.IOException; +import java.util.stream.Collectors; + +import jdk.test.lib.NetworkConfiguration; public class Promiscuous { @@ -208,7 +212,8 @@ public class Promiscuous { InetAddress ip4Group1 = InetAddress.getByName("225.4.5.6"); InetAddress ip4Group2 = InetAddress.getByName("225.4.6.6"); - for (NetworkInterface nif: config.ip4Interfaces()) { + for (NetworkInterface nif: config.ip4MulticastInterfaces() + .collect(Collectors.toList())) { InetAddress source = config.ip4Addresses(nif).iterator().next(); test(INET, nif, ip4Group1, ip4Group2); diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java b/jdk/test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java deleted file mode 100644 index 77544d2bd92..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/NetworkConfiguration.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.io.PrintStream; -import java.io.UncheckedIOException; -import java.io.IOException; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Predicate; -import java.util.stream.Stream; -import static java.net.NetworkInterface.getNetworkInterfaces; -import static java.util.Collections.list; - -/** - * Helper class for retrieving network interfaces and local addresses - * suitable for testing. - */ -public class NetworkConfiguration { - - static final boolean isWindows = - System.getProperty("os.name").startsWith("Windows"); - static final boolean isMacOS = - System.getProperty("os.name").contains("OS X"); - - private Map> ip4Interfaces; - private Map> ip6Interfaces; - - private NetworkConfiguration(Map> ip4Interfaces, - Map> ip6Interfaces) - { - this.ip4Interfaces = ip4Interfaces; - this.ip6Interfaces = ip6Interfaces; - } - - /** - * Returns a stream of interfaces suitable for functional tests. - */ - public Stream interfaces() { - return Stream.concat(ip4Interfaces(), ip6Interfaces()) - .distinct(); - } - - /** - * Returns a stream of interfaces suitable for IPv4 functional tests. - */ - public Stream ip4Interfaces() { - return ip4Interfaces.keySet().stream() - .filter(NetworkConfiguration::isNotExcludedInterface) - .filter(hasIp4Addresses); - } - - /** - * Returns a stream of interfaces suitable for IPv6 functional tests. - */ - public Stream ip6Interfaces() { - return ip6Interfaces.keySet().stream() - .filter(NetworkConfiguration::isNotExcludedInterface) - .filter(hasIp6Addresses); - } - - private static boolean isNotExcludedInterface(NetworkInterface nif) { - if (isMacOS && nif.getName().contains("awdl")) - return false; - String dName = nif.getDisplayName(); - if (isWindows && dName != null && dName.contains("Teredo")) - return false; - return true; - } - - private final Predicate hasIp4Addresses = nif -> { - Optional addr = ip4Interfaces.get(nif).stream() - .filter(a -> !a.isAnyLocalAddress()) - .findAny(); - - return addr.isPresent(); - }; - - private final Predicate hasIp6Addresses = nif -> { - Optional addr = ip6Interfaces.get(nif).stream() - .filter(a -> !a.isAnyLocalAddress()) - .findAny(); - - return addr.isPresent(); - }; - - - /** - * Returns a stream of interfaces suitable for IPv4 multicast tests. - */ - public Stream ip4MulticastInterfaces() { - return ip4Interfaces().filter(supportsIp4Multicast); - } - - /** - * Returns a stream of interfaces suitable for IPv6 multicast tests. - */ - public Stream ip6MulticastInterfaces() { - return ip6Interfaces().filter(supportsIp6Multicast); - } - - private final Predicate supportsIp4Multicast = nif -> { - try { - if (!nif.supportsMulticast() || nif.isLoopback()) - return false; - - Optional addr = ip4Interfaces.get(nif).stream() - .filter(a -> !a.isAnyLocalAddress()) - .findAny(); - - return addr.isPresent(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - }; - - private final Predicate supportsIp6Multicast = nif -> { - try { - if (!nif.supportsMulticast() || nif.isLoopback()) - return false; - - Optional addr = ip6Interfaces.get(nif).stream() - .filter(a -> !a.isAnyLocalAddress()) - .findAny(); - - return addr.isPresent(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - }; - - /** - * Returns all addresses on all "functional" interfaces. - */ - public Stream addresses(NetworkInterface nif) { - return Stream.concat(ip4Interfaces.get(nif).stream(), - ip6Interfaces.get(nif).stream()); - } - - /** - * Returns all IPv4 addresses on all "functional" interfaces. - */ - public Stream ip4Addresses() { - return ip4Interfaces().flatMap(nif -> ip4Addresses(nif)); - } - - /** - * Returns all IPv6 addresses on all "functional" interfaces. - */ - public Stream ip6Addresses() { - return ip6Interfaces().flatMap(nif -> ip6Addresses(nif)); - } - - /** - * Returns all IPv4 addresses the given interface. - */ - public Stream ip4Addresses(NetworkInterface nif) { - return ip4Interfaces.get(nif).stream(); - } - - /** - * Returns all IPv6 addresses for the given interface. - */ - public Stream ip6Addresses(NetworkInterface nif) { - return ip6Interfaces.get(nif).stream(); - } - - /** - * Return a NetworkConfiguration instance. - */ - public static NetworkConfiguration probe() throws IOException { - Map> ip4Interfaces = new HashMap<>(); - Map> ip6Interfaces = new HashMap<>(); - - List nifs = list(getNetworkInterfaces()); - for (NetworkInterface nif : nifs) { - // ignore interfaces that are down - if (!nif.isUp() || nif.isPointToPoint()) - continue; - - List ip4Addresses = new LinkedList<>(); - List ip6Addresses = new LinkedList<>(); - ip4Interfaces.put(nif, ip4Addresses); - ip6Interfaces.put(nif, ip6Addresses); - for (InetAddress addr : list(nif.getInetAddresses())) { - if (addr instanceof Inet4Address) - ip4Addresses.add((Inet4Address)addr); - else if (addr instanceof Inet6Address) - ip6Addresses.add((Inet6Address)addr); - } - } - return new NetworkConfiguration(ip4Interfaces, ip6Interfaces); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - interfaces().forEach(nif -> sb.append(interfaceInformation(nif))); - return sb.toString(); - } - - /** Returns detailed information for the given interface. */ - public static String interfaceInformation(NetworkInterface nif) { - StringBuilder sb = new StringBuilder(); - try { - sb.append("Display name: " + nif.getDisplayName() + "\n"); - sb.append("Name: " + nif.getName() + "\n"); - for (InetAddress inetAddress : list(nif.getInetAddresses())) - sb.append("InetAddress: " + inetAddress + "\n"); - sb.append("Up? " + nif.isUp() + "\n"); - sb.append("Loopback? " + nif.isLoopback() + "\n"); - sb.append("PointToPoint? " + nif.isPointToPoint() + "\n"); - sb.append("Supports multicast? " + nif.supportsMulticast() + "\n"); - sb.append("Virtual? " + nif.isVirtual() + "\n"); - sb.append("Hardware address: " + - Arrays.toString(nif.getHardwareAddress()) + "\n"); - sb.append("MTU: " + nif.getMTU() + "\n"); - sb.append("Index: " + nif.getIndex() + "\n"); - sb.append("\n"); - return sb.toString(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - - /** Prints all the system interface information to the give stream. */ - public static void printSystemConfiguration(PrintStream out) { - try { - out.println("*** all system network interface configuration ***"); - List nifs = list(getNetworkInterfaces()); - for (NetworkInterface nif : nifs) - out.print(interfaceInformation(nif)); - out.println("*** end ***"); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } -} diff --git a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java index fbdad8c8953..be761a789a7 100644 --- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java +++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java @@ -31,9 +31,9 @@ * @bug 6216082 * @summary Redirect problem with HttpsURLConnection using a proxy * @modules java.base/sun.net.www - * @library .. /lib/testlibrary + * @library .. /test/lib * @build HttpCallback TestHttpsServer ClosedChannelList - * HttpTransaction TunnelProxy jdk.testlibrary.NetworkConfiguration + * HttpTransaction TunnelProxy * @key intermittent * @run main/othervm B6216082 */ @@ -43,7 +43,7 @@ import java.net.*; import javax.net.ssl.*; import java.util.*; -import jdk.testlibrary.NetworkConfiguration; +import jdk.test.lib.NetworkConfiguration; public class B6216082 { static SimpleHttpTransaction httpTrans; From 095e01f97067d10d107150ca11240ce4b00aea42 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 22 May 2017 15:50:09 +0200 Subject: [PATCH 071/105] 8180745: Add --release 10 as an alias for --release 9 Reviewed-by: mcimadamore --- .../com/sun/tools/javac/platform/JDKPlatformProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java index 9cfb2eb8ddb..3ece0dd65f8 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java @@ -66,7 +66,7 @@ public class JDKPlatformProvider implements PlatformProvider { @Override public PlatformDescription getPlatform(String platformName, String options) { - return new PlatformDescriptionImpl(platformName); + return new PlatformDescriptionImpl(platformName.equals("10") ? "9" : platformName); } private static final String[] symbolFileLocation = { "lib", "ct.sym" }; @@ -93,6 +93,10 @@ public class JDKPlatformProvider implements PlatformProvider { } catch (IOException | ProviderNotFoundException ex) { } } + + if (SUPPORTED_JAVA_PLATFORM_VERSIONS.contains("9")) { + SUPPORTED_JAVA_PLATFORM_VERSIONS.add("10"); + } } private static String targetNumericVersion(Target target) { From b8f2a6edadf32f268dd4299df83e26076aa64cdc Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Mon, 22 May 2017 09:44:14 -0700 Subject: [PATCH 072/105] 8180720: method InferenceGraph.initNodes() can potentially add a trivial dependency of a node to itself Reviewed-by: mcimadamore --- .../share/classes/com/sun/tools/javac/comp/Infer.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java index a5cab459056..641283ab427 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java @@ -1889,10 +1889,13 @@ public class Infer { Type i = n_i.data.first(); for (Node n_j : nodes) { Type j = n_j.data.first(); - UndetVar uv_i = (UndetVar)inferenceContext.asUndetVar(i); - if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) { - //update i's bound dependencies - n_i.addDependency(n_j); + // don't compare a variable to itself + if (i != j) { + UndetVar uv_i = (UndetVar)inferenceContext.asUndetVar(i); + if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) { + //update i's bound dependencies + n_i.addDependency(n_j); + } } } } From 32e18391c5cc2adc1893812138233a7a3574adb9 Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Mon, 22 May 2017 12:49:05 -0700 Subject: [PATCH 073/105] 8180660: missing LNT entry for finally block Co-authored-by: Maurizio Cimadamore Reviewed-by: mcimadamore, vromero --- .../classes/com/sun/tools/javac/jvm/Gen.java | 9 +- .../com/sun/tools/javac/tree/TreeInfo.java | 24 ++- .../InlinedFinallyConfuseDebuggersTest.java | 3 +- .../MissingLNTEntryForFinalizerTest.java | 180 ++++++++++++++++++ .../linenumbers/FinallyLineNumberTest.java | 15 +- 5 files changed, 220 insertions(+), 11 deletions(-) create mode 100644 langtools/test/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java index 4d5af67f195..c8a63a2cc74 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -25,6 +25,7 @@ package com.sun.tools.javac.jvm; +import com.sun.tools.javac.tree.TreeInfo.PosKind; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.List; @@ -1399,12 +1400,16 @@ public class Gen extends JCTree.Visitor { catchallpc, 0); startseg = env.info.gaps.next().intValue(); } - code.statBegin(TreeInfo.finalizerPos(env.tree)); + code.statBegin(TreeInfo.finalizerPos(env.tree, PosKind.FIRST_STAT_POS)); code.markStatBegin(); Item excVar = makeTemp(syms.throwableType); excVar.store(); genFinalizer(env); + code.resolvePending(); + code.statBegin(TreeInfo.finalizerPos(env.tree, PosKind.END_POS)); + code.markStatBegin(); + excVar.load(); registerCatch(body.pos(), startseg, env.info.gaps.next().intValue(), @@ -1418,7 +1423,7 @@ public class Gen extends JCTree.Visitor { code.resolve(env.info.cont); // Mark statement line number - code.statBegin(TreeInfo.finalizerPos(env.tree)); + code.statBegin(TreeInfo.finalizerPos(env.tree, PosKind.FIRST_STAT_POS)); code.markStatBegin(); // Save return address. diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java index b0f430b0862..1796c4dd890 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,6 +46,8 @@ import static com.sun.tools.javac.tree.JCTree.Tag.SYNCHRONIZED; import javax.tools.JavaFileObject; +import java.util.function.ToIntFunction; + import static com.sun.tools.javac.tree.JCTree.JCOperatorExpression.OperandPos.LEFT; import static com.sun.tools.javac.tree.JCTree.JCOperatorExpression.OperandPos.RIGHT; @@ -580,13 +582,29 @@ public class TreeInfo { }; } + public enum PosKind { + START_POS(TreeInfo::getStartPos), + FIRST_STAT_POS(TreeInfo::firstStatPos), + END_POS(TreeInfo::endPos); + + final ToIntFunction posFunc; + + PosKind(ToIntFunction posFunc) { + this.posFunc = posFunc; + } + + int toPos(JCTree tree) { + return posFunc.applyAsInt(tree); + } + } + /** The position of the finalizer of given try/synchronized statement. */ - public static int finalizerPos(JCTree tree) { + public static int finalizerPos(JCTree tree, PosKind posKind) { if (tree.hasTag(TRY)) { JCTry t = (JCTry) tree; Assert.checkNonNull(t.finalizer); - return firstStatPos(t.finalizer); + return posKind.toPos(t.finalizer); } else if (tree.hasTag(SYNCHRONIZED)) { return endPos(((JCSynchronized) tree).body); } else { diff --git a/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java b/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java index 9edfb58cc38..721e9f72002 100644 --- a/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java +++ b/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,6 +72,7 @@ public class InlinedFinallyConfuseDebuggersTest { {9, 21}, //System.out.println("finally"); {10, 29}, {9, 32}, //System.out.println("finally"); + {10, 41}, //} {11, 43}, }; diff --git a/langtools/test/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java b/langtools/test/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java new file mode 100644 index 00000000000..49e4026fd07 --- /dev/null +++ b/langtools/test/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java @@ -0,0 +1,180 @@ +/* + * 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 8180141 + * @summary Missing entry in LineNumberTable for break statement that jumps out of try-finally + * @modules jdk.jdeps/com.sun.tools.classfile + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.comp + * jdk.compiler/com.sun.tools.javac.file + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.tree + * jdk.compiler/com.sun.tools.javac.util + * @compile -g MissingLNTEntryForFinalizerTest.java + * @run main MissingLNTEntryForFinalizerTest + */ + +import java.io.File; +import java.net.URI; + +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; + +import com.sun.tools.classfile.*; +import com.sun.tools.javac.comp.Attr; +import com.sun.tools.javac.comp.AttrContext; +import com.sun.tools.javac.comp.Env; +import com.sun.tools.javac.comp.Modules; +import com.sun.tools.javac.file.JavacFileManager; +import com.sun.tools.javac.main.JavaCompiler; +import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.tree.JCTree.*; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.List; + +import static com.sun.tools.javac.util.List.of; +import static com.sun.tools.javac.tree.JCTree.Tag.*; + +public class MissingLNTEntryForFinalizerTest { + protected ReusableJavaCompiler tool; + Context context; + + MissingLNTEntryForFinalizerTest() { + context = new Context(); + JavacFileManager.preRegister(context); + MyAttr.preRegister(context); + tool = new ReusableJavaCompiler(context); + } + + public static void main(String... args) throws Throwable { + new MissingLNTEntryForFinalizerTest().test(); + } + + void test() throws Throwable { + JavaSource source = new JavaSource("1"); + tool.clear(); + List inputs = of(source); + try { + tool.compile(inputs); + } catch (Throwable ex) { + throw new AssertionError(ex); + } + File testClasses = new File("."); + File file = new File(testClasses, "Test1.class"); + ClassFile classFile = ClassFile.read(file); + for (Method m : classFile.methods) { + if (classFile.constant_pool.getUTF8Value(m.name_index).equals("foo")) { + Code_attribute code = (Code_attribute)m.attributes.get(Attribute.Code); + LineNumberTable_attribute lnt = (LineNumberTable_attribute)code.attributes.get(Attribute.LineNumberTable); + checkLNT(lnt, MyAttr.lineNumber); + } + } + } + + void checkLNT(LineNumberTable_attribute lnt, int lineToCheckFor) { + for (LineNumberTable_attribute.Entry e: lnt.line_number_table) { + if (e.line_number == lineToCheckFor) { + return; + } + } + throw new AssertionError("seek line number not found in the LNT for method foo()"); + } + + class JavaSource extends SimpleJavaFileObject { + String id; + String template = + "import java.util.*;\n" + + "class Test#Id {\n" + + " void foo() {\n" + + " List l = null;\n" + + " String first = null;\n" + + " try {\n" + + " first = l.get(0);\n" + + " } finally {\n" + + " if (first != null) {\n" + + " System.out.println(\"finalizer\");\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; + + JavaSource(String id) { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + this.id = id; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return template.replace("#Id", id); + } + } + + /* this class has been set up to do not depend on a fixed line number, this Attr subclass will + * look for 'break' or 'continue' statements in order to find the actual line number they occupy. + * This way the test can find if that line number appears in the LNT generated for a given class. + */ + static class MyAttr extends Attr { + static int lineNumber; + + static void preRegister(Context context) { + context.put(attrKey, (com.sun.tools.javac.util.Context.Factory) c -> new MyAttr(c)); + } + + MyAttr(Context context) { + super(context); + } + + @Override + public com.sun.tools.javac.code.Type attribStat(JCTree tree, Env env) { + com.sun.tools.javac.code.Type result = super.attribStat(tree, env); + if (tree.hasTag(TRY)) { + JCTry tryTree = (JCTry)tree; + lineNumber = env.toplevel.lineMap.getLineNumber(tryTree.finalizer.endpos); + } + return result; + } + } + + static class ReusableJavaCompiler extends JavaCompiler { + ReusableJavaCompiler(Context context) { + super(context); + } + + @Override + protected void checkReusable() { + // do nothing + } + + @Override + public void close() { + //do nothing + } + + void clear() { + newRound(); + Modules.instance(context).newRound(); + } + } +} diff --git a/langtools/test/tools/javac/linenumbers/FinallyLineNumberTest.java b/langtools/test/tools/javac/linenumbers/FinallyLineNumberTest.java index 892d36589b2..51946f63884 100644 --- a/langtools/test/tools/javac/linenumbers/FinallyLineNumberTest.java +++ b/langtools/test/tools/javac/linenumbers/FinallyLineNumberTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ import com.sun.tools.classfile.Code_attribute; import com.sun.tools.classfile.LineNumberTable_attribute; import com.sun.tools.classfile.LineNumberTable_attribute.Entry; -import java.io.File; import java.io.IOException; public class FinallyLineNumberTest { @@ -46,13 +45,13 @@ public class FinallyLineNumberTest { if (lines == null) { throw new Exception("finally line number table could not be loaded"); } - if (lines.length != 4) { + if (lines.length != 5) { // Help debug System.err.println("LineTable error, got lines:"); for (Entry e : lines) { System.err.println(e.line_number); } - throw new Exception("finally line number table incorrect: length=" + lines.length + " expected length=4"); + throw new Exception("finally line number table incorrect: length=" + lines.length + " expected length=5"); } // return null line, for the load null operation @@ -71,11 +70,17 @@ public class FinallyLineNumberTest { throw new Exception("finally line number table incorrect: got=" + current + " expected=" + first); } - // finally line, for when exception is thrown + // for when exception is thrown current = lines[3].line_number; if (current != first + 2) { throw new Exception("finally line number table incorrect: got=" + current + " expected=" + (first + 2)); } + + // the '}' closing the finally block + current = lines[4].line_number; + if (current != first + 3) { + throw new Exception("finally line number table incorrect: got=" + current + " expected=" + (first + 3)); + } } static Entry[] findEntries() throws IOException, ConstantPoolException { From fd9c3d8158adecf5fa953226e883d9af01bfb4af Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 23 May 2017 11:58:32 -0400 Subject: [PATCH 074/105] 8139673: NMT stack traces in output should show mtcomponent Show memory types of malloc site in detail report Co-authored-by: Max Ockner Reviewed-by: dholmes, shade, coleenp --- .../src/share/vm/services/mallocSiteTable.cpp | 18 ++++++------- .../src/share/vm/services/mallocSiteTable.hpp | 27 ++++++++++++------- .../src/share/vm/services/mallocTracker.cpp | 6 ++--- .../src/share/vm/services/mallocTracker.hpp | 4 +-- hotspot/src/share/vm/services/memReporter.cpp | 18 +++++++++---- hotspot/src/share/vm/services/memReporter.hpp | 4 +-- 6 files changed, 46 insertions(+), 31 deletions(-) diff --git a/hotspot/src/share/vm/services/mallocSiteTable.cpp b/hotspot/src/share/vm/services/mallocSiteTable.cpp index 4ab10b49a52..caf3ee820e4 100644 --- a/hotspot/src/share/vm/services/mallocSiteTable.cpp +++ b/hotspot/src/share/vm/services/mallocSiteTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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 @@ -97,7 +97,7 @@ bool MallocSiteTable::initialize() { // Instantiate hash entry for hashtable entry allocation callsite MallocSiteHashtableEntry* entry = ::new ((void*)_hash_entry_allocation_site) - MallocSiteHashtableEntry(*stack); + MallocSiteHashtableEntry(*stack, mtNMT); // Add the allocation site to hashtable. int index = hash_to_index(stack->hash()); @@ -134,14 +134,15 @@ bool MallocSiteTable::walk(MallocSiteWalker* walker) { * Under any of above circumstances, caller should handle the situation. */ MallocSite* MallocSiteTable::lookup_or_add(const NativeCallStack& key, size_t* bucket_idx, - size_t* pos_idx) { + size_t* pos_idx, MEMFLAGS flags) { + assert(flags != mtNone, "Should have a real memory type"); unsigned int index = hash_to_index(key.hash()); *bucket_idx = (size_t)index; *pos_idx = 0; // First entry for this hash bucket if (_table[index] == NULL) { - MallocSiteHashtableEntry* entry = new_entry(key); + MallocSiteHashtableEntry* entry = new_entry(key, flags); // OOM check if (entry == NULL) return NULL; @@ -156,13 +157,12 @@ MallocSite* MallocSiteTable::lookup_or_add(const NativeCallStack& key, size_t* b MallocSiteHashtableEntry* head = _table[index]; while (head != NULL && (*pos_idx) <= MAX_BUCKET_LENGTH) { MallocSite* site = head->data(); - if (site->equals(key)) { - // found matched entry + if (site->flags() == flags && site->equals(key)) { return head->data(); } if (head->next() == NULL && (*pos_idx) < MAX_BUCKET_LENGTH) { - MallocSiteHashtableEntry* entry = new_entry(key); + MallocSiteHashtableEntry* entry = new_entry(key, flags); // OOM check if (entry == NULL) return NULL; if (head->atomic_insert(entry)) { @@ -191,10 +191,10 @@ MallocSite* MallocSiteTable::malloc_site(size_t bucket_idx, size_t pos_idx) { // Allocates MallocSiteHashtableEntry object. Special call stack // (pre-installed allocation site) has to be used to avoid infinite // recursion. -MallocSiteHashtableEntry* MallocSiteTable::new_entry(const NativeCallStack& key) { +MallocSiteHashtableEntry* MallocSiteTable::new_entry(const NativeCallStack& key, MEMFLAGS flags) { void* p = AllocateHeap(sizeof(MallocSiteHashtableEntry), mtNMT, *hash_entry_allocation_stack(), AllocFailStrategy::RETURN_NULL); - return ::new (p) MallocSiteHashtableEntry(key); + return ::new (p) MallocSiteHashtableEntry(key, flags); } void MallocSiteTable::reset() { diff --git a/hotspot/src/share/vm/services/mallocSiteTable.hpp b/hotspot/src/share/vm/services/mallocSiteTable.hpp index 1081ef00014..fa4d2b54801 100644 --- a/hotspot/src/share/vm/services/mallocSiteTable.hpp +++ b/hotspot/src/share/vm/services/mallocSiteTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,12 +37,16 @@ // MallocSite represents a code path that eventually calls // os::malloc() to allocate memory class MallocSite : public AllocationSite { + private: + MEMFLAGS _flags; + public: MallocSite() : - AllocationSite(NativeCallStack::EMPTY_STACK) { } + AllocationSite(NativeCallStack::EMPTY_STACK), _flags(mtNone) {} + + MallocSite(const NativeCallStack& stack, MEMFLAGS flags) : + AllocationSite(stack), _flags(flags) {} - MallocSite(const NativeCallStack& stack) : - AllocationSite(stack) { } void allocate(size_t size) { data()->allocate(size); } void deallocate(size_t size) { data()->deallocate(size); } @@ -51,6 +55,7 @@ class MallocSite : public AllocationSite { size_t size() const { return peek()->size(); } // The number of calls were made size_t count() const { return peek()->count(); } + MEMFLAGS flags() const { return (MEMFLAGS)_flags; } }; // Malloc site hashtable entry @@ -62,8 +67,10 @@ class MallocSiteHashtableEntry : public CHeapObj { public: MallocSiteHashtableEntry() : _next(NULL) { } - MallocSiteHashtableEntry(const NativeCallStack& stack): - _malloc_site(stack), _next(NULL) { } + MallocSiteHashtableEntry(NativeCallStack stack, MEMFLAGS flags): + _malloc_site(stack, flags), _next(NULL) { + assert(flags != mtNone, "Expect a real memory type"); + } inline const MallocSiteHashtableEntry* next() const { return _next; @@ -198,11 +205,11 @@ class MallocSiteTable : AllStatic { // 1. out of memory // 2. overflow hash bucket static inline bool allocation_at(const NativeCallStack& stack, size_t size, - size_t* bucket_idx, size_t* pos_idx) { + size_t* bucket_idx, size_t* pos_idx, MEMFLAGS flags) { AccessLock locker(&_access_count); if (locker.sharedLock()) { NOT_PRODUCT(_peak_count = MAX2(_peak_count, _access_count);) - MallocSite* site = lookup_or_add(stack, bucket_idx, pos_idx); + MallocSite* site = lookup_or_add(stack, bucket_idx, pos_idx, flags); if (site != NULL) site->allocate(size); return site != NULL; } @@ -228,13 +235,13 @@ class MallocSiteTable : AllStatic { static bool walk_malloc_site(MallocSiteWalker* walker); private: - static MallocSiteHashtableEntry* new_entry(const NativeCallStack& key); + static MallocSiteHashtableEntry* new_entry(const NativeCallStack& key, MEMFLAGS flags); static void reset(); // Delete a bucket linked list static void delete_linked_list(MallocSiteHashtableEntry* head); - static MallocSite* lookup_or_add(const NativeCallStack& key, size_t* bucket_idx, size_t* pos_idx); + static MallocSite* lookup_or_add(const NativeCallStack& key, size_t* bucket_idx, size_t* pos_idx, MEMFLAGS flags); static MallocSite* malloc_site(size_t bucket_idx, size_t pos_idx); static bool walk(MallocSiteWalker* walker); diff --git a/hotspot/src/share/vm/services/mallocTracker.cpp b/hotspot/src/share/vm/services/mallocTracker.cpp index 16a0cde04c4..d50e97aa3f4 100644 --- a/hotspot/src/share/vm/services/mallocTracker.cpp +++ b/hotspot/src/share/vm/services/mallocTracker.cpp @@ -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 @@ -77,8 +77,8 @@ void MallocHeader::release() const { } bool MallocHeader::record_malloc_site(const NativeCallStack& stack, size_t size, - size_t* bucket_idx, size_t* pos_idx) const { - bool ret = MallocSiteTable::allocation_at(stack, size, bucket_idx, pos_idx); + size_t* bucket_idx, size_t* pos_idx, MEMFLAGS flags) const { + bool ret = MallocSiteTable::allocation_at(stack, size, bucket_idx, pos_idx, flags); // Something went wrong, could be OOM or overflow malloc site table. // We want to keep tracking data under OOM circumstance, so transition to diff --git a/hotspot/src/share/vm/services/mallocTracker.hpp b/hotspot/src/share/vm/services/mallocTracker.hpp index 329d2ea9dfc..9d92477cb01 100644 --- a/hotspot/src/share/vm/services/mallocTracker.hpp +++ b/hotspot/src/share/vm/services/mallocTracker.hpp @@ -275,7 +275,7 @@ class MallocHeader VALUE_OBJ_CLASS_SPEC { if (level == NMT_detail) { size_t bucket_idx; size_t pos_idx; - if (record_malloc_site(stack, size, &bucket_idx, &pos_idx)) { + if (record_malloc_site(stack, size, &bucket_idx, &pos_idx, flags)) { assert(bucket_idx <= MAX_MALLOCSITE_TABLE_SIZE, "Overflow bucket index"); assert(pos_idx <= MAX_BUCKET_LENGTH, "Overflow bucket position index"); _bucket_idx = bucket_idx; @@ -299,7 +299,7 @@ class MallocHeader VALUE_OBJ_CLASS_SPEC { _size = size; } bool record_malloc_site(const NativeCallStack& stack, size_t size, - size_t* bucket_idx, size_t* pos_idx) const; + size_t* bucket_idx, size_t* pos_idx, MEMFLAGS flags) const; }; diff --git a/hotspot/src/share/vm/services/memReporter.cpp b/hotspot/src/share/vm/services/memReporter.cpp index 0269619178f..dfc4e4d45ce 100644 --- a/hotspot/src/share/vm/services/memReporter.cpp +++ b/hotspot/src/share/vm/services/memReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,11 +43,16 @@ void MemReporterBase::print_total(size_t reserved, size_t committed) const { amount_in_current_scale(reserved), scale, amount_in_current_scale(committed), scale); } -void MemReporterBase::print_malloc(size_t amount, size_t count) const { +void MemReporterBase::print_malloc(size_t amount, size_t count, MEMFLAGS flag) const { const char* scale = current_scale(); outputStream* out = output(); - out->print("(malloc=" SIZE_FORMAT "%s", - amount_in_current_scale(amount), scale); + if (flag != mtNone) { + out->print("(malloc=" SIZE_FORMAT "%s type=%s", + amount_in_current_scale(amount), scale, NMTUtil::flag_to_name(flag)); + } else { + out->print("(malloc=" SIZE_FORMAT "%s", + amount_in_current_scale(amount), scale); + } if (count > 0) { out->print(" #" SIZE_FORMAT "", count); @@ -200,7 +205,10 @@ void MemDetailReporter::report_malloc_sites() { const NativeCallStack* stack = malloc_site->call_stack(); stack->print_on(out); out->print("%29s", " "); - print_malloc(malloc_site->size(), malloc_site->count()); + MEMFLAGS flag = malloc_site->flags(); + assert((flag >= 0 && flag < (int)mt_number_of_types) && flag != mtNone, + "Must have a valid memory type"); + print_malloc(malloc_site->size(), malloc_site->count(),flag); out->print_cr("\n"); } } diff --git a/hotspot/src/share/vm/services/memReporter.hpp b/hotspot/src/share/vm/services/memReporter.hpp index 951076c9358..50b6b7f8cf1 100644 --- a/hotspot/src/share/vm/services/memReporter.hpp +++ b/hotspot/src/share/vm/services/memReporter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ class MemReporterBase : public StackObj { // Print summary total, malloc and virtual memory void print_total(size_t reserved, size_t committed) const; - void print_malloc(size_t amount, size_t count) const; + void print_malloc(size_t amount, size_t count, MEMFLAGS flag = mtNone) const; void print_virtual_memory(size_t reserved, size_t committed) const; void print_malloc_line(size_t amount, size_t count) const; From d0b55c146f13c726cd909c46b50d51c9530aa5d8 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:26 +0000 Subject: [PATCH 075/105] Added tag jdk-10+7 for changeset e1b5a6c45d39 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index db39fa4e9d3..f2260b02f55 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -421,3 +421,4 @@ ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166 b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170 +aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7 From c056b9b52a701e279597788ade0680a33162849e Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:28 +0000 Subject: [PATCH 076/105] Added tag jdk-10+7 for changeset 6647a4cd5d00 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 673fe9bd8b6..c68c8cae98e 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -420,3 +420,4 @@ f260f1a2acf616509a4ee5a29bc7f2acca3853e3 jdk-9+167 bc21e5ba6bf1538551093f57fa0f1a6571be05cc jdk-9+168 0e522ff8b9f52a9d4929af9a6aa84110f4dcd81d jdk-9+169 18355c879c69a33167f1862896738a7b9a4da729 jdk-9+170 +85581ae8a97f20fd2f817a71eb3cd7b04e492722 jdk-10+7 From 19e83876e2efb5fa637bbc5ac05d1a88c84f2872 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:30 +0000 Subject: [PATCH 077/105] Added tag jdk-10+7 for changeset 9d896ba4a48b --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index d0c9ec26ac2..96d37c2dd66 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -423,3 +423,4 @@ ac7e572a6a6ba5bbd7e6aa94a289f88cc86256a4 jdk-10+4 2746716dcc5a8c28ccf41df0c8fb620b1a1e7098 jdk-9+168 912cf69806d518c5af7fba30b340c4cb5458dd22 jdk-9+169 e75d3abe579a7b39b762fc0a1a337c49eb072d82 jdk-9+170 +b0efae7df1dfa14926058baebaf999e4268c955c jdk-10+7 From f4f9fbcbd0cba598b9554e9dc0f562b8e42c15c7 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:34 +0000 Subject: [PATCH 078/105] Added tag jdk-10+7 for changeset 7546d531a619 --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 088b9c458bc..32f11f47464 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -411,3 +411,4 @@ e118c818dbf84d15191414c453b77c089116fdc0 jdk-9+167 0f81cde5a1f75786f381dbfb59b9afbab70174c7 jdk-9+168 131e250080158e57ce45130560f5f987b92642b5 jdk-9+169 550bfc15779f8f339610793867fdc251125811b5 jdk-9+170 +7e9cb37e6d6edbe56fdf4d510e5110f797823f09 jdk-10+7 From 1a6fd96373cc6a7efc4d257773adeabd5ca0cbe2 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:37 +0000 Subject: [PATCH 079/105] Added tag jdk-10+7 for changeset 0eb9c6043275 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 1c7733efb46..e11a16947ee 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -420,3 +420,4 @@ ac697b2bdf486ef18caad2092bd24036e14946ac jdk-10+5 23a87f409371fb8ce7b764cccb3a74c3f6b29900 jdk-9+168 5d9d2a65fb26aa183019346c11d9314819621665 jdk-9+169 6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170 +09cae4c36242734f5450de739b8264523a030809 jdk-10+7 From 9d19fc55dd89ed8b8ba1a5ab44966de4b5ae1466 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:42 +0000 Subject: [PATCH 080/105] Added tag jdk-10+7 for changeset d554736d963e --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index bab340cbb49..9179fa6ba7a 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -420,3 +420,4 @@ d1436b2945383cef15edbdba9bb41ef1656c987b jdk-10+5 e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168 177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169 ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170 +cbd65760a005766610583949b3b5c9ace92e74b3 jdk-10+7 From 42c08330fb53f9697f8cc8fd94c49a17cfaadcd3 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:49 +0000 Subject: [PATCH 081/105] Added tag jdk-10+7 for changeset a5c0bfac4b0b --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 8ef690e90f2..cd6f4b43194 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -420,3 +420,4 @@ c7358d703e1282af3dcd8af6c037dc4342de9054 jdk-10+6 03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168 b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169 8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170 +aed5a4edc8275c1c50195503756ff92bfe0197f5 jdk-10+7 From 9f3f2de137d4aaa6899f255b62c40e37ab0505b1 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 21:11:50 +0000 Subject: [PATCH 082/105] Added tag jdk-10+7 for changeset f5053ff33fd4 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 011c2debf81..ea8f7b38c78 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -580,3 +580,4 @@ c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165 fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168 16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169 38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170 +9d4746eca95aec3e5a344bf2520745dcc1d17eed jdk-10+7 From 42d34a7cbfff8c6568c56f4e6f100a749ec665a6 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:38:54 +0000 Subject: [PATCH 083/105] Added tag jdk-10+8 for changeset d7deaa5e4f97 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index f2260b02f55..bf64ef1712e 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -422,3 +422,4 @@ b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170 aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7 +df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8 From ab1cd91fde436921970e0c09755f31b9f2ed494d Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:38:55 +0000 Subject: [PATCH 084/105] Added tag jdk-10+8 for changeset 53876ff5a88a --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index e11a16947ee..45875ae185d 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -421,3 +421,4 @@ ac697b2bdf486ef18caad2092bd24036e14946ac jdk-10+5 5d9d2a65fb26aa183019346c11d9314819621665 jdk-9+169 6e78f902f477a093afca85a1042f97410d01eb69 jdk-9+170 09cae4c36242734f5450de739b8264523a030809 jdk-10+7 +856998840907b67b7e1fc49259f785ac085a189b jdk-10+8 From eba67fcdfda2f70a21aba3c127d2bf191e191434 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:38:56 +0000 Subject: [PATCH 085/105] Added tag jdk-10+8 for changeset 635cc02314e3 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 96d37c2dd66..1e510f647f7 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -424,3 +424,4 @@ ac7e572a6a6ba5bbd7e6aa94a289f88cc86256a4 jdk-10+4 912cf69806d518c5af7fba30b340c4cb5458dd22 jdk-9+169 e75d3abe579a7b39b762fc0a1a337c49eb072d82 jdk-9+170 b0efae7df1dfa14926058baebaf999e4268c955c jdk-10+7 +e705867d9989d00e4357f66f18b302c95e13b5e7 jdk-10+8 From 563c8385cb229adbd747e0de1cd3e8c93e853f9e Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:38:58 +0000 Subject: [PATCH 086/105] Added tag jdk-10+8 for changeset 25593a0aff77 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index ea8f7b38c78..368f851bf14 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -581,3 +581,4 @@ fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168 16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169 38a240fd58a287acb1963920b92ed4d9c2fd39e3 jdk-9+170 9d4746eca95aec3e5a344bf2520745dcc1d17eed jdk-10+7 +f5ded0cf954c770deeecb80f2ba1ba6a05cd979b jdk-10+8 From 3d61e714f030790b577f85e142477b58849bf998 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:39:02 +0000 Subject: [PATCH 087/105] Added tag jdk-10+8 for changeset f0579c053626 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 9179fa6ba7a..3a58536ca86 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -421,3 +421,4 @@ e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168 177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169 ef9954f6896bb0b95ac62bf769f68b59a7a56ccd jdk-9+170 cbd65760a005766610583949b3b5c9ace92e74b3 jdk-10+7 +f0adc10ed8316e6cf316e3208c5ecf6835d22bc4 jdk-10+8 From 4b675c65c6b15f656996468eaba231d39da522e6 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:39:02 +0000 Subject: [PATCH 088/105] Added tag jdk-10+8 for changeset 38f7f9fa0ac1 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index cd6f4b43194..0fe545af082 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -421,3 +421,4 @@ c7358d703e1282af3dcd8af6c037dc4342de9054 jdk-10+6 b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169 8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170 aed5a4edc8275c1c50195503756ff92bfe0197f5 jdk-10+7 +648b0a00824eb29e71936bc3258d309a25e3b8c0 jdk-10+8 From b3cfbae65da56f9d5e5cbbe9513a4f1549b37aab Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:39:06 +0000 Subject: [PATCH 089/105] Added tag jdk-10+8 for changeset a0908e5be3bc --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index c68c8cae98e..3e74be3ac37 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -421,3 +421,4 @@ bc21e5ba6bf1538551093f57fa0f1a6571be05cc jdk-9+168 0e522ff8b9f52a9d4929af9a6aa84110f4dcd81d jdk-9+169 18355c879c69a33167f1862896738a7b9a4da729 jdk-9+170 85581ae8a97f20fd2f817a71eb3cd7b04e492722 jdk-10+7 +6d9a33d72d0647f3981c9d9c636a6f1290689895 jdk-10+8 From a26ee23e2f3c9712dd2ec163547e9a6383635ff7 Mon Sep 17 00:00:00 2001 From: Lana Steuck Date: Tue, 23 May 2017 22:39:07 +0000 Subject: [PATCH 090/105] Added tag jdk-10+8 for changeset ba5bed4f71d4 --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 32f11f47464..ef877223386 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -412,3 +412,4 @@ e118c818dbf84d15191414c453b77c089116fdc0 jdk-9+167 131e250080158e57ce45130560f5f987b92642b5 jdk-9+169 550bfc15779f8f339610793867fdc251125811b5 jdk-9+170 7e9cb37e6d6edbe56fdf4d510e5110f797823f09 jdk-10+7 +edb825e2dfb140c8e57a61b5d45de19edebccccf jdk-10+8 From 8437db66f38515c01ab362569bd97863d654fc86 Mon Sep 17 00:00:00 2001 From: Mikhailo Seledtsov Date: Tue, 23 May 2017 20:14:52 -0700 Subject: [PATCH 091/105] 8180631: [TESTBUG] CDS tests should use CDSTestUtils.executeAndLog whenever spawning sub processes Updated all relevant call sites to use executeAndLog() Reviewed-by: iklam, ccheung --- .../DumpSymbolAndStringTable.java | 8 +++--- .../SharedArchiveFile/LargeSharedSpace.java | 1 - .../SharedArchiveFile/LimitSharedSizes.java | 27 +++++++------------ .../SharedArchiveFile/MaxMetaspaceSize.java | 11 ++++---- .../SharedArchiveFile/SASymbolTableTest.java | 8 +----- 5 files changed, 21 insertions(+), 34 deletions(-) diff --git a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java index b4ef5c323c9..97e8e584e5b 100644 --- a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java +++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.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 @@ -30,7 +30,7 @@ * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions DumpSymbolAndStringTable */ - +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.JDKToolFinder; @@ -42,7 +42,7 @@ public class DumpSymbolAndStringTable { ProcessBuilder pb = new ProcessBuilder(); pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.symboltable", "-verbose"}); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); + OutputAnalyzer output = CDSTestUtils.executeAndLog(pb, "jcmd-symboltable"); try { output.shouldContain("24 2: DumpSymbolAndStringTable\n"); } catch (RuntimeException e) { @@ -50,7 +50,7 @@ public class DumpSymbolAndStringTable { } pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.stringtable", "-verbose"}); - output = new OutputAnalyzer(pb.start()); + output = CDSTestUtils.executeAndLog(pb, "jcmd-stringtable"); try { output.shouldContain("16: java.lang.String\n"); } catch (RuntimeException e) { diff --git a/hotspot/test/runtime/SharedArchiveFile/LargeSharedSpace.java b/hotspot/test/runtime/SharedArchiveFile/LargeSharedSpace.java index c4b8a6788cd..e6b5e69b5a8 100644 --- a/hotspot/test/runtime/SharedArchiveFile/LargeSharedSpace.java +++ b/hotspot/test/runtime/SharedArchiveFile/LargeSharedSpace.java @@ -40,7 +40,6 @@ import jdk.test.lib.Platform; public class LargeSharedSpace { public static void main(String[] args) throws Exception { - ProcessBuilder pb; OutputAnalyzer output; // Test case 1: -XX:SharedMiscCodeSize=1066924031 diff --git a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java index e6b8777f2ea..859e2e13d6e 100644 --- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java +++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.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 @@ -31,6 +31,7 @@ * @run main LimitSharedSizes */ +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; @@ -150,7 +151,7 @@ public class LimitSharedSizes { option, "-Xshare:dump"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); + OutputAnalyzer output = CDSTestUtils.executeAndLog(pb, "dump" + counter); switch (td.getResult()) { case VALID: @@ -167,22 +168,14 @@ public class LimitSharedSizes { "-XX:+PrintSharedArchiveAndExit", "-version"); - try { - output = new OutputAnalyzer(pb.start()); - output.shouldContain("archive is valid"); - } catch (RuntimeException e) { - // if sharing failed due to ASLR or similar reasons, - // check whether sharing was attempted at all (UseSharedSpaces) - if ((output.getOutput().contains("Unable to use shared archive") || - output.getOutput().contains("Unable to map ReadOnly shared space at required address.") || - output.getOutput().contains("Unable to map ReadWrite shared space at required address.") || - output.getOutput().contains("Unable to reserve shared space at required address")) && - output.getExitValue() == 1) { - System.out.println("Unable to use shared archive: test not executed; assumed passed"); - continue; - } + output = CDSTestUtils.executeAndLog(pb, "use" + counter); + if(CDSTestUtils.isUnableToMap(output)) { + System.out.println("Unable to use shared archive: " + + "test not executed; assumed passed"); + continue; + } else { + output.shouldHaveExitValue(0); } - output.shouldHaveExitValue(0); } } break; diff --git a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java index 1adb658d6ca..3ddb71bf12f 100644 --- a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java +++ b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,15 +30,16 @@ * java.management */ +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; public class MaxMetaspaceSize { public static void main(String[] args) throws Exception { + String msg = "is not large enough.\n" + + "Either don't specify the -XX:MaxMetaspaceSize=\n" + + "or increase the size to at least"; ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:MaxMetaspaceSize=10m", "-Xshare:dump"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("is not large enough.\nEither don't specify the -XX:MaxMetaspaceSize=\nor increase the size to at least"); - output.shouldHaveExitValue(2); + CDSTestUtils.executeAndLog(pb, "dump").shouldContain(msg).shouldHaveExitValue(2); } } diff --git a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java index 7d1f8e57ad9..eefdc2c0d39 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java +++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java @@ -95,17 +95,11 @@ public class SASymbolTableTest { "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED", "SASymbolTableTestAgent", Long.toString(pid)); - OutputAnalyzer output = ProcessTools.executeProcess(tool); - System.out.println("STDOUT["); - System.out.println(output.getOutput()); + OutputAnalyzer output = CDSTestUtils.executeAndLog(tool, "tool"); if (output.getStdout().contains("connected too early")) { System.out.println("SymbolTable not created by VM - test skipped"); return; } - System.out.println("]"); - System.out.println("STDERR["); - System.out.print(output.getStderr()); - System.out.println("]"); output.shouldHaveExitValue(0); } catch (Exception ex) { throw new RuntimeException("Test ERROR " + ex, ex); From 4d1141ee1c6e72f0f4689229bb7554609ea4ca57 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Wed, 24 May 2017 12:42:44 +0200 Subject: [PATCH 092/105] 8180763: Improve inlining of Symbol::equals(char*,int) into CompactHashtable Reviewed-by: iklam, jiangli --- hotspot/src/share/vm/oops/symbol.cpp | 16 ---------------- hotspot/src/share/vm/oops/symbol.hpp | 11 ++++++++++- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/hotspot/src/share/vm/oops/symbol.cpp b/hotspot/src/share/vm/oops/symbol.cpp index 5f4ad042e75..80ab208893c 100644 --- a/hotspot/src/share/vm/oops/symbol.cpp +++ b/hotspot/src/share/vm/oops/symbol.cpp @@ -65,22 +65,6 @@ void Symbol::operator delete(void *p) { FreeHeap(p); } -// ------------------------------------------------------------------ -// Symbol::equals -// -// Compares the symbol with a string of the given length. -bool Symbol::equals(const char* str, int len) const { - int l = utf8_length(); - if (l != len) return false; - while (l-- > 0) { - if (str[l] != (char) byte_at(l)) - return false; - } - assert(l == -1, "we should be at the beginning"); - return true; -} - - // ------------------------------------------------------------------ // Symbol::starts_with // diff --git a/hotspot/src/share/vm/oops/symbol.hpp b/hotspot/src/share/vm/oops/symbol.hpp index 468640caa24..d4c6850ed04 100644 --- a/hotspot/src/share/vm/oops/symbol.hpp +++ b/hotspot/src/share/vm/oops/symbol.hpp @@ -175,7 +175,16 @@ class Symbol : public MetaspaceObj { int utf8_length() const { return _length; } // Compares the symbol with a string. - bool equals(const char* str, int len) const; + bool equals(const char* str, int len) const { + int l = utf8_length(); + if (l != len) return false; + while (l-- > 0) { + if (str[l] != (char) byte_at(l)) + return false; + } + assert(l == -1, "we should be at the beginning"); + return true; + } bool equals(const char* str) const { return equals(str, (int) strlen(str)); } // Tests if the symbol starts with the given prefix. From 72aff46551ff08cfa91005cf8eb1e08a131082d6 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Wed, 24 May 2017 16:11:36 +0000 Subject: [PATCH 093/105] 8180856: Remove RecordType.java Reviewed-by: weijun --- .../classes/sun/security/ssl/RecordType.java | 122 ------------------ 1 file changed, 122 deletions(-) delete mode 100644 jdk/src/java.base/share/classes/sun/security/ssl/RecordType.java diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RecordType.java b/jdk/src/java.base/share/classes/sun/security/ssl/RecordType.java deleted file mode 100644 index 1468802aeb0..00000000000 --- a/jdk/src/java.base/share/classes/sun/security/ssl/RecordType.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.security.ssl; - -/* - * enumation of record type - */ -enum RecordType { - - RECORD_CHANGE_CIPHER_SPEC (Record.ct_change_cipher_spec, - HandshakeMessage.ht_not_applicable), - RECORD_ALERT (Record.ct_alert, - HandshakeMessage.ht_not_applicable), - RECORD_HELLO_REQUEST (Record.ct_handshake, - HandshakeMessage.ht_hello_request), - RECORD_CLIENT_HELLO (Record.ct_handshake, - HandshakeMessage.ht_client_hello), - RECORD_SERVER_HELLO (Record.ct_handshake, - HandshakeMessage.ht_server_hello), - RECORD_HELLO_VERIFY_REQUEST (Record.ct_handshake, - HandshakeMessage.ht_hello_verify_request), - RECORD_NEW_SESSION_TICKET (Record.ct_handshake, - HandshakeMessage.ht_new_session_ticket), - RECORD_CERTIFICATE (Record.ct_handshake, - HandshakeMessage.ht_certificate), - RECORD_SERVER_KEY_EXCHANGE (Record.ct_handshake, - HandshakeMessage.ht_server_key_exchange), - RECORD_CERTIFICATE_REQUEST (Record.ct_handshake, - HandshakeMessage.ht_certificate_request), - RECORD_SERVER_HELLO_DONE (Record.ct_handshake, - HandshakeMessage.ht_server_hello_done), - RECORD_CERTIFICATE_VERIFY (Record.ct_handshake, - HandshakeMessage.ht_certificate_verify), - RECORD_CLIENT_KEY_EXCHANGE (Record.ct_handshake, - HandshakeMessage.ht_client_key_exchange), - RECORD_FINISHED (Record.ct_handshake, - HandshakeMessage.ht_finished), - RECORD_CERTIFICATE_URL (Record.ct_handshake, - HandshakeMessage.ht_certificate_url), - RECORD_CERTIFICATE_STATUS (Record.ct_handshake, - HandshakeMessage.ht_certificate_status), - RECORD_SUPPLIEMENTAL_DATA (Record.ct_handshake, - HandshakeMessage.ht_supplemental_data), - RECORD_APPLICATION_DATA (Record.ct_application_data, - HandshakeMessage.ht_not_applicable); - - byte contentType; - byte handshakeType; - - private RecordType(byte contentType, byte handshakeType) { - this.contentType = contentType; - this.handshakeType = handshakeType; - } - - static RecordType valueOf(byte contentType, byte handshakeType) { - if (contentType == Record.ct_change_cipher_spec) { - return RECORD_CHANGE_CIPHER_SPEC; - } else if (contentType == Record.ct_alert) { - return RECORD_ALERT; - } else if (contentType == Record.ct_application_data) { - return RECORD_APPLICATION_DATA; - } else if (handshakeType == HandshakeMessage.ht_hello_request) { - return RECORD_HELLO_REQUEST; - } else if (handshakeType == HandshakeMessage.ht_client_hello) { - return RECORD_CLIENT_HELLO; - } else if (handshakeType == HandshakeMessage.ht_server_hello) { - return RECORD_SERVER_HELLO; - } else if (handshakeType == HandshakeMessage.ht_hello_verify_request) { - return RECORD_HELLO_VERIFY_REQUEST; - } else if (handshakeType == HandshakeMessage.ht_new_session_ticket) { - return RECORD_NEW_SESSION_TICKET; - } else if (handshakeType == HandshakeMessage.ht_certificate) { - return RECORD_CERTIFICATE; - } else if (handshakeType == HandshakeMessage.ht_server_key_exchange) { - return RECORD_SERVER_KEY_EXCHANGE; - } else if (handshakeType == HandshakeMessage.ht_certificate_request) { - return RECORD_CERTIFICATE_REQUEST; - } else if (handshakeType == HandshakeMessage.ht_server_hello_done) { - return RECORD_SERVER_HELLO_DONE; - } else if (handshakeType == HandshakeMessage.ht_certificate_verify) { - return RECORD_CERTIFICATE_VERIFY; - } else if (handshakeType == HandshakeMessage.ht_client_key_exchange) { - return RECORD_CLIENT_KEY_EXCHANGE; - } else if (handshakeType == HandshakeMessage.ht_finished) { - return RECORD_FINISHED; - } else if (handshakeType == HandshakeMessage.ht_certificate_url) { - return RECORD_CERTIFICATE_URL; - } else if (handshakeType == HandshakeMessage.ht_certificate_status) { - return RECORD_CERTIFICATE_STATUS; - } else if (handshakeType == HandshakeMessage.ht_supplemental_data) { - return RECORD_SUPPLIEMENTAL_DATA; - } - - // otherwise, invalid record type - throw new IllegalArgumentException( - "Invalid record type (ContentType:" + contentType + - ", HandshakeType:" + handshakeType + ")"); - } -} From 6823a2068e0bc95b18cbdd46ddfaaa597cd3a17b Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 24 May 2017 13:53:44 -0700 Subject: [PATCH 094/105] 8180802: move jdk.testlibrary.management.ThreadMXBeanTool to top level testlibrary Reviewed-by: psandoz --- .../test/lib/management/ThreadMXBeanTool.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 test/lib/jdk/test/lib/management/ThreadMXBeanTool.java diff --git a/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java b/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java new file mode 100644 index 00000000000..eeb4297f500 --- /dev/null +++ b/test/lib/jdk/test/lib/management/ThreadMXBeanTool.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.management; + +import java.lang.management.ManagementFactory; +import java.lang.management.ThreadInfo; +import java.lang.management.ThreadMXBean; + +/** + * A few utility methods to use ThreadMXBean. + */ +public final class ThreadMXBeanTool { + + /** + * Waits until {@link Thread} is in the certain {@link Thread.State} + * and blocking on {@code object}. + * + * @param state The thread state + * @param object The object to block on + */ + public static void waitUntilBlockingOnObject(Thread thread, Thread.State state, Object object) + throws InterruptedException { + String want = object == null ? null : object.getClass().getName() + '@' + + Integer.toHexString(System.identityHashCode(object)); + ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); + while (thread.isAlive()) { + ThreadInfo ti = tmx.getThreadInfo(thread.getId()); + if (ti.getThreadState() == state + && (want == null || want.equals(ti.getLockName()))) { + return; + } + Thread.sleep(1); + } + } + + /** + * Waits until {@link Thread} is in native. + */ + public static void waitUntilInNative(Thread thread) throws InterruptedException { + ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); + while (thread.isAlive()) { + ThreadInfo ti = tmx.getThreadInfo(thread.getId()); + if (ti.isInNative()) { + return; + } + Thread.sleep(1); + } + } + +} From e238187859b9c77fac6503a4c4cb651163b33c98 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 24 May 2017 13:55:37 -0700 Subject: [PATCH 095/105] 8180802: move jdk.testlibrary.management.ThreadMXBeanTool to top level testlibrary Reviewed-by: psandoz --- .../management/ThreadMXBeanTool.java | 72 ------------------- 1 file changed, 72 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/management/ThreadMXBeanTool.java diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/management/ThreadMXBeanTool.java b/jdk/test/lib/testlibrary/jdk/testlibrary/management/ThreadMXBeanTool.java deleted file mode 100644 index b3f4417a898..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/management/ThreadMXBeanTool.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary.management; - -import java.lang.management.ManagementFactory; -import java.lang.management.ThreadInfo; -import java.lang.management.ThreadMXBean; -import java.util.concurrent.TimeoutException; - -/** - * A few utility methods to use ThreadMXBean. - */ -public final class ThreadMXBeanTool { - - /** - * Waits until {@link Thread} is in the certain {@link State} - * and blocking on {@code object}. - * - * @param state The thread state - * @param object The object to block on - */ - public static void waitUntilBlockingOnObject(Thread thread, Thread.State state, Object object) - throws InterruptedException { - String want = object == null ? null : object.getClass().getName() + '@' - + Integer.toHexString(System.identityHashCode(object)); - ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); - while (thread.isAlive()) { - ThreadInfo ti = tmx.getThreadInfo(thread.getId()); - if (ti.getThreadState() == state - && (want == null || want.equals(ti.getLockName()))) { - return; - } - Thread.sleep(1); - } - } - - /** - * Waits until {@link Thread} is in native. - */ - public static void waitUntilInNative(Thread thread) throws InterruptedException { - ThreadMXBean tmx = ManagementFactory.getThreadMXBean(); - while (thread.isAlive()) { - ThreadInfo ti = tmx.getThreadInfo(thread.getId()); - if (ti.isInNative()) { - return; - } - Thread.sleep(1); - } - } - -} From 97a536003e44aeccf134c8cd64371e1c7fad95a0 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 24 May 2017 14:16:09 -0700 Subject: [PATCH 096/105] 8180724: move ModuleInfoMaker to the top level testlibrary Reviewed-by: psandoz, mchung --- jdk/test/lib/testlibrary/ModuleInfoMaker.java | 127 ------------------ jdk/test/tools/jmod/hashes/HashesTest.java | 37 ++--- .../AddExportsTestWarningError.java | 5 +- .../addreads/AddReadsTestWarningError.java | 6 +- 4 files changed, 24 insertions(+), 151 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/ModuleInfoMaker.java diff --git a/jdk/test/lib/testlibrary/ModuleInfoMaker.java b/jdk/test/lib/testlibrary/ModuleInfoMaker.java deleted file mode 100644 index 5e4f15a6774..00000000000 --- a/jdk/test/lib/testlibrary/ModuleInfoMaker.java +++ /dev/null @@ -1,127 +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. - */ - -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Stream; - -import static org.testng.Assert.assertTrue; - -/** - * Utility class for creating test modules. - */ -public class ModuleInfoMaker { - private static String MODULE_INFO_JAVA = "module-info.java"; - private static Pattern MODULE_PATTERN = - Pattern.compile("module\\s+((?:\\w+\\.)*)"); - private static Pattern PACKAGE_PATTERN = - Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))"); - private static Pattern CLASS_PATTERN = - Pattern.compile("(?:public\\s+)?(?:class|enum|interface)\\s+(\\w+)"); - - private final Path dir; - public ModuleInfoMaker(Path dir) { - this.dir = dir; - } - - /** - * Create java source files of the given module - */ - public void writeJavaFiles(String module, String moduleInfoJava, String... contents) - throws IOException - { - Path msrc = dir.resolve(module); - new JavaSource(moduleInfoJava).write(msrc); - for (String c : contents) { - new JavaSource(c).write(msrc); - } - } - - /** - * Compile the module to the given destination. - */ - public void compile(String module, Path dest, String... options) - throws IOException - { - Path msrc = dir.resolve(module); - Stream args = - Stream.concat(Arrays.stream(options), - Stream.of("--module-source-path", - dir.toString())); - assertTrue(CompilerUtils.compile(msrc, dest, args.toArray(String[]::new)), - "Fail to compile " + module); - } - - static class JavaSource { - final String source; - JavaSource(String source) { - this.source = source; - } - - /** - * Writes the source code to a file in a specified directory. - * @param dir the directory - * @throws IOException if there is a problem writing the file - */ - public void write(Path dir) throws IOException { - Path file = dir.resolve(getJavaFileNameFromSource(source)); - Files.createDirectories(file.getParent()); - try (BufferedWriter out = Files.newBufferedWriter(file)) { - out.write(source.replace("\n", System.lineSeparator())); - } - } - - /** - * Extracts the Java file name from the class declaration. - * This method is intended for simple files and uses regular expressions, - * so comments matching the pattern can make the method fail. - */ - static String getJavaFileNameFromSource(String source) { - String packageName = null; - - Matcher matcher = MODULE_PATTERN.matcher(source); - if (matcher.find()) - return MODULE_INFO_JAVA; - - matcher = PACKAGE_PATTERN.matcher(source); - if (matcher.find()) - packageName = matcher.group(1).replace(".", "/"); - - matcher = CLASS_PATTERN.matcher(source); - if (matcher.find()) { - String className = matcher.group(1) + ".java"; - return (packageName == null) ? className : packageName + "/" + className; - } else if (packageName != null) { - return packageName + "/package-info.java"; - } else { - throw new Error("Could not extract the java class " + - "name from the provided source"); - } - } - } -} diff --git a/jdk/test/tools/jmod/hashes/HashesTest.java b/jdk/test/tools/jmod/hashes/HashesTest.java index 10680927c19..e71efe91bc5 100644 --- a/jdk/test/tools/jmod/hashes/HashesTest.java +++ b/jdk/test/tools/jmod/hashes/HashesTest.java @@ -25,13 +25,12 @@ * @test * @bug 8160286 * @summary Test the recording and checking of module hashes - * @library /lib/testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.base/jdk.internal.module * jdk.compiler * jdk.jartool * jdk.jlink - * @build CompilerUtils ModuleInfoMaker * @run testng HashesTest */ @@ -62,6 +61,8 @@ import jdk.internal.module.ModuleInfo; import jdk.internal.module.ModuleHashes; import jdk.internal.module.ModulePath; +import jdk.test.lib.compiler.ModuleInfoMaker; + import org.testng.annotations.Test; import static org.testng.Assert.*; @@ -382,7 +383,7 @@ public class HashesTest { makeModule(mn, null, deps); } - private void makeModule(String mn, ModuleDescriptor.Requires.Modifier mod, String... deps) + private void makeModule(String mn, ModuleDescriptor.Requires.Modifier mod, String... deps) throws IOException { if (mod != null && mod != TRANSITIVE && mod != STATIC) { @@ -390,23 +391,23 @@ public class HashesTest { } StringBuilder sb = new StringBuilder(); - sb.append("module " + mn + " {").append("\n"); - Arrays.stream(deps).forEach(req -> { - sb.append(" requires "); - if (mod != null) { - sb.append(mod.toString().toLowerCase()).append(" "); - } - sb.append(req + ";\n"); - }); + sb.append("module ") + .append(mn) + .append(" {") + .append("\n"); + Arrays.stream(deps) + .forEach(req -> { + sb.append(" requires "); + if (mod != null) { + sb.append(mod.toString().toLowerCase()) + .append(" "); + } + sb.append(req) + .append(";\n"); + }); sb.append("}\n"); builder.writeJavaFiles(mn, sb.toString()); - - compileModule(mn, srcDir); - } - - private void compileModule(String moduleName, Path src) throws IOException { - Path msrc = src.resolve(moduleName); - assertTrue(CompilerUtils.compile(msrc, mods, "--module-source-path", src.toString())); + builder.compile(mn, mods); } private void jmodHashModules(String moduleName, String hashModulesPattern) { diff --git a/jdk/test/tools/launcher/modules/addexports/AddExportsTestWarningError.java b/jdk/test/tools/launcher/modules/addexports/AddExportsTestWarningError.java index 0a20fec711a..66c4930c0ca 100644 --- a/jdk/test/tools/launcher/modules/addexports/AddExportsTestWarningError.java +++ b/jdk/test/tools/launcher/modules/addexports/AddExportsTestWarningError.java @@ -25,9 +25,8 @@ * @test * @bug 8168836 * @summary Basic argument validation for --add-exports - * @library /lib/testlibrary + * @library /lib/testlibrary /test/lib * @modules jdk.compiler - * @build AddExportsTestWarningError CompilerUtils ModuleInfoMaker * @build jdk.testlibrary.* * @run testng AddExportsTestWarningError */ @@ -40,6 +39,7 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.stream.Stream; +import jdk.test.lib.compiler.ModuleInfoMaker; import jdk.testlibrary.OutputAnalyzer; import static jdk.testlibrary.ProcessTools.*; @@ -48,7 +48,6 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.*; - @Test public class AddExportsTestWarningError { diff --git a/jdk/test/tools/launcher/modules/addreads/AddReadsTestWarningError.java b/jdk/test/tools/launcher/modules/addreads/AddReadsTestWarningError.java index 6c9ee5634eb..079acccf400 100644 --- a/jdk/test/tools/launcher/modules/addreads/AddReadsTestWarningError.java +++ b/jdk/test/tools/launcher/modules/addreads/AddReadsTestWarningError.java @@ -25,9 +25,9 @@ * @test * @bug 8168836 * @summary Basic argument validation for --add-reads - * @library /lib/testlibrary + * @library /lib/testlibrary /test/lib * @modules jdk.compiler - * @build AddReadsTestWarningError CompilerUtils ModuleInfoMaker + * @build AddReadsTestWarningError * @build jdk.testlibrary.* * @run testng AddReadsTestWarningError */ @@ -40,6 +40,7 @@ import java.nio.file.Paths; import java.util.Arrays; import java.util.stream.Stream; +import jdk.test.lib.compiler.ModuleInfoMaker; import jdk.testlibrary.OutputAnalyzer; import static jdk.testlibrary.ProcessTools.*; @@ -48,7 +49,6 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static org.testng.Assert.*; - @Test public class AddReadsTestWarningError { From 662fb55c953c5aed8030c59232f454cb9546f168 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 24 May 2017 14:16:20 -0700 Subject: [PATCH 097/105] 8180724: move ModuleInfoMaker to the top level testlibrary Reviewed-by: psandoz, mchung --- .../test/lib/compiler/ModuleInfoMaker.java | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 test/lib/jdk/test/lib/compiler/ModuleInfoMaker.java diff --git a/test/lib/jdk/test/lib/compiler/ModuleInfoMaker.java b/test/lib/jdk/test/lib/compiler/ModuleInfoMaker.java new file mode 100644 index 00000000000..f6438a678ca --- /dev/null +++ b/test/lib/jdk/test/lib/compiler/ModuleInfoMaker.java @@ -0,0 +1,129 @@ +/* + * 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 jdk.test.lib.compiler; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Stream; + +/** + * Utility class for creating test modules. + */ +public class ModuleInfoMaker { + private static final String MODULE_INFO_JAVA = "module-info.java"; + private static final Pattern MODULE_PATTERN = + Pattern.compile("module\\s+((?:\\w+\\.)*)"); + private static final Pattern PACKAGE_PATTERN = + Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))"); + private static final Pattern CLASS_PATTERN = + Pattern.compile("(?:public\\s+)?(?:class|enum|interface)\\s+(\\w+)"); + + private final Path dir; + + public ModuleInfoMaker(Path dir) { + this.dir = dir; + } + + /** + * Create java source files of the given module + */ + public void writeJavaFiles(String module, String moduleInfoJava, String... contents) + throws IOException + { + Path msrc = dir.resolve(module); + new JavaSource(moduleInfoJava).write(msrc); + for (String c : contents) { + new JavaSource(c).write(msrc); + } + } + + /** + * Compile the module to the given destination. + */ + public void compile(String module, Path dest, String... options) + throws IOException + { + Path msrc = dir.resolve(module); + String[] args = + Stream.concat(Arrays.stream(options), + Stream.of("--module-source-path", + dir.toString())).toArray(String[]::new); + if (!CompilerUtils.compile(msrc, dest, args)) { + throw new Error("Fail to compile " + module); + } + } + + static class JavaSource { + final String source; + JavaSource(String source) { + this.source = source; + } + + /** + * Writes the source code to a file in a specified directory. + * @param dir the directory + * @throws IOException if there is a problem writing the file + */ + public void write(Path dir) throws IOException { + Path file = dir.resolve(getJavaFileNameFromSource(source)); + Files.createDirectories(file.getParent()); + try (BufferedWriter out = Files.newBufferedWriter(file)) { + out.write(source.replace("\n", System.lineSeparator())); + } + } + + /** + * Extracts the Java file name from the class declaration. + * This method is intended for simple files and uses regular expressions, + * so comments matching the pattern can make the method fail. + */ + static String getJavaFileNameFromSource(String source) { + String packageName = null; + + Matcher matcher = MODULE_PATTERN.matcher(source); + if (matcher.find()) + return MODULE_INFO_JAVA; + + matcher = PACKAGE_PATTERN.matcher(source); + if (matcher.find()) + packageName = matcher.group(1).replace(".", "/"); + + matcher = CLASS_PATTERN.matcher(source); + if (matcher.find()) { + String className = matcher.group(1) + ".java"; + return (packageName == null) ? className : packageName + "/" + className; + } else if (packageName != null) { + return packageName + "/package-info.java"; + } else { + throw new Error("Could not extract the java class " + + "name from the provided source"); + } + } + } +} From 88ef6ea270972292b33a16b71756b28fef93fc27 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 24 May 2017 15:21:14 -0700 Subject: [PATCH 098/105] 8180399: move jdk.testlibrary.LockFreeLogManager to the top level test library Reviewed-by: psandoz, mchung --- test/lib/jdk/test/lib/LockFreeLogger.java | 84 +++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 test/lib/jdk/test/lib/LockFreeLogger.java diff --git a/test/lib/jdk/test/lib/LockFreeLogger.java b/test/lib/jdk/test/lib/LockFreeLogger.java new file mode 100644 index 00000000000..4e96b9abccd --- /dev/null +++ b/test/lib/jdk/test/lib/LockFreeLogger.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib; + +import java.util.Collection; +import java.util.Comparator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * A logger designed specifically to allow collecting ordered log messages + * in a multi-threaded environment without involving any kind of locking. + *

      + * It is particularly useful in situations when one needs to assert various + * details about the tested thread state or the locks it hold while also wanting + * to produce diagnostic log messages. + *

      + * The logger does not provide any guarantees about the completness of the + * logs written from different threads - it is up to the caller to make sure + * {@code toString()} method is called only when all the activity has ceased + * and the per-thread logs contain all the necessary data. + * + * @author Jaroslav Bachorik + **/ +public class LockFreeLogger { + private final AtomicInteger logCntr = new AtomicInteger(0); + private final Collection> allRecords = new ConcurrentLinkedQueue<>(); + private final ThreadLocal> records = ThreadLocal.withInitial(ConcurrentHashMap::new); + + public LockFreeLogger() { + allRecords.add(records.get()); + } + + /** + * Log a message + * @param format Message format + * @param params Message parameters + */ + public void log(String format, Object ... params) { + int id = logCntr.getAndIncrement(); + records.get().put(id, String.format(format, params)); + } + + /** + * Will generate an aggregated log of chronologically ordered messages. + *

      + * Make sure that you call this method only when all the related threads + * have finished; otherwise you might get incomplete data. + * + * @return An aggregated log of chronologically ordered messages + */ + @Override + public String toString() { + return allRecords.stream() + .flatMap(m -> m.entrySet().stream()) + .sorted(Comparator.comparing(Map.Entry::getKey)) + .map(Map.Entry::getValue) + .collect(Collectors.joining()); + } +} From 2d7f46e91bca88d883533cdc4950050a6c9951cc Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 24 May 2017 15:24:40 -0700 Subject: [PATCH 099/105] 8180399: move jdk.testlibrary.LockFreeLogManager to the top level test library Reviewed-by: psandoz, mchung --- .../lang/Thread/ThreadStateController.java | 8 +- .../java/lang/Thread/ThreadStateTest.java | 1 + .../lang/management/ThreadMXBean/Locks.java | 20 ++--- .../ThreadMXBean/ThreadMXBeanStateTest.java | 1 + .../jdk/testlibrary/LockFreeLogManager.java | 90 ------------------- 5 files changed, 16 insertions(+), 104 deletions(-) delete mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/LockFreeLogManager.java diff --git a/jdk/test/java/lang/Thread/ThreadStateController.java b/jdk/test/java/lang/Thread/ThreadStateController.java index c426d1b34b4..d644a1a9ece 100644 --- a/jdk/test/java/lang/Thread/ThreadStateController.java +++ b/jdk/test/java/lang/Thread/ThreadStateController.java @@ -27,7 +27,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; -import jdk.testlibrary.LockFreeLogManager; +import jdk.test.lib.LockFreeLogger; import jdk.testlibrary.Utils; /** @@ -100,7 +100,7 @@ public class ThreadStateController extends Thread { private final AtomicInteger iterations = new AtomicInteger(); private final AtomicInteger interrupted = new AtomicInteger(); - private final LockFreeLogManager logManager = new LockFreeLogManager(); + private final LockFreeLogger logger = new LockFreeLogger(); @Override public void run() { @@ -349,7 +349,7 @@ public class ThreadStateController extends Thread { } private void log(String msg, Object ... params) { - logManager.log(msg, params); + logger.log(msg, params); } /** @@ -361,6 +361,6 @@ public class ThreadStateController extends Thread { public String getLog() throws InterruptedException { this.join(); - return logManager.toString(); + return logger.toString(); } } diff --git a/jdk/test/java/lang/Thread/ThreadStateTest.java b/jdk/test/java/lang/Thread/ThreadStateTest.java index 843cfd7ddeb..6509e391099 100644 --- a/jdk/test/java/lang/Thread/ThreadStateTest.java +++ b/jdk/test/java/lang/Thread/ThreadStateTest.java @@ -31,6 +31,7 @@ import static java.lang.Thread.State.*; * * @author Mandy Chung * @library /lib/testlibrary + * @library /test/lib * @build jdk.testlibrary.* * @build ThreadStateTest ThreadStateController * @run main/othervm -Xmixed ThreadStateTest diff --git a/jdk/test/java/lang/management/ThreadMXBean/Locks.java b/jdk/test/java/lang/management/ThreadMXBean/Locks.java index fa7a5b63a6f..85761d23ed0 100644 --- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java +++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java @@ -29,17 +29,17 @@ * @author Mandy Chung * @author Jaroslav Bachorik * - * @library /lib/testlibrary + * @library /test/lib * - * @build jdk.testlibrary.* * @run main/othervm Locks */ import java.lang.management.*; import java.util.Arrays; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.Phaser; import java.util.function.Predicate; -import jdk.testlibrary.LockFreeLogManager; +import jdk.test.lib.LockFreeLogger; public class Locks { @@ -47,7 +47,7 @@ public class Locks { private static final Object OBJB = new Object(); private static final EnhancedWaiter OBJC = new EnhancedWaiter(); private static final ThreadMXBean TM = ManagementFactory.getThreadMXBean(); - private static final LockFreeLogManager LOGGER = new LockFreeLogManager(); + private static final LockFreeLogger LOGGER = new LockFreeLogger(); private static String getLockName(Object lock) { if (lock == null) return null; @@ -60,12 +60,12 @@ public class Locks { if (t == null) { return; } - Optional result = Arrays.asList( - TM.getThreadInfo(TM.getAllThreadIds(), true, true)). - stream(). - filter(tInfo -> (tInfo != null && tInfo.getLockOwnerName() != null) - ? tInfo.getLockOwnerName().equals(t.getName()) : false). - findAny(); + String name = t.getName(); + Optional result = Arrays.stream( + TM.getThreadInfo(TM.getAllThreadIds(), true, true)) + .filter(Objects::nonNull) + .filter(i -> name.equals(i.getLockOwnerName())) + .findAny(); if (result.isPresent()) { throw new RuntimeException("Thread " + t.getName() + " is not " + "supposed to be hold any lock. Currently owning lock : " diff --git a/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java index 6a9c9cacedf..fc94d4ab0ca 100644 --- a/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java +++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java @@ -31,6 +31,7 @@ * * @library ../../Thread * @library /lib/testlibrary + * @library /test/lib * * @build jdk.testlibrary.* * @build ThreadMXBeanStateTest ThreadStateController diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/LockFreeLogManager.java b/jdk/test/lib/testlibrary/jdk/testlibrary/LockFreeLogManager.java deleted file mode 100644 index f895018be44..00000000000 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/LockFreeLogManager.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.testlibrary; - -import java.util.Collection; -import java.util.Formatter; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -/** - * A log manager designed specifically to allow collecting ordered log messages - * in a multi-threaded environment without involving any kind of locking. - *

      - * It is particularly useful in situations when one needs to assert various - * details about the tested thread state or the locks it hold while also wanting - * to produce diagnostic log messages. - *

      - * The log manager does not provide any guarantees about the completness of the - * logs written from different threads - it is up to the caller to make sure - * {@code toString()} method is called only when all the activity has ceased - * and the per-thread logs contain all the necessary data. - * - * @author Jaroslav Bachorik - **/ -public class LockFreeLogManager { - private final AtomicInteger logCntr = new AtomicInteger(0); - private final Collection> allRecords = new ConcurrentLinkedQueue<>(); - private final ThreadLocal> records = new ThreadLocal>() { - @Override - protected Map initialValue() { - Map m = new ConcurrentHashMap<>(); - allRecords.add(m); - return m; - } - - }; - - /** - * Log a message - * @param format Message format - * @param params Message parameters - */ - public void log(String format, Object ... params) { - int id = logCntr.getAndIncrement(); - try (Formatter formatter = new Formatter()) { - records.get().put(id, formatter.format(format, params).toString()); - } - } - - /** - * Will generate an aggregated log of chronologically ordered messages. - *

      - * Make sure that you call this method only when all the related threads - * have finished; otherwise you might get incomplete data. - * - * @return An aggregated log of chronologically ordered messages - */ - @Override - public String toString() { - return allRecords.stream() - .flatMap(m->m.entrySet().stream()) - .sorted((l, r)->l.getKey().compareTo(r.getKey())) - .map(e->e.getValue()) - .collect(Collectors.joining()); - } -} From da44748ec746b18ef3ca9ffc9b3f1e4ae8a9bba5 Mon Sep 17 00:00:00 2001 From: Adam Petcher Date: Thu, 25 May 2017 11:31:23 +0100 Subject: [PATCH 100/105] 8172244: AIOOBE in KeyStore.getCertificateAlias on Windows Reviewed-by: vinnie --- .../classes/sun/security/mscapi/KeyStore.java | 8 +- .../mscapi/KeyStoreEmptyCertChain.java | 81 +++++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 jdk/test/sun/security/mscapi/KeyStoreEmptyCertChain.java diff --git a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java index c4888bf3049..16e99bbfd48 100644 --- a/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java +++ b/jdk/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -513,7 +513,7 @@ abstract class KeyStore extends KeyStoreSpi { if (entry != null) { // Get end-entity certificate and remove from system cert store X509Certificate[] certChain = entry.getCertificateChain(); - if (certChain != null) { + if (certChain != null && certChain.length > 0) { try { @@ -629,7 +629,9 @@ abstract class KeyStore extends KeyStoreSpi { for (Map.Entry mapEntry : entries.entrySet()) { KeyEntry entry = mapEntry.getValue(); - if (entry.certChain != null && entry.certChain[0].equals(cert)) { + if (entry.certChain != null && + entry.certChain.length > 0 && + entry.certChain[0].equals(cert)) { return entry.getAlias(); } } diff --git a/jdk/test/sun/security/mscapi/KeyStoreEmptyCertChain.java b/jdk/test/sun/security/mscapi/KeyStoreEmptyCertChain.java new file mode 100644 index 00000000000..d603df9f1c8 --- /dev/null +++ b/jdk/test/sun/security/mscapi/KeyStoreEmptyCertChain.java @@ -0,0 +1,81 @@ +/* + * 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 8172244 + * @summary Verify that no exception is thrown with empty cert chain + * in MSCAPI. + * @requires os.family == "windows" + * @modules java.base/sun.security.tools.keytool java.base/sun.security.x509 + * @run main/othervm --add-opens java.base/java.security=ALL-UNNAMED + * KeyStoreEmptyCertChain + */ + +import java.security.KeyStore; +import java.security.cert.Certificate; +import sun.security.x509.X500Name; +import sun.security.tools.keytool.CertAndKeyGen; +import java.security.KeyPairGenerator; +import java.security.KeyPair; +import java.security.PrivateKey; +import java.security.KeyStoreSpi; +import java.lang.reflect.*; + +public class KeyStoreEmptyCertChain { + + public static void main(String[] args) { + + try { + + KeyStore keyStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); + keyStore.load(null, null); + + // Generate a certificate to use for testing + CertAndKeyGen gen = new CertAndKeyGen("RSA", "SHA256withRSA"); + gen.generate(2048); + Certificate cert = + gen.getSelfCertificate(new X500Name("CN=test"), 3600); + String alias = "JDK-8172244"; + char[] password = "password".toCharArray(); + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); + + // generate a private key for the certificate + kpg.initialize(2048); + KeyPair keyPair = kpg.generateKeyPair(); + PrivateKey privKey = keyPair.getPrivate(); + // need to bypass checks to store the private key without the cert + Field spiField = KeyStore.class.getDeclaredField("keyStoreSpi"); + spiField.setAccessible(true); + KeyStoreSpi spi = (KeyStoreSpi) spiField.get(keyStore); + spi.engineSetKeyEntry(alias, privKey, password, new Certificate[0]); + keyStore.store(null, null); + + keyStore.getCertificateAlias(cert); + keyStore.deleteEntry(alias); + // test passes if no exception is thrown + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } +} From fa2f54dbde776ae5ddb830c68c791c99216c158d Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 23:27:02 +0200 Subject: [PATCH 101/105] Added tag jdk-10+8 for changeset c42dc7b58b4d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 9fd0a508429..4a41328ccfa 100644 --- a/.hgtags +++ b/.hgtags @@ -420,3 +420,4 @@ d1cab6c7e608479be4ebfad48a25b0ed48600f62 jdk-10+3 f113ce12fe24fbd24acf02711372d9f1e1c12426 jdk-10+5 1407b19a2ddf6baae162f5a1a5b96af473f4d7d1 jdk-10+6 30e75693ae99fd8e47fd2f5116527aff1b59aff9 jdk-10+7 +c42dc7b58b4d4301ea676a76326fd9bbd403d595 jdk-10+8 From fc47ba11e663863a450215e04e2200377886d741 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 23:28:56 +0200 Subject: [PATCH 102/105] Added tag jdk-9+170 for changeset 898cbe31fbda --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 69da0fb8aa2..cc30bedcf44 100644 --- a/.hgtags +++ b/.hgtags @@ -413,3 +413,4 @@ d3e973f1809606c67412361041ad197e50fe8cec jdk-9+166 8fd0a4569191f33c98ee90c2709174a342fefb0d jdk-9+167 fcabc74bd44e56c7419d111d59b95669ecb33c55 jdk-9+168 c7efde2b60fc1ec04630be769d9ad60efb39c39c jdk-9+169 +898cbe31fbdae2d25d141384fac746cc244a730c jdk-9+170 From 81f1f2df46489c16ea43f8524151505688d50b8b Mon Sep 17 00:00:00 2001 From: Lutz Schmidt Date: Wed, 24 May 2017 17:30:45 -0700 Subject: [PATCH 103/105] 8180612: [ppc] assert failure in cpu/ppc/vm/assembler_ppc.hpp due to immediate value out of range Change RTM flags type to 'int' and set value range Reviewed-by: simonis, kvn --- hotspot/src/cpu/ppc/vm/globals_ppc.hpp | 20 +++++++++----- hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp | 26 ++++++++++++++----- hotspot/src/cpu/x86/vm/globals_x86.hpp | 19 +++++++++----- hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp | 4 +-- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp index bf4ca17df09..8e0656ba215 100644 --- a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp @@ -164,7 +164,7 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong); product(bool, ZapMemory, false, "Write 0x0101... to empty memory." \ " Use this to ease debugging.") \ \ - /* Use Restricted Transactional Memory for lock eliding */ \ + /* Use Restricted Transactional Memory for lock elision */ \ product(bool, UseRTMLocking, false, \ "Enable RTM lock eliding for inflated locks in compiled code") \ \ @@ -174,24 +174,30 @@ define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong); product(bool, UseRTMDeopt, false, \ "Perform deopt and recompilation based on RTM abort ratio") \ \ - product(uintx, RTMRetryCount, 5, \ + product(int, RTMRetryCount, 5, \ "Number of RTM retries on lock abort or busy") \ + range(0, max_jint) \ \ - experimental(intx, RTMSpinLoopCount, 100, \ + experimental(int, RTMSpinLoopCount, 100, \ "Spin count for lock to become free before RTM retry") \ + range(0, 32767) /* immediate operand limit on ppc */ \ \ - experimental(intx, RTMAbortThreshold, 1000, \ + experimental(int, RTMAbortThreshold, 1000, \ "Calculate abort ratio after this number of aborts") \ + range(0, max_jint) \ \ - experimental(intx, RTMLockingThreshold, 10000, \ + experimental(int, RTMLockingThreshold, 10000, \ "Lock count at which to do RTM lock eliding without " \ "abort ratio calculation") \ + range(0, max_jint) \ \ - experimental(intx, RTMAbortRatio, 50, \ + experimental(int, RTMAbortRatio, 50, \ "Lock abort ratio at which to stop use RTM lock eliding") \ + range(0, 100) /* natural range, checked in vm_version_ppc.cpp */ \ \ - experimental(intx, RTMTotalCountIncrRate, 64, \ + experimental(int, RTMTotalCountIncrRate, 64, \ "Increment total RTM attempted lock count once every n times") \ + range(1, 32767) /* immediate operand limit on ppc */ \ \ experimental(intx, RTMLockingCalculationDelay, 0, \ "Number of milliseconds to wait before start calculating aborts " \ diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp index afe71824178..f8dd94c23df 100644 --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -2498,14 +2498,20 @@ void MacroAssembler::rtm_abort_ratio_calculation(Register rtm_counters_Reg, // All transactions = total_count * RTMTotalCountIncrRate // Set no_rtm bit if (Aborted transactions >= All transactions * RTMAbortRatio) ld(R0, RTMLockingCounters::abort_count_offset(), rtm_counters_Reg); - cmpdi(CCR0, R0, RTMAbortThreshold); - blt(CCR0, L_check_always_rtm2); + if (is_simm(RTMAbortThreshold, 16)) { // cmpdi can handle 16bit immediate only. + cmpdi(CCR0, R0, RTMAbortThreshold); + blt(CCR0, L_check_always_rtm2); // reload of rtm_counters_Reg not necessary + } else { + load_const_optimized(rtm_counters_Reg, RTMAbortThreshold); + cmpd(CCR0, R0, rtm_counters_Reg); + blt(CCR0, L_check_always_rtm1); // reload of rtm_counters_Reg required + } mulli(R0, R0, 100); const Register tmpReg = rtm_counters_Reg; ld(tmpReg, RTMLockingCounters::total_count_offset(), rtm_counters_Reg); - mulli(tmpReg, tmpReg, RTMTotalCountIncrRate); - mulli(tmpReg, tmpReg, RTMAbortRatio); + mulli(tmpReg, tmpReg, RTMTotalCountIncrRate); // allowable range: int16 + mulli(tmpReg, tmpReg, RTMAbortRatio); // allowable range: int16 cmpd(CCR0, R0, tmpReg); blt(CCR0, L_check_always_rtm1); // jump to reload if (method_data != NULL) { @@ -2521,7 +2527,13 @@ void MacroAssembler::rtm_abort_ratio_calculation(Register rtm_counters_Reg, load_const_optimized(rtm_counters_Reg, (address)rtm_counters, R0); // reload bind(L_check_always_rtm2); ld(tmpReg, RTMLockingCounters::total_count_offset(), rtm_counters_Reg); - cmpdi(CCR0, tmpReg, RTMLockingThreshold / RTMTotalCountIncrRate); + int64_t thresholdValue = RTMLockingThreshold / RTMTotalCountIncrRate; + if (is_simm(thresholdValue, 16)) { // cmpdi can handle 16bit immediate only. + cmpdi(CCR0, tmpReg, thresholdValue); + } else { + load_const_optimized(R0, thresholdValue); + cmpd(CCR0, tmpReg, R0); + } blt(CCR0, L_done); if (method_data != NULL) { // Set rtm_state to "always rtm" in MDO. @@ -2620,7 +2632,7 @@ void MacroAssembler::rtm_stack_locking(ConditionRegister flag, if (PrintPreciseRTMLockingStatistics || profile_rtm) { Label L_noincrement; if (RTMTotalCountIncrRate > 1) { - branch_on_random_using_tb(tmp, (int)RTMTotalCountIncrRate, L_noincrement); + branch_on_random_using_tb(tmp, RTMTotalCountIncrRate, L_noincrement); } assert(stack_rtm_counters != NULL, "should not be NULL when profiling RTM"); load_const_optimized(tmp, (address)stack_rtm_counters->total_count_addr(), R0); @@ -2687,7 +2699,7 @@ void MacroAssembler::rtm_inflated_locking(ConditionRegister flag, if (PrintPreciseRTMLockingStatistics || profile_rtm) { Label L_noincrement; if (RTMTotalCountIncrRate > 1) { - branch_on_random_using_tb(R0, (int)RTMTotalCountIncrRate, L_noincrement); + branch_on_random_using_tb(R0, RTMTotalCountIncrRate, L_noincrement); } assert(rtm_counters != NULL, "should not be NULL when profiling RTM"); load_const(R0, (address)rtm_counters->total_count_addr(), tmpReg); diff --git a/hotspot/src/cpu/x86/vm/globals_x86.hpp b/hotspot/src/cpu/x86/vm/globals_x86.hpp index 5673abb4448..b1206fa5b9a 100644 --- a/hotspot/src/cpu/x86/vm/globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp @@ -160,25 +160,30 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); product(bool, UseRTMDeopt, false, \ "Perform deopt and recompilation based on RTM abort ratio") \ \ - product(uintx, RTMRetryCount, 5, \ + product(int, RTMRetryCount, 5, \ "Number of RTM retries on lock abort or busy") \ - range(0, max_uintx) \ + range(0, max_jint) \ \ - experimental(intx, RTMSpinLoopCount, 100, \ + experimental(int, RTMSpinLoopCount, 100, \ "Spin count for lock to become free before RTM retry") \ + range(0, max_jint) \ \ - experimental(intx, RTMAbortThreshold, 1000, \ + experimental(int, RTMAbortThreshold, 1000, \ "Calculate abort ratio after this number of aborts") \ + range(0, max_jint) \ \ - experimental(intx, RTMLockingThreshold, 10000, \ + experimental(int, RTMLockingThreshold, 10000, \ "Lock count at which to do RTM lock eliding without " \ "abort ratio calculation") \ + range(0, max_jint) \ \ - experimental(intx, RTMAbortRatio, 50, \ + experimental(int, RTMAbortRatio, 50, \ "Lock abort ratio at which to stop use RTM lock eliding") \ + range(0, 100) /* natural range, checked in vm_version_x86.cpp */ \ \ - experimental(intx, RTMTotalCountIncrRate, 64, \ + experimental(int, RTMTotalCountIncrRate, 64, \ "Increment total RTM attempted lock count once every n times") \ + range(1, max_jint) \ \ experimental(intx, RTMLockingCalculationDelay, 0, \ "Number of milliseconds to wait before start calculating aborts " \ diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index 66063e8b249..26568735bba 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -1492,7 +1492,7 @@ void MacroAssembler::rtm_stack_locking(Register objReg, Register tmpReg, Registe Label L_noincrement; if (RTMTotalCountIncrRate > 1) { // tmpReg, scrReg and flags are killed - branch_on_random_using_rdtsc(tmpReg, scrReg, (int)RTMTotalCountIncrRate, L_noincrement); + branch_on_random_using_rdtsc(tmpReg, scrReg, RTMTotalCountIncrRate, L_noincrement); } assert(stack_rtm_counters != NULL, "should not be NULL when profiling RTM"); atomic_incptr(ExternalAddress((address)stack_rtm_counters->total_count_addr()), scrReg); @@ -1553,7 +1553,7 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi Label L_noincrement; if (RTMTotalCountIncrRate > 1) { // tmpReg, scrReg and flags are killed - branch_on_random_using_rdtsc(tmpReg, scrReg, (int)RTMTotalCountIncrRate, L_noincrement); + branch_on_random_using_rdtsc(tmpReg, scrReg, RTMTotalCountIncrRate, L_noincrement); } assert(rtm_counters != NULL, "should not be NULL when profiling RTM"); atomic_incptr(ExternalAddress((address)rtm_counters->total_count_addr()), scrReg); From ad4bc13f9f43c7b3264fa8a17a8a10b32774d5f1 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Thu, 25 May 2017 09:38:33 +0200 Subject: [PATCH 104/105] 8152953: ForceSafepoint operations should be more specific Reviewed-by: dholmes, sspitsyn, rkennke, coleenp --- .../src/share/vm/classfile/classLoader.cpp | 2 +- hotspot/src/share/vm/code/icBuffer.cpp | 4 +- hotspot/src/share/vm/prims/jvmtiEnv.cpp | 4 +- hotspot/src/share/vm/runtime/synchronizer.cpp | 2 +- hotspot/src/share/vm/runtime/thread.cpp | 2 +- .../src/share/vm/runtime/vm_operations.hpp | 40 +++++++++++++++---- 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index 08c4db7a3dd..e6721178d0b 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -1945,7 +1945,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { if (can_be_compiled(m, comp_level)) { if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) { // Give sweeper a chance to keep up with CTW - VM_ForceSafepoint op; + VM_CTWThreshold op; VMThread::execute(&op); _codecache_sweep_counter = 0; } diff --git a/hotspot/src/share/vm/code/icBuffer.cpp b/hotspot/src/share/vm/code/icBuffer.cpp index abbe781737d..74ca1f6841a 100644 --- a/hotspot/src/share/vm/code/icBuffer.cpp +++ b/hotspot/src/share/vm/code/icBuffer.cpp @@ -126,8 +126,8 @@ ICStub* InlineCacheBuffer::new_ic_stub() { // We do this by forcing a safepoint EXCEPTION_MARK; - VM_ForceSafepoint vfs; - VMThread::execute(&vfs); + VM_ICBufferFull ibf; + VMThread::execute(&ibf); // We could potential get an async. exception at this point. // In that case we will rethrow it to ourselvs. if (HAS_PENDING_EXCEPTION) { diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp index 5aeef2073b3..b67e23f45ad 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp @@ -985,8 +985,8 @@ JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvm results[i] = JVMTI_ERROR_NONE; // indicate successful suspend } if (needSafepoint > 0) { - VM_ForceSafepoint vfs; - VMThread::execute(&vfs); + VM_ThreadsSuspendJVMTI tsj; + VMThread::execute(&tsj); } // per-thread suspend results returned via results parameter return JVMTI_ERROR_NONE; diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index 53da2f733a9..52754a8511e 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -1063,7 +1063,7 @@ static void InduceScavenge(Thread * Self, const char * Whence) { // Must VM_Operation instance be heap allocated as the op will be enqueue and posted // to the VMthread and have a lifespan longer than that of this activation record. // The VMThread will delete the op when completed. - VMThread::execute(new VM_ForceAsyncSafepoint()); + VMThread::execute(new VM_ScavengeMonitors()); if (ObjectMonitor::Knob_Verbose) { tty->print_cr("INFO: Monitor scavenge - STW posted @%s (%d)", diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 0b0c5d35c8a..87cf3ebc033 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -2275,7 +2275,7 @@ void JavaThread::java_suspend() { } } - VM_ForceSafepoint vm_suspend; + VM_ThreadSuspend vm_suspend; VMThread::execute(&vm_suspend); } diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp index 2dd1ce13d34..52e4606cf35 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.hpp +++ b/hotspot/src/share/vm/runtime/vm_operations.hpp @@ -106,6 +106,11 @@ template(MarkActiveNMethods) \ template(PrintCompileQueue) \ template(PrintClassHierarchy) \ + template(ThreadSuspend) \ + template(CTWThreshold) \ + template(ThreadsSuspendJVMTI) \ + template(ICBufferFull) \ + template(ScavengeMonitors) \ class VM_Operation: public CHeapObj { public: @@ -238,20 +243,41 @@ class VM_ClearICs: public VM_Operation { VMOp_Type type() const { return VMOp_ClearICs; } }; -// dummy vm op, evaluated just to force a safepoint +// empty vm op, evaluated just to force a safepoint class VM_ForceSafepoint: public VM_Operation { public: - VM_ForceSafepoint() {} void doit() {} VMOp_Type type() const { return VMOp_ForceSafepoint; } }; -// dummy vm op, evaluated just to force a safepoint -class VM_ForceAsyncSafepoint: public VM_Operation { +// empty vm op, when forcing a safepoint to suspend a thread +class VM_ThreadSuspend: public VM_ForceSafepoint { public: - VM_ForceAsyncSafepoint() {} - void doit() {} - VMOp_Type type() const { return VMOp_ForceAsyncSafepoint; } + VMOp_Type type() const { return VMOp_ThreadSuspend; } +}; + +// empty vm op, when forcing a safepoint due to ctw threshold is reached for the sweeper +class VM_CTWThreshold: public VM_ForceSafepoint { + public: + VMOp_Type type() const { return VMOp_CTWThreshold; } +}; + +// empty vm op, when forcing a safepoint to suspend threads from jvmti +class VM_ThreadsSuspendJVMTI: public VM_ForceSafepoint { + public: + VMOp_Type type() const { return VMOp_ThreadsSuspendJVMTI; } +}; + +// empty vm op, when forcing a safepoint due to inline cache buffers being full +class VM_ICBufferFull: public VM_ForceSafepoint { + public: + VMOp_Type type() const { return VMOp_ICBufferFull; } +}; + +// empty asynchronous vm op, when forcing a safepoint to scavenge monitors +class VM_ScavengeMonitors: public VM_ForceSafepoint { + public: + VMOp_Type type() const { return VMOp_ScavengeMonitors; } Mode evaluation_mode() const { return _async_safepoint; } bool is_cheap_allocated() const { return true; } }; From 3ca4b6b01b9f5727718dcda2d9682fa941be7595 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Thu, 25 May 2017 09:43:43 +0200 Subject: [PATCH 105/105] 8152955: Many safepoints of "no vm operation" kind Reviewed-by: dholmes, rkennke, shade --- hotspot/src/share/vm/runtime/safepoint.cpp | 8 ++--- hotspot/src/share/vm/runtime/vmThread.cpp | 36 ++++++++++++++++------ hotspot/src/share/vm/runtime/vmThread.hpp | 10 +++++- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index 8e6dccaec20..8cf29a76a29 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -396,9 +396,7 @@ void SafepointSynchronize::begin() { GCLocker::set_jni_lock_count(_current_jni_active_count); if (log_is_enabled(Debug, safepoint)) { - VM_Operation *op = VMThread::vm_operation(); - log_debug(safepoint)("Entering safepoint region: %s", - (op != NULL) ? op->name() : "no vm operation"); + log_debug(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description()); } RuntimeService::record_safepoint_synchronized(); @@ -845,10 +843,8 @@ void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason // To debug the long safepoint, specify both DieOnSafepointTimeout & // ShowMessageBoxOnError. if (DieOnSafepointTimeout) { - VM_Operation *op = VMThread::vm_operation(); fatal("Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.", - SafepointTimeoutDelay, - op != NULL ? op->name() : "no vm operation"); + SafepointTimeoutDelay, VMThread::vm_safepoint_description()); } } diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp index 5b3fda00fd9..0f259fd16ca 100644 --- a/hotspot/src/share/vm/runtime/vmThread.cpp +++ b/hotspot/src/share/vm/runtime/vmThread.cpp @@ -204,6 +204,7 @@ VMThread* VMThread::_vm_thread = NULL; VM_Operation* VMThread::_cur_vm_operation = NULL; VMOperationQueue* VMThread::_vm_queue = NULL; PerfCounter* VMThread::_perf_accumulated_vm_operation_time = NULL; +const char* VMThread::_no_op_reason = NULL; void VMThread::create() { @@ -273,6 +274,7 @@ void VMThread::run() { } // 4526887 let VM thread exit at Safepoint + _no_op_reason = "Halt"; SafepointSynchronize::begin(); if (VerifyBeforeExit) { @@ -380,6 +382,25 @@ void VMThread::evaluate_operation(VM_Operation* op) { } } +bool VMThread::no_op_safepoint_needed(bool check_time) { + if (SafepointALot) { + _no_op_reason = "SafepointALot"; + return true; + } + if (!SafepointSynchronize::is_cleanup_needed()) { + return false; + } + if (check_time) { + long interval = SafepointSynchronize::last_non_safepoint_interval(); + bool max_time_exceeded = GuaranteedSafepointInterval != 0 && + (interval > GuaranteedSafepointInterval); + if (!max_time_exceeded) { + return false; + } + } + _no_op_reason = "Cleanup"; + return true; +} void VMThread::loop() { assert(_cur_vm_operation == NULL, "no current one should be executing"); @@ -418,8 +439,7 @@ void VMThread::loop() { exit(-1); } - if (timedout && (SafepointALot || - SafepointSynchronize::is_cleanup_needed())) { + if (timedout && VMThread::no_op_safepoint_needed(false)) { MutexUnlockerEx mul(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag); // Force a safepoint since we have not had one for at least @@ -542,14 +562,10 @@ void VMThread::loop() { // // We want to make sure that we get to a safepoint regularly. // - if (SafepointALot || SafepointSynchronize::is_cleanup_needed()) { - long interval = SafepointSynchronize::last_non_safepoint_interval(); - bool max_time_exceeded = GuaranteedSafepointInterval != 0 && (interval > GuaranteedSafepointInterval); - if (SafepointALot || max_time_exceeded) { - HandleMark hm(VMThread::vm_thread()); - SafepointSynchronize::begin(); - SafepointSynchronize::end(); - } + if (VMThread::no_op_safepoint_needed(true)) { + HandleMark hm(VMThread::vm_thread()); + SafepointSynchronize::begin(); + SafepointSynchronize::end(); } } } diff --git a/hotspot/src/share/vm/runtime/vmThread.hpp b/hotspot/src/share/vm/runtime/vmThread.hpp index 85c52cb4d0f..ef01208c5ca 100644 --- a/hotspot/src/share/vm/runtime/vmThread.hpp +++ b/hotspot/src/share/vm/runtime/vmThread.hpp @@ -99,7 +99,12 @@ class VMThread: public NamedThread { static Monitor * _terminate_lock; static PerfCounter* _perf_accumulated_vm_operation_time; + static const char* _no_op_reason; + + static bool no_op_safepoint_needed(bool check_time); + void evaluate_operation(VM_Operation* op); + public: // Constructor VMThread(); @@ -126,7 +131,10 @@ class VMThread: public NamedThread { static void execute(VM_Operation* op); // Returns the current vm operation if any. - static VM_Operation* vm_operation() { return _cur_vm_operation; } + static VM_Operation* vm_operation() { return _cur_vm_operation; } + + // Returns the current vm operation name or set reason + static const char* vm_safepoint_description() { return _cur_vm_operation != NULL ? _cur_vm_operation->name() : _no_op_reason; }; // Returns the single instance of VMThread. static VMThread* vm_thread() { return _vm_thread; }

      Modules